aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/Kconfig14
-rw-r--r--sound/soc/omap/Makefile2
-rw-r--r--sound/soc/omap/n810.c47
-rw-r--r--sound/soc/omap/omap-mcbsp.c20
-rw-r--r--sound/soc/omap/omap-pcm.c2
-rw-r--r--sound/soc/omap/omap3pandora.c49
-rw-r--r--sound/soc/omap/osk5912.c12
-rw-r--r--sound/soc/omap/sdp3430.c115
8 files changed, 209 insertions, 52 deletions
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 4f7f04014585..675732e724d5 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -8,7 +8,7 @@ config SND_OMAP_SOC_MCBSP
8 8
9config SND_OMAP_SOC_N810 9config SND_OMAP_SOC_N810
10 tristate "SoC Audio support for Nokia N810" 10 tristate "SoC Audio support for Nokia N810"
11 depends on SND_OMAP_SOC && MACH_NOKIA_N810 11 depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C
12 select SND_OMAP_SOC_MCBSP 12 select SND_OMAP_SOC_MCBSP
13 select OMAP_MUX 13 select OMAP_MUX
14 select SND_SOC_TLV320AIC3X 14 select SND_SOC_TLV320AIC3X
@@ -17,7 +17,7 @@ config SND_OMAP_SOC_N810
17 17
18config SND_OMAP_SOC_OSK5912 18config SND_OMAP_SOC_OSK5912
19 tristate "SoC Audio support for omap osk5912" 19 tristate "SoC Audio support for omap osk5912"
20 depends on SND_OMAP_SOC && MACH_OMAP_OSK 20 depends on SND_OMAP_SOC && MACH_OMAP_OSK && I2C
21 select SND_OMAP_SOC_MCBSP 21 select SND_OMAP_SOC_MCBSP
22 select SND_SOC_TLV320AIC23 22 select SND_SOC_TLV320AIC23
23 help 23 help
@@ -55,3 +55,13 @@ config SND_OMAP_SOC_OMAP3_PANDORA
55 select SND_SOC_TWL4030 55 select SND_SOC_TWL4030
56 help 56 help
57 Say Y if you want to add support for SoC audio on the OMAP3 Pandora. 57 Say Y if you want to add support for SoC audio on the OMAP3 Pandora.
58
59config SND_OMAP_SOC_OMAP3_BEAGLE
60 tristate "SoC Audio support for OMAP3 Beagle"
61 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_BEAGLE
62 select SND_OMAP_SOC_MCBSP
63 select SND_SOC_TWL4030
64 help
65 Say Y if you want to add support for SoC audio on the Beagleboard.
66
67
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 76fedd96e365..0c9e4ac37660 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -12,6 +12,7 @@ snd-soc-overo-objs := overo.o
12snd-soc-omap2evm-objs := omap2evm.o 12snd-soc-omap2evm-objs := omap2evm.o
13snd-soc-sdp3430-objs := sdp3430.o 13snd-soc-sdp3430-objs := sdp3430.o
14snd-soc-omap3pandora-objs := omap3pandora.o 14snd-soc-omap3pandora-objs := omap3pandora.o
15snd-soc-omap3beagle-objs := omap3beagle.o
15 16
16obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o 17obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
17obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o 18obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
@@ -19,3 +20,4 @@ obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
19obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o 20obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
20obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o 21obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
21obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o 22obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
23obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index 25593fee9121..a6d1178ce128 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -40,6 +40,13 @@
40#define N810_HEADSET_AMP_GPIO 10 40#define N810_HEADSET_AMP_GPIO 10
41#define N810_SPEAKER_AMP_GPIO 101 41#define N810_SPEAKER_AMP_GPIO 101
42 42
43enum {
44 N810_JACK_DISABLED,
45 N810_JACK_HP,
46 N810_JACK_HS,
47 N810_JACK_MIC,
48};
49
43static struct clk *sys_clkout2; 50static struct clk *sys_clkout2;
44static struct clk *sys_clkout2_src; 51static struct clk *sys_clkout2_src;
45static struct clk *func96m_clk; 52static struct clk *func96m_clk;
@@ -50,15 +57,32 @@ static int n810_dmic_func;
50 57
51static void n810_ext_control(struct snd_soc_codec *codec) 58static void n810_ext_control(struct snd_soc_codec *codec)
52{ 59{
60 int hp = 0, line1l = 0;
61
62 switch (n810_jack_func) {
63 case N810_JACK_HS:
64 line1l = 1;
65 case N810_JACK_HP:
66 hp = 1;
67 break;
68 case N810_JACK_MIC:
69 line1l = 1;
70 break;
71 }
72
53 if (n810_spk_func) 73 if (n810_spk_func)
54 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 74 snd_soc_dapm_enable_pin(codec, "Ext Spk");
55 else 75 else
56 snd_soc_dapm_disable_pin(codec, "Ext Spk"); 76 snd_soc_dapm_disable_pin(codec, "Ext Spk");
57 77
58 if (n810_jack_func) 78 if (hp)
59 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 79 snd_soc_dapm_enable_pin(codec, "Headphone Jack");
60 else 80 else
61 snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 81 snd_soc_dapm_disable_pin(codec, "Headphone Jack");
82 if (line1l)
83 snd_soc_dapm_enable_pin(codec, "LINE1L");
84 else
85 snd_soc_dapm_disable_pin(codec, "LINE1L");
62 86
63 if (n810_dmic_func) 87 if (n810_dmic_func)
64 snd_soc_dapm_enable_pin(codec, "DMic"); 88 snd_soc_dapm_enable_pin(codec, "DMic");
@@ -72,7 +96,7 @@ static int n810_startup(struct snd_pcm_substream *substream)
72{ 96{
73 struct snd_pcm_runtime *runtime = substream->runtime; 97 struct snd_pcm_runtime *runtime = substream->runtime;
74 struct snd_soc_pcm_runtime *rtd = substream->private_data; 98 struct snd_soc_pcm_runtime *rtd = substream->private_data;
75 struct snd_soc_codec *codec = rtd->socdev->codec; 99 struct snd_soc_codec *codec = rtd->socdev->card->codec;
76 100
77 snd_pcm_hw_constraint_minmax(runtime, 101 snd_pcm_hw_constraint_minmax(runtime,
78 SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); 102 SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2);
@@ -229,7 +253,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
229}; 253};
230 254
231static const char *spk_function[] = {"Off", "On"}; 255static const char *spk_function[] = {"Off", "On"};
232static const char *jack_function[] = {"Off", "Headphone"}; 256static const char *jack_function[] = {"Off", "Headphone", "Headset", "Mic"};
233static const char *input_function[] = {"ADC", "Digital Mic"}; 257static const char *input_function[] = {"ADC", "Digital Mic"};
234static const struct soc_enum n810_enum[] = { 258static const struct soc_enum n810_enum[] = {
235 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), 259 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function),
@@ -248,20 +272,23 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = {
248 272
249static int n810_aic33_init(struct snd_soc_codec *codec) 273static int n810_aic33_init(struct snd_soc_codec *codec)
250{ 274{
251 int i, err; 275 int err;
252 276
253 /* Not connected */ 277 /* Not connected */
254 snd_soc_dapm_nc_pin(codec, "MONO_LOUT"); 278 snd_soc_dapm_nc_pin(codec, "MONO_LOUT");
255 snd_soc_dapm_nc_pin(codec, "HPLCOM"); 279 snd_soc_dapm_nc_pin(codec, "HPLCOM");
256 snd_soc_dapm_nc_pin(codec, "HPRCOM"); 280 snd_soc_dapm_nc_pin(codec, "HPRCOM");
281 snd_soc_dapm_nc_pin(codec, "MIC3L");
282 snd_soc_dapm_nc_pin(codec, "MIC3R");
283 snd_soc_dapm_nc_pin(codec, "LINE1R");
284 snd_soc_dapm_nc_pin(codec, "LINE2L");
285 snd_soc_dapm_nc_pin(codec, "LINE2R");
257 286
258 /* Add N810 specific controls */ 287 /* Add N810 specific controls */
259 for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) { 288 err = snd_soc_add_controls(codec, aic33_n810_controls,
260 err = snd_ctl_add(codec->card, 289 ARRAY_SIZE(aic33_n810_controls));
261 snd_soc_cnew(&aic33_n810_controls[i], codec, NULL)); 290 if (err < 0)
262 if (err < 0) 291 return err;
263 return err;
264 }
265 292
266 /* Add N810 specific widgets */ 293 /* Add N810 specific widgets */
267 snd_soc_dapm_new_controls(codec, aic33_dapm_widgets, 294 snd_soc_dapm_new_controls(codec, aic33_dapm_widgets,
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 05dd5abcddf4..d6882be33452 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -461,6 +461,16 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
461 return err; 461 return err;
462} 462}
463 463
464static struct snd_soc_dai_ops omap_mcbsp_dai_ops = {
465 .startup = omap_mcbsp_dai_startup,
466 .shutdown = omap_mcbsp_dai_shutdown,
467 .trigger = omap_mcbsp_dai_trigger,
468 .hw_params = omap_mcbsp_dai_hw_params,
469 .set_fmt = omap_mcbsp_dai_set_dai_fmt,
470 .set_clkdiv = omap_mcbsp_dai_set_clkdiv,
471 .set_sysclk = omap_mcbsp_dai_set_dai_sysclk,
472};
473
464#define OMAP_MCBSP_DAI_BUILDER(link_id) \ 474#define OMAP_MCBSP_DAI_BUILDER(link_id) \
465{ \ 475{ \
466 .name = "omap-mcbsp-dai-"#link_id, \ 476 .name = "omap-mcbsp-dai-"#link_id, \
@@ -477,15 +487,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
477 .rates = OMAP_MCBSP_RATES, \ 487 .rates = OMAP_MCBSP_RATES, \
478 .formats = SNDRV_PCM_FMTBIT_S16_LE, \ 488 .formats = SNDRV_PCM_FMTBIT_S16_LE, \
479 }, \ 489 }, \
480 .ops = { \ 490 .ops = &omap_mcbsp_dai_ops, \
481 .startup = omap_mcbsp_dai_startup, \
482 .shutdown = omap_mcbsp_dai_shutdown, \
483 .trigger = omap_mcbsp_dai_trigger, \
484 .hw_params = omap_mcbsp_dai_hw_params, \
485 .set_fmt = omap_mcbsp_dai_set_dai_fmt, \
486 .set_clkdiv = omap_mcbsp_dai_set_clkdiv, \
487 .set_sysclk = omap_mcbsp_dai_set_dai_sysclk, \
488 }, \
489 .private_data = &mcbsp_data[(link_id)].bus_id, \ 491 .private_data = &mcbsp_data[(link_id)].bus_id, \
490} 492}
491 493
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index dd3bb2933762..8e1431cb46bb 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -265,7 +265,7 @@ static int omap_pcm_mmap(struct snd_pcm_substream *substream,
265 runtime->dma_bytes); 265 runtime->dma_bytes);
266} 266}
267 267
268struct snd_pcm_ops omap_pcm_ops = { 268static struct snd_pcm_ops omap_pcm_ops = {
269 .open = omap_pcm_open, 269 .open = omap_pcm_open,
270 .close = omap_pcm_close, 270 .close = omap_pcm_close,
271 .ioctl = snd_pcm_lib_ioctl, 271 .ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index fcc2f5d9a878..fe282d4ef422 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -143,7 +143,7 @@ static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = {
143}; 143};
144 144
145static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = { 145static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = {
146 SND_SOC_DAPM_MIC("Mic (Internal)", NULL), 146 SND_SOC_DAPM_MIC("Mic (internal)", NULL),
147 SND_SOC_DAPM_MIC("Mic (external)", NULL), 147 SND_SOC_DAPM_MIC("Mic (external)", NULL),
148 SND_SOC_DAPM_LINE("Line In", NULL), 148 SND_SOC_DAPM_LINE("Line In", NULL),
149}; 149};
@@ -155,16 +155,33 @@ static const struct snd_soc_dapm_route omap3pandora_out_map[] = {
155}; 155};
156 156
157static const struct snd_soc_dapm_route omap3pandora_in_map[] = { 157static const struct snd_soc_dapm_route omap3pandora_in_map[] = {
158 {"INL", NULL, "Line In"}, 158 {"AUXL", NULL, "Line In"},
159 {"INR", NULL, "Line In"}, 159 {"AUXR", NULL, "Line In"},
160 {"INL", NULL, "Mic (Internal)"}, 160
161 {"INR", NULL, "Mic (external)"}, 161 {"MAINMIC", NULL, "Mic Bias 1"},
162 {"Mic Bias 1", NULL, "Mic (internal)"},
163
164 {"SUBMIC", NULL, "Mic Bias 2"},
165 {"Mic Bias 2", NULL, "Mic (external)"},
162}; 166};
163 167
164static int omap3pandora_out_init(struct snd_soc_codec *codec) 168static int omap3pandora_out_init(struct snd_soc_codec *codec)
165{ 169{
166 int ret; 170 int ret;
167 171
172 /* All TWL4030 output pins are floating */
173 snd_soc_dapm_nc_pin(codec, "OUTL");
174 snd_soc_dapm_nc_pin(codec, "OUTR");
175 snd_soc_dapm_nc_pin(codec, "EARPIECE");
176 snd_soc_dapm_nc_pin(codec, "PREDRIVEL");
177 snd_soc_dapm_nc_pin(codec, "PREDRIVER");
178 snd_soc_dapm_nc_pin(codec, "HSOL");
179 snd_soc_dapm_nc_pin(codec, "HSOR");
180 snd_soc_dapm_nc_pin(codec, "CARKITL");
181 snd_soc_dapm_nc_pin(codec, "CARKITR");
182 snd_soc_dapm_nc_pin(codec, "HFL");
183 snd_soc_dapm_nc_pin(codec, "HFR");
184
168 ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets, 185 ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets,
169 ARRAY_SIZE(omap3pandora_out_dapm_widgets)); 186 ARRAY_SIZE(omap3pandora_out_dapm_widgets));
170 if (ret < 0) 187 if (ret < 0)
@@ -180,18 +197,11 @@ static int omap3pandora_in_init(struct snd_soc_codec *codec)
180{ 197{
181 int ret; 198 int ret;
182 199
183 /* All TWL4030 output pins are floating */ 200 /* Not comnnected */
184 snd_soc_dapm_nc_pin(codec, "OUTL"), 201 snd_soc_dapm_nc_pin(codec, "HSMIC");
185 snd_soc_dapm_nc_pin(codec, "OUTR"), 202 snd_soc_dapm_nc_pin(codec, "CARKITMIC");
186 snd_soc_dapm_nc_pin(codec, "EARPIECE"), 203 snd_soc_dapm_nc_pin(codec, "DIGIMIC0");
187 snd_soc_dapm_nc_pin(codec, "PREDRIVEL"), 204 snd_soc_dapm_nc_pin(codec, "DIGIMIC1");
188 snd_soc_dapm_nc_pin(codec, "PREDRIVER"),
189 snd_soc_dapm_nc_pin(codec, "HSOL"),
190 snd_soc_dapm_nc_pin(codec, "HSOR"),
191 snd_soc_dapm_nc_pin(codec, "CARKITL"),
192 snd_soc_dapm_nc_pin(codec, "CARKITR"),
193 snd_soc_dapm_nc_pin(codec, "HFL"),
194 snd_soc_dapm_nc_pin(codec, "HFR"),
195 205
196 ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, 206 ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets,
197 ARRAY_SIZE(omap3pandora_in_dapm_widgets)); 207 ARRAY_SIZE(omap3pandora_in_dapm_widgets));
@@ -251,10 +261,9 @@ static int __init omap3pandora_soc_init(void)
251{ 261{
252 int ret; 262 int ret;
253 263
254 if (!machine_is_omap3_pandora()) { 264 if (!machine_is_omap3_pandora())
255 pr_debug(PREFIX "Not OMAP3 Pandora\n");
256 return -ENODEV; 265 return -ENODEV;
257 } 266
258 pr_info("OMAP3 Pandora SoC init\n"); 267 pr_info("OMAP3 Pandora SoC init\n");
259 268
260 ret = gpio_request(OMAP3_PANDORA_DAC_POWER_GPIO, "dac_power"); 269 ret = gpio_request(OMAP3_PANDORA_DAC_POWER_GPIO, "dac_power");
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index cd41a948df7b..a952a4eb3361 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -186,13 +186,6 @@ static int __init osk_soc_init(void)
186 return -ENODEV; 186 return -ENODEV;
187 } 187 }
188 188
189 if (clk_get_usecount(tlv320aic23_mclk) > 0) {
190 /* MCLK is already in use */
191 printk(KERN_WARNING
192 "MCLK in use at %d Hz. We change it to %d Hz\n",
193 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);
194 }
195
196 /* 189 /*
197 * Configure 12 MHz output on MCLK. 190 * Configure 12 MHz output on MCLK.
198 */ 191 */
@@ -205,9 +198,8 @@ static int __init osk_soc_init(void)
205 } 198 }
206 } 199 }
207 200
208 printk(KERN_INFO "MCLK = %d [%d], usecount = %d\n", 201 printk(KERN_INFO "MCLK = %d [%d]\n",
209 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK, 202 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);
210 clk_get_usecount(tlv320aic23_mclk));
211 203
212 return 0; 204 return 0;
213err1: 205err1:
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index e226fa75669c..10f1c867f11d 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -28,6 +28,7 @@
28#include <sound/pcm.h> 28#include <sound/pcm.h>
29#include <sound/soc.h> 29#include <sound/soc.h>
30#include <sound/soc-dapm.h> 30#include <sound/soc-dapm.h>
31#include <sound/jack.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
@@ -38,6 +39,8 @@
38#include "omap-pcm.h" 39#include "omap-pcm.h"
39#include "../codecs/twl4030.h" 40#include "../codecs/twl4030.h"
40 41
42static struct snd_soc_card snd_soc_sdp3430;
43
41static int sdp3430_hw_params(struct snd_pcm_substream *substream, 44static int sdp3430_hw_params(struct snd_pcm_substream *substream,
42 struct snd_pcm_hw_params *params) 45 struct snd_pcm_hw_params *params)
43{ 46{
@@ -81,12 +84,121 @@ static struct snd_soc_ops sdp3430_ops = {
81 .hw_params = sdp3430_hw_params, 84 .hw_params = sdp3430_hw_params,
82}; 85};
83 86
87/* Headset jack */
88static struct snd_soc_jack hs_jack;
89
90/* Headset jack detection DAPM pins */
91static struct snd_soc_jack_pin hs_jack_pins[] = {
92 {
93 .pin = "Headset Mic",
94 .mask = SND_JACK_MICROPHONE,
95 },
96 {
97 .pin = "Headset Stereophone",
98 .mask = SND_JACK_HEADPHONE,
99 },
100};
101
102/* Headset jack detection gpios */
103static struct snd_soc_jack_gpio hs_jack_gpios[] = {
104 {
105 .gpio = (OMAP_MAX_GPIO_LINES + 2),
106 .name = "hsdet-gpio",
107 .report = SND_JACK_HEADSET,
108 .debounce_time = 200,
109 },
110};
111
112/* SDP3430 machine DAPM */
113static const struct snd_soc_dapm_widget sdp3430_twl4030_dapm_widgets[] = {
114 SND_SOC_DAPM_MIC("Ext Mic", NULL),
115 SND_SOC_DAPM_SPK("Ext Spk", NULL),
116 SND_SOC_DAPM_MIC("Headset Mic", NULL),
117 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
118};
119
120static const struct snd_soc_dapm_route audio_map[] = {
121 /* External Mics: MAINMIC, SUBMIC with bias*/
122 {"MAINMIC", NULL, "Mic Bias 1"},
123 {"SUBMIC", NULL, "Mic Bias 2"},
124 {"Mic Bias 1", NULL, "Ext Mic"},
125 {"Mic Bias 2", NULL, "Ext Mic"},
126
127 /* External Speakers: HFL, HFR */
128 {"Ext Spk", NULL, "HFL"},
129 {"Ext Spk", NULL, "HFR"},
130
131 /* Headset Mic: HSMIC with bias */
132 {"HSMIC", NULL, "Headset Mic Bias"},
133 {"Headset Mic Bias", NULL, "Headset Mic"},
134
135 /* Headset Stereophone (Headphone): HSOL, HSOR */
136 {"Headset Stereophone", NULL, "HSOL"},
137 {"Headset Stereophone", NULL, "HSOR"},
138};
139
140static int sdp3430_twl4030_init(struct snd_soc_codec *codec)
141{
142 int ret;
143
144 /* Add SDP3430 specific widgets */
145 ret = snd_soc_dapm_new_controls(codec, sdp3430_twl4030_dapm_widgets,
146 ARRAY_SIZE(sdp3430_twl4030_dapm_widgets));
147 if (ret)
148 return ret;
149
150 /* Set up SDP3430 specific audio path audio_map */
151 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
152
153 /* SDP3430 connected pins */
154 snd_soc_dapm_enable_pin(codec, "Ext Mic");
155 snd_soc_dapm_enable_pin(codec, "Ext Spk");
156 snd_soc_dapm_disable_pin(codec, "Headset Mic");
157 snd_soc_dapm_disable_pin(codec, "Headset Stereophone");
158
159 /* TWL4030 not connected pins */
160 snd_soc_dapm_nc_pin(codec, "AUXL");
161 snd_soc_dapm_nc_pin(codec, "AUXR");
162 snd_soc_dapm_nc_pin(codec, "CARKITMIC");
163 snd_soc_dapm_nc_pin(codec, "DIGIMIC0");
164 snd_soc_dapm_nc_pin(codec, "DIGIMIC1");
165
166 snd_soc_dapm_nc_pin(codec, "OUTL");
167 snd_soc_dapm_nc_pin(codec, "OUTR");
168 snd_soc_dapm_nc_pin(codec, "EARPIECE");
169 snd_soc_dapm_nc_pin(codec, "PREDRIVEL");
170 snd_soc_dapm_nc_pin(codec, "PREDRIVER");
171 snd_soc_dapm_nc_pin(codec, "CARKITL");
172 snd_soc_dapm_nc_pin(codec, "CARKITR");
173
174 ret = snd_soc_dapm_sync(codec);
175 if (ret)
176 return ret;
177
178 /* Headset jack detection */
179 ret = snd_soc_jack_new(&snd_soc_sdp3430, "Headset Jack",
180 SND_JACK_HEADSET, &hs_jack);
181 if (ret)
182 return ret;
183
184 ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
185 hs_jack_pins);
186 if (ret)
187 return ret;
188
189 ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
190 hs_jack_gpios);
191
192 return ret;
193}
194
84/* Digital audio interface glue - connects codec <--> CPU */ 195/* Digital audio interface glue - connects codec <--> CPU */
85static struct snd_soc_dai_link sdp3430_dai = { 196static struct snd_soc_dai_link sdp3430_dai = {
86 .name = "TWL4030", 197 .name = "TWL4030",
87 .stream_name = "TWL4030", 198 .stream_name = "TWL4030",
88 .cpu_dai = &omap_mcbsp_dai[0], 199 .cpu_dai = &omap_mcbsp_dai[0],
89 .codec_dai = &twl4030_dai, 200 .codec_dai = &twl4030_dai,
201 .init = sdp3430_twl4030_init,
90 .ops = &sdp3430_ops, 202 .ops = &sdp3430_ops,
91}; 203};
92 204
@@ -142,6 +254,9 @@ module_init(sdp3430_soc_init);
142 254
143static void __exit sdp3430_soc_exit(void) 255static void __exit sdp3430_soc_exit(void)
144{ 256{
257 snd_soc_jack_free_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
258 hs_jack_gpios);
259
145 platform_device_unregister(sdp3430_snd_device); 260 platform_device_unregister(sdp3430_snd_device);
146} 261}
147module_exit(sdp3430_soc_exit); 262module_exit(sdp3430_soc_exit);