All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes
@ 2014-09-02 20:20 Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 1/5] ASoC: adau1373: " Lars-Peter Clausen
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-09-02 20:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Lars-Peter Clausen, patches, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax

Hi,

There are a handful of drivers which do set idle_bias_level = true, but at the
same time implement suspend and resume handlers which do bias level transitions 
to OFF in suspend and to STANDBY in resume. Since the ASoC core will only
suspend a CODEC if it is idle this means that drivers that set idle_bias_level =
true will already be at bias level OFF when suspend is called, which makes the
manual transition unnecessary. On the other hand manual transition to STANDBY in
resume will be reverted by the core going back to OFF after the resume handler
has run. So the manual bias level change in resume is also unnecessary and can
cause additional IO operations.

This series removes all those unnecessary manual bias level transitions.

- Lars

Lars-Peter Clausen (5):
  ASoC: adau1373: Remove unnecessary suspend/resume bias level changes
  ASoC: lm49453: Remove unnecessary suspend/resume bias level changes
  ASoC: tlv320aic3x: Remove unnecessary suspend/resume bias level
    changes
  ASoC: wm8804: Remove unnecessary suspend/resume bias level changes
  ASoC: wm8995: Remove unnecessary suspend/resume bias level changes

 sound/soc/codecs/adau1373.c    | 14 --------------
 sound/soc/codecs/lm49453.c     | 14 --------------
 sound/soc/codecs/tlv320aic3x.c | 16 ----------------
 sound/soc/codecs/wm8804.c      | 19 -------------------
 sound/soc/codecs/wm8995.c      | 19 -------------------
 5 files changed, 82 deletions(-)

-- 
1.8.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] ASoC: adau1373: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
@ 2014-09-02 20:20 ` Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 2/5] ASoC: lm49453: " Lars-Peter Clausen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-09-02 20:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Lars-Peter Clausen, patches, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax

The ASoC core will only call the suspend/resume callbacks when the device's
DAPM context is idle. Since this driver sets idle_bias_off to true this
means that the device is already in SND_SOC_BIAS_OFF when the suspend
callback is called, so there is no need to manually set this state again.
There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
since the core will go right back to SND_SOC_BIAS_OFF.

Also drop the regcache_cache_only() calls from the suspend and resume
handlers. There shouldn't be any IO happening after suspend and before
resume.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/adau1373.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index 1ff7d4d..1947565 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -1454,23 +1454,10 @@ static int adau1373_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
-static int adau1373_suspend(struct snd_soc_codec *codec)
-{
-	struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec);
-	int ret;
-
-	ret = adau1373_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	regcache_cache_only(adau1373->regmap, true);
-
-	return ret;
-}
-
 static int adau1373_resume(struct snd_soc_codec *codec)
 {
 	struct adau1373 *adau1373 = snd_soc_codec_get_drvdata(codec);
 
-	regcache_cache_only(adau1373->regmap, false);
-	adau1373_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 	regcache_sync(adau1373->regmap);
 
 	return 0;
@@ -1502,7 +1489,6 @@ static const struct regmap_config adau1373_regmap_config = {
 static struct snd_soc_codec_driver adau1373_codec_driver = {
 	.probe =	adau1373_probe,
 	.remove =	adau1373_remove,
-	.suspend =	adau1373_suspend,
 	.resume =	adau1373_resume,
 	.set_bias_level = adau1373_set_bias_level,
 	.idle_bias_off = true,
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] ASoC: lm49453: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 1/5] ASoC: adau1373: " Lars-Peter Clausen
@ 2014-09-02 20:20 ` Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 3/5] ASoC: tlv320aic3x: " Lars-Peter Clausen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-09-02 20:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Lars-Peter Clausen, patches, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax

The ASoC core will only call the suspend/resume callbacks when the device's
DAPM context is idle. Since this driver sets idle_bias_off to true this
means that the device is already in SND_SOC_BIAS_OFF when the suspend
callback is called, so there is no need to manually set this state again.
There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
since the core will go right back to SND_SOC_BIAS_OFF.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/lm49453.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index 275b3f7..c1ae576 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -1395,18 +1395,6 @@ static struct snd_soc_dai_driver lm49453_dai[] = {
 	},
 };
 
