| OLD | NEW |
| 1 /* | 1 /* |
| 2 * ASoC driver for TI DAVINCI EVM platform | 2 * ASoC driver for TI DAVINCI EVM platform |
| 3 * | 3 * |
| 4 * Author: Vladimir Barinov, <vbarinov@embeddedalley.com> | 4 * Author: Vladimir Barinov, <vbarinov@embeddedalley.com> |
| 5 * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com> | 5 * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com> |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
| 8 * it under the terms of the GNU General Public License version 2 as | 8 * it under the terms of the GNU General Public License version 2 as |
| 9 * published by the Free Software Foundation. | 9 * published by the Free Software Foundation. |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 #include <linux/module.h> | 12 #include <linux/module.h> |
| 13 #include <linux/moduleparam.h> | 13 #include <linux/moduleparam.h> |
| 14 #include <linux/timer.h> | 14 #include <linux/timer.h> |
| 15 #include <linux/interrupt.h> | 15 #include <linux/interrupt.h> |
| 16 #include <linux/platform_device.h> | 16 #include <linux/platform_device.h> |
| 17 #include <linux/i2c.h> | 17 #include <linux/i2c.h> |
| 18 #include <sound/core.h> | 18 #include <sound/core.h> |
| 19 #include <sound/pcm.h> | 19 #include <sound/pcm.h> |
| 20 #include <sound/soc.h> | 20 #include <sound/soc.h> |
| 21 #include <sound/soc-dapm.h> | |
| 22 | 21 |
| 23 #include <asm/dma.h> | 22 #include <asm/dma.h> |
| 24 #include <asm/mach-types.h> | 23 #include <asm/mach-types.h> |
| 25 | 24 |
| 26 #include <mach/asp.h> | 25 #include <mach/asp.h> |
| 27 #include <mach/edma.h> | 26 #include <mach/edma.h> |
| 28 #include <mach/mux.h> | 27 #include <mach/mux.h> |
| 29 | 28 |
| 30 #include "../codecs/tlv320aic3x.h" | |
| 31 #include "davinci-pcm.h" | 29 #include "davinci-pcm.h" |
| 32 #include "davinci-i2s.h" | 30 #include "davinci-i2s.h" |
| 33 #include "davinci-mcasp.h" | 31 #include "davinci-mcasp.h" |
| 34 | 32 |
| 35 #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | 33 #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
| 36 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) | 34 SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
| 37 static int evm_hw_params(struct snd_pcm_substream *substream, | 35 static int evm_hw_params(struct snd_pcm_substream *substream, |
| 38 struct snd_pcm_hw_params *params) | 36 struct snd_pcm_hw_params *params) |
| 39 { | 37 { |
| 40 struct snd_soc_pcm_runtime *rtd = substream->private_data; | 38 struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 {"LINE1L", NULL, "Line In"}, | 123 {"LINE1L", NULL, "Line In"}, |
| 126 {"LINE2L", NULL, "Line In"}, | 124 {"LINE2L", NULL, "Line In"}, |
| 127 {"LINE1R", NULL, "Line In"}, | 125 {"LINE1R", NULL, "Line In"}, |
| 128 {"LINE2R", NULL, "Line In"}, | 126 {"LINE2R", NULL, "Line In"}, |
| 129 }; | 127 }; |
| 130 | 128 |
| 131 /* Logic for a aic3x as connected on a davinci-evm */ | 129 /* Logic for a aic3x as connected on a davinci-evm */ |
| 132 static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) | 130 static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) |
| 133 { | 131 { |
| 134 struct snd_soc_codec *codec = rtd->codec; | 132 struct snd_soc_codec *codec = rtd->codec; |
| 133 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 135 | 134 |
| 136 /* Add davinci-evm specific widgets */ | 135 /* Add davinci-evm specific widgets */ |
| 137 » snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, | 136 » snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, |
| 138 ARRAY_SIZE(aic3x_dapm_widgets)); | 137 ARRAY_SIZE(aic3x_dapm_widgets)); |
| 139 | 138 |
| 140 /* Set up davinci-evm specific audio path audio_map */ | 139 /* Set up davinci-evm specific audio path audio_map */ |
| 141 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 140 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
| 142 | 141 |
| 143 /* not connected */ | 142 /* not connected */ |
| 144 » snd_soc_dapm_disable_pin(codec, "MONO_LOUT"); | 143 » snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); |
| 145 » snd_soc_dapm_disable_pin(codec, "HPLCOM"); | 144 » snd_soc_dapm_disable_pin(dapm, "HPLCOM"); |
| 146 » snd_soc_dapm_disable_pin(codec, "HPRCOM"); | 145 » snd_soc_dapm_disable_pin(dapm, "HPRCOM"); |
| 147 | 146 |
| 148 /* always connected */ | 147 /* always connected */ |
| 149 » snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 148 » snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); |
| 150 » snd_soc_dapm_enable_pin(codec, "Line Out"); | 149 » snd_soc_dapm_enable_pin(dapm, "Line Out"); |
| 151 » snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 150 » snd_soc_dapm_enable_pin(dapm, "Mic Jack"); |
| 152 » snd_soc_dapm_enable_pin(codec, "Line In"); | 151 » snd_soc_dapm_enable_pin(dapm, "Line In"); |
| 153 | 152 |
| 154 » snd_soc_dapm_sync(codec); | 153 » snd_soc_dapm_sync(dapm); |
| 155 | 154 |
| 156 return 0; | 155 return 0; |
| 157 } | 156 } |
| 158 | 157 |
| 159 /* davinci-evm digital audio interface glue - connects codec <--> CPU */ | 158 /* davinci-evm digital audio interface glue - connects codec <--> CPU */ |
| 160 static struct snd_soc_dai_link dm6446_evm_dai = { | 159 static struct snd_soc_dai_link dm6446_evm_dai = { |
| 161 .name = "TLV320AIC3X", | 160 .name = "TLV320AIC3X", |
| 162 .stream_name = "AIC3X", | 161 .stream_name = "AIC3X", |
| 163 .cpu_dai_name = "davinci-mcbsp", | 162 .cpu_dai_name = "davinci-mcbsp", |
| 164 .codec_dai_name = "tlv320aic3x-hifi", | 163 .codec_dai_name = "tlv320aic3x-hifi", |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 { | 211 { |
| 213 .name = "McASP", | 212 .name = "McASP", |
| 214 .stream_name = "spdif", | 213 .stream_name = "spdif", |
| 215 .cpu_dai_name= "davinci-mcasp.1", | 214 .cpu_dai_name= "davinci-mcasp.1", |
| 216 .codec_dai_name = "dit-hifi", | 215 .codec_dai_name = "dit-hifi", |
| 217 .codec_name = "spdif_dit", | 216 .codec_name = "spdif_dit", |
| 218 .platform_name = "davinci-pcm-audio", | 217 .platform_name = "davinci-pcm-audio", |
| 219 .ops = &evm_spdif_ops, | 218 .ops = &evm_spdif_ops, |
| 220 }, | 219 }, |
| 221 }; | 220 }; |
| 222 static struct snd_soc_dai_link da8xx_evm_dai = { | 221 |
| 222 static struct snd_soc_dai_link da830_evm_dai = { |
| 223 » .name = "TLV320AIC3X", |
| 224 » .stream_name = "AIC3X", |
| 225 » .cpu_dai_name = "davinci-mcasp.1", |
| 226 » .codec_dai_name = "tlv320aic3x-hifi", |
| 227 » .codec_name = "tlv320aic3x-codec.1-0018", |
| 228 » .platform_name = "davinci-pcm-audio", |
| 229 » .init = evm_aic3x_init, |
| 230 » .ops = &evm_ops, |
| 231 }; |
| 232 |
| 233 static struct snd_soc_dai_link da850_evm_dai = { |
| 223 .name = "TLV320AIC3X", | 234 .name = "TLV320AIC3X", |
| 224 .stream_name = "AIC3X", | 235 .stream_name = "AIC3X", |
| 225 .cpu_dai_name= "davinci-mcasp.0", | 236 .cpu_dai_name= "davinci-mcasp.0", |
| 226 .codec_dai_name = "tlv320aic3x-hifi", | 237 .codec_dai_name = "tlv320aic3x-hifi", |
| 227 » .codec_name = "tlv320aic3x-codec.0-001a", | 238 » .codec_name = "tlv320aic3x-codec.1-0018", |
| 228 .platform_name = "davinci-pcm-audio", | 239 .platform_name = "davinci-pcm-audio", |
| 229 .init = evm_aic3x_init, | 240 .init = evm_aic3x_init, |
| 230 .ops = &evm_ops, | 241 .ops = &evm_ops, |
| 231 }; | 242 }; |
| 232 | 243 |
| 233 /* davinci dm6446 evm audio machine driver */ | 244 /* davinci dm6446 evm audio machine driver */ |
| 234 static struct snd_soc_card dm6446_snd_soc_card_evm = { | 245 static struct snd_soc_card dm6446_snd_soc_card_evm = { |
| 235 .name = "DaVinci DM6446 EVM", | 246 .name = "DaVinci DM6446 EVM", |
| 236 .dai_link = &dm6446_evm_dai, | 247 .dai_link = &dm6446_evm_dai, |
| 237 .num_links = 1, | 248 .num_links = 1, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 253 | 264 |
| 254 /* davinci dm6467 evm audio machine driver */ | 265 /* davinci dm6467 evm audio machine driver */ |
| 255 static struct snd_soc_card dm6467_snd_soc_card_evm = { | 266 static struct snd_soc_card dm6467_snd_soc_card_evm = { |
| 256 .name = "DaVinci DM6467 EVM", | 267 .name = "DaVinci DM6467 EVM", |
| 257 .dai_link = dm6467_evm_dai, | 268 .dai_link = dm6467_evm_dai, |
| 258 .num_links = ARRAY_SIZE(dm6467_evm_dai), | 269 .num_links = ARRAY_SIZE(dm6467_evm_dai), |
| 259 }; | 270 }; |
| 260 | 271 |
| 261 static struct snd_soc_card da830_snd_soc_card = { | 272 static struct snd_soc_card da830_snd_soc_card = { |
| 262 .name = "DA830/OMAP-L137 EVM", | 273 .name = "DA830/OMAP-L137 EVM", |
| 263 » .dai_link = &da8xx_evm_dai, | 274 » .dai_link = &da830_evm_dai, |
| 264 .num_links = 1, | 275 .num_links = 1, |
| 265 }; | 276 }; |
| 266 | 277 |
| 267 static struct snd_soc_card da850_snd_soc_card = { | 278 static struct snd_soc_card da850_snd_soc_card = { |
| 268 .name = "DA850/OMAP-L138 EVM", | 279 .name = "DA850/OMAP-L138 EVM", |
| 269 » .dai_link = &da8xx_evm_dai, | 280 » .dai_link = &da850_evm_dai, |
| 270 .num_links = 1, | 281 .num_links = 1, |
| 271 }; | 282 }; |
| 272 | 283 |
| 273 static struct platform_device *evm_snd_device; | 284 static struct platform_device *evm_snd_device; |
| 274 | 285 |
| 275 static int __init evm_init(void) | 286 static int __init evm_init(void) |
| 276 { | 287 { |
| 277 struct snd_soc_card *evm_snd_dev_data; | 288 struct snd_soc_card *evm_snd_dev_data; |
| 278 int index; | 289 int index; |
| 279 int ret; | 290 int ret; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 { | 326 { |
| 316 platform_device_unregister(evm_snd_device); | 327 platform_device_unregister(evm_snd_device); |
| 317 } | 328 } |
| 318 | 329 |
| 319 module_init(evm_init); | 330 module_init(evm_init); |
| 320 module_exit(evm_exit); | 331 module_exit(evm_exit); |
| 321 | 332 |
| 322 MODULE_AUTHOR("Vladimir Barinov"); | 333 MODULE_AUTHOR("Vladimir Barinov"); |
| 323 MODULE_DESCRIPTION("TI DAVINCI EVM ASoC driver"); | 334 MODULE_DESCRIPTION("TI DAVINCI EVM ASoC driver"); |
| 324 MODULE_LICENSE("GPL"); | 335 MODULE_LICENSE("GPL"); |
| OLD | NEW |