From 387fe80fb13ed9f5f3741a661f96e409a2c959b5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:37 +0100 Subject: ASoC: wm8983: Cleanup manual bias level transitions Set the CODEC driver's suspend_bias_off flag rather than manually going to SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes the code a bit shorter and cleaner. Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/wm8983.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index ac5defd..5d1cf08 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c @@ -967,29 +967,6 @@ static int wm8983_set_bias_level(struct snd_soc_codec *codec, return 0; } -#ifdef CONFIG_PM -static int wm8983_suspend(struct snd_soc_codec *codec) -{ - wm8983_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - -static int wm8983_resume(struct snd_soc_codec *codec) -{ - wm8983_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - return 0; -} -#else -#define wm8983_suspend NULL -#define wm8983_resume NULL -#endif - -static int wm8983_remove(struct snd_soc_codec *codec) -{ - wm8983_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - static int wm8983_probe(struct snd_soc_codec *codec) { int ret; @@ -1055,10 +1032,8 @@ static struct snd_soc_dai_driver wm8983_dai = { static struct snd_soc_codec_driver soc_codec_dev_wm8983 = { .probe = wm8983_probe, - .remove = wm8983_remove, - .suspend = wm8983_suspend, - .resume = wm8983_resume, .set_bias_level = wm8983_set_bias_level, + .suspend_bias_off = true, .controls = wm8983_snd_controls, .num_controls = ARRAY_SIZE(wm8983_snd_controls), .dapm_widgets = wm8983_dapm_widgets, -- cgit v1.1 From d02486fd42a3295edbec4db8f7f81c1432fa60a4 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:36 +0100 Subject: ASoC: wm8978: Cleanup manual bias level transitions Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. The manual transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe() can also be removed as the core will automatically do this after the CODEC has been probed. Signed-off-by: Lars-Peter Clausen Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8978.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index ee2ba57..cf70329 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c @@ -991,21 +991,11 @@ static int wm8978_probe(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(update_reg); i++) snd_soc_update_bits(codec, update_reg[i], 0x100, 0x100); - wm8978_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - - return 0; -} - -/* power down chip */ -static int wm8978_remove(struct snd_soc_codec *codec) -{ - wm8978_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; } static struct snd_soc_codec_driver soc_codec_dev_wm8978 = { .probe = wm8978_probe, - .remove = wm8978_remove, .suspend = wm8978_suspend, .resume = wm8978_resume, .set_bias_level = wm8978_set_bias_level, -- cgit v1.1 From a5dde8c42ef6b3cb47c69905ee51520e18ac6515 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:38 +0100 Subject: ASoC: wm8985: Cleanup manual bias level transitions Set the CODEC driver's suspend_bias_off flag rather than manually going to SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes the code a bit shorter and cleaner. Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. The manual transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe() can also be removed as the core will automatically do this after the CODEC has been probed. Signed-off-by: Lars-Peter Clausen Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8985.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index ee38019..0b3b54c 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c @@ -961,29 +961,6 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec, return 0; } -#ifdef CONFIG_PM -static int wm8985_suspend(struct snd_soc_codec *codec) -{ - wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - -static int wm8985_resume(struct snd_soc_codec *codec) -{ - wm8985_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - return 0; -} -#else -#define wm8985_suspend NULL -#define wm8985_resume NULL -#endif - -static int wm8985_remove(struct snd_soc_codec *codec) -{ - wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - static int wm8985_probe(struct snd_soc_codec *codec) { size_t i; @@ -1023,7 +1000,6 @@ static int wm8985_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8985_BIAS_CTRL, WM8985_BIASCUT, WM8985_BIASCUT); - wm8985_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; err_reg_enable: @@ -1064,10 +1040,8 @@ static struct snd_soc_dai_driver wm8985_dai = { static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { .probe = wm8985_probe, - .remove = wm8985_remove, - .suspend = wm8985_suspend, - .resume = wm8985_resume, .set_bias_level = wm8985_set_bias_level, + .suspend_bias_off = true, .controls = wm8985_snd_controls, .num_controls = ARRAY_SIZE(wm8985_snd_controls), -- cgit v1.1 From 1f07b8de451f5f4f6a268a95a34183e528cda711 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:39 +0100 Subject: ASoC: wm8988: Cleanup manual bias level transitions Set the CODEC driver's suspend_bias_off flag rather than manually going to SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes the code a bit shorter and cleaner. Also remove the regcache_mark_dirty() from the suspend handler since it is already called by the ASoC core. Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. The manual transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe() can also be removed as the core will automatically do this after the CODEC has been probed. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/wm8988.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index a5130d9..e418199 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -793,21 +793,6 @@ static struct snd_soc_dai_driver wm8988_dai = { .symmetric_rates = 1, }; -static int wm8988_suspend(struct snd_soc_codec *codec) -{ - struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec); - - wm8988_set_bias_level(codec, SND_SOC_BIAS_OFF); - regcache_mark_dirty(wm8988->regmap); - return 0; -} - -static int wm8988_resume(struct snd_soc_codec *codec) -{ - wm8988_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - return 0; -} - static int wm8988_probe(struct snd_soc_codec *codec) { int ret = 0; @@ -825,23 +810,13 @@ static int wm8988_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8988_ROUT2V, 0x0100, 0x0100); snd_soc_update_bits(codec, WM8988_RINVOL, 0x0100, 0x0100); - wm8988_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - - return 0; -} - -static int wm8988_remove(struct snd_soc_codec *codec) -{ - wm8988_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; } static struct snd_soc_codec_driver soc_codec_dev_wm8988 = { .probe = wm8988_probe, - .remove = wm8988_remove, - .suspend = wm8988_suspend, - .resume = wm8988_resume, .set_bias_level = wm8988_set_bias_level, + .suspend_bias_off = true, .controls = wm8988_snd_controls, .num_controls = ARRAY_SIZE(wm8988_snd_controls), -- cgit v1.1 From 955efc8f50eb11d1c85daca6db7943c63dc5c2e7 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:40 +0100 Subject: ASoC: wm8990: Cleanup manual bias level transitions Set the CODEC driver's suspend_bias_off flag rather than manually going to SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes the code a bit shorter and cleaner. Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. Signed-off-by: Lars-Peter Clausen Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8990.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 03e43e3..8a58422 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -1271,18 +1271,6 @@ static struct snd_soc_dai_driver wm8990_dai = { .ops = &wm8990_dai_ops, }; -static int wm8990_suspend(struct snd_soc_codec *codec) -{ - wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - -static int wm8990_resume(struct snd_soc_codec *codec) -{ - wm8990_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - return 0; -} - /* * initialise the WM8990 driver * register the mixer and dsp interfaces with the kernel @@ -1309,19 +1297,11 @@ static int wm8990_probe(struct snd_soc_codec *codec) return 0; } -/* power down chip */ -static int wm8990_remove(struct snd_soc_codec *codec) -{ - wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - static struct snd_soc_codec_driver soc_codec_dev_wm8990 = { .probe = wm8990_probe, - .remove = wm8990_remove, - .suspend = wm8990_suspend, - .resume = wm8990_resume, .set_bias_level = wm8990_set_bias_level, + .suspend_bias_off = true, + .controls = wm8990_snd_controls, .num_controls = ARRAY_SIZE(wm8990_snd_controls), .dapm_widgets = wm8990_dapm_widgets, -- cgit v1.1