Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 2 | /* |
| 3 | * ASoC driver for TI DAVINCI EVM platform |
| 4 | * |
Vladimir Barinov | d6b5203 | 2008-09-29 23:14:11 +0400 | [diff] [blame] | 5 | * Author: Vladimir Barinov, <vbarinov@embeddedalley.com> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 6 | * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/moduleparam.h> |
| 11 | #include <linux/timer.h> |
| 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/platform_device.h> |
Ben Dooks | aa6b904 | 2009-08-20 22:50:42 +0100 | [diff] [blame] | 14 | #include <linux/i2c.h> |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 15 | #include <linux/of_platform.h> |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 16 | #include <linux/clk.h> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 17 | #include <sound/core.h> |
| 18 | #include <sound/pcm.h> |
| 19 | #include <sound/soc.h> |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 20 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 21 | #include <asm/dma.h> |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 22 | #include <asm/mach-types.h> |
| 23 | |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 24 | struct snd_soc_card_drvdata_davinci { |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 25 | struct clk *mclk; |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 26 | unsigned sysclk; |
| 27 | }; |
| 28 | |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 29 | static int evm_startup(struct snd_pcm_substream *substream) |
| 30 | { |
Kuninori Morimoto | 02cde14 | 2020-07-20 10:17:48 +0900 | [diff] [blame] | 31 | struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
Lars-Peter Clausen | 2896b8b | 2014-05-19 11:41:47 +0200 | [diff] [blame] | 32 | struct snd_soc_card *soc_card = rtd->card; |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 33 | struct snd_soc_card_drvdata_davinci *drvdata = |
| 34 | snd_soc_card_get_drvdata(soc_card); |
| 35 | |
| 36 | if (drvdata->mclk) |
| 37 | return clk_prepare_enable(drvdata->mclk); |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | static void evm_shutdown(struct snd_pcm_substream *substream) |
| 43 | { |
Kuninori Morimoto | 02cde14 | 2020-07-20 10:17:48 +0900 | [diff] [blame] | 44 | struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
Lars-Peter Clausen | 2896b8b | 2014-05-19 11:41:47 +0200 | [diff] [blame] | 45 | struct snd_soc_card *soc_card = rtd->card; |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 46 | struct snd_soc_card_drvdata_davinci *drvdata = |
| 47 | snd_soc_card_get_drvdata(soc_card); |
| 48 | |
Xu Wang | ff3cfcc | 2020-10-29 08:25:13 +0000 | [diff] [blame] | 49 | clk_disable_unprepare(drvdata->mclk); |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 50 | } |
| 51 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 52 | static int evm_hw_params(struct snd_pcm_substream *substream, |
| 53 | struct snd_pcm_hw_params *params) |
| 54 | { |
Kuninori Morimoto | 02cde14 | 2020-07-20 10:17:48 +0900 | [diff] [blame] | 55 | struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
Kuninori Morimoto | 2842b87 | 2020-03-23 14:21:14 +0900 | [diff] [blame] | 56 | struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
| 57 | struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
Lars-Peter Clausen | 2896b8b | 2014-05-19 11:41:47 +0200 | [diff] [blame] | 58 | struct snd_soc_card *soc_card = rtd->card; |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 59 | int ret = 0; |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 60 | unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *) |
| 61 | snd_soc_card_get_drvdata(soc_card))->sysclk; |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 62 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 63 | /* set the codec system clock */ |
David Brownell | 05d5e99 | 2009-01-04 02:50:10 -0800 | [diff] [blame] | 64 | 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] | 65 | if (ret < 0) |
| 66 | return ret; |
| 67 | |
Daniel Mack | 5b66aa2 | 2012-10-04 15:08:41 +0200 | [diff] [blame] | 68 | /* set the CPU system clock */ |
| 69 | ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT); |
Peter Ujfalusi | 69f3405 | 2019-08-30 13:38:41 +0300 | [diff] [blame] | 70 | if (ret < 0 && ret != -ENOTSUPP) |
Daniel Mack | 5b66aa2 | 2012-10-04 15:08:41 +0200 | [diff] [blame] | 71 | return ret; |
| 72 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 73 | return 0; |
| 74 | } |
| 75 | |
Rikard Falkeborn | 5100436 | 2021-09-29 11:31:21 +0200 | [diff] [blame] | 76 | static const struct snd_soc_ops evm_ops = { |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 77 | .startup = evm_startup, |
| 78 | .shutdown = evm_shutdown, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 79 | .hw_params = evm_hw_params, |
| 80 | }; |
| 81 | |
| 82 | /* davinci-evm machine dapm widgets */ |
| 83 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { |
| 84 | SND_SOC_DAPM_HP("Headphone Jack", NULL), |
| 85 | SND_SOC_DAPM_LINE("Line Out", NULL), |
| 86 | SND_SOC_DAPM_MIC("Mic Jack", NULL), |
| 87 | SND_SOC_DAPM_LINE("Line In", NULL), |
| 88 | }; |
| 89 | |
| 90 | /* davinci-evm machine audio_mapnections to the codec pins */ |
Mark Brown | acf497f | 2008-05-13 14:58:30 +0200 | [diff] [blame] | 91 | static const struct snd_soc_dapm_route audio_map[] = { |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 92 | /* Headphone connected to HPLOUT, HPROUT */ |
| 93 | {"Headphone Jack", NULL, "HPLOUT"}, |
| 94 | {"Headphone Jack", NULL, "HPROUT"}, |
| 95 | |
| 96 | /* Line Out connected to LLOUT, RLOUT */ |
| 97 | {"Line Out", NULL, "LLOUT"}, |
| 98 | {"Line Out", NULL, "RLOUT"}, |
| 99 | |
| 100 | /* Mic connected to (MIC3L | MIC3R) */ |
Hebbar Gururaja | e2e8bfd | 2013-01-31 18:23:04 +0530 | [diff] [blame] | 101 | {"MIC3L", NULL, "Mic Bias"}, |
| 102 | {"MIC3R", NULL, "Mic Bias"}, |
| 103 | {"Mic Bias", NULL, "Mic Jack"}, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 104 | |
| 105 | /* Line In connected to (LINE1L | LINE2L), (LINE1R | LINE2R) */ |
| 106 | {"LINE1L", NULL, "Line In"}, |
| 107 | {"LINE2L", NULL, "Line In"}, |
| 108 | {"LINE1R", NULL, "Line In"}, |
| 109 | {"LINE2R", NULL, "Line In"}, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | /* Logic for a aic3x as connected on a davinci-evm */ |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 113 | static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 114 | { |
Lars-Peter Clausen | d343a66 | 2014-03-12 15:27:35 +0100 | [diff] [blame] | 115 | struct snd_soc_card *card = rtd->card; |
Lars-Peter Clausen | 2896b8b | 2014-05-19 11:41:47 +0200 | [diff] [blame] | 116 | struct device_node *np = card->dev->of_node; |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 117 | int ret; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 118 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 119 | /* Add davinci-evm specific widgets */ |
Lars-Peter Clausen | d343a66 | 2014-03-12 15:27:35 +0100 | [diff] [blame] | 120 | snd_soc_dapm_new_controls(&card->dapm, aic3x_dapm_widgets, |
Mark Brown | acf497f | 2008-05-13 14:58:30 +0200 | [diff] [blame] | 121 | ARRAY_SIZE(aic3x_dapm_widgets)); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 122 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 123 | if (np) { |
Lars-Peter Clausen | d343a66 | 2014-03-12 15:27:35 +0100 | [diff] [blame] | 124 | ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing"); |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 125 | if (ret) |
| 126 | return ret; |
| 127 | } else { |
| 128 | /* Set up davinci-evm specific audio path audio_map */ |
Lars-Peter Clausen | d343a66 | 2014-03-12 15:27:35 +0100 | [diff] [blame] | 129 | snd_soc_dapm_add_routes(&card->dapm, audio_map, |
| 130 | ARRAY_SIZE(audio_map)); |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 131 | } |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 132 | |
| 133 | /* not connected */ |
Lars-Peter Clausen | b213b44 | 2015-04-11 13:11:28 +0200 | [diff] [blame] | 134 | snd_soc_dapm_nc_pin(&card->dapm, "MONO_LOUT"); |
| 135 | snd_soc_dapm_nc_pin(&card->dapm, "HPLCOM"); |
| 136 | snd_soc_dapm_nc_pin(&card->dapm, "HPRCOM"); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 137 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 138 | return 0; |
| 139 | } |
| 140 | |
| 141 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 142 | SND_SOC_DAILINK_DEFS(dm6446, |
| 143 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcbsp")), |
| 144 | DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.1-001b", |
| 145 | "tlv320aic3x-hifi")), |
| 146 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcbsp"))); |
| 147 | |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 148 | static struct snd_soc_dai_link dm6446_evm_dai = { |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 149 | .name = "TLV320AIC3X", |
| 150 | .stream_name = "AIC3X", |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 151 | .init = evm_aic3x_init, |
| 152 | .ops = &evm_ops, |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 153 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 154 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 155 | SND_SOC_DAILINK_REG(dm6446), |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 156 | }; |
| 157 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 158 | SND_SOC_DAILINK_DEFS(dm355, |
| 159 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcbsp.1")), |
| 160 | DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.1-001b", |
| 161 | "tlv320aic3x-hifi")), |
| 162 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcbsp.1"))); |
| 163 | |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 164 | static struct snd_soc_dai_link dm355_evm_dai = { |
| 165 | .name = "TLV320AIC3X", |
| 166 | .stream_name = "AIC3X", |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 167 | .init = evm_aic3x_init, |
| 168 | .ops = &evm_ops, |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 169 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 170 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 171 | SND_SOC_DAILINK_REG(dm355), |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 172 | }; |
| 173 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 174 | #ifdef CONFIG_SND_SOC_DM365_AIC3X_CODEC |
| 175 | SND_SOC_DAILINK_DEFS(dm365, |
| 176 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcbsp")), |
| 177 | DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.1-0018", |
| 178 | "tlv320aic3x-hifi")), |
| 179 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcbsp"))); |
| 180 | #elif defined(CONFIG_SND_SOC_DM365_VOICE_CODEC) |
| 181 | SND_SOC_DAILINK_DEFS(dm365, |
| 182 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-vcif")), |
| 183 | DAILINK_COMP_ARRAY(COMP_CODEC("cq93vc-codec", "cq93vc-hifi")), |
| 184 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-vcif"))); |
| 185 | #endif |
| 186 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 187 | static struct snd_soc_dai_link dm365_evm_dai = { |
Peter Ujfalusi | f2055e1 | 2018-12-17 14:21:34 +0200 | [diff] [blame] | 188 | #ifdef CONFIG_SND_SOC_DM365_AIC3X_CODEC |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 189 | .name = "TLV320AIC3X", |
| 190 | .stream_name = "AIC3X", |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 191 | .init = evm_aic3x_init, |
| 192 | .ops = &evm_ops, |
| 193 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 194 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 195 | SND_SOC_DAILINK_REG(dm365), |
Peter Ujfalusi | f2055e1 | 2018-12-17 14:21:34 +0200 | [diff] [blame] | 196 | #elif defined(CONFIG_SND_SOC_DM365_VOICE_CODEC) |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 197 | .name = "Voice Codec - CQ93VC", |
| 198 | .stream_name = "CQ93", |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 199 | SND_SOC_DAILINK_REG(dm365), |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 200 | #endif |
| 201 | }; |
| 202 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 203 | SND_SOC_DAILINK_DEFS(dm6467_aic3x, |
| 204 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcasp.0")), |
| 205 | DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.0-001a", |
| 206 | "tlv320aic3x-hifi")), |
| 207 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcasp.0"))); |
| 208 | |
| 209 | SND_SOC_DAILINK_DEFS(dm6467_spdif, |
| 210 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcasp.1")), |
| 211 | DAILINK_COMP_ARRAY(COMP_CODEC("spdif_dit", "dit-hifi")), |
| 212 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcasp.1"))); |
| 213 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 214 | static struct snd_soc_dai_link dm6467_evm_dai[] = { |
| 215 | { |
| 216 | .name = "TLV320AIC3X", |
| 217 | .stream_name = "AIC3X", |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 218 | .init = evm_aic3x_init, |
| 219 | .ops = &evm_ops, |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 220 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 221 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 222 | SND_SOC_DAILINK_REG(dm6467_aic3x), |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 223 | }, |
| 224 | { |
| 225 | .name = "McASP", |
| 226 | .stream_name = "spdif", |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 227 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 228 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 229 | SND_SOC_DAILINK_REG(dm6467_spdif), |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 230 | }, |
| 231 | }; |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 232 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 233 | SND_SOC_DAILINK_DEFS(da830, |
| 234 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcasp.1")), |
| 235 | DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.1-0018", |
| 236 | "tlv320aic3x-hifi")), |
| 237 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcasp.1"))); |
| 238 | |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 239 | static struct snd_soc_dai_link da830_evm_dai = { |
| 240 | .name = "TLV320AIC3X", |
| 241 | .stream_name = "AIC3X", |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 242 | .init = evm_aic3x_init, |
| 243 | .ops = &evm_ops, |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 244 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 245 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 246 | SND_SOC_DAILINK_REG(da830), |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 247 | }; |
| 248 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 249 | SND_SOC_DAILINK_DEFS(da850, |
| 250 | DAILINK_COMP_ARRAY(COMP_CPU("davinci-mcasp.0")), |
| 251 | DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.1-0018", |
| 252 | "tlv320aic3x-hifi")), |
| 253 | DAILINK_COMP_ARRAY(COMP_PLATFORM("davinci-mcasp.0"))); |
| 254 | |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 255 | static struct snd_soc_dai_link da850_evm_dai = { |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 256 | .name = "TLV320AIC3X", |
| 257 | .stream_name = "AIC3X", |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 258 | .init = evm_aic3x_init, |
| 259 | .ops = &evm_ops, |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 260 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 261 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 262 | SND_SOC_DAILINK_REG(da850), |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 263 | }; |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 264 | |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 265 | /* davinci dm6446 evm audio machine driver */ |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 266 | /* |
| 267 | * ASP0 in DM6446 EVM is clocked by U55, as configured by |
| 268 | * board-dm644x-evm.c using GPIOs from U18. There are six |
| 269 | * options; here we "know" we use a 48 KHz sample rate. |
| 270 | */ |
| 271 | static struct snd_soc_card_drvdata_davinci dm6446_snd_soc_card_drvdata = { |
| 272 | .sysclk = 12288000, |
| 273 | }; |
| 274 | |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 275 | static struct snd_soc_card dm6446_snd_soc_card_evm = { |
| 276 | .name = "DaVinci DM6446 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 277 | .owner = THIS_MODULE, |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 278 | .dai_link = &dm6446_evm_dai, |
| 279 | .num_links = 1, |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 280 | .drvdata = &dm6446_snd_soc_card_drvdata, |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 281 | }; |
| 282 | |
| 283 | /* davinci dm355 evm audio machine driver */ |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 284 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ |
| 285 | static struct snd_soc_card_drvdata_davinci dm355_snd_soc_card_drvdata = { |
| 286 | .sysclk = 27000000, |
| 287 | }; |
| 288 | |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 289 | static struct snd_soc_card dm355_snd_soc_card_evm = { |
| 290 | .name = "DaVinci DM355 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 291 | .owner = THIS_MODULE, |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 292 | .dai_link = &dm355_evm_dai, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 293 | .num_links = 1, |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 294 | .drvdata = &dm355_snd_soc_card_drvdata, |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 295 | }; |
| 296 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 297 | /* davinci dm365 evm audio machine driver */ |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 298 | static struct snd_soc_card_drvdata_davinci dm365_snd_soc_card_drvdata = { |
| 299 | .sysclk = 27000000, |
| 300 | }; |
| 301 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 302 | static struct snd_soc_card dm365_snd_soc_card_evm = { |
| 303 | .name = "DaVinci DM365 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 304 | .owner = THIS_MODULE, |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 305 | .dai_link = &dm365_evm_dai, |
| 306 | .num_links = 1, |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 307 | .drvdata = &dm365_snd_soc_card_drvdata, |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 308 | }; |
| 309 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 310 | /* davinci dm6467 evm audio machine driver */ |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 311 | static struct snd_soc_card_drvdata_davinci dm6467_snd_soc_card_drvdata = { |
| 312 | .sysclk = 27000000, |
| 313 | }; |
| 314 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 315 | static struct snd_soc_card dm6467_snd_soc_card_evm = { |
| 316 | .name = "DaVinci DM6467 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 317 | .owner = THIS_MODULE, |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 318 | .dai_link = dm6467_evm_dai, |
| 319 | .num_links = ARRAY_SIZE(dm6467_evm_dai), |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 320 | .drvdata = &dm6467_snd_soc_card_drvdata, |
| 321 | }; |
| 322 | |
| 323 | static struct snd_soc_card_drvdata_davinci da830_snd_soc_card_drvdata = { |
| 324 | .sysclk = 24576000, |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 325 | }; |
| 326 | |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 327 | static struct snd_soc_card da830_snd_soc_card = { |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 328 | .name = "DA830/OMAP-L137 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 329 | .owner = THIS_MODULE, |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 330 | .dai_link = &da830_evm_dai, |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 331 | .num_links = 1, |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 332 | .drvdata = &da830_snd_soc_card_drvdata, |
| 333 | }; |
| 334 | |
| 335 | static struct snd_soc_card_drvdata_davinci da850_snd_soc_card_drvdata = { |
| 336 | .sysclk = 24576000, |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 337 | }; |
| 338 | |
| 339 | static struct snd_soc_card da850_snd_soc_card = { |
| 340 | .name = "DA850/OMAP-L138 EVM", |
Axel Lin | 36a16d1 | 2011-12-22 21:19:42 +0800 | [diff] [blame] | 341 | .owner = THIS_MODULE, |
Vaibhav Bedia | f9eb9dd | 2011-02-03 16:42:25 +0530 | [diff] [blame] | 342 | .dai_link = &da850_evm_dai, |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 343 | .num_links = 1, |
Jyri Sarha | bcf2556 | 2013-09-17 12:26:00 +0300 | [diff] [blame] | 344 | .drvdata = &da850_snd_soc_card_drvdata, |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 345 | }; |
| 346 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 347 | #if defined(CONFIG_OF) |
| 348 | |
| 349 | /* |
| 350 | * The struct is used as place holder. It will be completely |
| 351 | * filled with data from dt node. |
| 352 | */ |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 353 | SND_SOC_DAILINK_DEFS(evm, |
| 354 | DAILINK_COMP_ARRAY(COMP_EMPTY()), |
Kuninori Morimoto | 44e5781 | 2019-06-28 10:49:18 +0900 | [diff] [blame] | 355 | DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "tlv320aic3x-hifi")), |
| 356 | DAILINK_COMP_ARRAY(COMP_EMPTY())); |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 357 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 358 | static struct snd_soc_dai_link evm_dai_tlv320aic3x = { |
| 359 | .name = "TLV320AIC3X", |
| 360 | .stream_name = "AIC3X", |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 361 | .ops = &evm_ops, |
| 362 | .init = evm_aic3x_init, |
Peter Ujfalusi | d38970e | 2013-11-14 11:35:21 +0200 | [diff] [blame] | 363 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM | |
| 364 | SND_SOC_DAIFMT_IB_NF, |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 365 | SND_SOC_DAILINK_REG(evm), |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | static const struct of_device_id davinci_evm_dt_ids[] = { |
| 369 | { |
| 370 | .compatible = "ti,da830-evm-audio", |
| 371 | .data = (void *) &evm_dai_tlv320aic3x, |
| 372 | }, |
| 373 | { /* sentinel */ } |
| 374 | }; |
| 375 | MODULE_DEVICE_TABLE(of, davinci_evm_dt_ids); |
| 376 | |
| 377 | /* davinci evm audio machine driver */ |
| 378 | static struct snd_soc_card evm_soc_card = { |
| 379 | .owner = THIS_MODULE, |
| 380 | .num_links = 1, |
| 381 | }; |
| 382 | |
| 383 | static int davinci_evm_probe(struct platform_device *pdev) |
| 384 | { |
| 385 | struct device_node *np = pdev->dev.of_node; |
Shailendra Verma | 3f81d9a | 2017-01-27 16:40:57 +0530 | [diff] [blame] | 386 | const struct of_device_id *match; |
| 387 | struct snd_soc_dai_link *dai; |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 388 | struct snd_soc_card_drvdata_davinci *drvdata = NULL; |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 389 | struct clk *mclk; |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 390 | int ret = 0; |
| 391 | |
Shailendra Verma | 3f81d9a | 2017-01-27 16:40:57 +0530 | [diff] [blame] | 392 | match = of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); |
| 393 | if (!match) { |
| 394 | dev_err(&pdev->dev, "Error: No device match found\n"); |
| 395 | return -ENODEV; |
| 396 | } |
| 397 | |
| 398 | dai = (struct snd_soc_dai_link *) match->data; |
| 399 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 400 | evm_soc_card.dai_link = dai; |
| 401 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 402 | dai->codecs->of_node = of_parse_phandle(np, "ti,audio-codec", 0); |
| 403 | if (!dai->codecs->of_node) |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 404 | return -EINVAL; |
| 405 | |
Kuninori Morimoto | de3582fe | 2019-06-06 13:12:57 +0900 | [diff] [blame] | 406 | dai->cpus->of_node = of_parse_phandle(np, "ti,mcasp-controller", 0); |
| 407 | if (!dai->cpus->of_node) |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 408 | return -EINVAL; |
| 409 | |
Kuninori Morimoto | 44e5781 | 2019-06-28 10:49:18 +0900 | [diff] [blame] | 410 | dai->platforms->of_node = dai->cpus->of_node; |
| 411 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 412 | evm_soc_card.dev = &pdev->dev; |
| 413 | ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); |
| 414 | if (ret) |
| 415 | return ret; |
| 416 | |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 417 | mclk = devm_clk_get(&pdev->dev, "mclk"); |
| 418 | if (PTR_ERR(mclk) == -EPROBE_DEFER) { |
| 419 | return -EPROBE_DEFER; |
| 420 | } else if (IS_ERR(mclk)) { |
| 421 | dev_dbg(&pdev->dev, "mclk not found.\n"); |
| 422 | mclk = NULL; |
| 423 | } |
| 424 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 425 | drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); |
| 426 | if (!drvdata) |
| 427 | return -ENOMEM; |
| 428 | |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 429 | drvdata->mclk = mclk; |
| 430 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 431 | ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk); |
Jyri Sarha | 5ad8865 | 2014-01-27 17:37:51 +0200 | [diff] [blame] | 432 | |
| 433 | if (ret < 0) { |
| 434 | if (!drvdata->mclk) { |
| 435 | dev_err(&pdev->dev, |
| 436 | "No clock or clock rate defined.\n"); |
| 437 | return -EINVAL; |
| 438 | } |
| 439 | drvdata->sysclk = clk_get_rate(drvdata->mclk); |
| 440 | } else if (drvdata->mclk) { |
| 441 | unsigned int requestd_rate = drvdata->sysclk; |
| 442 | clk_set_rate(drvdata->mclk, drvdata->sysclk); |
| 443 | drvdata->sysclk = clk_get_rate(drvdata->mclk); |
| 444 | if (drvdata->sysclk != requestd_rate) |
| 445 | dev_warn(&pdev->dev, |
| 446 | "Could not get requested rate %u using %u.\n", |
| 447 | requestd_rate, drvdata->sysclk); |
| 448 | } |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 449 | |
| 450 | snd_soc_card_set_drvdata(&evm_soc_card, drvdata); |
| 451 | ret = devm_snd_soc_register_card(&pdev->dev, &evm_soc_card); |
| 452 | |
| 453 | if (ret) |
| 454 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); |
| 455 | |
| 456 | return ret; |
| 457 | } |
| 458 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 459 | static struct platform_driver davinci_evm_driver = { |
| 460 | .probe = davinci_evm_probe, |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 461 | .driver = { |
| 462 | .name = "davinci_evm", |
Peter Ujfalusi | fb6d208 | 2014-01-30 15:21:31 +0200 | [diff] [blame] | 463 | .pm = &snd_soc_pm_ops, |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 464 | .of_match_table = of_match_ptr(davinci_evm_dt_ids), |
| 465 | }, |
| 466 | }; |
| 467 | #endif |
| 468 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 469 | static struct platform_device *evm_snd_device; |
| 470 | |
| 471 | static int __init evm_init(void) |
| 472 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 473 | struct snd_soc_card *evm_snd_dev_data; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 474 | int index; |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 475 | int ret; |
| 476 | |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 477 | /* |
| 478 | * If dtb is there, the devices will be created dynamically. |
| 479 | * Only register platfrom driver structure. |
| 480 | */ |
| 481 | #if defined(CONFIG_OF) |
| 482 | if (of_have_populated_dt()) |
| 483 | return platform_driver_register(&davinci_evm_driver); |
| 484 | #endif |
| 485 | |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 486 | if (machine_is_davinci_evm()) { |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 487 | evm_snd_dev_data = &dm6446_snd_soc_card_evm; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 488 | index = 0; |
| 489 | } else if (machine_is_davinci_dm355_evm()) { |
Chris Paulson-Ellis | bedad0c | 2010-11-16 12:27:09 +0000 | [diff] [blame] | 490 | evm_snd_dev_data = &dm355_snd_soc_card_evm; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 491 | index = 1; |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 492 | } else if (machine_is_davinci_dm365_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 493 | evm_snd_dev_data = &dm365_snd_soc_card_evm; |
Miguel Aguilar | aa9b88e | 2010-03-11 09:33:40 -0600 | [diff] [blame] | 494 | index = 0; |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 495 | } else if (machine_is_davinci_dm6467_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 496 | evm_snd_dev_data = &dm6467_snd_soc_card_evm; |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 497 | index = 0; |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 498 | } else if (machine_is_davinci_da830_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 499 | evm_snd_dev_data = &da830_snd_soc_card; |
Chaithrika U S | 7ae5945 | 2009-08-07 10:07:51 -0400 | [diff] [blame] | 500 | index = 1; |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 501 | } else if (machine_is_davinci_da850_evm()) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 502 | evm_snd_dev_data = &da850_snd_soc_card; |
Chaithrika U S | 30230f4 | 2009-08-11 16:59:21 -0400 | [diff] [blame] | 503 | index = 0; |
David Brownell | f492ec9 | 2009-05-14 13:01:59 -0700 | [diff] [blame] | 504 | } else |
| 505 | return -EINVAL; |
| 506 | |
| 507 | evm_snd_device = platform_device_alloc("soc-audio", index); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 508 | if (!evm_snd_device) |
| 509 | return -ENOMEM; |
| 510 | |
Chaithrika U S | 04f80f5 | 2009-06-05 06:28:49 -0400 | [diff] [blame] | 511 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 512 | ret = platform_device_add(evm_snd_device); |
| 513 | if (ret) |
| 514 | platform_device_put(evm_snd_device); |
| 515 | |
| 516 | return ret; |
| 517 | } |
| 518 | |
| 519 | static void __exit evm_exit(void) |
| 520 | { |
Hebbar, Gururaja | ee2f615 | 2013-10-23 15:30:14 +0300 | [diff] [blame] | 521 | #if defined(CONFIG_OF) |
| 522 | if (of_have_populated_dt()) { |
| 523 | platform_driver_unregister(&davinci_evm_driver); |
| 524 | return; |
| 525 | } |
| 526 | #endif |
| 527 | |
Vladimir Barinov | 310355c | 2008-02-18 11:40:22 +0100 | [diff] [blame] | 528 | platform_device_unregister(evm_snd_device); |
| 529 | } |
| 530 | |
| 531 | module_init(evm_init); |
| 532 | module_exit(evm_exit); |
| 533 | |
| 534 | MODULE_AUTHOR("Vladimir Barinov"); |
| 535 | MODULE_DESCRIPTION("TI DAVINCI EVM ASoC driver"); |
| 536 | MODULE_LICENSE("GPL"); |