diff options
Diffstat (limited to 'sound/soc/davinci/davinci-evm.c')
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 102 |
1 files changed, 48 insertions, 54 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 58fd1cbedd88..f3bb6f60f205 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -27,9 +27,10 @@ | |||
27 | #include <mach/mux.h> | 27 | #include <mach/mux.h> |
28 | 28 | ||
29 | #include "../codecs/tlv320aic3x.h" | 29 | #include "../codecs/tlv320aic3x.h" |
30 | #include "../codecs/spdif_transciever.h" | ||
30 | #include "davinci-pcm.h" | 31 | #include "davinci-pcm.h" |
31 | #include "davinci-i2s.h" | 32 | #include "davinci-i2s.h" |
32 | 33 | #include "davinci-mcasp.h" | |
33 | 34 | ||
34 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | 35 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
35 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) | 36 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
@@ -43,7 +44,7 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
43 | unsigned sysclk; | 44 | unsigned sysclk; |
44 | 45 | ||
45 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ | 46 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ |
46 | if (machine_is_davinci_dm355_evm()) | 47 | if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm()) |
47 | sysclk = 27000000; | 48 | sysclk = 27000000; |
48 | 49 | ||
49 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by | 50 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by |
@@ -144,6 +145,24 @@ static struct snd_soc_dai_link evm_dai = { | |||
144 | .ops = &evm_ops, | 145 | .ops = &evm_ops, |
145 | }; | 146 | }; |
146 | 147 | ||
148 | static struct snd_soc_dai_link dm6467_evm_dai[] = { | ||
149 | { | ||
150 | .name = "TLV320AIC3X", | ||
151 | .stream_name = "AIC3X", | ||
152 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], | ||
153 | .codec_dai = &aic3x_dai, | ||
154 | .init = evm_aic3x_init, | ||
155 | .ops = &evm_ops, | ||
156 | }, | ||
157 | { | ||
158 | .name = "McASP", | ||
159 | .stream_name = "spdif", | ||
160 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_DIT_DAI], | ||
161 | .codec_dai = &dit_stub_dai, | ||
162 | .ops = &evm_ops, | ||
163 | }, | ||
164 | }; | ||
165 | |||
147 | /* davinci-evm audio machine driver */ | 166 | /* davinci-evm audio machine driver */ |
148 | static struct snd_soc_card snd_soc_card_evm = { | 167 | static struct snd_soc_card snd_soc_card_evm = { |
149 | .name = "DaVinci EVM", | 168 | .name = "DaVinci EVM", |
@@ -152,12 +171,26 @@ static struct snd_soc_card snd_soc_card_evm = { | |||
152 | .num_links = 1, | 171 | .num_links = 1, |
153 | }; | 172 | }; |
154 | 173 | ||
174 | /* davinci dm6467 evm audio machine driver */ | ||
175 | static struct snd_soc_card dm6467_snd_soc_card_evm = { | ||
176 | .name = "DaVinci DM6467 EVM", | ||
177 | .platform = &davinci_soc_platform, | ||
178 | .dai_link = dm6467_evm_dai, | ||
179 | .num_links = ARRAY_SIZE(dm6467_evm_dai), | ||
180 | }; | ||
181 | |||
155 | /* evm audio private data */ | 182 | /* evm audio private data */ |
156 | static struct aic3x_setup_data evm_aic3x_setup = { | 183 | static struct aic3x_setup_data evm_aic3x_setup = { |
157 | .i2c_bus = 1, | 184 | .i2c_bus = 1, |
158 | .i2c_address = 0x1b, | 185 | .i2c_address = 0x1b, |
159 | }; | 186 | }; |
160 | 187 | ||
188 | /* dm6467 evm audio private data */ | ||
189 | static struct aic3x_setup_data dm6467_evm_aic3x_setup = { | ||
190 | .i2c_bus = 1, | ||
191 | .i2c_address = 0x18, | ||
192 | }; | ||
193 | |||
161 | /* evm audio subsystem */ | 194 | /* evm audio subsystem */ |
162 | static struct snd_soc_device evm_snd_devdata = { | 195 | static struct snd_soc_device evm_snd_devdata = { |
163 | .card = &snd_soc_card_evm, | 196 | .card = &snd_soc_card_evm, |
@@ -165,60 +198,30 @@ static struct snd_soc_device evm_snd_devdata = { | |||
165 | .codec_data = &evm_aic3x_setup, | 198 | .codec_data = &evm_aic3x_setup, |
166 | }; | 199 | }; |
167 | 200 | ||
168 | /* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */ | 201 | /* evm audio subsystem */ |
169 | static struct resource evm_snd_resources[] = { | 202 | static struct snd_soc_device dm6467_evm_snd_devdata = { |
170 | { | 203 | .card = &dm6467_snd_soc_card_evm, |
171 | .start = DAVINCI_ASP0_BASE, | 204 | .codec_dev = &soc_codec_dev_aic3x, |
172 | .end = DAVINCI_ASP0_BASE + SZ_8K - 1, | 205 | .codec_data = &dm6467_evm_aic3x_setup, |
173 | .flags = IORESOURCE_MEM, | ||
174 | }, | ||
175 | }; | ||
176 | |||
177 | static struct evm_snd_platform_data evm_snd_data = { | ||
178 | .tx_dma_ch = DAVINCI_DMA_ASP0_TX, | ||
179 | .rx_dma_ch = DAVINCI_DMA_ASP0_RX, | ||
180 | }; | ||
181 | |||
182 | /* DM335 EVM uses ASP1; line-out is a stereo mini-jack */ | ||
183 | static struct resource dm335evm_snd_resources[] = { | ||
184 | { | ||
185 | .start = DAVINCI_ASP1_BASE, | ||
186 | .end = DAVINCI_ASP1_BASE + SZ_8K - 1, | ||
187 | .flags = IORESOURCE_MEM, | ||
188 | }, | ||
189 | }; | ||
190 | |||
191 | static struct evm_snd_platform_data dm335evm_snd_data = { | ||
192 | .tx_dma_ch = DAVINCI_DMA_ASP1_TX, | ||
193 | .rx_dma_ch = DAVINCI_DMA_ASP1_RX, | ||
194 | }; | 206 | }; |
195 | 207 | ||
196 | static struct platform_device *evm_snd_device; | 208 | static struct platform_device *evm_snd_device; |
197 | 209 | ||
198 | static int __init evm_init(void) | 210 | static int __init evm_init(void) |
199 | { | 211 | { |
200 | struct resource *resources; | 212 | struct snd_soc_device *evm_snd_dev_data; |
201 | unsigned num_resources; | ||
202 | struct evm_snd_platform_data *data; | ||
203 | int index; | 213 | int index; |
204 | int ret; | 214 | int ret; |
205 | 215 | ||
206 | if (machine_is_davinci_evm()) { | 216 | if (machine_is_davinci_evm()) { |
207 | davinci_cfg_reg(DM644X_MCBSP); | 217 | evm_snd_dev_data = &evm_snd_devdata; |
208 | |||
209 | resources = evm_snd_resources; | ||
210 | num_resources = ARRAY_SIZE(evm_snd_resources); | ||
211 | data = &evm_snd_data; | ||
212 | index = 0; | 218 | index = 0; |
213 | } else if (machine_is_davinci_dm355_evm()) { | 219 | } else if (machine_is_davinci_dm355_evm()) { |
214 | /* we don't use ASP1 IRQs, or we'd need to mux them ... */ | 220 | evm_snd_dev_data = &evm_snd_devdata; |
215 | davinci_cfg_reg(DM355_EVT8_ASP1_TX); | ||
216 | davinci_cfg_reg(DM355_EVT9_ASP1_RX); | ||
217 | |||
218 | resources = dm335evm_snd_resources; | ||
219 | num_resources = ARRAY_SIZE(dm335evm_snd_resources); | ||
220 | data = &dm335evm_snd_data; | ||
221 | index = 1; | 221 | index = 1; |
222 | } else if (machine_is_davinci_dm6467_evm()) { | ||
223 | evm_snd_dev_data = &dm6467_evm_snd_devdata; | ||
224 | index = 0; | ||
222 | } else | 225 | } else |
223 | return -EINVAL; | 226 | return -EINVAL; |
224 | 227 | ||
@@ -226,17 +229,8 @@ static int __init evm_init(void) | |||
226 | if (!evm_snd_device) | 229 | if (!evm_snd_device) |
227 | return -ENOMEM; | 230 | return -ENOMEM; |
228 | 231 | ||
229 | platform_set_drvdata(evm_snd_device, &evm_snd_devdata); | 232 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); |
230 | evm_snd_devdata.dev = &evm_snd_device->dev; | 233 | evm_snd_dev_data->dev = &evm_snd_device->dev; |
231 | platform_device_add_data(evm_snd_device, data, sizeof(*data)); | ||
232 | |||
233 | ret = platform_device_add_resources(evm_snd_device, resources, | ||
234 | num_resources); | ||
235 | if (ret) { | ||
236 | platform_device_put(evm_snd_device); | ||
237 | return ret; | ||
238 | } | ||
239 | |||
240 | ret = platform_device_add(evm_snd_device); | 234 | ret = platform_device_add(evm_snd_device); |
241 | if (ret) | 235 | if (ret) |
242 | platform_device_put(evm_snd_device); | 236 | platform_device_put(evm_snd_device); |