diff options
Diffstat (limited to 'sound/soc/omap')
-rw-r--r-- | sound/soc/omap/Kconfig | 4 | ||||
-rw-r--r-- | sound/soc/omap/am3517evm.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/ams-delta.c | 68 | ||||
-rw-r--r-- | sound/soc/omap/n810.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/omap-abe-twl6040.c | 13 | ||||
-rw-r--r-- | sound/soc/omap/omap-dmic.c | 9 | ||||
-rw-r--r-- | sound/soc/omap/omap-hdmi-card.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/omap-hdmi.c | 6 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 25 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.h | 2 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 16 | ||||
-rw-r--r-- | sound/soc/omap/omap-pcm.c | 25 | ||||
-rw-r--r-- | sound/soc/omap/omap-pcm.h | 30 | ||||
-rw-r--r-- | sound/soc/omap/omap-twl4030.c | 15 | ||||
-rw-r--r-- | sound/soc/omap/omap3pandora.c | 35 | ||||
-rw-r--r-- | sound/soc/omap/osk5912.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/rx51.c | 275 |
17 files changed, 305 insertions, 226 deletions
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index e00659351a4e..d44463a7b0fa 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig | |||
@@ -26,7 +26,7 @@ config SND_OMAP_SOC_N810 | |||
26 | 26 | ||
27 | config SND_OMAP_SOC_RX51 | 27 | config SND_OMAP_SOC_RX51 |
28 | tristate "SoC Audio support for Nokia RX-51" | 28 | tristate "SoC Audio support for Nokia RX-51" |
29 | depends on SND_OMAP_SOC && ARM && (MACH_NOKIA_RX51 || COMPILE_TEST) | 29 | depends on SND_OMAP_SOC && ARM && (MACH_NOKIA_RX51 || COMPILE_TEST) && I2C |
30 | select SND_OMAP_SOC_MCBSP | 30 | select SND_OMAP_SOC_MCBSP |
31 | select SND_SOC_TLV320AIC3X | 31 | select SND_SOC_TLV320AIC3X |
32 | select SND_SOC_TPA6130A2 | 32 | select SND_SOC_TPA6130A2 |
@@ -37,7 +37,7 @@ config SND_OMAP_SOC_RX51 | |||
37 | 37 | ||
38 | config SND_OMAP_SOC_AMS_DELTA | 38 | config SND_OMAP_SOC_AMS_DELTA |
39 | tristate "SoC Audio support for Amstrad E3 (Delta) videophone" | 39 | tristate "SoC Audio support for Amstrad E3 (Delta) videophone" |
40 | depends on SND_OMAP_SOC && MACH_AMS_DELTA | 40 | depends on SND_OMAP_SOC && MACH_AMS_DELTA && TTY |
41 | select SND_OMAP_SOC_MCBSP | 41 | select SND_OMAP_SOC_MCBSP |
42 | select SND_SOC_CX20442 | 42 | select SND_SOC_CX20442 |
43 | help | 43 | help |
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c index 994dcf345975..25a33e9d417a 100644 --- a/sound/soc/omap/am3517evm.c +++ b/sound/soc/omap/am3517evm.c | |||
@@ -77,7 +77,7 @@ static struct snd_soc_dai_link am3517evm_dai = { | |||
77 | .stream_name = "AIC23", | 77 | .stream_name = "AIC23", |
78 | .cpu_dai_name = "omap-mcbsp.1", | 78 | .cpu_dai_name = "omap-mcbsp.1", |
79 | .codec_dai_name = "tlv320aic23-hifi", | 79 | .codec_dai_name = "tlv320aic23-hifi", |
80 | .platform_name = "omap-pcm-audio", | 80 | .platform_name = "omap-mcbsp.1", |
81 | .codec_name = "tlv320aic23-codec.2-001a", | 81 | .codec_name = "tlv320aic23-codec.2-001a", |
82 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | | 82 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | |
83 | SND_SOC_DAIFMT_CBM_CFM, | 83 | SND_SOC_DAIFMT_CBM_CFM, |
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 56a5219c0a00..bb243c663e6b 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "omap-mcbsp.h" | 38 | #include "omap-mcbsp.h" |
39 | #include "../codecs/cx20442.h" | 39 | #include "../codecs/cx20442.h" |
40 | 40 | ||
41 | |||
42 | /* Board specific DAPM widgets */ | 41 | /* Board specific DAPM widgets */ |
43 | static const struct snd_soc_dapm_widget ams_delta_dapm_widgets[] = { | 42 | static const struct snd_soc_dapm_widget ams_delta_dapm_widgets[] = { |
44 | /* Handset */ | 43 | /* Handset */ |
@@ -90,17 +89,23 @@ static const unsigned short ams_delta_audio_mode_pins[] = { | |||
90 | 89 | ||
91 | static unsigned short ams_delta_audio_agc; | 90 | static unsigned short ams_delta_audio_agc; |
92 | 91 | ||
92 | /* | ||
93 | * Used for passing a codec structure pointer | ||
94 | * from the board initialization code to the tty line discipline. | ||
95 | */ | ||
96 | static struct snd_soc_codec *cx20442_codec; | ||
97 | |||
93 | static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, | 98 | static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, |
94 | struct snd_ctl_elem_value *ucontrol) | 99 | struct snd_ctl_elem_value *ucontrol) |
95 | { | 100 | { |
96 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 101 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); |
97 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 102 | struct snd_soc_dapm_context *dapm = &card->dapm; |
98 | struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; | 103 | struct soc_enum *control = (struct soc_enum *)kcontrol->private_value; |
99 | unsigned short pins; | 104 | unsigned short pins; |
100 | int pin, changed = 0; | 105 | int pin, changed = 0; |
101 | 106 | ||
102 | /* Refuse any mode changes if we are not able to control the codec. */ | 107 | /* Refuse any mode changes if we are not able to control the codec. */ |
103 | if (!codec->hw_write) | 108 | if (!cx20442_codec->hw_write) |
104 | return -EUNATCH; | 109 | return -EUNATCH; |
105 | 110 | ||
106 | if (ucontrol->value.enumerated.item[0] >= control->items) | 111 | if (ucontrol->value.enumerated.item[0] >= control->items) |
@@ -166,8 +171,8 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, | |||
166 | static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol, | 171 | static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol, |
167 | struct snd_ctl_elem_value *ucontrol) | 172 | struct snd_ctl_elem_value *ucontrol) |
168 | { | 173 | { |
169 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 174 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); |
170 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 175 | struct snd_soc_dapm_context *dapm = &card->dapm; |
171 | unsigned short pins, mode; | 176 | unsigned short pins, mode; |
172 | 177 | ||
173 | pins = ((snd_soc_dapm_get_pin_status(dapm, "Mouthpiece") << | 178 | pins = ((snd_soc_dapm_get_pin_status(dapm, "Mouthpiece") << |
@@ -270,12 +275,6 @@ static void cx81801_timeout(unsigned long data) | |||
270 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0); | 275 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0); |
271 | } | 276 | } |
272 | 277 | ||
273 | /* | ||
274 | * Used for passing a codec structure pointer | ||
275 | * from the board initialization code to the tty line discipline. | ||
276 | */ | ||
277 | static struct snd_soc_codec *cx20442_codec; | ||
278 | |||
279 | /* Line discipline .open() */ | 278 | /* Line discipline .open() */ |
280 | static int cx81801_open(struct tty_struct *tty) | 279 | static int cx81801_open(struct tty_struct *tty) |
281 | { | 280 | { |
@@ -302,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty) | |||
302 | static void cx81801_close(struct tty_struct *tty) | 301 | static void cx81801_close(struct tty_struct *tty) |
303 | { | 302 | { |
304 | struct snd_soc_codec *codec = tty->disc_data; | 303 | struct snd_soc_codec *codec = tty->disc_data; |
305 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 304 | struct snd_soc_dapm_context *dapm = &codec->card->dapm; |
306 | 305 | ||
307 | del_timer_sync(&cx81801_timer); | 306 | del_timer_sync(&cx81801_timer); |
308 | 307 | ||
@@ -475,15 +474,14 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream) | |||
475 | 474 | ||
476 | static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | 475 | static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) |
477 | { | 476 | { |
478 | struct snd_soc_codec *codec = rtd->codec; | ||
479 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
480 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 477 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
481 | struct snd_soc_card *card = rtd->card; | 478 | struct snd_soc_card *card = rtd->card; |
479 | struct snd_soc_dapm_context *dapm = &card->dapm; | ||
482 | int ret; | 480 | int ret; |
483 | /* Codec is ready, now add/activate board specific controls */ | 481 | /* Codec is ready, now add/activate board specific controls */ |
484 | 482 | ||
485 | /* Store a pointer to the codec structure for tty ldisc use */ | 483 | /* Store a pointer to the codec structure for tty ldisc use */ |
486 | cx20442_codec = codec; | 484 | cx20442_codec = rtd->codec; |
487 | 485 | ||
488 | /* Set up digital mute if not provided by the codec */ | 486 | /* Set up digital mute if not provided by the codec */ |
489 | if (!codec_dai->driver->ops) { | 487 | if (!codec_dai->driver->ops) { |
@@ -520,41 +518,12 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | |||
520 | return 0; | 518 | return 0; |
521 | } | 519 | } |
522 | 520 | ||
523 | /* Add board specific DAPM widgets and routes */ | ||
524 | ret = snd_soc_dapm_new_controls(dapm, ams_delta_dapm_widgets, | ||
525 | ARRAY_SIZE(ams_delta_dapm_widgets)); | ||
526 | if (ret) { | ||
527 | dev_warn(card->dev, | ||
528 | "Failed to register DAPM controls, " | ||
529 | "will continue without any.\n"); | ||
530 | return 0; | ||
531 | } | ||
532 | |||
533 | ret = snd_soc_dapm_add_routes(dapm, ams_delta_audio_map, | ||
534 | ARRAY_SIZE(ams_delta_audio_map)); | ||
535 | if (ret) { | ||
536 | dev_warn(card->dev, | ||
537 | "Failed to set up DAPM routes, " | ||
538 | "will continue with codec default map.\n"); | ||
539 | return 0; | ||
540 | } | ||
541 | |||
542 | /* Set up initial pin constellation */ | 521 | /* Set up initial pin constellation */ |
543 | snd_soc_dapm_disable_pin(dapm, "Mouthpiece"); | 522 | snd_soc_dapm_disable_pin(dapm, "Mouthpiece"); |
544 | snd_soc_dapm_enable_pin(dapm, "Earpiece"); | ||
545 | snd_soc_dapm_enable_pin(dapm, "Microphone"); | ||
546 | snd_soc_dapm_disable_pin(dapm, "Speaker"); | 523 | snd_soc_dapm_disable_pin(dapm, "Speaker"); |
547 | snd_soc_dapm_disable_pin(dapm, "AGCIN"); | 524 | snd_soc_dapm_disable_pin(dapm, "AGCIN"); |
548 | snd_soc_dapm_disable_pin(dapm, "AGCOUT"); | 525 | snd_soc_dapm_disable_pin(dapm, "AGCOUT"); |
549 | 526 | ||
550 | /* Add virtual switch */ | ||
551 | ret = snd_soc_add_codec_controls(codec, ams_delta_audio_controls, | ||
552 | ARRAY_SIZE(ams_delta_audio_controls)); | ||
553 | if (ret) | ||
554 | dev_warn(card->dev, | ||
555 | "Failed to register audio mode control, " | ||
556 | "will continue without it.\n"); | ||
557 | |||
558 | return 0; | 527 | return 0; |
559 | } | 528 | } |
560 | 529 | ||
@@ -565,7 +534,7 @@ static struct snd_soc_dai_link ams_delta_dai_link = { | |||
565 | .cpu_dai_name = "omap-mcbsp.1", | 534 | .cpu_dai_name = "omap-mcbsp.1", |
566 | .codec_dai_name = "cx20442-voice", | 535 | .codec_dai_name = "cx20442-voice", |
567 | .init = ams_delta_cx20442_init, | 536 | .init = ams_delta_cx20442_init, |
568 | .platform_name = "omap-pcm-audio", | 537 | .platform_name = "omap-mcbsp.1", |
569 | .codec_name = "cx20442-codec", | 538 | .codec_name = "cx20442-codec", |
570 | .ops = &ams_delta_ops, | 539 | .ops = &ams_delta_ops, |
571 | }; | 540 | }; |
@@ -576,6 +545,13 @@ static struct snd_soc_card ams_delta_audio_card = { | |||
576 | .owner = THIS_MODULE, | 545 | .owner = THIS_MODULE, |
577 | .dai_link = &ams_delta_dai_link, | 546 | .dai_link = &ams_delta_dai_link, |
578 | .num_links = 1, | 547 | .num_links = 1, |
548 | |||
549 | .controls = ams_delta_audio_controls, | ||
550 | .num_controls = ARRAY_SIZE(ams_delta_audio_controls), | ||
551 | .dapm_widgets = ams_delta_dapm_widgets, | ||
552 | .num_dapm_widgets = ARRAY_SIZE(ams_delta_dapm_widgets), | ||
553 | .dapm_routes = ams_delta_audio_map, | ||
554 | .num_dapm_routes = ARRAY_SIZE(ams_delta_audio_map), | ||
579 | }; | 555 | }; |
580 | 556 | ||
581 | /* Module init/exit */ | 557 | /* Module init/exit */ |
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index fd4d9c809e50..5d7f9cebe041 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -278,7 +278,7 @@ static struct snd_soc_dai_link n810_dai = { | |||
278 | .name = "TLV320AIC33", | 278 | .name = "TLV320AIC33", |
279 | .stream_name = "AIC33", | 279 | .stream_name = "AIC33", |
280 | .cpu_dai_name = "omap-mcbsp.2", | 280 | .cpu_dai_name = "omap-mcbsp.2", |
281 | .platform_name = "omap-pcm-audio", | 281 | .platform_name = "omap-mcbsp.2", |
282 | .codec_name = "tlv320aic3x-codec.2-0018", | 282 | .codec_name = "tlv320aic3x-codec.2-0018", |
283 | .codec_dai_name = "tlv320aic3x-hifi", | 283 | .codec_dai_name = "tlv320aic3x-hifi", |
284 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 284 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c index 024dafc3e298..cec836ed0c01 100644 --- a/sound/soc/omap/omap-abe-twl6040.c +++ b/sound/soc/omap/omap-abe-twl6040.c | |||
@@ -47,8 +47,7 @@ static int omap_abe_hw_params(struct snd_pcm_substream *substream, | |||
47 | { | 47 | { |
48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
49 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 49 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
50 | struct snd_soc_codec *codec = rtd->codec; | 50 | struct snd_soc_card *card = rtd->card; |
51 | struct snd_soc_card *card = codec->card; | ||
52 | struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); | 51 | struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); |
53 | int clk_id, freq; | 52 | int clk_id, freq; |
54 | int ret; | 53 | int ret; |
@@ -168,7 +167,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
168 | static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) | 167 | static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) |
169 | { | 168 | { |
170 | struct snd_soc_codec *codec = rtd->codec; | 169 | struct snd_soc_codec *codec = rtd->codec; |
171 | struct snd_soc_card *card = codec->card; | 170 | struct snd_soc_card *card = rtd->card; |
172 | struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); | 171 | struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); |
173 | int hs_trim; | 172 | int hs_trim; |
174 | int ret = 0; | 173 | int ret = 0; |
@@ -214,9 +213,7 @@ static struct snd_soc_dai_link abe_twl6040_dai_links[] = { | |||
214 | { | 213 | { |
215 | .name = "TWL6040", | 214 | .name = "TWL6040", |
216 | .stream_name = "TWL6040", | 215 | .stream_name = "TWL6040", |
217 | .cpu_dai_name = "omap-mcpdm", | ||
218 | .codec_dai_name = "twl6040-legacy", | 216 | .codec_dai_name = "twl6040-legacy", |
219 | .platform_name = "omap-pcm-audio", | ||
220 | .codec_name = "twl6040-codec", | 217 | .codec_name = "twl6040-codec", |
221 | .init = omap_abe_twl6040_init, | 218 | .init = omap_abe_twl6040_init, |
222 | .ops = &omap_abe_ops, | 219 | .ops = &omap_abe_ops, |
@@ -224,9 +221,7 @@ static struct snd_soc_dai_link abe_twl6040_dai_links[] = { | |||
224 | { | 221 | { |
225 | .name = "DMIC", | 222 | .name = "DMIC", |
226 | .stream_name = "DMIC Capture", | 223 | .stream_name = "DMIC Capture", |
227 | .cpu_dai_name = "omap-dmic", | ||
228 | .codec_dai_name = "dmic-hifi", | 224 | .codec_dai_name = "dmic-hifi", |
229 | .platform_name = "omap-pcm-audio", | ||
230 | .codec_name = "dmic-codec", | 225 | .codec_name = "dmic-codec", |
231 | .init = omap_abe_dmic_init, | 226 | .init = omap_abe_dmic_init, |
232 | .ops = &omap_abe_dmic_ops, | 227 | .ops = &omap_abe_dmic_ops, |
@@ -281,14 +276,14 @@ static int omap_abe_probe(struct platform_device *pdev) | |||
281 | dev_err(&pdev->dev, "McPDM node is not provided\n"); | 276 | dev_err(&pdev->dev, "McPDM node is not provided\n"); |
282 | return -EINVAL; | 277 | return -EINVAL; |
283 | } | 278 | } |
284 | abe_twl6040_dai_links[0].cpu_dai_name = NULL; | ||
285 | abe_twl6040_dai_links[0].cpu_of_node = dai_node; | 279 | abe_twl6040_dai_links[0].cpu_of_node = dai_node; |
280 | abe_twl6040_dai_links[0].platform_of_node = dai_node; | ||
286 | 281 | ||
287 | dai_node = of_parse_phandle(node, "ti,dmic", 0); | 282 | dai_node = of_parse_phandle(node, "ti,dmic", 0); |
288 | if (dai_node) { | 283 | if (dai_node) { |
289 | num_links = 2; | 284 | num_links = 2; |
290 | abe_twl6040_dai_links[1].cpu_dai_name = NULL; | ||
291 | abe_twl6040_dai_links[1].cpu_of_node = dai_node; | 285 | abe_twl6040_dai_links[1].cpu_of_node = dai_node; |
286 | abe_twl6040_dai_links[1].platform_of_node = dai_node; | ||
292 | 287 | ||
293 | priv->dmic_codec_dev = platform_device_register_simple( | 288 | priv->dmic_codec_dev = platform_device_register_simple( |
294 | "dmic-codec", -1, NULL, 0); | 289 | "dmic-codec", -1, NULL, 0); |
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 1bd531d718f9..53da041896c4 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <sound/dmaengine_pcm.h> | 42 | #include <sound/dmaengine_pcm.h> |
43 | 43 | ||
44 | #include "omap-dmic.h" | 44 | #include "omap-dmic.h" |
45 | #include "omap-pcm.h" | ||
45 | 46 | ||
46 | struct omap_dmic { | 47 | struct omap_dmic { |
47 | struct device *dev; | 48 | struct device *dev; |
@@ -113,7 +114,6 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream, | |||
113 | 114 | ||
114 | mutex_unlock(&dmic->mutex); | 115 | mutex_unlock(&dmic->mutex); |
115 | 116 | ||
116 | snd_soc_dai_set_dma_data(dai, substream, &dmic->dma_data); | ||
117 | return ret; | 117 | return ret; |
118 | } | 118 | } |
119 | 119 | ||
@@ -417,6 +417,9 @@ static int omap_dmic_probe(struct snd_soc_dai *dai) | |||
417 | 417 | ||
418 | /* Configure DMIC threshold value */ | 418 | /* Configure DMIC threshold value */ |
419 | dmic->threshold = OMAP_DMIC_THRES_MAX - 3; | 419 | dmic->threshold = OMAP_DMIC_THRES_MAX - 3; |
420 | |||
421 | snd_soc_dai_init_dma_data(dai, NULL, &dmic->dma_data); | ||
422 | |||
420 | return 0; | 423 | return 0; |
421 | } | 424 | } |
422 | 425 | ||
@@ -492,6 +495,10 @@ static int asoc_dmic_probe(struct platform_device *pdev) | |||
492 | if (ret) | 495 | if (ret) |
493 | goto err_put_clk; | 496 | goto err_put_clk; |
494 | 497 | ||
498 | ret = omap_pcm_platform_register(&pdev->dev); | ||
499 | if (ret) | ||
500 | goto err_put_clk; | ||
501 | |||
495 | return 0; | 502 | return 0; |
496 | 503 | ||
497 | err_put_clk: | 504 | err_put_clk: |
diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c index 7e66e9cba5a8..f649fe84b629 100644 --- a/sound/soc/omap/omap-hdmi-card.c +++ b/sound/soc/omap/omap-hdmi-card.c | |||
@@ -33,7 +33,7 @@ static struct snd_soc_dai_link omap_hdmi_dai = { | |||
33 | .name = "HDMI", | 33 | .name = "HDMI", |
34 | .stream_name = "HDMI", | 34 | .stream_name = "HDMI", |
35 | .cpu_dai_name = "omap-hdmi-audio-dai", | 35 | .cpu_dai_name = "omap-hdmi-audio-dai", |
36 | .platform_name = "omap-pcm-audio", | 36 | .platform_name = "omap-hdmi-audio-dai", |
37 | .codec_name = "hdmi-audio-codec", | 37 | .codec_name = "hdmi-audio-codec", |
38 | .codec_dai_name = "hdmi-hifi", | 38 | .codec_dai_name = "hdmi-hifi", |
39 | }; | 39 | }; |
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index ced3b88b44d4..537a1ec8ad61 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
37 | 37 | ||
38 | #include "omap-hdmi.h" | 38 | #include "omap-hdmi.h" |
39 | #include "omap-pcm.h" | ||
39 | 40 | ||
40 | #define DRV_NAME "omap-hdmi-audio-dai" | 41 | #define DRV_NAME "omap-hdmi-audio-dai" |
41 | 42 | ||
@@ -324,7 +325,10 @@ static int omap_hdmi_probe(struct platform_device *pdev) | |||
324 | ret = snd_soc_register_component(&pdev->dev, &omap_hdmi_component, | 325 | ret = snd_soc_register_component(&pdev->dev, &omap_hdmi_component, |
325 | &omap_hdmi_dai, 1); | 326 | &omap_hdmi_dai, 1); |
326 | 327 | ||
327 | return ret; | 328 | if (ret) |
329 | return ret; | ||
330 | |||
331 | return omap_pcm_platform_register(&pdev->dev); | ||
328 | } | 332 | } |
329 | 333 | ||
330 | static int omap_hdmi_remove(struct platform_device *pdev) | 334 | static int omap_hdmi_remove(struct platform_device *pdev) |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 6c19bba23570..71d226626f7c 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/platform_data/asoc-ti-mcbsp.h> | 38 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
39 | #include "mcbsp.h" | 39 | #include "mcbsp.h" |
40 | #include "omap-mcbsp.h" | 40 | #include "omap-mcbsp.h" |
41 | #include "omap-pcm.h" | ||
41 | 42 | ||
42 | #define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000) | 43 | #define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000) |
43 | 44 | ||
@@ -149,9 +150,6 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
149 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); | 150 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); |
150 | } | 151 | } |
151 | 152 | ||
152 | snd_soc_dai_set_dma_data(cpu_dai, substream, | ||
153 | &mcbsp->dma_data[substream->stream]); | ||
154 | |||
155 | return err; | 153 | return err; |
156 | } | 154 | } |
157 | 155 | ||
@@ -559,6 +557,10 @@ static int omap_mcbsp_probe(struct snd_soc_dai *dai) | |||
559 | 557 | ||
560 | pm_runtime_enable(mcbsp->dev); | 558 | pm_runtime_enable(mcbsp->dev); |
561 | 559 | ||
560 | snd_soc_dai_init_dma_data(dai, | ||
561 | &mcbsp->dma_data[SNDRV_PCM_STREAM_PLAYBACK], | ||
562 | &mcbsp->dma_data[SNDRV_PCM_STREAM_CAPTURE]); | ||
563 | |||
562 | return 0; | 564 | return 0; |
563 | } | 565 | } |
564 | 566 | ||
@@ -691,7 +693,7 @@ OMAP_MCBSP_SOC_SINGLE_S16_EXT("McBSP" #port " Sidetone Channel 1 Volume", \ | |||
691 | OMAP_MCBSP_ST_CONTROLS(2); | 693 | OMAP_MCBSP_ST_CONTROLS(2); |
692 | OMAP_MCBSP_ST_CONTROLS(3); | 694 | OMAP_MCBSP_ST_CONTROLS(3); |
693 | 695 | ||
694 | int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd) | 696 | int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd, int port_id) |
695 | { | 697 | { |
696 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 698 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
697 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); | 699 | struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); |
@@ -701,7 +703,7 @@ int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd) | |||
701 | return 0; | 703 | return 0; |
702 | } | 704 | } |
703 | 705 | ||
704 | switch (mcbsp->id) { | 706 | switch (port_id) { |
705 | case 2: /* McBSP 2 */ | 707 | case 2: /* McBSP 2 */ |
706 | return snd_soc_add_dai_controls(cpu_dai, | 708 | return snd_soc_add_dai_controls(cpu_dai, |
707 | omap_mcbsp2_st_controls, | 709 | omap_mcbsp2_st_controls, |
@@ -711,6 +713,7 @@ int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd) | |||
711 | omap_mcbsp3_st_controls, | 713 | omap_mcbsp3_st_controls, |
712 | ARRAY_SIZE(omap_mcbsp3_st_controls)); | 714 | ARRAY_SIZE(omap_mcbsp3_st_controls)); |
713 | default: | 715 | default: |
716 | dev_err(mcbsp->dev, "Port %d not supported\n", port_id); | ||
714 | break; | 717 | break; |
715 | } | 718 | } |
716 | 719 | ||
@@ -799,11 +802,15 @@ static int asoc_mcbsp_probe(struct platform_device *pdev) | |||
799 | platform_set_drvdata(pdev, mcbsp); | 802 | platform_set_drvdata(pdev, mcbsp); |
800 | 803 | ||
801 | ret = omap_mcbsp_init(pdev); | 804 | ret = omap_mcbsp_init(pdev); |
802 | if (!ret) | 805 | if (ret) |
803 | return snd_soc_register_component(&pdev->dev, &omap_mcbsp_component, | 806 | return ret; |
804 | &omap_mcbsp_dai, 1); | 807 | |
808 | ret = snd_soc_register_component(&pdev->dev, &omap_mcbsp_component, | ||
809 | &omap_mcbsp_dai, 1); | ||
810 | if (ret) | ||
811 | return ret; | ||
805 | 812 | ||
806 | return ret; | 813 | return omap_pcm_platform_register(&pdev->dev); |
807 | } | 814 | } |
808 | 815 | ||
809 | static int asoc_mcbsp_remove(struct platform_device *pdev) | 816 | static int asoc_mcbsp_remove(struct platform_device *pdev) |
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h index ba8386a0d8dc..2e3369c27be3 100644 --- a/sound/soc/omap/omap-mcbsp.h +++ b/sound/soc/omap/omap-mcbsp.h | |||
@@ -39,6 +39,6 @@ enum omap_mcbsp_div { | |||
39 | OMAP_MCBSP_CLKGDV, /* Sample rate generator divider */ | 39 | OMAP_MCBSP_CLKGDV, /* Sample rate generator divider */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd); | 42 | int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd, int port_id); |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 2f5b1536477e..d8ebb52645a9 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <sound/dmaengine_pcm.h> | 42 | #include <sound/dmaengine_pcm.h> |
43 | 43 | ||
44 | #include "omap-mcpdm.h" | 44 | #include "omap-mcpdm.h" |
45 | #include "omap-pcm.h" | ||
45 | 46 | ||
46 | struct mcpdm_link_config { | 47 | struct mcpdm_link_config { |
47 | u32 link_mask; /* channel mask for the direction */ | 48 | u32 link_mask; /* channel mask for the direction */ |
@@ -265,9 +266,6 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, | |||
265 | } | 266 | } |
266 | mutex_unlock(&mcpdm->mutex); | 267 | mutex_unlock(&mcpdm->mutex); |
267 | 268 | ||
268 | snd_soc_dai_set_dma_data(dai, substream, | ||
269 | &mcpdm->dma_data[substream->stream]); | ||
270 | |||
271 | return 0; | 269 | return 0; |
272 | } | 270 | } |
273 | 271 | ||
@@ -406,6 +404,11 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai) | |||
406 | mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2; | 404 | mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2; |
407 | mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold = | 405 | mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold = |
408 | MCPDM_UP_THRES_MAX - 3; | 406 | MCPDM_UP_THRES_MAX - 3; |
407 | |||
408 | snd_soc_dai_init_dma_data(dai, | ||
409 | &mcpdm->dma_data[SNDRV_PCM_STREAM_PLAYBACK], | ||
410 | &mcpdm->dma_data[SNDRV_PCM_STREAM_CAPTURE]); | ||
411 | |||
409 | return ret; | 412 | return ret; |
410 | } | 413 | } |
411 | 414 | ||
@@ -460,6 +463,7 @@ static int asoc_mcpdm_probe(struct platform_device *pdev) | |||
460 | { | 463 | { |
461 | struct omap_mcpdm *mcpdm; | 464 | struct omap_mcpdm *mcpdm; |
462 | struct resource *res; | 465 | struct resource *res; |
466 | int ret; | ||
463 | 467 | ||
464 | mcpdm = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcpdm), GFP_KERNEL); | 468 | mcpdm = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcpdm), GFP_KERNEL); |
465 | if (!mcpdm) | 469 | if (!mcpdm) |
@@ -490,9 +494,13 @@ static int asoc_mcpdm_probe(struct platform_device *pdev) | |||
490 | 494 | ||
491 | mcpdm->dev = &pdev->dev; | 495 | mcpdm->dev = &pdev->dev; |
492 | 496 | ||
493 | return devm_snd_soc_register_component(&pdev->dev, | 497 | ret = devm_snd_soc_register_component(&pdev->dev, |
494 | &omap_mcpdm_component, | 498 | &omap_mcpdm_component, |
495 | &omap_mcpdm_dai, 1); | 499 | &omap_mcpdm_dai, 1); |
500 | if (ret) | ||
501 | return ret; | ||
502 | |||
503 | return omap_pcm_platform_register(&pdev->dev); | ||
496 | } | 504 | } |
497 | 505 | ||
498 | static const struct of_device_id omap_mcpdm_of_match[] = { | 506 | static const struct of_device_id omap_mcpdm_of_match[] = { |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 07b8b7bc9d20..8d809f8509c8 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -232,31 +232,12 @@ static struct snd_soc_platform_driver omap_soc_platform = { | |||
232 | .pcm_free = omap_pcm_free_dma_buffers, | 232 | .pcm_free = omap_pcm_free_dma_buffers, |
233 | }; | 233 | }; |
234 | 234 | ||
235 | static int omap_pcm_probe(struct platform_device *pdev) | 235 | int omap_pcm_platform_register(struct device *dev) |
236 | { | 236 | { |
237 | return snd_soc_register_platform(&pdev->dev, | 237 | return devm_snd_soc_register_platform(dev, &omap_soc_platform); |
238 | &omap_soc_platform); | ||
239 | } | 238 | } |
240 | 239 | EXPORT_SYMBOL_GPL(omap_pcm_platform_register); | |
241 | static int omap_pcm_remove(struct platform_device *pdev) | ||
242 | { | ||
243 | snd_soc_unregister_platform(&pdev->dev); | ||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | static struct platform_driver omap_pcm_driver = { | ||
248 | .driver = { | ||
249 | .name = "omap-pcm-audio", | ||
250 | .owner = THIS_MODULE, | ||
251 | }, | ||
252 | |||
253 | .probe = omap_pcm_probe, | ||
254 | .remove = omap_pcm_remove, | ||
255 | }; | ||
256 | |||
257 | module_platform_driver(omap_pcm_driver); | ||
258 | 240 | ||
259 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); | 241 | MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); |
260 | MODULE_DESCRIPTION("OMAP PCM DMA module"); | 242 | MODULE_DESCRIPTION("OMAP PCM DMA module"); |
261 | MODULE_LICENSE("GPL"); | 243 | MODULE_LICENSE("GPL"); |
262 | MODULE_ALIAS("platform:omap-pcm-audio"); | ||
diff --git a/sound/soc/omap/omap-pcm.h b/sound/soc/omap/omap-pcm.h new file mode 100644 index 000000000000..c1d2f31d71e9 --- /dev/null +++ b/sound/soc/omap/omap-pcm.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * omap-pcm.h - OMAP PCM driver | ||
3 | * | ||
4 | * Copyright (C) 2014 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __OMAP_PCM_H__ | ||
19 | #define __OMAP_PCM_H__ | ||
20 | |||
21 | #if IS_ENABLED(CONFIG_SND_OMAP_SOC) | ||
22 | int omap_pcm_platform_register(struct device *dev); | ||
23 | #else | ||
24 | static inline int omap_pcm_platform_register(struct device *dev) | ||
25 | { | ||
26 | return 0; | ||
27 | } | ||
28 | #endif /* CONFIG_SND_OMAP_SOC */ | ||
29 | |||
30 | #endif /* __OMAP_PCM_H__ */ | ||
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c index 6a8d6b5f160d..64141db311b2 100644 --- a/sound/soc/omap/omap-twl4030.c +++ b/sound/soc/omap/omap-twl4030.c | |||
@@ -55,8 +55,7 @@ static int omap_twl4030_hw_params(struct snd_pcm_substream *substream, | |||
55 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 55 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
56 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 56 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
57 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 57 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
58 | struct snd_soc_codec *codec = rtd->codec; | 58 | struct snd_soc_card *card = rtd->card; |
59 | struct snd_soc_card *card = codec->card; | ||
60 | unsigned int fmt; | 59 | unsigned int fmt; |
61 | int ret; | 60 | int ret; |
62 | 61 | ||
@@ -179,7 +178,7 @@ static inline void twl4030_disconnect_pin(struct snd_soc_dapm_context *dapm, | |||
179 | static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) | 178 | static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) |
180 | { | 179 | { |
181 | struct snd_soc_codec *codec = rtd->codec; | 180 | struct snd_soc_codec *codec = rtd->codec; |
182 | struct snd_soc_card *card = codec->card; | 181 | struct snd_soc_card *card = rtd->card; |
183 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 182 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
184 | struct omap_tw4030_pdata *pdata = dev_get_platdata(card->dev); | 183 | struct omap_tw4030_pdata *pdata = dev_get_platdata(card->dev); |
185 | struct omap_twl4030 *priv = snd_soc_card_get_drvdata(card); | 184 | struct omap_twl4030 *priv = snd_soc_card_get_drvdata(card); |
@@ -239,7 +238,7 @@ static struct snd_soc_dai_link omap_twl4030_dai_links[] = { | |||
239 | .stream_name = "TWL4030 HiFi", | 238 | .stream_name = "TWL4030 HiFi", |
240 | .cpu_dai_name = "omap-mcbsp.2", | 239 | .cpu_dai_name = "omap-mcbsp.2", |
241 | .codec_dai_name = "twl4030-hifi", | 240 | .codec_dai_name = "twl4030-hifi", |
242 | .platform_name = "omap-pcm-audio", | 241 | .platform_name = "omap-mcbsp.2", |
243 | .codec_name = "twl4030-codec", | 242 | .codec_name = "twl4030-codec", |
244 | .init = omap_twl4030_init, | 243 | .init = omap_twl4030_init, |
245 | .ops = &omap_twl4030_ops, | 244 | .ops = &omap_twl4030_ops, |
@@ -249,7 +248,7 @@ static struct snd_soc_dai_link omap_twl4030_dai_links[] = { | |||
249 | .stream_name = "TWL4030 Voice", | 248 | .stream_name = "TWL4030 Voice", |
250 | .cpu_dai_name = "omap-mcbsp.3", | 249 | .cpu_dai_name = "omap-mcbsp.3", |
251 | .codec_dai_name = "twl4030-voice", | 250 | .codec_dai_name = "twl4030-voice", |
252 | .platform_name = "omap-pcm-audio", | 251 | .platform_name = "omap-mcbsp.2", |
253 | .codec_name = "twl4030-codec", | 252 | .codec_name = "twl4030-codec", |
254 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | | 253 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | |
255 | SND_SOC_DAIFMT_CBM_CFM, | 254 | SND_SOC_DAIFMT_CBM_CFM, |
@@ -299,12 +298,18 @@ static int omap_twl4030_probe(struct platform_device *pdev) | |||
299 | omap_twl4030_dai_links[0].cpu_dai_name = NULL; | 298 | omap_twl4030_dai_links[0].cpu_dai_name = NULL; |
300 | omap_twl4030_dai_links[0].cpu_of_node = dai_node; | 299 | omap_twl4030_dai_links[0].cpu_of_node = dai_node; |
301 | 300 | ||
301 | omap_twl4030_dai_links[0].platform_name = NULL; | ||
302 | omap_twl4030_dai_links[0].platform_of_node = dai_node; | ||
303 | |||
302 | dai_node = of_parse_phandle(node, "ti,mcbsp-voice", 0); | 304 | dai_node = of_parse_phandle(node, "ti,mcbsp-voice", 0); |
303 | if (!dai_node) { | 305 | if (!dai_node) { |
304 | card->num_links = 1; | 306 | card->num_links = 1; |
305 | } else { | 307 | } else { |
306 | omap_twl4030_dai_links[1].cpu_dai_name = NULL; | 308 | omap_twl4030_dai_links[1].cpu_dai_name = NULL; |
307 | omap_twl4030_dai_links[1].cpu_of_node = dai_node; | 309 | omap_twl4030_dai_links[1].cpu_of_node = dai_node; |
310 | |||
311 | omap_twl4030_dai_links[1].platform_name = NULL; | ||
312 | omap_twl4030_dai_links[1].platform_of_node = dai_node; | ||
308 | } | 313 | } |
309 | 314 | ||
310 | priv->jack_detect = of_get_named_gpio(node, | 315 | priv->jack_detect = of_get_named_gpio(node, |
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index cf604a2faa18..076bec606d78 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c | |||
@@ -121,7 +121,7 @@ static int omap3pandora_hp_event(struct snd_soc_dapm_widget *w, | |||
121 | * |A| <~~clk~~+ | 121 | * |A| <~~clk~~+ |
122 | * |P| <--- TWL4030 <--------- Line In and MICs | 122 | * |P| <--- TWL4030 <--------- Line In and MICs |
123 | */ | 123 | */ |
124 | static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = { | 124 | static const struct snd_soc_dapm_widget omap3pandora_dapm_widgets[] = { |
125 | SND_SOC_DAPM_DAC_E("PCM DAC", "HiFi Playback", SND_SOC_NOPM, | 125 | SND_SOC_DAPM_DAC_E("PCM DAC", "HiFi Playback", SND_SOC_NOPM, |
126 | 0, 0, omap3pandora_dac_event, | 126 | 0, 0, omap3pandora_dac_event, |
127 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 127 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
@@ -130,22 +130,18 @@ static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = { | |||
130 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 130 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
131 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | 131 | SND_SOC_DAPM_HP("Headphone Jack", NULL), |
132 | SND_SOC_DAPM_LINE("Line Out", NULL), | 132 | SND_SOC_DAPM_LINE("Line Out", NULL), |
133 | }; | ||
134 | 133 | ||
135 | static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = { | ||
136 | SND_SOC_DAPM_MIC("Mic (internal)", NULL), | 134 | SND_SOC_DAPM_MIC("Mic (internal)", NULL), |
137 | SND_SOC_DAPM_MIC("Mic (external)", NULL), | 135 | SND_SOC_DAPM_MIC("Mic (external)", NULL), |
138 | SND_SOC_DAPM_LINE("Line In", NULL), | 136 | SND_SOC_DAPM_LINE("Line In", NULL), |
139 | }; | 137 | }; |
140 | 138 | ||
141 | static const struct snd_soc_dapm_route omap3pandora_out_map[] = { | 139 | static const struct snd_soc_dapm_route omap3pandora_map[] = { |
142 | {"PCM DAC", NULL, "APLL Enable"}, | 140 | {"PCM DAC", NULL, "APLL Enable"}, |
143 | {"Headphone Amplifier", NULL, "PCM DAC"}, | 141 | {"Headphone Amplifier", NULL, "PCM DAC"}, |
144 | {"Line Out", NULL, "PCM DAC"}, | 142 | {"Line Out", NULL, "PCM DAC"}, |
145 | {"Headphone Jack", NULL, "Headphone Amplifier"}, | 143 | {"Headphone Jack", NULL, "Headphone Amplifier"}, |
146 | }; | ||
147 | 144 | ||
148 | static const struct snd_soc_dapm_route omap3pandora_in_map[] = { | ||
149 | {"AUXL", NULL, "Line In"}, | 145 | {"AUXL", NULL, "Line In"}, |
150 | {"AUXR", NULL, "Line In"}, | 146 | {"AUXR", NULL, "Line In"}, |
151 | 147 | ||
@@ -160,7 +156,6 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) | |||
160 | { | 156 | { |
161 | struct snd_soc_codec *codec = rtd->codec; | 157 | struct snd_soc_codec *codec = rtd->codec; |
162 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 158 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
163 | int ret; | ||
164 | 159 | ||
165 | /* All TWL4030 output pins are floating */ | 160 | /* All TWL4030 output pins are floating */ |
166 | snd_soc_dapm_nc_pin(dapm, "EARPIECE"); | 161 | snd_soc_dapm_nc_pin(dapm, "EARPIECE"); |
@@ -174,20 +169,13 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) | |||
174 | snd_soc_dapm_nc_pin(dapm, "HFR"); | 169 | snd_soc_dapm_nc_pin(dapm, "HFR"); |
175 | snd_soc_dapm_nc_pin(dapm, "VIBRA"); | 170 | snd_soc_dapm_nc_pin(dapm, "VIBRA"); |
176 | 171 | ||
177 | ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets, | 172 | return 0; |
178 | ARRAY_SIZE(omap3pandora_out_dapm_widgets)); | ||
179 | if (ret < 0) | ||
180 | return ret; | ||
181 | |||
182 | return snd_soc_dapm_add_routes(dapm, omap3pandora_out_map, | ||
183 | ARRAY_SIZE(omap3pandora_out_map)); | ||
184 | } | 173 | } |
185 | 174 | ||
186 | static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) | 175 | static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) |
187 | { | 176 | { |
188 | struct snd_soc_codec *codec = rtd->codec; | 177 | struct snd_soc_codec *codec = rtd->codec; |
189 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 178 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
190 | int ret; | ||
191 | 179 | ||
192 | /* Not comnnected */ | 180 | /* Not comnnected */ |
193 | snd_soc_dapm_nc_pin(dapm, "HSMIC"); | 181 | snd_soc_dapm_nc_pin(dapm, "HSMIC"); |
@@ -195,13 +183,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) | |||
195 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); | 183 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); |
196 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); | 184 | snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); |
197 | 185 | ||
198 | ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets, | 186 | return 0; |
199 | ARRAY_SIZE(omap3pandora_in_dapm_widgets)); | ||
200 | if (ret < 0) | ||
201 | return ret; | ||
202 | |||
203 | return snd_soc_dapm_add_routes(dapm, omap3pandora_in_map, | ||
204 | ARRAY_SIZE(omap3pandora_in_map)); | ||
205 | } | 187 | } |
206 | 188 | ||
207 | static struct snd_soc_ops omap3pandora_ops = { | 189 | static struct snd_soc_ops omap3pandora_ops = { |
@@ -215,7 +197,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { | |||
215 | .stream_name = "HiFi Out", | 197 | .stream_name = "HiFi Out", |
216 | .cpu_dai_name = "omap-mcbsp.2", | 198 | .cpu_dai_name = "omap-mcbsp.2", |
217 | .codec_dai_name = "twl4030-hifi", | 199 | .codec_dai_name = "twl4030-hifi", |
218 | .platform_name = "omap-pcm-audio", | 200 | .platform_name = "omap-mcbsp.2", |
219 | .codec_name = "twl4030-codec", | 201 | .codec_name = "twl4030-codec", |
220 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 202 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
221 | SND_SOC_DAIFMT_CBS_CFS, | 203 | SND_SOC_DAIFMT_CBS_CFS, |
@@ -226,7 +208,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { | |||
226 | .stream_name = "Line/Mic In", | 208 | .stream_name = "Line/Mic In", |
227 | .cpu_dai_name = "omap-mcbsp.4", | 209 | .cpu_dai_name = "omap-mcbsp.4", |
228 | .codec_dai_name = "twl4030-hifi", | 210 | .codec_dai_name = "twl4030-hifi", |
229 | .platform_name = "omap-pcm-audio", | 211 | .platform_name = "omap-mcbsp.4", |
230 | .codec_name = "twl4030-codec", | 212 | .codec_name = "twl4030-codec", |
231 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 213 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
232 | SND_SOC_DAIFMT_CBS_CFS, | 214 | SND_SOC_DAIFMT_CBS_CFS, |
@@ -241,6 +223,11 @@ static struct snd_soc_card snd_soc_card_omap3pandora = { | |||
241 | .owner = THIS_MODULE, | 223 | .owner = THIS_MODULE, |
242 | .dai_link = omap3pandora_dai, | 224 | .dai_link = omap3pandora_dai, |
243 | .num_links = ARRAY_SIZE(omap3pandora_dai), | 225 | .num_links = ARRAY_SIZE(omap3pandora_dai), |
226 | |||
227 | .dapm_widgets = omap3pandora_dapm_widgets, | ||
228 | .num_dapm_widgets = ARRAY_SIZE(omap3pandora_dapm_widgets), | ||
229 | .dapm_routes = omap3pandora_map, | ||
230 | .num_dapm_routes = ARRAY_SIZE(omap3pandora_map), | ||
244 | }; | 231 | }; |
245 | 232 | ||
246 | static struct platform_device *omap3pandora_snd_device; | 233 | static struct platform_device *omap3pandora_snd_device; |
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c index d03e57da7708..aa4053bf6710 100644 --- a/sound/soc/omap/osk5912.c +++ b/sound/soc/omap/osk5912.c | |||
@@ -96,7 +96,7 @@ static struct snd_soc_dai_link osk_dai = { | |||
96 | .stream_name = "AIC23", | 96 | .stream_name = "AIC23", |
97 | .cpu_dai_name = "omap-mcbsp.1", | 97 | .cpu_dai_name = "omap-mcbsp.1", |
98 | .codec_dai_name = "tlv320aic23-hifi", | 98 | .codec_dai_name = "tlv320aic23-hifi", |
99 | .platform_name = "omap-pcm-audio", | 99 | .platform_name = "omap-mcbsp.1", |
100 | .codec_name = "tlv320aic23-codec", | 100 | .codec_name = "tlv320aic23-codec", |
101 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | | 101 | .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | |
102 | SND_SOC_DAIFMT_CBM_CFM, | 102 | SND_SOC_DAIFMT_CBM_CFM, |
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 7fb3d4b10370..6951dc812055 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/gpio/consumer.h> | ||
29 | #include <linux/module.h> | 30 | #include <linux/module.h> |
30 | #include <sound/core.h> | 31 | #include <sound/core.h> |
31 | #include <sound/jack.h> | 32 | #include <sound/jack.h> |
@@ -38,15 +39,6 @@ | |||
38 | 39 | ||
39 | #include "omap-mcbsp.h" | 40 | #include "omap-mcbsp.h" |
40 | 41 | ||
41 | #define RX51_TVOUT_SEL_GPIO 40 | ||
42 | #define RX51_JACK_DETECT_GPIO 177 | ||
43 | #define RX51_ECI_SW_GPIO 182 | ||
44 | /* | ||
45 | * REVISIT: TWL4030 GPIO base in RX-51. Now statically defined to 192. This | ||
46 | * gpio is reserved in arch/arm/mach-omap2/board-rx51-peripherals.c | ||
47 | */ | ||
48 | #define RX51_SPEAKER_AMP_TWL_GPIO (192 + 7) | ||
49 | |||
50 | enum { | 42 | enum { |
51 | RX51_JACK_DISABLED, | 43 | RX51_JACK_DISABLED, |
52 | RX51_JACK_TVOUT, /* tv-out with stereo output */ | 44 | RX51_JACK_TVOUT, /* tv-out with stereo output */ |
@@ -54,12 +46,21 @@ enum { | |||
54 | RX51_JACK_HS, /* headset: stereo output with mic */ | 46 | RX51_JACK_HS, /* headset: stereo output with mic */ |
55 | }; | 47 | }; |
56 | 48 | ||
49 | struct rx51_audio_pdata { | ||
50 | struct gpio_desc *tvout_selection_gpio; | ||
51 | struct gpio_desc *jack_detection_gpio; | ||
52 | struct gpio_desc *eci_sw_gpio; | ||
53 | struct gpio_desc *speaker_amp_gpio; | ||
54 | }; | ||
55 | |||
57 | static int rx51_spk_func; | 56 | static int rx51_spk_func; |
58 | static int rx51_dmic_func; | 57 | static int rx51_dmic_func; |
59 | static int rx51_jack_func; | 58 | static int rx51_jack_func; |
60 | 59 | ||
61 | static void rx51_ext_control(struct snd_soc_dapm_context *dapm) | 60 | static void rx51_ext_control(struct snd_soc_dapm_context *dapm) |
62 | { | 61 | { |
62 | struct snd_soc_card *card = dapm->card; | ||
63 | struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card); | ||
63 | int hp = 0, hs = 0, tvout = 0; | 64 | int hp = 0, hs = 0, tvout = 0; |
64 | 65 | ||
65 | switch (rx51_jack_func) { | 66 | switch (rx51_jack_func) { |
@@ -93,7 +94,7 @@ static void rx51_ext_control(struct snd_soc_dapm_context *dapm) | |||
93 | else | 94 | else |
94 | snd_soc_dapm_disable_pin_unlocked(dapm, "HS Mic"); | 95 | snd_soc_dapm_disable_pin_unlocked(dapm, "HS Mic"); |
95 | 96 | ||
96 | gpio_set_value(RX51_TVOUT_SEL_GPIO, tvout); | 97 | gpiod_set_value(pdata->tvout_selection_gpio, tvout); |
97 | 98 | ||
98 | snd_soc_dapm_sync_unlocked(dapm); | 99 | snd_soc_dapm_sync_unlocked(dapm); |
99 | 100 | ||
@@ -154,10 +155,12 @@ static int rx51_set_spk(struct snd_kcontrol *kcontrol, | |||
154 | static int rx51_spk_event(struct snd_soc_dapm_widget *w, | 155 | static int rx51_spk_event(struct snd_soc_dapm_widget *w, |
155 | struct snd_kcontrol *k, int event) | 156 | struct snd_kcontrol *k, int event) |
156 | { | 157 | { |
157 | if (SND_SOC_DAPM_EVENT_ON(event)) | 158 | struct snd_soc_dapm_context *dapm = w->dapm; |
158 | gpio_set_value_cansleep(RX51_SPEAKER_AMP_TWL_GPIO, 1); | 159 | struct snd_soc_card *card = dapm->card; |
159 | else | 160 | struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card); |
160 | gpio_set_value_cansleep(RX51_SPEAKER_AMP_TWL_GPIO, 0); | 161 | |
162 | gpiod_set_raw_value_cansleep(pdata->speaker_amp_gpio, | ||
163 | !!SND_SOC_DAPM_EVENT_ON(event)); | ||
161 | 164 | ||
162 | return 0; | 165 | return 0; |
163 | } | 166 | } |
@@ -223,7 +226,6 @@ static struct snd_soc_jack rx51_av_jack; | |||
223 | 226 | ||
224 | static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { | 227 | static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = { |
225 | { | 228 | { |
226 | .gpio = RX51_JACK_DETECT_GPIO, | ||
227 | .name = "avdet-gpio", | 229 | .name = "avdet-gpio", |
228 | .report = SND_JACK_HEADSET, | 230 | .report = SND_JACK_HEADSET, |
229 | .invert = 1, | 231 | .invert = 1, |
@@ -237,9 +239,6 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { | |||
237 | SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event), | 239 | SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event), |
238 | SND_SOC_DAPM_MIC("HS Mic", NULL), | 240 | SND_SOC_DAPM_MIC("HS Mic", NULL), |
239 | SND_SOC_DAPM_LINE("FM Transmitter", NULL), | 241 | SND_SOC_DAPM_LINE("FM Transmitter", NULL), |
240 | }; | ||
241 | |||
242 | static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = { | ||
243 | SND_SOC_DAPM_SPK("Earphone", NULL), | 242 | SND_SOC_DAPM_SPK("Earphone", NULL), |
244 | }; | 243 | }; |
245 | 244 | ||
@@ -253,9 +252,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
253 | 252 | ||
254 | {"DMic Rate 64", NULL, "Mic Bias"}, | 253 | {"DMic Rate 64", NULL, "Mic Bias"}, |
255 | {"Mic Bias", NULL, "DMic"}, | 254 | {"Mic Bias", NULL, "DMic"}, |
256 | }; | ||
257 | 255 | ||
258 | static const struct snd_soc_dapm_route audio_mapb[] = { | ||
259 | {"b LINE2R", NULL, "MONO_LOUT"}, | 256 | {"b LINE2R", NULL, "MONO_LOUT"}, |
260 | {"Earphone", NULL, "b HPLOUT"}, | 257 | {"Earphone", NULL, "b HPLOUT"}, |
261 | 258 | ||
@@ -263,9 +260,11 @@ static const struct snd_soc_dapm_route audio_mapb[] = { | |||
263 | {"b Mic Bias", NULL, "HS Mic"} | 260 | {"b Mic Bias", NULL, "HS Mic"} |
264 | }; | 261 | }; |
265 | 262 | ||
266 | static const char *spk_function[] = {"Off", "On"}; | 263 | static const char * const spk_function[] = {"Off", "On"}; |
267 | static const char *input_function[] = {"ADC", "Digital Mic"}; | 264 | static const char * const input_function[] = {"ADC", "Digital Mic"}; |
268 | static const char *jack_function[] = {"Off", "TV-OUT", "Headphone", "Headset"}; | 265 | static const char * const jack_function[] = { |
266 | "Off", "TV-OUT", "Headphone", "Headset" | ||
267 | }; | ||
269 | 268 | ||
270 | static const struct soc_enum rx51_enum[] = { | 269 | static const struct soc_enum rx51_enum[] = { |
271 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), | 270 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), |
@@ -281,15 +280,15 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { | |||
281 | SOC_ENUM_EXT("Jack Function", rx51_enum[2], | 280 | SOC_ENUM_EXT("Jack Function", rx51_enum[2], |
282 | rx51_get_jack, rx51_set_jack), | 281 | rx51_get_jack, rx51_set_jack), |
283 | SOC_DAPM_PIN_SWITCH("FM Transmitter"), | 282 | SOC_DAPM_PIN_SWITCH("FM Transmitter"), |
284 | }; | ||
285 | |||
286 | static const struct snd_kcontrol_new aic34_rx51_controlsb[] = { | ||
287 | SOC_DAPM_PIN_SWITCH("Earphone"), | 283 | SOC_DAPM_PIN_SWITCH("Earphone"), |
288 | }; | 284 | }; |
289 | 285 | ||
290 | static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | 286 | static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) |
291 | { | 287 | { |
292 | struct snd_soc_codec *codec = rtd->codec; | 288 | struct snd_soc_codec *codec = rtd->codec; |
289 | struct snd_soc_card *card = rtd->card; | ||
290 | struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card); | ||
291 | |||
293 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 292 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
294 | int err; | 293 | int err; |
295 | 294 | ||
@@ -298,57 +297,41 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | |||
298 | snd_soc_dapm_nc_pin(dapm, "MIC3R"); | 297 | snd_soc_dapm_nc_pin(dapm, "MIC3R"); |
299 | snd_soc_dapm_nc_pin(dapm, "LINE1R"); | 298 | snd_soc_dapm_nc_pin(dapm, "LINE1R"); |
300 | 299 | ||
301 | /* Add RX-51 specific controls */ | ||
302 | err = snd_soc_add_card_controls(rtd->card, aic34_rx51_controls, | ||
303 | ARRAY_SIZE(aic34_rx51_controls)); | ||
304 | if (err < 0) | ||
305 | return err; | ||
306 | |||
307 | /* Add RX-51 specific widgets */ | ||
308 | snd_soc_dapm_new_controls(dapm, aic34_dapm_widgets, | ||
309 | ARRAY_SIZE(aic34_dapm_widgets)); | ||
310 | |||
311 | /* Set up RX-51 specific audio path audio_map */ | ||
312 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
313 | |||
314 | err = tpa6130a2_add_controls(codec); | 300 | err = tpa6130a2_add_controls(codec); |
315 | if (err < 0) | 301 | if (err < 0) { |
302 | dev_err(card->dev, "Failed to add TPA6130A2 controls\n"); | ||
316 | return err; | 303 | return err; |
304 | } | ||
317 | snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); | 305 | snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42); |
318 | 306 | ||
319 | err = omap_mcbsp_st_add_controls(rtd); | 307 | err = omap_mcbsp_st_add_controls(rtd, 2); |
320 | if (err < 0) | 308 | if (err < 0) { |
309 | dev_err(card->dev, "Failed to add MCBSP controls\n"); | ||
321 | return err; | 310 | return err; |
311 | } | ||
322 | 312 | ||
323 | /* AV jack detection */ | 313 | /* AV jack detection */ |
324 | err = snd_soc_jack_new(codec, "AV Jack", | 314 | err = snd_soc_jack_new(codec, "AV Jack", |
325 | SND_JACK_HEADSET | SND_JACK_VIDEOOUT, | 315 | SND_JACK_HEADSET | SND_JACK_VIDEOOUT, |
326 | &rx51_av_jack); | 316 | &rx51_av_jack); |
327 | if (err) | 317 | if (err) { |
318 | dev_err(card->dev, "Failed to add AV Jack\n"); | ||
328 | return err; | 319 | return err; |
320 | } | ||
321 | |||
322 | /* prepare gpio for snd_soc_jack_add_gpios */ | ||
323 | rx51_av_jack_gpios[0].gpio = desc_to_gpio(pdata->jack_detection_gpio); | ||
324 | devm_gpiod_put(card->dev, pdata->jack_detection_gpio); | ||
325 | |||
329 | err = snd_soc_jack_add_gpios(&rx51_av_jack, | 326 | err = snd_soc_jack_add_gpios(&rx51_av_jack, |
330 | ARRAY_SIZE(rx51_av_jack_gpios), | 327 | ARRAY_SIZE(rx51_av_jack_gpios), |
331 | rx51_av_jack_gpios); | 328 | rx51_av_jack_gpios); |
332 | 329 | if (err) { | |
333 | return err; | 330 | dev_err(card->dev, "Failed to add GPIOs\n"); |
334 | } | ||
335 | |||
336 | static int rx51_aic34b_init(struct snd_soc_dapm_context *dapm) | ||
337 | { | ||
338 | int err; | ||
339 | |||
340 | err = snd_soc_add_card_controls(dapm->card, aic34_rx51_controlsb, | ||
341 | ARRAY_SIZE(aic34_rx51_controlsb)); | ||
342 | if (err < 0) | ||
343 | return err; | 331 | return err; |
332 | } | ||
344 | 333 | ||
345 | err = snd_soc_dapm_new_controls(dapm, aic34_dapm_widgetsb, | 334 | return err; |
346 | ARRAY_SIZE(aic34_dapm_widgetsb)); | ||
347 | if (err < 0) | ||
348 | return 0; | ||
349 | |||
350 | return snd_soc_dapm_add_routes(dapm, audio_mapb, | ||
351 | ARRAY_SIZE(audio_mapb)); | ||
352 | } | 335 | } |
353 | 336 | ||
354 | /* Digital audio interface glue - connects codec <--> CPU */ | 337 | /* Digital audio interface glue - connects codec <--> CPU */ |
@@ -358,7 +341,7 @@ static struct snd_soc_dai_link rx51_dai[] = { | |||
358 | .stream_name = "AIC34", | 341 | .stream_name = "AIC34", |
359 | .cpu_dai_name = "omap-mcbsp.2", | 342 | .cpu_dai_name = "omap-mcbsp.2", |
360 | .codec_dai_name = "tlv320aic3x-hifi", | 343 | .codec_dai_name = "tlv320aic3x-hifi", |
361 | .platform_name = "omap-pcm-audio", | 344 | .platform_name = "omap-mcbsp.2", |
362 | .codec_name = "tlv320aic3x-codec.2-0018", | 345 | .codec_name = "tlv320aic3x-codec.2-0018", |
363 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | | 346 | .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | |
364 | SND_SOC_DAIFMT_CBM_CFM, | 347 | SND_SOC_DAIFMT_CBM_CFM, |
@@ -371,7 +354,6 @@ static struct snd_soc_aux_dev rx51_aux_dev[] = { | |||
371 | { | 354 | { |
372 | .name = "TLV320AIC34b", | 355 | .name = "TLV320AIC34b", |
373 | .codec_name = "tlv320aic3x-codec.2-0019", | 356 | .codec_name = "tlv320aic3x-codec.2-0019", |
374 | .init = rx51_aic34b_init, | ||
375 | }, | 357 | }, |
376 | }; | 358 | }; |
377 | 359 | ||
@@ -392,63 +374,160 @@ static struct snd_soc_card rx51_sound_card = { | |||
392 | .num_aux_devs = ARRAY_SIZE(rx51_aux_dev), | 374 | .num_aux_devs = ARRAY_SIZE(rx51_aux_dev), |
393 | .codec_conf = rx51_codec_conf, | 375 | .codec_conf = rx51_codec_conf, |
394 | .num_configs = ARRAY_SIZE(rx51_codec_conf), | 376 | .num_configs = ARRAY_SIZE(rx51_codec_conf), |
395 | }; | ||
396 | 377 | ||
397 | static struct platform_device *rx51_snd_device; | 378 | .controls = aic34_rx51_controls, |
379 | .num_controls = ARRAY_SIZE(aic34_rx51_controls), | ||
380 | .dapm_widgets = aic34_dapm_widgets, | ||
381 | .num_dapm_widgets = ARRAY_SIZE(aic34_dapm_widgets), | ||
382 | .dapm_routes = audio_map, | ||
383 | .num_dapm_routes = ARRAY_SIZE(audio_map), | ||
384 | }; | ||
398 | 385 | ||
399 | static int __init rx51_soc_init(void) | 386 | static int rx51_soc_probe(struct platform_device *pdev) |
400 | { | 387 | { |
388 | struct rx51_audio_pdata *pdata; | ||
389 | struct device_node *np = pdev->dev.of_node; | ||
390 | struct snd_soc_card *card = &rx51_sound_card; | ||
401 | int err; | 391 | int err; |
402 | 392 | ||
403 | if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900")) | 393 | if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900")) |
404 | return -ENODEV; | 394 | return -ENODEV; |
405 | 395 | ||
406 | err = gpio_request_one(RX51_TVOUT_SEL_GPIO, | 396 | card->dev = &pdev->dev; |
407 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "tvout_sel"); | 397 | |
408 | if (err) | 398 | if (np) { |
409 | goto err_gpio_tvout_sel; | 399 | struct device_node *dai_node; |
410 | err = gpio_request_one(RX51_ECI_SW_GPIO, | 400 | |
411 | GPIOF_DIR_OUT | GPIOF_INIT_HIGH, "eci_sw"); | 401 | dai_node = of_parse_phandle(np, "nokia,cpu-dai", 0); |
412 | if (err) | 402 | if (!dai_node) { |
413 | goto err_gpio_eci_sw; | 403 | dev_err(&pdev->dev, "McBSP node is not provided\n"); |
414 | 404 | return -EINVAL; | |
415 | rx51_snd_device = platform_device_alloc("soc-audio", -1); | 405 | } |
416 | if (!rx51_snd_device) { | 406 | rx51_dai[0].cpu_dai_name = NULL; |
417 | err = -ENOMEM; | 407 | rx51_dai[0].platform_name = NULL; |
418 | goto err1; | 408 | rx51_dai[0].cpu_of_node = dai_node; |
409 | rx51_dai[0].platform_of_node = dai_node; | ||
410 | |||
411 | dai_node = of_parse_phandle(np, "nokia,audio-codec", 0); | ||
412 | if (!dai_node) { | ||
413 | dev_err(&pdev->dev, "Codec node is not provided\n"); | ||
414 | return -EINVAL; | ||
415 | } | ||
416 | rx51_dai[0].codec_name = NULL; | ||
417 | rx51_dai[0].codec_of_node = dai_node; | ||
418 | |||
419 | dai_node = of_parse_phandle(np, "nokia,audio-codec", 1); | ||
420 | if (!dai_node) { | ||
421 | dev_err(&pdev->dev, "Auxiliary Codec node is not provided\n"); | ||
422 | return -EINVAL; | ||
423 | } | ||
424 | rx51_aux_dev[0].codec_name = NULL; | ||
425 | rx51_aux_dev[0].codec_of_node = dai_node; | ||
426 | rx51_codec_conf[0].dev_name = NULL; | ||
427 | rx51_codec_conf[0].of_node = dai_node; | ||
428 | |||
429 | dai_node = of_parse_phandle(np, "nokia,headphone-amplifier", 0); | ||
430 | if (!dai_node) { | ||
431 | dev_err(&pdev->dev, "Headphone amplifier node is not provided\n"); | ||
432 | return -EINVAL; | ||
433 | } | ||
434 | |||
435 | /* TODO: tpa6130a2a driver supports only a single instance, so | ||
436 | * this driver ignores the headphone-amplifier node for now. | ||
437 | * It's already mandatory in the DT binding to be future proof. | ||
438 | */ | ||
419 | } | 439 | } |
420 | 440 | ||
421 | platform_set_drvdata(rx51_snd_device, &rx51_sound_card); | 441 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
442 | if (pdata == NULL) { | ||
443 | dev_err(card->dev, "failed to create private data\n"); | ||
444 | return -ENOMEM; | ||
445 | } | ||
446 | snd_soc_card_set_drvdata(card, pdata); | ||
422 | 447 | ||
423 | err = platform_device_add(rx51_snd_device); | 448 | pdata->tvout_selection_gpio = devm_gpiod_get(card->dev, |
424 | if (err) | 449 | "tvout-selection"); |
425 | goto err2; | 450 | if (IS_ERR(pdata->tvout_selection_gpio)) { |
451 | dev_err(card->dev, "could not get tvout selection gpio\n"); | ||
452 | return PTR_ERR(pdata->tvout_selection_gpio); | ||
453 | } | ||
426 | 454 | ||
427 | return 0; | 455 | err = gpiod_direction_output(pdata->tvout_selection_gpio, 0); |
428 | err2: | 456 | if (err) { |
429 | platform_device_put(rx51_snd_device); | 457 | dev_err(card->dev, "could not setup tvout selection gpio\n"); |
430 | err1: | 458 | return err; |
431 | gpio_free(RX51_ECI_SW_GPIO); | 459 | } |
432 | err_gpio_eci_sw: | ||
433 | gpio_free(RX51_TVOUT_SEL_GPIO); | ||
434 | err_gpio_tvout_sel: | ||
435 | 460 | ||
436 | return err; | 461 | pdata->jack_detection_gpio = devm_gpiod_get(card->dev, |
462 | "jack-detection"); | ||
463 | if (IS_ERR(pdata->jack_detection_gpio)) { | ||
464 | dev_err(card->dev, "could not get jack detection gpio\n"); | ||
465 | return PTR_ERR(pdata->jack_detection_gpio); | ||
466 | } | ||
467 | |||
468 | pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch"); | ||
469 | if (IS_ERR(pdata->eci_sw_gpio)) { | ||
470 | dev_err(card->dev, "could not get eci switch gpio\n"); | ||
471 | return PTR_ERR(pdata->eci_sw_gpio); | ||
472 | } | ||
473 | |||
474 | err = gpiod_direction_output(pdata->eci_sw_gpio, 1); | ||
475 | if (err) { | ||
476 | dev_err(card->dev, "could not setup eci switch gpio\n"); | ||
477 | return err; | ||
478 | } | ||
479 | |||
480 | pdata->speaker_amp_gpio = devm_gpiod_get(card->dev, | ||
481 | "speaker-amplifier"); | ||
482 | if (IS_ERR(pdata->speaker_amp_gpio)) { | ||
483 | dev_err(card->dev, "could not get speaker enable gpio\n"); | ||
484 | return PTR_ERR(pdata->speaker_amp_gpio); | ||
485 | } | ||
486 | |||
487 | err = gpiod_direction_output(pdata->speaker_amp_gpio, 0); | ||
488 | if (err) { | ||
489 | dev_err(card->dev, "could not setup speaker enable gpio\n"); | ||
490 | return err; | ||
491 | } | ||
492 | |||
493 | err = devm_snd_soc_register_card(card->dev, card); | ||
494 | if (err) { | ||
495 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); | ||
496 | return err; | ||
497 | } | ||
498 | |||
499 | return 0; | ||
437 | } | 500 | } |
438 | 501 | ||
439 | static void __exit rx51_soc_exit(void) | 502 | static int rx51_soc_remove(struct platform_device *pdev) |
440 | { | 503 | { |
441 | snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), | 504 | snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), |
442 | rx51_av_jack_gpios); | 505 | rx51_av_jack_gpios); |
443 | 506 | ||
444 | platform_device_unregister(rx51_snd_device); | 507 | return 0; |
445 | gpio_free(RX51_ECI_SW_GPIO); | ||
446 | gpio_free(RX51_TVOUT_SEL_GPIO); | ||
447 | } | 508 | } |
448 | 509 | ||
449 | module_init(rx51_soc_init); | 510 | #if defined(CONFIG_OF) |
450 | module_exit(rx51_soc_exit); | 511 | static const struct of_device_id rx51_audio_of_match[] = { |
512 | { .compatible = "nokia,n900-audio", }, | ||
513 | {}, | ||
514 | }; | ||
515 | MODULE_DEVICE_TABLE(of, rx51_audio_of_match); | ||
516 | #endif | ||
517 | |||
518 | static struct platform_driver rx51_soc_driver = { | ||
519 | .driver = { | ||
520 | .name = "rx51-audio", | ||
521 | .owner = THIS_MODULE, | ||
522 | .of_match_table = of_match_ptr(rx51_audio_of_match), | ||
523 | }, | ||
524 | .probe = rx51_soc_probe, | ||
525 | .remove = rx51_soc_remove, | ||
526 | }; | ||
527 | |||
528 | module_platform_driver(rx51_soc_driver); | ||
451 | 529 | ||
452 | MODULE_AUTHOR("Nokia Corporation"); | 530 | MODULE_AUTHOR("Nokia Corporation"); |
453 | MODULE_DESCRIPTION("ALSA SoC Nokia RX-51"); | 531 | MODULE_DESCRIPTION("ALSA SoC Nokia RX-51"); |
454 | MODULE_LICENSE("GPL"); | 532 | MODULE_LICENSE("GPL"); |
533 | MODULE_ALIAS("platform:rx51-audio"); | ||