-static int lm49453_suspend(struct snd_soc_codec *codec)
-{
-	lm49453_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	return 0;
-}
-
-static int lm49453_resume(struct snd_soc_codec *codec)
-{
-	lm49453_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-	return 0;
-}
-
 /* power down chip */
 static int lm49453_remove(struct snd_soc_codec *codec)
 {
@@ -1416,8 +1404,6 @@ static int lm49453_remove(struct snd_soc_codec *codec)
 
 static struct snd_soc_codec_driver soc_codec_dev_lm49453 = {
 	.remove = lm49453_remove,
-	.suspend = lm49453_suspend,
-	.resume = lm49453_resume,
 	.set_bias_level = lm49453_set_bias_level,
 	.controls = lm49453_snd_controls,
 	.num_controls = ARRAY_SIZE(lm49453_snd_controls),
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] ASoC: tlv320aic3x: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 1/5] ASoC: adau1373: " Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 2/5] ASoC: lm49453: " Lars-Peter Clausen
@ 2014-09-02 20:20 ` Lars-Peter Clausen
  2014-09-02 20:20 ` [PATCH 4/5] ASoC: wm8804: " Lars-Peter Clausen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-09-02 20:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Lars-Peter Clausen, patches, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax

The ASoC core will only call the suspend/resume callbacks when the device's
DAPM context is idle. Since this driver sets idle_bias_off to true this
means that the device is already in SND_SOC_BIAS_OFF when the suspend
callback is called, so there is no need to manually set this state again.
There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
since the core will go right back to SND_SOC_BIAS_OFF.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/tlv320aic3x.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 64f179e..f2c416d 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1222,20 +1222,6 @@ static struct snd_soc_dai_driver aic3x_dai = {
 	.symmetric_rates = 1,
 };
 
