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