aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/n810.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/n810.c')
-rw-r--r--sound/soc/omap/n810.c47
1 files changed, 37 insertions, 10 deletions
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,