diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 10:00:22 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 10:00:22 -0500 |
commit | 4de3a8e101150feaefa1139611a50ff37467f33e (patch) | |
tree | daada742542518b02d7db7c5d32e715eaa5f166d /sound/soc/codecs/wm8580.c | |
parent | 294064f58953f9964e5945424b09c51800330a83 (diff) | |
parent | 099469502f62fbe0d7e4f0b83a2f22538367f734 (diff) |
Merge branch 'master' into fixes
Diffstat (limited to 'sound/soc/codecs/wm8580.c')
-rw-r--r-- | sound/soc/codecs/wm8580.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 8212b3c8bfdd..211285164d70 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/pm.h> | 24 | #include <linux/pm.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/regulator/consumer.h> | 26 | #include <linux/regulator/consumer.h> |
28 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
29 | #include <linux/of_device.h> | 28 | #include <linux/of_device.h> |
@@ -273,7 +272,7 @@ SND_SOC_DAPM_INPUT("AINL"), | |||
273 | SND_SOC_DAPM_INPUT("AINR"), | 272 | SND_SOC_DAPM_INPUT("AINR"), |
274 | }; | 273 | }; |
275 | 274 | ||
276 | static const struct snd_soc_dapm_route audio_map[] = { | 275 | static const struct snd_soc_dapm_route wm8580_dapm_routes[] = { |
277 | { "VOUT1L", NULL, "DAC1" }, | 276 | { "VOUT1L", NULL, "DAC1" }, |
278 | { "VOUT1R", NULL, "DAC1" }, | 277 | { "VOUT1R", NULL, "DAC1" }, |
279 | 278 | ||
@@ -287,17 +286,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
287 | { "ADC", NULL, "AINR" }, | 286 | { "ADC", NULL, "AINR" }, |
288 | }; | 287 | }; |
289 | 288 | ||
290 | static int wm8580_add_widgets(struct snd_soc_codec *codec) | ||
291 | { | ||
292 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
293 | |||
294 | snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets, | ||
295 | ARRAY_SIZE(wm8580_dapm_widgets)); | ||
296 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
297 | |||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | /* PLL divisors */ | 289 | /* PLL divisors */ |
302 | struct _pll_div { | 290 | struct _pll_div { |
303 | u32 prescale:1; | 291 | u32 prescale:1; |
@@ -682,7 +670,7 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
682 | { | 670 | { |
683 | struct snd_soc_codec *codec = dai->codec; | 671 | struct snd_soc_codec *codec = dai->codec; |
684 | struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec); | 672 | struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec); |
685 | int sel, sel_mask, sel_shift; | 673 | int ret, sel, sel_mask, sel_shift; |
686 | 674 | ||
687 | switch (dai->driver->id) { | 675 | switch (dai->driver->id) { |
688 | case WM8580_DAI_PAIFRX: | 676 | case WM8580_DAI_PAIFRX: |
@@ -723,7 +711,11 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
723 | /* We really should validate PLL settings but not yet */ | 711 | /* We really should validate PLL settings but not yet */ |
724 | wm8580->sysclk[dai->driver->id] = freq; | 712 | wm8580->sysclk[dai->driver->id] = freq; |
725 | 713 | ||
726 | return snd_soc_update_bits(codec, WM8580_CLKSEL, sel_mask, sel); | 714 | ret = snd_soc_update_bits(codec, WM8580_CLKSEL, sel_mask, sel); |
715 | if (ret < 0) | ||
716 | return ret; | ||
717 | |||
718 | return 0; | ||
727 | } | 719 | } |
728 | 720 | ||
729 | static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute) | 721 | static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute) |
@@ -776,7 +768,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec, | |||
776 | #define WM8580_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 768 | #define WM8580_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
777 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) | 769 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
778 | 770 | ||
779 | static struct snd_soc_dai_ops wm8580_dai_ops_playback = { | 771 | static const struct snd_soc_dai_ops wm8580_dai_ops_playback = { |
780 | .set_sysclk = wm8580_set_sysclk, | 772 | .set_sysclk = wm8580_set_sysclk, |
781 | .hw_params = wm8580_paif_hw_params, | 773 | .hw_params = wm8580_paif_hw_params, |
782 | .set_fmt = wm8580_set_paif_dai_fmt, | 774 | .set_fmt = wm8580_set_paif_dai_fmt, |
@@ -785,7 +777,7 @@ static struct snd_soc_dai_ops wm8580_dai_ops_playback = { | |||
785 | .digital_mute = wm8580_digital_mute, | 777 | .digital_mute = wm8580_digital_mute, |
786 | }; | 778 | }; |
787 | 779 | ||
788 | static struct snd_soc_dai_ops wm8580_dai_ops_capture = { | 780 | static const struct snd_soc_dai_ops wm8580_dai_ops_capture = { |
789 | .set_sysclk = wm8580_set_sysclk, | 781 | .set_sysclk = wm8580_set_sysclk, |
790 | .hw_params = wm8580_paif_hw_params, | 782 | .hw_params = wm8580_paif_hw_params, |
791 | .set_fmt = wm8580_set_paif_dai_fmt, | 783 | .set_fmt = wm8580_set_paif_dai_fmt, |
@@ -857,10 +849,6 @@ static int wm8580_probe(struct snd_soc_codec *codec) | |||
857 | 849 | ||
858 | wm8580_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 850 | wm8580_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
859 | 851 | ||
860 | snd_soc_add_controls(codec, wm8580_snd_controls, | ||
861 | ARRAY_SIZE(wm8580_snd_controls)); | ||
862 | wm8580_add_widgets(codec); | ||
863 | |||
864 | return 0; | 852 | return 0; |
865 | 853 | ||
866 | err_regulator_enable: | 854 | err_regulator_enable: |
@@ -890,6 +878,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8580 = { | |||
890 | .reg_cache_size = ARRAY_SIZE(wm8580_reg), | 878 | .reg_cache_size = ARRAY_SIZE(wm8580_reg), |
891 | .reg_word_size = sizeof(u16), | 879 | .reg_word_size = sizeof(u16), |
892 | .reg_cache_default = wm8580_reg, | 880 | .reg_cache_default = wm8580_reg, |
881 | |||
882 | .controls = wm8580_snd_controls, | ||
883 | .num_controls = ARRAY_SIZE(wm8580_snd_controls), | ||
884 | .dapm_widgets = wm8580_dapm_widgets, | ||
885 | .num_dapm_widgets = ARRAY_SIZE(wm8580_dapm_widgets), | ||
886 | .dapm_routes = wm8580_dapm_routes, | ||
887 | .num_dapm_routes = ARRAY_SIZE(wm8580_dapm_routes), | ||
893 | }; | 888 | }; |
894 | 889 | ||
895 | static const struct of_device_id wm8580_of_match[] = { | 890 | static const struct of_device_id wm8580_of_match[] = { |