aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-01-29 09:31:06 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-01-29 09:32:52 -0500
commitb2c3e923110f6ca60ccb30cf4a6bda5211454c4f (patch)
treea49311b0231b3887122ec23771a7b32b54f37bd7 /sound
parent660c63a4a289a835aa9af93a45884c5d0c004b20 (diff)
ASoC: clean up wm8974 and wm8978 clock divider handling
wm8974 and wm8978 codec drivers control DAC and ADC oversampling rates in their .set_clkdiv() methods, which is wrong, because these are simple boolean switches and not clock dividers. Move these bits to sound controls. Also remove manual configuration of the MCLK divider in wm8978, since it is configured automatically. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8974.c12
-rw-r--r--sound/soc/codecs/wm8974.h12
-rw-r--r--sound/soc/codecs/wm8978.c19
-rw-r--r--sound/soc/codecs/wm8978.h3
-rw-r--r--sound/soc/sh/migor.c4
5 files changed, 9 insertions, 41 deletions
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 8812751da8c9..ee637af4737a 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -170,6 +170,10 @@ SOC_ENUM("Aux Mode", wm8974_auxmode),
170 170
171SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0), 171SOC_SINGLE("Capture Boost(+20dB)", WM8974_ADCBOOST, 8, 1, 0),
172SOC_SINGLE("Mono Playback Switch", WM8974_MONOMIX, 6, 1, 1), 172SOC_SINGLE("Mono Playback Switch", WM8974_MONOMIX, 6, 1, 1),
173
174/* DAC / ADC oversampling */
175SOC_SINGLE("DAC 128x Oversampling Switch", WM8974_DAC, 8, 1, 0),
176SOC_SINGLE("ADC 128x Oversampling Switch", WM8974_ADC, 8, 1, 0),
173}; 177};
174 178
175/* Speaker Output Mixer */ 179/* Speaker Output Mixer */
@@ -381,14 +385,6 @@ static int wm8974_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
381 reg = snd_soc_read(codec, WM8974_CLOCK) & 0x11f; 385 reg = snd_soc_read(codec, WM8974_CLOCK) & 0x11f;
382 snd_soc_write(codec, WM8974_CLOCK, reg | div); 386 snd_soc_write(codec, WM8974_CLOCK, reg | div);
383 break; 387 break;
384 case WM8974_ADCCLK:
385 reg = snd_soc_read(codec, WM8974_ADC) & 0x1f7;
386 snd_soc_write(codec, WM8974_ADC, reg | div);
387 break;
388 case WM8974_DACCLK:
389 reg = snd_soc_read(codec, WM8974_DAC) & 0x1f7;
390 snd_soc_write(codec, WM8974_DAC, reg | div);
391 break;
392 case WM8974_BCLKDIV: 388 case WM8974_BCLKDIV:
393 reg = snd_soc_read(codec, WM8974_CLOCK) & 0x1e3; 389 reg = snd_soc_read(codec, WM8974_CLOCK) & 0x1e3;
394 snd_soc_write(codec, WM8974_CLOCK, reg | div); 390 snd_soc_write(codec, WM8974_CLOCK, reg | div);
diff --git a/sound/soc/codecs/wm8974.h b/sound/soc/codecs/wm8974.h
index 98de9562d4d2..896a7f0f3fc4 100644
--- a/sound/soc/codecs/wm8974.h
+++ b/sound/soc/codecs/wm8974.h
@@ -57,17 +57,7 @@
57/* Clock divider Id's */ 57/* Clock divider Id's */
58#define WM8974_OPCLKDIV 0 58#define WM8974_OPCLKDIV 0
59#define WM8974_MCLKDIV 1 59#define WM8974_MCLKDIV 1
60#define WM8974_ADCCLK 2 60#define WM8974_BCLKDIV 2
61#define WM8974_DACCLK 3
62#define WM8974_BCLKDIV 4
63
64/* DAC clock dividers */
65#define WM8974_DACCLK_F2 (1 << 3)
66#define WM8974_DACCLK_F4 (0 << 3)
67
68/* ADC clock dividers */
69#define WM8974_ADCCLK_F2 (1 << 3)
70#define WM8974_ADCCLK_F4 (0 << 3)
71 61
72/* PLL Out dividers */ 62/* PLL Out dividers */
73#define WM8974_OPCLKDIV_1 (0 << 4) 63#define WM8974_OPCLKDIV_1 (0 << 4)
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 8dcebaa8604a..ec2624b4c370 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -210,6 +210,10 @@ static const struct snd_kcontrol_new wm8978_snd_controls[] = {
210 /* Speaker */ 210 /* Speaker */
211 SOC_DOUBLE_R("Speaker Switch", 211 SOC_DOUBLE_R("Speaker Switch",
212 WM8978_LOUT2_SPK_CONTROL, WM8978_ROUT2_SPK_CONTROL, 6, 1, 1), 212 WM8978_LOUT2_SPK_CONTROL, WM8978_ROUT2_SPK_CONTROL, 6, 1, 1),
213
214 /* DAC / ADC oversampling */
215 SOC_SINGLE("DAC 128x Oversampling Switch", WM8978_DAC_CONTROL, 8, 1, 0),
216 SOC_SINGLE("ADC 128x Oversampling Switch", WM8978_ADC_CONTROL, 8, 1, 0),
213}; 217};
214 218
215/* Mixer #1: Output (OUT1, OUT2) Mixer: mix AUX, Input mixer output and DAC */ 219/* Mixer #1: Output (OUT1, OUT2) Mixer: mix AUX, Input mixer output and DAC */
@@ -513,21 +517,6 @@ static int wm8978_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
513 if (wm8978->f_mclk) 517 if (wm8978->f_mclk)
514 ret = wm8978_configure_pll(codec); 518 ret = wm8978_configure_pll(codec);
515 break; 519 break;
516 case WM8978_MCLKDIV:
517 if (div & ~0xe0)
518 return -EINVAL;
519 snd_soc_update_bits(codec, WM8978_CLOCKING, 0xe0, div);
520 break;
521 case WM8978_ADCCLK:
522 if (div & ~8)
523 return -EINVAL;
524 snd_soc_update_bits(codec, WM8978_ADC_CONTROL, 8, div);
525 break;
526 case WM8978_DACCLK:
527 if (div & ~8)
528 return -EINVAL;
529 snd_soc_update_bits(codec, WM8978_DAC_CONTROL, 8, div);
530 break;
531 case WM8978_BCLKDIV: 520 case WM8978_BCLKDIV:
532 if (div & ~0x1c) 521 if (div & ~0x1c)
533 return -EINVAL; 522 return -EINVAL;
diff --git a/sound/soc/codecs/wm8978.h b/sound/soc/codecs/wm8978.h
index b58f0bf947e7..56ec83270917 100644
--- a/sound/soc/codecs/wm8978.h
+++ b/sound/soc/codecs/wm8978.h
@@ -72,9 +72,6 @@
72/* Clock divider Id's */ 72/* Clock divider Id's */
73enum wm8978_clk_id { 73enum wm8978_clk_id {
74 WM8978_OPCLKRATE, 74 WM8978_OPCLKRATE,
75 WM8978_MCLKDIV,
76 WM8978_ADCCLK,
77 WM8978_DACCLK,
78 WM8978_BCLKDIV, 75 WM8978_BCLKDIV,
79}; 76};
80 77
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c
index 3ccd9b393312..b823a5c9b9bc 100644
--- a/sound/soc/sh/migor.c
+++ b/sound/soc/sh/migor.c
@@ -59,10 +59,6 @@ static int migor_hw_params(struct snd_pcm_substream *substream,
59 if (ret < 0) 59 if (ret < 0)
60 return ret; 60 return ret;
61 61
62 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8978_DACCLK, 8);
63 if (ret < 0)
64 return ret;
65
66 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8978_OPCLKRATE, rate * 512); 62 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8978_OPCLKRATE, rate * 512);
67 if (ret < 0) 63 if (ret < 0)
68 return ret; 64 return ret;