diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-11-23 07:37:30 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-24 13:27:02 -0500 |
commit | b0d55b1a63ea3c3d694c58694d93f74bea61215f (patch) | |
tree | 36508a5085e60c6bc202708815257728b671514a | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
ASoC: wm8903: 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. Also remove the unused codec field from the wm8903_priv
struct so we can remove the whole probe callback.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wm8903.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index c038b3e04398..9758d2ed542e 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -117,7 +117,6 @@ static const struct reg_default wm8903_reg_defaults[] = { | |||
117 | struct wm8903_priv { | 117 | struct wm8903_priv { |
118 | struct wm8903_platform_data *pdata; | 118 | struct wm8903_platform_data *pdata; |
119 | struct device *dev; | 119 | struct device *dev; |
120 | struct snd_soc_codec *codec; | ||
121 | struct regmap *regmap; | 120 | struct regmap *regmap; |
122 | 121 | ||
123 | int sysclk; | 122 | int sysclk; |
@@ -1757,21 +1756,12 @@ static struct snd_soc_dai_driver wm8903_dai = { | |||
1757 | .symmetric_rates = 1, | 1756 | .symmetric_rates = 1, |
1758 | }; | 1757 | }; |
1759 | 1758 | ||
1760 | static int wm8903_suspend(struct snd_soc_codec *codec) | ||
1761 | { | ||
1762 | wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1763 | |||
1764 | return 0; | ||
1765 | } | ||
1766 | |||
1767 | static int wm8903_resume(struct snd_soc_codec *codec) | 1759 | static int wm8903_resume(struct snd_soc_codec *codec) |
1768 | { | 1760 | { |
1769 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | 1761 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); |
1770 | 1762 | ||
1771 | regcache_sync(wm8903->regmap); | 1763 | regcache_sync(wm8903->regmap); |
1772 | 1764 | ||
1773 | wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1774 | |||
1775 | return 0; | 1765 | return 0; |
1776 | } | 1766 | } |
1777 | 1767 | ||
@@ -1889,33 +1879,12 @@ static void wm8903_free_gpio(struct wm8903_priv *wm8903) | |||
1889 | } | 1879 | } |
1890 | #endif | 1880 | #endif |
1891 | 1881 | ||
1892 | static int wm8903_probe(struct snd_soc_codec *codec) | ||
1893 | { | ||
1894 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | ||
1895 | |||
1896 | wm8903->codec = codec; | ||
1897 | |||
1898 | /* power on device */ | ||
1899 | wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1900 | |||
1901 | return 0; | ||
1902 | } | ||
1903 | |||
1904 | /* power down chip */ | ||
1905 | static int wm8903_remove(struct snd_soc_codec *codec) | ||
1906 | { | ||
1907 | wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1908 | |||
1909 | return 0; | ||
1910 | } | ||
1911 | |||
1912 | static struct snd_soc_codec_driver soc_codec_dev_wm8903 = { | 1882 | static struct snd_soc_codec_driver soc_codec_dev_wm8903 = { |
1913 | .probe = wm8903_probe, | ||
1914 | .remove = wm8903_remove, | ||
1915 | .suspend = wm8903_suspend, | ||
1916 | .resume = wm8903_resume, | 1883 | .resume = wm8903_resume, |
1917 | .set_bias_level = wm8903_set_bias_level, | 1884 | .set_bias_level = wm8903_set_bias_level, |
1918 | .seq_notifier = wm8903_seq_notifier, | 1885 | .seq_notifier = wm8903_seq_notifier, |
1886 | .suspend_bias_off = true, | ||
1887 | |||
1919 | .controls = wm8903_snd_controls, | 1888 | .controls = wm8903_snd_controls, |
1920 | .num_controls = ARRAY_SIZE(wm8903_snd_controls), | 1889 | .num_controls = ARRAY_SIZE(wm8903_snd_controls), |
1921 | .dapm_widgets = wm8903_dapm_widgets, | 1890 | .dapm_widgets = wm8903_dapm_widgets, |