diff options
Diffstat (limited to 'sound/soc/omap/omap3pandora.c')
-rw-r--r-- | sound/soc/omap/omap3pandora.c | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index 9eecac135bbb..8047c521e318 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c | |||
@@ -28,13 +28,12 @@ | |||
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include <sound/pcm.h> | 29 | #include <sound/pcm.h> |
30 | #include <sound/soc.h> | 30 | #include <sound/soc.h> |
31 | #include <sound/soc-dapm.h> | ||
32 | 31 | ||
33 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
33 | #include <plat/mcbsp.h> | ||
34 | 34 | ||
35 | #include "omap-mcbsp.h" | 35 | #include "omap-mcbsp.h" |
36 | #include "omap-pcm.h" | 36 | #include "omap-pcm.h" |
37 | #include "../codecs/twl4030.h" | ||
38 | 37 | ||
39 | #define OMAP3_PANDORA_DAC_POWER_GPIO 118 | 38 | #define OMAP3_PANDORA_DAC_POWER_GPIO 118 |
40 | #define OMAP3_PANDORA_AMP_POWER_GPIO 14 | 39 | #define OMAP3_PANDORA_AMP_POWER_GPIO 14 |
@@ -47,8 +46,8 @@ static int omap3pandora_hw_params(struct snd_pcm_substream *substream, | |||
47 | struct snd_pcm_hw_params *params) | 46 | struct snd_pcm_hw_params *params) |
48 | { | 47 | { |
49 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
50 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 49 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
51 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 50 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
52 | int fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 51 | int fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
53 | SND_SOC_DAIFMT_CBS_CFS; | 52 | SND_SOC_DAIFMT_CBS_CFS; |
54 | int ret; | 53 | int ret; |
@@ -167,52 +166,56 @@ static const struct snd_soc_dapm_route omap3pandora_in_map[] = { | |||
167 | {"Mic Bias 2", NULL, "Mic (external)"}, | 166 | {"Mic Bias 2", NULL, "Mic (external)"}, |
168 | }; | 167 | }; |
169 | 168 | ||
170 | static int omap3pandora_out_init(struct snd_soc_codec *codec) | 169 | static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) |
171 | { | 170 | { |
171 | struct snd_soc_codec *codec = rtd->codec; | ||
172 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
172 | int ret; | 173 | int ret; |
173 | 174 | ||
174 | /* All TWL4030 output pins are floating */ | 175 | /* All TWL4030 output pins are floating */ |
175 | snd_soc_dapm_nc_pin(codec, "EARPIECE"); | 176 | snd_soc_dapm_nc_pin(dapm, "EARPIECE"); |
176 | snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); | 177 | snd_soc_dapm_nc_pin(dapm, "PREDRIVEL"); |
177 | snd_soc_dapm_nc_pin(codec, "PREDRIVER"); | 178 | snd_soc_dapm_nc_pin(dapm, "PREDRIVER"); |
178 | snd_soc_dapm_nc_pin(codec, "HSOL"); | 179 | snd_soc_dapm_nc_pin(dapm, "HSOL"); |
179 | snd_soc_dapm_nc_pin(codec, "HSOR"); | 180 | snd_soc_dapm_nc_pin(dapm, "HSOR"); |
180 | snd_soc_dapm_nc_pin(codec, "CARKITL"); | 181 | snd_soc_dapm_nc_pin(dapm, "CARKITL"); |
181 | snd_soc_dapm_nc_pin(codec, "CARKITR"); | 182 | snd_soc_dapm_nc_pin(dapm, "CARKITR"); |
182 | snd_soc_dapm_nc_pin(codec, "HFL"); | 183 | snd_soc_dapm_nc_pin(dapm, "HFL"); |
183 | snd_soc_dapm_nc_pin(codec, "HFR"); | 184 | snd_soc_dapm_nc_pin(dapm, "HFR"); |
184 | snd_soc_dapm_nc_pin(codec, "VIBRA"); | 185 | snd_soc_dapm_nc_pin(dapm, "VIBRA"); |
185 | 186 | ||
186 | ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets, | 187 | ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets, |
187 | ARRAY_SIZE(omap3pandora_out_dapm_widgets)); | 188 | ARRAY_SIZE(omap3pandora_out_dapm_widgets)); |
188 | if (ret < 0) | 189 | if (ret < 0) |
189 | return ret; | 190 | return ret; |
190 | 191 | ||
191 | snd_soc_dapm_add_routes(codec, omap3pandora_out_map, | 192 | snd_soc_dapm_add_routes(dapm, omap3pandora_out_map, |
192 | ARRAY_SIZE(omap3pandora_out_map)); | 193 | ARRAY_SIZE(omap3pandora_out_map)); |
193 | 194 | ||
194 | return snd_soc_dapm_sync(codec); | 195 | return snd_soc_dapm_sync(dapm); |
195 | } | 196 | } |
196 | 197 | ||
197 | static int omap3pandora_in_init(struct snd_soc_codec *codec) | 198 | static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) |
198 | { | 199 | { |
200 | struct snd_soc_codec *codec = rtd->codec; | ||
201 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
199 | int ret; | 202 | int ret; |
200 | 203 | ||
201 | /* Not comnnected */ | 204 | /* Not comnnected */ |
202 | snd_soc_dapm_nc_pin(codec, "HSMIC"); | 205 | snd_soc_dapm_nc_pin(dapm, "HSMIC"); |
203 | snd_soc_dapm_nc_pin(codec, "CARKITMIC"); | 206 | snd_soc_dapm_nc_pin(dapm, "CARKITMIC"); |
204 | snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); | 207 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); |
205 | snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); | 208 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); |
206 | 209 | ||
207 | ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, | 210 | ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets, |
208 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); | 211 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); |
209 | if (ret < 0) | 212 | if (ret < 0) |
210 | return ret; | 213 | return ret; |
211 | 214 | ||
212 | snd_soc_dapm_add_routes(codec, omap3pandora_in_map, | 215 | snd_soc_dapm_add_routes(dapm, omap3pandora_in_map, |
213 | ARRAY_SIZE(omap3pandora_in_map)); | 216 | ARRAY_SIZE(omap3pandora_in_map)); |
214 | 217 | ||
215 | return snd_soc_dapm_sync(codec); | 218 | return snd_soc_dapm_sync(dapm); |
216 | } | 219 | } |
217 | 220 | ||
218 | static struct snd_soc_ops omap3pandora_ops = { | 221 | static struct snd_soc_ops omap3pandora_ops = { |
@@ -224,15 +227,19 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { | |||
224 | { | 227 | { |
225 | .name = "PCM1773", | 228 | .name = "PCM1773", |
226 | .stream_name = "HiFi Out", | 229 | .stream_name = "HiFi Out", |
227 | .cpu_dai = &omap_mcbsp_dai[0], | 230 | .cpu_dai_name = "omap-mcbsp-dai.1", |
228 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 231 | .codec_dai_name = "twl4030-hifi", |
232 | .platform_name = "omap-pcm-audio", | ||
233 | .codec_name = "twl4030-codec", | ||
229 | .ops = &omap3pandora_ops, | 234 | .ops = &omap3pandora_ops, |
230 | .init = omap3pandora_out_init, | 235 | .init = omap3pandora_out_init, |
231 | }, { | 236 | }, { |
232 | .name = "TWL4030", | 237 | .name = "TWL4030", |
233 | .stream_name = "Line/Mic In", | 238 | .stream_name = "Line/Mic In", |
234 | .cpu_dai = &omap_mcbsp_dai[1], | 239 | .cpu_dai_name = "omap-mcbsp-dai.3", |
235 | .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI], | 240 | .codec_dai_name = "twl4030-hifi", |
241 | .platform_name = "omap-pcm-audio", | ||
242 | .codec_name = "twl4030-codec", | ||
236 | .ops = &omap3pandora_ops, | 243 | .ops = &omap3pandora_ops, |
237 | .init = omap3pandora_in_init, | 244 | .init = omap3pandora_in_init, |
238 | } | 245 | } |
@@ -241,17 +248,10 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { | |||
241 | /* SoC card */ | 248 | /* SoC card */ |
242 | static struct snd_soc_card snd_soc_card_omap3pandora = { | 249 | static struct snd_soc_card snd_soc_card_omap3pandora = { |
243 | .name = "omap3pandora", | 250 | .name = "omap3pandora", |
244 | .platform = &omap_soc_platform, | ||
245 | .dai_link = omap3pandora_dai, | 251 | .dai_link = omap3pandora_dai, |
246 | .num_links = ARRAY_SIZE(omap3pandora_dai), | 252 | .num_links = ARRAY_SIZE(omap3pandora_dai), |
247 | }; | 253 | }; |
248 | 254 | ||
249 | /* Audio subsystem */ | ||
250 | static struct snd_soc_device omap3pandora_snd_data = { | ||
251 | .card = &snd_soc_card_omap3pandora, | ||
252 | .codec_dev = &soc_codec_dev_twl4030, | ||
253 | }; | ||
254 | |||
255 | static struct platform_device *omap3pandora_snd_device; | 255 | static struct platform_device *omap3pandora_snd_device; |
256 | 256 | ||
257 | static int __init omap3pandora_soc_init(void) | 257 | static int __init omap3pandora_soc_init(void) |
@@ -294,10 +294,7 @@ static int __init omap3pandora_soc_init(void) | |||
294 | goto fail1; | 294 | goto fail1; |
295 | } | 295 | } |
296 | 296 | ||
297 | platform_set_drvdata(omap3pandora_snd_device, &omap3pandora_snd_data); | 297 | platform_set_drvdata(omap3pandora_snd_device, &snd_soc_card_omap3pandora); |
298 | omap3pandora_snd_data.dev = &omap3pandora_snd_device->dev; | ||
299 | *(unsigned int *)omap_mcbsp_dai[0].private_data = 1; /* McBSP2 */ | ||
300 | *(unsigned int *)omap_mcbsp_dai[1].private_data = 3; /* McBSP4 */ | ||
301 | 298 | ||
302 | ret = platform_device_add(omap3pandora_snd_device); | 299 | ret = platform_device_add(omap3pandora_snd_device); |
303 | if (ret) { | 300 | if (ret) { |
@@ -310,6 +307,7 @@ static int __init omap3pandora_soc_init(void) | |||
310 | pr_err(PREFIX "Failed to get DAC regulator from %s: %ld\n", | 307 | pr_err(PREFIX "Failed to get DAC regulator from %s: %ld\n", |
311 | dev_name(&omap3pandora_snd_device->dev), | 308 | dev_name(&omap3pandora_snd_device->dev), |
312 | PTR_ERR(omap3pandora_dac_reg)); | 309 | PTR_ERR(omap3pandora_dac_reg)); |
310 | ret = PTR_ERR(omap3pandora_dac_reg); | ||
313 | goto fail3; | 311 | goto fail3; |
314 | } | 312 | } |
315 | 313 | ||