aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-03-13 10:27:08 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-03-14 07:38:16 -0400
commit85fab7802a4bc00cc752f430e22a0d9fc41fe199 (patch)
tree60c583e62271c758eb34436f1b57e608d0479273 /sound/soc/pxa
parent0ce36c5f7f87632f26c8fbefe68b5116eda152d2 (diff)
ASoC: Fix Zylonite for non-networked SSP mode
This also simplifies the code a bit. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/zylonite.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c
index 9f6116edbb84..9a386b4c4ed1 100644
--- a/sound/soc/pxa/zylonite.c
+++ b/sound/soc/pxa/zylonite.c
@@ -96,42 +96,35 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
96 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 96 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
97 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 97 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
98 unsigned int pll_out = 0; 98 unsigned int pll_out = 0;
99 unsigned int acds = 0;
100 unsigned int wm9713_div = 0; 99 unsigned int wm9713_div = 0;
101 int ret = 0; 100 int ret = 0;
102 101 int rate = params_rate(params);
103 switch (params_rate(params)) { 102 int width = snd_pcm_format_physical_width(params_format(params));
103
104 /* Only support ratios that we can generate neatly from the AC97
105 * based master clock - in particular, this excludes 44.1kHz.
106 * In most applications the voice DAC will be used for telephony
107 * data so multiples of 8kHz will be the common case.
108 */
109 switch (rate) {
104 case 8000: 110 case 8000:
105 wm9713_div = 12; 111 wm9713_div = 12;
106 pll_out = 2048000;
107 break; 112 break;
108 case 16000: 113 case 16000:
109 wm9713_div = 6; 114 wm9713_div = 6;
110 pll_out = 4096000;
111 break; 115 break;
112 case 48000: 116 case 48000:
113 default:
114 wm9713_div = 2; 117 wm9713_div = 2;
115 pll_out = 12288000;
116 acds = 1;
117 break; 118 break;
119 default:
120 /* Don't support OSS emulation */
121 return -EINVAL;
118 } 122 }
119 123
120 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | 124 /* Add 1 to the width for the leading clock cycle */
121 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); 125 pll_out = rate * (width + 1) * 8;
122 if (ret < 0)
123 return ret;
124
125 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
126 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
127 if (ret < 0)
128 return ret;
129 126
130 /* Use network mode for stereo, one slot per channel. */ 127 ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_AUDIO, 0, 1);
131 if (params_channels(params) > 1)
132 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 2);
133 else
134 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 1, 1);
135 if (ret < 0) 128 if (ret < 0)
136 return ret; 129 return ret;
137 130
@@ -139,14 +132,6 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
139 if (ret < 0) 132 if (ret < 0)
140 return ret; 133 return ret;
141 134
142 ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_AUDIO_DIV_ACDS, acds);
143 if (ret < 0)
144 return ret;
145
146 ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_AUDIO, 0, 1);
147 if (ret < 0)
148 return ret;
149
150 if (clk_pout) 135 if (clk_pout)
151 ret = snd_soc_dai_set_clkdiv(codec_dai, WM9713_PCMCLK_PLL_DIV, 136 ret = snd_soc_dai_set_clkdiv(codec_dai, WM9713_PCMCLK_PLL_DIV,
152 WM9713_PCMDIV(wm9713_div)); 137 WM9713_PCMDIV(wm9713_div));
@@ -156,6 +141,16 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
156 if (ret < 0) 141 if (ret < 0)
157 return ret; 142 return ret;
158 143
144 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
145 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
146 if (ret < 0)
147 return ret;
148
149 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
150 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
151 if (ret < 0)
152 return ret;
153
159 return 0; 154 return 0;
160} 155}
161 156