Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ASoC driver for TI DAVINCI EVM platform |
| 3 | * |
Vladimir Barinov | d6b5203 | 2008-09-29 23:14:11 +0400 | [diff] [blame] | 4 | * Author: Vladimir Barinov, <vbarinov@embeddedalley.com> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 5 | * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com> |
| 6 | * |
| 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 |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/moduleparam.h> |
| 14 | #include <linux/timer.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/platform_device.h> |
Ben Dooks | aa6b904 | 2009-08-20 22:50:42 +0100 | [diff] [blame] | 17 | #include <linux/i2c.h> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 18 | #include <sound/core.h> |
| 19 | #include <sound/pcm.h> |
| 20 | #include <sound/soc.h> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 21 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 22 | #include <asm/dma.h> |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 23 | #include <asm/mach-types.h> |
| 24 | |
| 25 | #include <mach/asp.h> |
| 26 | #include <mach/edma.h> |
| 27 | #include <mach/mux.h> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 28 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 29 | #include "davinci-pcm.h" |
| 30 | #include "davinci-i2s.h" |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 31 | #include "davinci-mcasp.h" |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 32 | |
Troy Kisky | d6f8339 | 2008-12-19 13:05:25 -0700 | [diff] [blame] | 33 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
| 34 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 35 | static int evm_hw_params(struct snd_pcm_substream *substream, |
| 36 | struct snd_pcm_hw_params *params) |
| 37 | { |
| 38 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 39 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 40 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 41 | int ret = 0; |
David Brownell | 05d5e99 | 2009-01-04 02:50:10 -0800 | [diff] [blame] | 42 | unsigned sysclk; |
| 43 | |
| 44 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ |
Miguel Aguilar | 9b95b16 | 2009-09-02 15:33:59 -0600 | [diff] [blame] | 45 | if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() || |
| 46 | machine_is_davinci_dm365_evm()) |
David Brownell | 05d5e99 | 2009-01-04 02:50:10 -0800 | [diff] [blame] | 47 | sysclk = 27000000; |
| 48 | |
| 49 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by |
| 50 | * board-dm644x-evm.c using GPIOs from U18. There are six |
| 51 | * options; here we "know" we use a 48 KHz sample rate. |
| 52 | */ |
| 53 | else if (machine_is_davinci_evm()) |
| 54 | sysclk = 12288000; |
| 55 | |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 56 | else if (machine_is_davinci_da830_evm() || |
| 57 | machine_is_davinci_da850_evm()) |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 58 | sysclk = 24576000; |
| 59 | |
David Brownell | 05d5e99 | 2009-01-04 02:50:10 -0800 | [diff] [blame] | 60 | else |
| 61 | return -EINVAL; |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 62 | |
| 63 | /* set codec DAI configuration */ |
Troy Kisky | 9e03162 | 2008-12-19 13:05:23 -0700 | [diff] [blame] | 64 | ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 65 | if (ret < 0) |
| 66 | return ret; |
| 67 | |
| 68 | /* set cpu DAI configuration */ |
Troy Kisky | 9e03162 | 2008-12-19 13:05:23 -0700 | [diff] [blame] | 69 | ret = snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 70 | if (ret < 0) |
| 71 | return ret; |
| 72 | |
| 73 | /* set the codec system clock */ |
David Brownell | 05d5e99 | 2009-01-04 02:50:10 -0800 | [diff] [blame] | 74 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 75 | if (ret < 0) |
| 76 | return ret; |
| 77 | |
| 78 | return 0; |
| 79 | } |
| 80 | |
Chaithrika U S | 8d43d1b | 2010-03-10 14:48:33 +0530 | [diff] [blame] | 81 | static int evm_spdif_hw_params(struct snd_pcm_substream *substream, |
| 82 | struct snd_pcm_hw_params *params) |
| 83 | { |
| 84 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 85 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
Chaithrika U S | 8d43d1b | 2010-03-10 14:48:33 +0530 | [diff] [blame] | 86 | |
| 87 | /* set cpu DAI configuration */ |
| 88 | return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); |
| 89 | } |
| 90 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 91 | static struct snd_soc_ops evm_ops = { |
| 92 | .hw_params = evm_hw_params, |
| 93 | }; |
| 94 | |
Chaithrika U S | 8d43d1b | 2010-03-10 14:48:33 +0530 | [diff] [blame] | 95 | static struct snd_soc_ops evm_spdif_ops = { |
| 96 | .hw_params = evm_spdif_hw_params, |
| 97 | }; |
| 98 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 99 | /* davinci-evm machine dapm widgets */ |
| 100 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { |
| 101 | SND_SOC_DAPM_HP("Headphone Jack", NULL), |
| 102 | SND_SOC_DAPM_LINE("Line Out", NULL), |
| 103 | SND_SOC_DAPM_MIC("Mic Jack", NULL), |
| 104 | SND_SOC_DAPM_LINE("Line In", NULL), |
| 105 | }; |
| 106 | |
| 107 | /* davinci-evm machine audio_mapnections to the codec pins */ |
Mark Brown | acf497f | 2008-05-13 14:58:30 +0200 | [diff] [blame] | 108 | static const struct snd_soc_dapm_route audio_map[] = { |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 109 | /* Headphone connected to HPLOUT, HPROUT */ |
| 110 | {"Headphone Jack", NULL, "HPLOUT"}, |
| 111 | {"Headphone Jack", NULL, "HPROUT"}, |
| 112 | |
| 113 | /* Line Out connected to LLOUT, RLOUT */ |
| 114 | {"Line Out", NULL, "LLOUT"}, |
| 115 | {"Line Out", NULL, "RLOUT"}, |
| 116 | |
| 117 | /* Mic connected to (MIC3L | MIC3R) */ |
| 118 | {"MIC3L", NULL, "Mic Bias 2V"}, |
| 119 | {"MIC3R", NULL, "Mic Bias 2V"}, |
| 120 | {"Mic Bias 2V", NULL, "Mic Jack"}, |
| 121 | |
| 122 | /* Line In connected to (LINE1L | LINE2L), (LINE1R | LINE2R) */ |
| 123 | {"LINE1L", NULL, "Line In"}, |
| 124 | {"LINE2L", NULL, "Line In"}, |
| 125 | {"LINE1R", NULL, "Line In"}, |
| 126 | {"LINE2R", NULL, "Line In"}, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | /* Logic for a aic3x as connected on a davinci-evm */ |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 130 | static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 131 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 132 | struct snd_soc_codec *codec = rtd->codec; |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 133 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 134 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 135 | /* Add davinci-evm specific widgets */ |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 136 | snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, |
Mark Brown | acf497f | 2008-05-13 14:58:30 +0200 | [diff] [blame] | 137 | ARRAY_SIZE(aic3x_dapm_widgets)); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 138 | |
| 139 | /* Set up davinci-evm specific audio path audio_map */ |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 140 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 141 | |
| 142 | /* not connected */ |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 143 | snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); |
| 144 | snd_soc_dapm_disable_pin(dapm, "HPLCOM"); |
| 145 | snd_soc_dapm_disable_pin(dapm, "HPRCOM"); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 146 | |
| 147 | /* always connected */ |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 148 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); |
| 149 | snd_soc_dapm_enable_pin(dapm, "Line Out"); |
| 150 | snd_soc_dapm_enable_pin(dapm, "Mic Jack"); |
| 151 | snd_soc_dapm_enable_pin(dapm, "Line In"); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 152 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 157 | static struct snd_soc_dai_link dm6446_evm_dai = { |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 158 | .name = "TLV320AIC3X", |
| 159 | .stream_name = "AIC3X", |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 160 | .cpu_dai_name = "davinci-mcbsp", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 161 | .codec_dai_name = "tlv320aic3x-hifi", |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 162 | .codec_name = "tlv320aic3x-codec.1-001b", |
| 163 | .platform_name = "davinci-pcm-audio", |
| 164 | .init = evm_aic3x_init, |
| 165 | .ops = &evm_ops, |
| 166 | }; |
| 167 | |
| 168 | static struct snd_soc_dai_link dm355_evm_dai = { |
| 169 | .name = "TLV320AIC3X", |
| 170 | .stream_name = "AIC3X", |
| 171 | .cpu_dai_name = "davinci-mcbsp.1", |
| 172 | .codec_dai_name = "tlv320aic3x-hifi", |
| 173 | .codec_name = "tlv320aic3x-codec.1-001b", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 174 | .platform_name = "davinci-pcm-audio", |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 175 | .init = evm_aic3x_init, |
| 176 | .ops = &evm_ops, |
| 177 | }; |
| 178 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 179 | static struct snd_soc_dai_link dm365_evm_dai = { |
| 180 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC |
| 181 | .name = "TLV320AIC3X", |
| 182 | .stream_name = "AIC3X", |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 183 | .cpu_dai_name = "davinci-mcbsp", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 184 | .codec_dai_name = "tlv320aic3x-hifi", |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 185 | .init = evm_aic3x_init, |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 186 | .codec_name = "tlv320aic3x-codec.1-0018", |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 187 | .ops = &evm_ops, |
| 188 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) |
| 189 | .name = "Voice Codec - CQ93VC", |
| 190 | .stream_name = "CQ93", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 191 | .cpu_dai_name = "davinci-vcif", |
| 192 | .codec_dai_name = "cq93vc-hifi", |
| 193 | .codec_name = "cq93vc-codec", |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 194 | #endif |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 195 | .platform_name = "davinci-pcm-audio", |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 196 | }; |
| 197 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 198 | static struct snd_soc_dai_link dm6467_evm_dai[] = { |
| 199 | { |
| 200 | .name = "TLV320AIC3X", |
| 201 | .stream_name = "AIC3X", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 202 | .cpu_dai_name= "davinci-mcasp.0", |
| 203 | .codec_dai_name = "tlv320aic3x-hifi", |
| 204 | .platform_name ="davinci-pcm-audio", |
| 205 | .codec_name = "tlv320aic3x-codec.0-001a", |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 206 | .init = evm_aic3x_init, |
| 207 | .ops = &evm_ops, |
| 208 | }, |
| 209 | { |
| 210 | .name = "McASP", |
| 211 | .stream_name = "spdif", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 212 | .cpu_dai_name= "davinci-mcasp.1", |
| 213 | .codec_dai_name = "dit-hifi", |
| 214 | .codec_name = "spdif_dit", |
| 215 | .platform_name = "davinci-pcm-audio", |
Chaithrika U S | 8d43d1b | 2010-03-10 14:48:33 +0530 | [diff] [blame] | 216 | .ops = &evm_spdif_ops, |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 217 | }, |
| 218 | }; |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 219 | |
| 220 | static struct snd_soc_dai_link da830_evm_dai = { |
| 221 | .name = "TLV320AIC3X", |
| 222 | .stream_name = "AIC3X", |
| 223 | .cpu_dai_name = "davinci-mcasp.1", |
| 224 | .codec_dai_name = "tlv320aic3x-hifi", |
| 225 | .codec_name = "tlv320aic3x-codec.1-0018", |
| 226 | .platform_name = "davinci-pcm-audio", |
| 227 | .init = evm_aic3x_init, |
| 228 | .ops = &evm_ops, |
| 229 | }; |
| 230 | |
| 231 | static struct snd_soc_dai_link da850_evm_dai = { |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 232 | .name = "TLV320AIC3X", |
| 233 | .stream_name = "AIC3X", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 234 | .cpu_dai_name= "davinci-mcasp.0", |
| 235 | .codec_dai_name = "tlv320aic3x-hifi", |
Rajashekhara, Sudhakar | dc5a460 | 2011-01-21 20:10:01 +0530 | [diff] [blame] | 236 | .codec_name = "tlv320aic3x-codec.1-0018", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 237 | .platform_name = "davinci-pcm-audio", |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 238 | .init = evm_aic3x_init, |
| 239 | .ops = &evm_ops, |
| 240 | }; |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 241 | |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 242 | /* davinci dm6446 evm audio machine driver */ |
| 243 | static struct snd_soc_card dm6446_snd_soc_card_evm = { |
| 244 | .name = "DaVinci DM6446 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 245 | .owner = THIS_MODULE, |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 246 | .dai_link = &dm6446_evm_dai, |
| 247 | .num_links = 1, |
| 248 | }; |
| 249 | |
| 250 | /* davinci dm355 evm audio machine driver */ |
| 251 | static struct snd_soc_card dm355_snd_soc_card_evm = { |
| 252 | .name = "DaVinci DM355 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 253 | .owner = THIS_MODULE, |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 254 | .dai_link = &dm355_evm_dai, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 255 | .num_links = 1, |
| 256 | }; |
| 257 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 258 | /* davinci dm365 evm audio machine driver */ |
| 259 | static struct snd_soc_card dm365_snd_soc_card_evm = { |
| 260 | .name = "DaVinci DM365 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 261 | .owner = THIS_MODULE, |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 262 | .dai_link = &dm365_evm_dai, |
| 263 | .num_links = 1, |
| 264 | }; |
| 265 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 266 | /* davinci dm6467 evm audio machine driver */ |
| 267 | static struct snd_soc_card dm6467_snd_soc_card_evm = { |
| 268 | .name = "DaVinci DM6467 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 269 | .owner = THIS_MODULE, |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 270 | .dai_link = dm6467_evm_dai, |
| 271 | .num_links = ARRAY_SIZE(dm6467_evm_dai), |
| 272 | }; |
| 273 | |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 274 | static struct snd_soc_card da830_snd_soc_card = { |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 275 | .name = "DA830/OMAP-L137 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 276 | .owner = THIS_MODULE, |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 277 | .dai_link = &da830_evm_dai, |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 278 | .num_links = 1, |
| 279 | }; |
| 280 | |
| 281 | static struct snd_soc_card da850_snd_soc_card = { |
| 282 | .name = "DA850/OMAP-L138 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 283 | .owner = THIS_MODULE, |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 284 | .dai_link = &da850_evm_dai, |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 285 | .num_links = 1, |
| 286 | }; |
| 287 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 288 | static struct platform_device *evm_snd_device; |
| 289 | |
| 290 | static int __init evm_init(void) |
| 291 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 292 | struct snd_soc_card *evm_snd_dev_data; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 293 | int index; |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 294 | int ret; |
| 295 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 296 | if (machine_is_davinci_evm()) { |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 297 | evm_snd_dev_data = &dm6446_snd_soc_card_evm; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 298 | index = 0; |
| 299 | } else if (machine_is_davinci_dm355_evm()) { |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 300 | evm_snd_dev_data = &dm355_snd_soc_card_evm; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 301 | index = 1; |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 302 | } else if (machine_is_davinci_dm365_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 303 | evm_snd_dev_data = &dm365_snd_soc_card_evm; |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 304 | index = 0; |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 305 | } else if (machine_is_davinci_dm6467_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 306 | evm_snd_dev_data = &dm6467_snd_soc_card_evm; |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 307 | index = 0; |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 308 | } else if (machine_is_davinci_da830_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 309 | evm_snd_dev_data = &da830_snd_soc_card; |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 310 | index = 1; |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 311 | } else if (machine_is_davinci_da850_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 312 | evm_snd_dev_data = &da850_snd_soc_card; |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 313 | index = 0; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 314 | } else |
| 315 | return -EINVAL; |
| 316 | |
| 317 | evm_snd_device = platform_device_alloc("soc-audio", index); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 318 | if (!evm_snd_device) |
| 319 | return -ENOMEM; |
| 320 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 321 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 322 | ret = platform_device_add(evm_snd_device); |
| 323 | if (ret) |
| 324 | platform_device_put(evm_snd_device); |
| 325 | |
| 326 | return ret; |
| 327 | } |
| 328 | |
| 329 | static void __exit evm_exit(void) |
| 330 | { |
| 331 | platform_device_unregister(evm_snd_device); |
| 332 | } |
| 333 | |
| 334 | module_init(evm_init); |
| 335 | module_exit(evm_exit); |
| 336 | |
| 337 | MODULE_AUTHOR("Vladimir Barinov"); |
| 338 | MODULE_DESCRIPTION("TI DAVINCI EVM ASoC driver"); |
| 339 | MODULE_LICENSE("GPL"); |