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