From b131c02e99b9da672a2b0cf96bad48d74c39572e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 5 Nov 2014 10:46:36 +0100 Subject: ASoC: wm8995: Use table based DAPM and control setup Makes the code a bit cleaner. Signed-off-by: Lars-Peter Clausen Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8995.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 1288edeb8c7d..e40c8a662183 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2102,13 +2102,6 @@ static int wm8995_probe(struct snd_soc_codec *codec) wm8995_update_class_w(codec); - snd_soc_add_codec_controls(codec, wm8995_snd_controls, - ARRAY_SIZE(wm8995_snd_controls)); - snd_soc_dapm_new_controls(&codec->dapm, wm8995_dapm_widgets, - ARRAY_SIZE(wm8995_dapm_widgets)); - snd_soc_dapm_add_routes(&codec->dapm, wm8995_intercon, - ARRAY_SIZE(wm8995_intercon)); - return 0; err_reg_enable: @@ -2205,6 +2198,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8995 = { .remove = wm8995_remove, .set_bias_level = wm8995_set_bias_level, .idle_bias_off = true, + + .controls = wm8995_snd_controls, + .num_controls = ARRAY_SIZE(wm8995_snd_controls), + .dapm_widgets = wm8995_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8995_dapm_widgets), + .dapm_routes = wm8995_intercon, + .num_dapm_routes = ARRAY_SIZE(wm8995_intercon), }; static struct regmap_config wm8995_regmap = { -- cgit v1.2.1 From 497b900f83c56d513794ccf56b7a87c50a34a454 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:41 +0100 Subject: ASoC: wm8991: 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/wm8991.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index d0be89731cdb..b0ac2c3e31b9 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -1227,32 +1227,6 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm8991_suspend(struct snd_soc_codec *codec) -{ - wm8991_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - -static int wm8991_resume(struct snd_soc_codec *codec) -{ - wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - return 0; -} - -/* power down chip */ -static int wm8991_remove(struct snd_soc_codec *codec) -{ - wm8991_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - -static int wm8991_probe(struct snd_soc_codec *codec) -{ - wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - - return 0; -} - #define WM8991_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) @@ -1293,11 +1267,9 @@ static struct snd_soc_dai_driver wm8991_dai = { }; static struct snd_soc_codec_driver soc_codec_dev_wm8991 = { - .probe = wm8991_probe, - .remove = wm8991_remove, - .suspend = wm8991_suspend, - .resume = wm8991_resume, .set_bias_level = wm8991_set_bias_level, + .suspend_bias_off = true, + .controls = wm8991_snd_controls, .num_controls = ARRAY_SIZE(wm8991_snd_controls), .dapm_widgets = wm8991_dapm_widgets, -- cgit v1.2.1 From 77d05e7f81da95eb2b6c7ae24ae0fb3272c49282 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:42 +0100 Subject: ASoC: wm8993: 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/wm8993.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 93b14eda355a..53c6fe359496 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1486,7 +1486,6 @@ static int wm8993_probe(struct snd_soc_codec *codec) { struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; wm8993->hubs_data.hp_startup_mode = 1; wm8993->hubs_data.dcs_codes_l = -2; @@ -1518,10 +1517,6 @@ static int wm8993_probe(struct snd_soc_codec *codec) wm8993->pdata.micbias1_lvl, wm8993->pdata.micbias2_lvl); - ret = wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - if (ret != 0) - return ret; - snd_soc_add_codec_controls(codec, wm8993_snd_controls, ARRAY_SIZE(wm8993_snd_controls)); if (wm8993->pdata.num_retune_configs != 0) { @@ -1550,12 +1545,6 @@ static int wm8993_probe(struct snd_soc_codec *codec) } -static int wm8993_remove(struct snd_soc_codec *codec) -{ - wm8993_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - #ifdef CONFIG_PM static int wm8993_suspend(struct snd_soc_codec *codec) { @@ -1629,7 +1618,6 @@ static const struct regmap_config wm8993_regmap = { static struct snd_soc_codec_driver soc_codec_dev_wm8993 = { .probe = wm8993_probe, - .remove = wm8993_remove, .suspend = wm8993_suspend, .resume = wm8993_resume, .set_bias_level = wm8993_set_bias_level, -- cgit v1.2.1 From 49d9ac383cddc3e8d4cae8bc7a8f4da9dc071121 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:43 +0100 Subject: ASoC: wm8994: 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. Signed-off-by: Lars-Peter Clausen Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 1fcb9f3f3097..c3a2e751513f 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -4391,8 +4391,6 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) struct wm8994 *control = wm8994->wm8994; int i; - wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); - for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, &wm8994->fll_locked[i]); -- cgit v1.2.1 From aee9ffabec81d96d68d8537ccc6fedfbb0e6c468 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:44 +0100 Subject: ASoC: wm8995: 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/wm8995.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index e40c8a662183..c280f0a3a424 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2004,7 +2004,6 @@ static int wm8995_remove(struct snd_soc_codec *codec) int i; wm8995 = snd_soc_codec_get_drvdata(codec); - wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF); for (i = 0; i < ARRAY_SIZE(wm8995->supplies); ++i) regulator_unregister_notifier(wm8995->supplies[i].consumer, @@ -2078,8 +2077,6 @@ static int wm8995_probe(struct snd_soc_codec *codec) goto err_reg_enable; } - wm8995_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - /* Latch volume updates (right only; we always do left then right). */ snd_soc_update_bits(codec, WM8995_AIF1_DAC1_RIGHT_VOLUME, WM8995_AIF1DAC1_VU_MASK, WM8995_AIF1DAC1_VU); -- cgit v1.2.1 From 68201d6998a0d7701f7c3009130c5d8cd6ad7562 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 23 Nov 2014 13:37:45 +0100 Subject: ASoC: wm9081: 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. Signed-off-by: Lars-Peter Clausen Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm9081.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 0cdc9e2184ab..b1d946facd57 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -1277,15 +1277,8 @@ static int wm9081_probe(struct snd_soc_codec *codec) return 0; } -static int wm9081_remove(struct snd_soc_codec *codec) -{ - wm9081_set_bias_level(codec, SND_SOC_BIAS_OFF); - return 0; -} - static struct snd_soc_codec_driver soc_codec_dev_wm9081 = { .probe = wm9081_probe, - .remove = wm9081_remove, .set_sysclk = wm9081_set_sysclk, .set_bias_level = wm9081_set_bias_level, -- cgit v1.2.1