diff options
Diffstat (limited to 'sound/soc/davinci/davinci-i2s.c')
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 257 |
1 files changed, 194 insertions, 63 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index abb5fedb0b1e..0fee779e3c76 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #define DAVINCI_MCBSP_PCR_CLKXP (1 << 1) | 59 | #define DAVINCI_MCBSP_PCR_CLKXP (1 << 1) |
60 | #define DAVINCI_MCBSP_PCR_FSRP (1 << 2) | 60 | #define DAVINCI_MCBSP_PCR_FSRP (1 << 2) |
61 | #define DAVINCI_MCBSP_PCR_FSXP (1 << 3) | 61 | #define DAVINCI_MCBSP_PCR_FSXP (1 << 3) |
62 | #define DAVINCI_MCBSP_PCR_SCLKME (1 << 7) | ||
62 | #define DAVINCI_MCBSP_PCR_CLKRM (1 << 8) | 63 | #define DAVINCI_MCBSP_PCR_CLKRM (1 << 8) |
63 | #define DAVINCI_MCBSP_PCR_CLKXM (1 << 9) | 64 | #define DAVINCI_MCBSP_PCR_CLKXM (1 << 9) |
64 | #define DAVINCI_MCBSP_PCR_FSRM (1 << 10) | 65 | #define DAVINCI_MCBSP_PCR_FSRM (1 << 10) |
@@ -110,16 +111,59 @@ static void davinci_mcbsp_start(struct snd_pcm_substream *substream) | |||
110 | { | 111 | { |
111 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 112 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
112 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; | 113 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; |
114 | struct snd_soc_device *socdev = rtd->socdev; | ||
115 | struct snd_soc_platform *platform = socdev->card->platform; | ||
113 | u32 w; | 116 | u32 w; |
117 | int ret; | ||
114 | 118 | ||
115 | /* Start the sample generator and enable transmitter/receiver */ | 119 | /* Start the sample generator and enable transmitter/receiver */ |
116 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 120 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
117 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_GRST, 1); | 121 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_GRST, 1); |
118 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 122 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); |
123 | |||
124 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
125 | /* Stop the DMA to avoid data loss */ | ||
126 | /* while the transmitter is out of reset to handle XSYNCERR */ | ||
127 | if (platform->pcm_ops->trigger) { | ||
128 | ret = platform->pcm_ops->trigger(substream, | ||
129 | SNDRV_PCM_TRIGGER_STOP); | ||
130 | if (ret < 0) | ||
131 | printk(KERN_DEBUG "Playback DMA stop failed\n"); | ||
132 | } | ||
133 | |||
134 | /* Enable the transmitter */ | ||
135 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | ||
119 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 1); | 136 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 1); |
120 | else | 137 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); |
138 | |||
139 | /* wait for any unexpected frame sync error to occur */ | ||
140 | udelay(100); | ||
141 | |||
142 | /* Disable the transmitter to clear any outstanding XSYNCERR */ | ||
143 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | ||
144 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 0); | ||
145 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | ||
146 | |||
147 | /* Restart the DMA */ | ||
148 | if (platform->pcm_ops->trigger) { | ||
149 | ret = platform->pcm_ops->trigger(substream, | ||
150 | SNDRV_PCM_TRIGGER_START); | ||
151 | if (ret < 0) | ||
152 | printk(KERN_DEBUG "Playback DMA start failed\n"); | ||
153 | } | ||
154 | /* Enable the transmitter */ | ||
155 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | ||
156 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 1); | ||
157 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | ||
158 | |||
159 | } else { | ||
160 | |||
161 | /* Enable the reciever */ | ||
162 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | ||
121 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_RRST, 1); | 163 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_RRST, 1); |
122 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 164 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); |
165 | } | ||
166 | |||
123 | 167 | ||
124 | /* Start frame sync */ | 168 | /* Start frame sync */ |
125 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 169 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
@@ -144,7 +188,8 @@ static void davinci_mcbsp_stop(struct snd_pcm_substream *substream) | |||
144 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 188 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); |
145 | } | 189 | } |
146 | 190 | ||
147 | static int davinci_i2s_startup(struct snd_pcm_substream *substream) | 191 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, |
192 | struct snd_soc_dai *dai) | ||
148 | { | 193 | { |
149 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 194 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
150 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 195 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
@@ -155,61 +200,138 @@ static int davinci_i2s_startup(struct snd_pcm_substream *substream) | |||
155 | return 0; | 200 | return 0; |
156 | } | 201 | } |
157 | 202 | ||
203 | #define DEFAULT_BITPERSAMPLE 16 | ||
204 | |||
158 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 205 | static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
159 | unsigned int fmt) | 206 | unsigned int fmt) |
160 | { | 207 | { |
161 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | 208 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; |
162 | u32 w; | 209 | unsigned int pcr; |
210 | unsigned int srgr; | ||
211 | unsigned int rcr; | ||
212 | unsigned int xcr; | ||
213 | srgr = DAVINCI_MCBSP_SRGR_FSGM | | ||
214 | DAVINCI_MCBSP_SRGR_FPER(DEFAULT_BITPERSAMPLE * 2 - 1) | | ||
215 | DAVINCI_MCBSP_SRGR_FWID(DEFAULT_BITPERSAMPLE - 1); | ||
163 | 216 | ||
164 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 217 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
165 | case SND_SOC_DAIFMT_CBS_CFS: | 218 | case SND_SOC_DAIFMT_CBS_CFS: |
166 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, | 219 | /* cpu is master */ |
167 | DAVINCI_MCBSP_PCR_FSXM | | 220 | pcr = DAVINCI_MCBSP_PCR_FSXM | |
168 | DAVINCI_MCBSP_PCR_FSRM | | 221 | DAVINCI_MCBSP_PCR_FSRM | |
169 | DAVINCI_MCBSP_PCR_CLKXM | | 222 | DAVINCI_MCBSP_PCR_CLKXM | |
170 | DAVINCI_MCBSP_PCR_CLKRM); | 223 | DAVINCI_MCBSP_PCR_CLKRM; |
171 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, | 224 | break; |
172 | DAVINCI_MCBSP_SRGR_FSGM); | 225 | case SND_SOC_DAIFMT_CBM_CFS: |
226 | /* McBSP CLKR pin is the input for the Sample Rate Generator. | ||
227 | * McBSP FSR and FSX are driven by the Sample Rate Generator. */ | ||
228 | pcr = DAVINCI_MCBSP_PCR_SCLKME | | ||
229 | DAVINCI_MCBSP_PCR_FSXM | | ||
230 | DAVINCI_MCBSP_PCR_FSRM; | ||
173 | break; | 231 | break; |
174 | case SND_SOC_DAIFMT_CBM_CFM: | 232 | case SND_SOC_DAIFMT_CBM_CFM: |
175 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, 0); | 233 | /* codec is master */ |
234 | pcr = 0; | ||
176 | break; | 235 | break; |
177 | default: | 236 | default: |
237 | printk(KERN_ERR "%s:bad master\n", __func__); | ||
178 | return -EINVAL; | 238 | return -EINVAL; |
179 | } | 239 | } |
180 | 240 | ||
181 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 241 | rcr = DAVINCI_MCBSP_RCR_RFRLEN1(1); |
182 | case SND_SOC_DAIFMT_IB_NF: | 242 | xcr = DAVINCI_MCBSP_XCR_XFIG | DAVINCI_MCBSP_XCR_XFRLEN1(1); |
183 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_PCR_REG); | 243 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
184 | MOD_REG_BIT(w, DAVINCI_MCBSP_PCR_CLKXP | | 244 | case SND_SOC_DAIFMT_DSP_B: |
185 | DAVINCI_MCBSP_PCR_CLKRP, 1); | ||
186 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, w); | ||
187 | break; | 245 | break; |
188 | case SND_SOC_DAIFMT_NB_IF: | 246 | case SND_SOC_DAIFMT_I2S: |
189 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_PCR_REG); | 247 | /* Davinci doesn't support TRUE I2S, but some codecs will have |
190 | MOD_REG_BIT(w, DAVINCI_MCBSP_PCR_FSXP | | 248 | * the left and right channels contiguous. This allows |
191 | DAVINCI_MCBSP_PCR_FSRP, 1); | 249 | * dsp_a mode to be used with an inverted normal frame clk. |
192 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, w); | 250 | * If your codec is master and does not have contiguous |
251 | * channels, then you will have sound on only one channel. | ||
252 | * Try using a different mode, or codec as slave. | ||
253 | * | ||
254 | * The TLV320AIC33 is an example of a codec where this works. | ||
255 | * It has a variable bit clock frequency allowing it to have | ||
256 | * valid data on every bit clock. | ||
257 | * | ||
258 | * The TLV320AIC23 is an example of a codec where this does not | ||
259 | * work. It has a fixed bit clock frequency with progressively | ||
260 | * more empty bit clock slots between channels as the sample | ||
261 | * rate is lowered. | ||
262 | */ | ||
263 | fmt ^= SND_SOC_DAIFMT_NB_IF; | ||
264 | case SND_SOC_DAIFMT_DSP_A: | ||
265 | rcr |= DAVINCI_MCBSP_RCR_RDATDLY(1); | ||
266 | xcr |= DAVINCI_MCBSP_XCR_XDATDLY(1); | ||
267 | break; | ||
268 | default: | ||
269 | printk(KERN_ERR "%s:bad format\n", __func__); | ||
270 | return -EINVAL; | ||
271 | } | ||
272 | |||
273 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
274 | case SND_SOC_DAIFMT_NB_NF: | ||
275 | /* CLKRP Receive clock polarity, | ||
276 | * 1 - sampled on rising edge of CLKR | ||
277 | * valid on rising edge | ||
278 | * CLKXP Transmit clock polarity, | ||
279 | * 1 - clocked on falling edge of CLKX | ||
280 | * valid on rising edge | ||
281 | * FSRP Receive frame sync pol, 0 - active high | ||
282 | * FSXP Transmit frame sync pol, 0 - active high | ||
283 | */ | ||
284 | pcr |= (DAVINCI_MCBSP_PCR_CLKXP | DAVINCI_MCBSP_PCR_CLKRP); | ||
193 | break; | 285 | break; |
194 | case SND_SOC_DAIFMT_IB_IF: | 286 | case SND_SOC_DAIFMT_IB_IF: |
195 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_PCR_REG); | 287 | /* CLKRP Receive clock polarity, |
196 | MOD_REG_BIT(w, DAVINCI_MCBSP_PCR_CLKXP | | 288 | * 0 - sampled on falling edge of CLKR |
197 | DAVINCI_MCBSP_PCR_CLKRP | | 289 | * valid on falling edge |
198 | DAVINCI_MCBSP_PCR_FSXP | | 290 | * CLKXP Transmit clock polarity, |
199 | DAVINCI_MCBSP_PCR_FSRP, 1); | 291 | * 0 - clocked on rising edge of CLKX |
200 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, w); | 292 | * valid on falling edge |
293 | * FSRP Receive frame sync pol, 1 - active low | ||
294 | * FSXP Transmit frame sync pol, 1 - active low | ||
295 | */ | ||
296 | pcr |= (DAVINCI_MCBSP_PCR_FSXP | DAVINCI_MCBSP_PCR_FSRP); | ||
201 | break; | 297 | break; |
202 | case SND_SOC_DAIFMT_NB_NF: | 298 | case SND_SOC_DAIFMT_NB_IF: |
299 | /* CLKRP Receive clock polarity, | ||
300 | * 1 - sampled on rising edge of CLKR | ||
301 | * valid on rising edge | ||
302 | * CLKXP Transmit clock polarity, | ||
303 | * 1 - clocked on falling edge of CLKX | ||
304 | * valid on rising edge | ||
305 | * FSRP Receive frame sync pol, 1 - active low | ||
306 | * FSXP Transmit frame sync pol, 1 - active low | ||
307 | */ | ||
308 | pcr |= (DAVINCI_MCBSP_PCR_CLKXP | DAVINCI_MCBSP_PCR_CLKRP | | ||
309 | DAVINCI_MCBSP_PCR_FSXP | DAVINCI_MCBSP_PCR_FSRP); | ||
310 | break; | ||
311 | case SND_SOC_DAIFMT_IB_NF: | ||
312 | /* CLKRP Receive clock polarity, | ||
313 | * 0 - sampled on falling edge of CLKR | ||
314 | * valid on falling edge | ||
315 | * CLKXP Transmit clock polarity, | ||
316 | * 0 - clocked on rising edge of CLKX | ||
317 | * valid on falling edge | ||
318 | * FSRP Receive frame sync pol, 0 - active high | ||
319 | * FSXP Transmit frame sync pol, 0 - active high | ||
320 | */ | ||
203 | break; | 321 | break; |
204 | default: | 322 | default: |
205 | return -EINVAL; | 323 | return -EINVAL; |
206 | } | 324 | } |
207 | 325 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, srgr); | |
326 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, pcr); | ||
327 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, rcr); | ||
328 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, xcr); | ||
208 | return 0; | 329 | return 0; |
209 | } | 330 | } |
210 | 331 | ||
211 | static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | 332 | static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, |
212 | struct snd_pcm_hw_params *params) | 333 | struct snd_pcm_hw_params *params, |
334 | struct snd_soc_dai *dai) | ||
213 | { | 335 | { |
214 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 336 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
215 | struct davinci_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; | 337 | struct davinci_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; |
@@ -219,25 +341,20 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
219 | u32 w; | 341 | u32 w; |
220 | 342 | ||
221 | /* general line settings */ | 343 | /* general line settings */ |
222 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, | 344 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
223 | DAVINCI_MCBSP_SPCR_RINTM(3) | | 345 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
224 | DAVINCI_MCBSP_SPCR_XINTM(3) | | 346 | w |= DAVINCI_MCBSP_SPCR_RINTM(3) | DAVINCI_MCBSP_SPCR_FREE; |
225 | DAVINCI_MCBSP_SPCR_FREE); | 347 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); |
226 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, | 348 | } else { |
227 | DAVINCI_MCBSP_RCR_RFRLEN1(1) | | 349 | w |= DAVINCI_MCBSP_SPCR_XINTM(3) | DAVINCI_MCBSP_SPCR_FREE; |
228 | DAVINCI_MCBSP_RCR_RDATDLY(1)); | 350 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); |
229 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, | 351 | } |
230 | DAVINCI_MCBSP_XCR_XFRLEN1(1) | | ||
231 | DAVINCI_MCBSP_XCR_XDATDLY(1) | | ||
232 | DAVINCI_MCBSP_XCR_XFIG); | ||
233 | 352 | ||
234 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); | 353 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); |
235 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SRGR_REG); | 354 | w = DAVINCI_MCBSP_SRGR_FSGM; |
236 | MOD_REG_BIT(w, DAVINCI_MCBSP_SRGR_FWID(snd_interval_value(i) - 1), 1); | 355 | MOD_REG_BIT(w, DAVINCI_MCBSP_SRGR_FWID(snd_interval_value(i) - 1), 1); |
237 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, w); | ||
238 | 356 | ||
239 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_FRAME_BITS); | 357 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_FRAME_BITS); |
240 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SRGR_REG); | ||
241 | MOD_REG_BIT(w, DAVINCI_MCBSP_SRGR_FPER(snd_interval_value(i) - 1), 1); | 358 | MOD_REG_BIT(w, DAVINCI_MCBSP_SRGR_FPER(snd_interval_value(i) - 1), 1); |
242 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, w); | 359 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, w); |
243 | 360 | ||
@@ -260,20 +377,24 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
260 | return -EINVAL; | 377 | return -EINVAL; |
261 | } | 378 | } |
262 | 379 | ||
263 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_RCR_REG); | 380 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
264 | MOD_REG_BIT(w, DAVINCI_MCBSP_RCR_RWDLEN1(mcbsp_word_length) | | 381 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_RCR_REG); |
265 | DAVINCI_MCBSP_RCR_RWDLEN2(mcbsp_word_length), 1); | 382 | MOD_REG_BIT(w, DAVINCI_MCBSP_RCR_RWDLEN1(mcbsp_word_length) | |
266 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, w); | 383 | DAVINCI_MCBSP_RCR_RWDLEN2(mcbsp_word_length), 1); |
384 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, w); | ||
267 | 385 | ||
268 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_XCR_REG); | 386 | } else { |
269 | MOD_REG_BIT(w, DAVINCI_MCBSP_XCR_XWDLEN1(mcbsp_word_length) | | 387 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_XCR_REG); |
270 | DAVINCI_MCBSP_XCR_XWDLEN2(mcbsp_word_length), 1); | 388 | MOD_REG_BIT(w, DAVINCI_MCBSP_XCR_XWDLEN1(mcbsp_word_length) | |
271 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, w); | 389 | DAVINCI_MCBSP_XCR_XWDLEN2(mcbsp_word_length), 1); |
390 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, w); | ||
272 | 391 | ||
392 | } | ||
273 | return 0; | 393 | return 0; |
274 | } | 394 | } |
275 | 395 | ||
276 | static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd) | 396 | static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, |
397 | struct snd_soc_dai *dai) | ||
277 | { | 398 | { |
278 | int ret = 0; | 399 | int ret = 0; |
279 | 400 | ||
@@ -299,8 +420,8 @@ static int davinci_i2s_probe(struct platform_device *pdev, | |||
299 | struct snd_soc_dai *dai) | 420 | struct snd_soc_dai *dai) |
300 | { | 421 | { |
301 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 422 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
302 | struct snd_soc_machine *machine = socdev->machine; | 423 | struct snd_soc_card *card = socdev->card; |
303 | struct snd_soc_dai *cpu_dai = machine->dai_link[pdev->id].cpu_dai; | 424 | struct snd_soc_dai *cpu_dai = card->dai_link[pdev->id].cpu_dai; |
304 | struct davinci_mcbsp_dev *dev; | 425 | struct davinci_mcbsp_dev *dev; |
305 | struct resource *mem, *ioarea; | 426 | struct resource *mem, *ioarea; |
306 | struct evm_snd_platform_data *pdata; | 427 | struct evm_snd_platform_data *pdata; |
@@ -361,8 +482,8 @@ static void davinci_i2s_remove(struct platform_device *pdev, | |||
361 | struct snd_soc_dai *dai) | 482 | struct snd_soc_dai *dai) |
362 | { | 483 | { |
363 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 484 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
364 | struct snd_soc_machine *machine = socdev->machine; | 485 | struct snd_soc_card *card = socdev->card; |
365 | struct snd_soc_dai *cpu_dai = machine->dai_link[pdev->id].cpu_dai; | 486 | struct snd_soc_dai *cpu_dai = card->dai_link[pdev->id].cpu_dai; |
366 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; | 487 | struct davinci_mcbsp_dev *dev = cpu_dai->private_data; |
367 | struct resource *mem; | 488 | struct resource *mem; |
368 | 489 | ||
@@ -381,7 +502,6 @@ static void davinci_i2s_remove(struct platform_device *pdev, | |||
381 | struct snd_soc_dai davinci_i2s_dai = { | 502 | struct snd_soc_dai davinci_i2s_dai = { |
382 | .name = "davinci-i2s", | 503 | .name = "davinci-i2s", |
383 | .id = 0, | 504 | .id = 0, |
384 | .type = SND_SOC_DAI_I2S, | ||
385 | .probe = davinci_i2s_probe, | 505 | .probe = davinci_i2s_probe, |
386 | .remove = davinci_i2s_remove, | 506 | .remove = davinci_i2s_remove, |
387 | .playback = { | 507 | .playback = { |
@@ -397,13 +517,24 @@ struct snd_soc_dai davinci_i2s_dai = { | |||
397 | .ops = { | 517 | .ops = { |
398 | .startup = davinci_i2s_startup, | 518 | .startup = davinci_i2s_startup, |
399 | .trigger = davinci_i2s_trigger, | 519 | .trigger = davinci_i2s_trigger, |
400 | .hw_params = davinci_i2s_hw_params,}, | 520 | .hw_params = davinci_i2s_hw_params, |
401 | .dai_ops = { | ||
402 | .set_fmt = davinci_i2s_set_dai_fmt, | 521 | .set_fmt = davinci_i2s_set_dai_fmt, |
403 | }, | 522 | }, |
404 | }; | 523 | }; |
405 | EXPORT_SYMBOL_GPL(davinci_i2s_dai); | 524 | EXPORT_SYMBOL_GPL(davinci_i2s_dai); |
406 | 525 | ||
526 | static int __init davinci_i2s_init(void) | ||
527 | { | ||
528 | return snd_soc_register_dai(&davinci_i2s_dai); | ||
529 | } | ||
530 | module_init(davinci_i2s_init); | ||
531 | |||
532 | static void __exit davinci_i2s_exit(void) | ||
533 | { | ||
534 | snd_soc_unregister_dai(&davinci_i2s_dai); | ||
535 | } | ||
536 | module_exit(davinci_i2s_exit); | ||
537 | |||
407 | MODULE_AUTHOR("Vladimir Barinov"); | 538 | MODULE_AUTHOR("Vladimir Barinov"); |
408 | MODULE_DESCRIPTION("TI DAVINCI I2S (McBSP) SoC Interface"); | 539 | MODULE_DESCRIPTION("TI DAVINCI I2S (McBSP) SoC Interface"); |
409 | MODULE_LICENSE("GPL"); | 540 | MODULE_LICENSE("GPL"); |