-static int aic3x_suspend(struct snd_soc_codec *codec)
-{
-	aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF);
-
-	return 0;
-}
-
-static int aic3x_resume(struct snd_soc_codec *codec)
-{
-	aic3x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-
-	return 0;
-}
-
 static void aic3x_mono_init(struct snd_soc_codec *codec)
 {
 	/* DAC to Mono Line Out default volume and route to Output mixer */
@@ -1429,8 +1415,6 @@ static struct snd_soc_codec_driver soc_codec_dev_aic3x = {
 	.idle_bias_off = true,
 	.probe = aic3x_probe,
 	.remove = aic3x_remove,
-	.suspend = aic3x_suspend,
-	.resume = aic3x_resume,
 	.controls = aic3x_snd_controls,
 	.num_controls = ARRAY_SIZE(aic3x_snd_controls),
 	.dapm_widgets = aic3x_dapm_widgets,
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] ASoC: wm8804: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
                   ` (2 preceding siblings ...)
  2014-09-02 20:20 ` [PATCH 3/5] ASoC: tlv320aic3x: " Lars-Peter Clausen
@ 2014-09-02 20:20 ` Lars-Peter Clausen
  2014-09-03  8:21   ` Charles Keepax
  2014-09-02 20:20 ` [PATCH 5/5] ASoC: wm8995: " Lars-Peter Clausen
  2014-09-03 18:26 ` [PATCH 0/5] ASoC: " Mark Brown
  5 siblings, 1 reply; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-09-02 20:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Lars-Peter Clausen, patches, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax

The ASoC core will only call the suspend/resume callbacks when the device's
DAPM context is idle. Since this driver sets idle_bias_off to true this
means that the device is already in SND_SOC_BIAS_OFF when the suspend
callback is called, so there is no need to manually set this state again.
There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
since the core will go right back to SND_SOC_BIAS_OFF.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/wm8804.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 0ea01df..3addc5f 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -518,23 +518,6 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec,
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int wm8804_suspend(struct snd_soc_codec *codec)
-{
-	wm8804_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	return 0;
-}
-
-static int wm8804_resume(struct snd_soc_codec *codec)
-{
-	wm8804_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-	return 0;
-}
-#else
-#define wm8804_suspend NULL
-#define wm8804_resume NULL
-#endif
-
 static int wm8804_remove(struct snd_soc_codec *codec)
 {
 	struct wm8804_priv *wm8804;
@@ -671,8 +654,6 @@ static struct snd_soc_dai_driver wm8804_dai = {
 static struct snd_soc_codec_driver soc_codec_dev_wm8804 = {
 	.probe = wm8804_probe,
 	.remove = wm8804_remove,
-	.suspend = wm8804_suspend,
-	.resume = wm8804_resume,
 	.set_bias_level = wm8804_set_bias_level,
 	.idle_bias_off = true,
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] ASoC: wm8995: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
                   ` (3 preceding siblings ...)
  2014-09-02 20:20 ` [PATCH 4/5] ASoC: wm8804: " Lars-Peter Clausen
@ 2014-09-02 20:20 ` Lars-Peter Clausen
  2014-09-03  8:22   ` Charles Keepax
  2014-09-03 18:26 ` [PATCH 0/5] ASoC: " Mark Brown
  5 siblings, 1 reply; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-09-02 20:20 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: alsa-devel, Lars-Peter Clausen, patches, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax

The ASoC core will only call the suspend/resume callbacks when the device's
DAPM context is idle. Since this driver sets idle_bias_off to true this
means that the device is already in SND_SOC_BIAS_OFF when the suspend
callback is called, so there is no need to manually set this state again.
There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
since the core will go right back to SND_SOC_BIAS_OFF.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/wm8995.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index cae4ac5..1288ede 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -1998,23 +1998,6 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec,
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int wm8995_suspend(struct snd_soc_codec *codec)
-{
-	wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	return 0;
-}
-
-static int wm8995_resume(struct snd_soc_codec *codec)
-{
-	wm8995_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-	return 0;
-}
-#else
-#define wm8995_suspend NULL
-#define wm8995_resume NULL
-#endif
-
 static int wm8995_remove(struct snd_soc_codec *codec)
 {
 	struct wm8995_priv *wm8995;
@@ -2220,8 +2203,6 @@ static struct snd_soc_dai_driver wm8995_dai[] = {
 static struct snd_soc_codec_driver soc_codec_dev_wm8995 = {
 	.probe = wm8995_probe,
 	.remove = wm8995_remove,
-	.suspend = wm8995_suspend,
-	.resume = wm8995_resume,
 	.set_bias_level = wm8995_set_bias_level,
 	.idle_bias_off = true,
 };
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/5] ASoC: wm8804: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 ` [PATCH 4/5] ASoC: wm8804: " Lars-Peter Clausen
@ 2014-09-03  8:21   ` Charles Keepax
  0 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2014-09-03  8:21 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: alsa-devel, patches, Liam Girdwood, Peter Ujfalusi,
	Vishwas A Deshpande, Mark Brown, M R Swami Reddy

On Tue, Sep 02, 2014 at 10:20:33PM +0200, Lars-Peter Clausen wrote:
> The ASoC core will only call the suspend/resume callbacks when the device's
> DAPM context is idle. Since this driver sets idle_bias_off to true this
> means that the device is already in SND_SOC_BIAS_OFF when the suspend
> callback is called, so there is no need to manually set this state again.
> There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
> since the core will go right back to SND_SOC_BIAS_OFF.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 5/5] ASoC: wm8995: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 ` [PATCH 5/5] ASoC: wm8995: " Lars-Peter Clausen
@ 2014-09-03  8:22   ` Charles Keepax
  0 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2014-09-03  8:22 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: alsa-devel, patches, Liam Girdwood, Peter Ujfalusi,
	Vishwas A Deshpande, Mark Brown, M R Swami Reddy

On Tue, Sep 02, 2014 at 10:20:34PM +0200, Lars-Peter Clausen wrote:
> The ASoC core will only call the suspend/resume callbacks when the device's
> DAPM context is idle. Since this driver sets idle_bias_off to true this
> means that the device is already in SND_SOC_BIAS_OFF when the suspend
> callback is called, so there is no need to manually set this state again.
> There is also no need to go to SND_SOC_BIAS_STANDBY in the resume callback
> since the core will go right back to SND_SOC_BIAS_OFF.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes
  2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
                   ` (4 preceding siblings ...)
  2014-09-02 20:20 ` [PATCH 5/5] ASoC: wm8995: " Lars-Peter Clausen
@ 2014-09-03 18:26 ` Mark Brown
  5 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2014-09-03 18:26 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: alsa-devel, patches, Liam Girdwood, Peter Ujfalusi,
	Vishwas A Deshpande, M R Swami Reddy, Charles Keepax


[-- Attachment #1.1: Type: text/plain, Size: 270 bytes --]

On Tue, Sep 02, 2014 at 10:20:29PM +0200, Lars-Peter Clausen wrote:
> Hi,
> 
> There are a handful of drivers which do set idle_bias_level = true, but at the
> same time implement suspend and resume handlers which do bias level transitions 

Applied all, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-03 18:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02 20:20 [PATCH 0/5] ASoC: Remove unnecessary suspend/resume bias level changes Lars-Peter Clausen
2014-09-02 20:20 ` [PATCH 1/5] ASoC: adau1373: " Lars-Peter Clausen
2014-09-02 20:20 ` [PATCH 2/5] ASoC: lm49453: " Lars-Peter Clausen
2014-09-02 20:20 ` [PATCH 3/5] ASoC: tlv320aic3x: " Lars-Peter Clausen
2014-09-02 20:20 ` [PATCH 4/5] ASoC: wm8804: " Lars-Peter Clausen
2014-09-03  8:21   ` Charles Keepax
2014-09-02 20:20 ` [PATCH 5/5] ASoC: wm8995: " Lars-Peter Clausen
2014-09-03  8:22   ` Charles Keepax
2014-09-03 18:26 ` [PATCH 0/5] ASoC: " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.