diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/omap/n810.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index c168a64e3162..767b39f339a8 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -46,11 +46,13 @@ static struct clk *func96m_clk; | |||
46 | 46 | ||
47 | static int n810_spk_func; | 47 | static int n810_spk_func; |
48 | static int n810_jack_func; | 48 | static int n810_jack_func; |
49 | static int n810_dmic_func; | ||
49 | 50 | ||
50 | static void n810_ext_control(struct snd_soc_codec *codec) | 51 | static void n810_ext_control(struct snd_soc_codec *codec) |
51 | { | 52 | { |
52 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", n810_spk_func); | 53 | snd_soc_dapm_set_endpoint(codec, "Ext Spk", n810_spk_func); |
53 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", n810_jack_func); | 54 | snd_soc_dapm_set_endpoint(codec, "Headphone Jack", n810_jack_func); |
55 | snd_soc_dapm_set_endpoint(codec, "DMic", n810_dmic_func); | ||
54 | 56 | ||
55 | snd_soc_dapm_sync_endpoints(codec); | 57 | snd_soc_dapm_sync_endpoints(codec); |
56 | } | 58 | } |
@@ -150,6 +152,28 @@ static int n810_set_jack(struct snd_kcontrol *kcontrol, | |||
150 | return 1; | 152 | return 1; |
151 | } | 153 | } |
152 | 154 | ||
155 | static int n810_get_input(struct snd_kcontrol *kcontrol, | ||
156 | struct snd_ctl_elem_value *ucontrol) | ||
157 | { | ||
158 | ucontrol->value.integer.value[0] = n810_dmic_func; | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int n810_set_input(struct snd_kcontrol *kcontrol, | ||
164 | struct snd_ctl_elem_value *ucontrol) | ||
165 | { | ||
166 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
167 | |||
168 | if (n810_dmic_func == ucontrol->value.integer.value[0]) | ||
169 | return 0; | ||
170 | |||
171 | n810_dmic_func = ucontrol->value.integer.value[0]; | ||
172 | n810_ext_control(codec); | ||
173 | |||
174 | return 1; | ||
175 | } | ||
176 | |||
153 | static int n810_spk_event(struct snd_soc_dapm_widget *w, | 177 | static int n810_spk_event(struct snd_soc_dapm_widget *w, |
154 | struct snd_kcontrol *k, int event) | 178 | struct snd_kcontrol *k, int event) |
155 | { | 179 | { |
@@ -175,6 +199,7 @@ static int n810_jack_event(struct snd_soc_dapm_widget *w, | |||
175 | static const struct snd_soc_dapm_widget aic33_dapm_widgets[] = { | 199 | static const struct snd_soc_dapm_widget aic33_dapm_widgets[] = { |
176 | SND_SOC_DAPM_SPK("Ext Spk", n810_spk_event), | 200 | SND_SOC_DAPM_SPK("Ext Spk", n810_spk_event), |
177 | SND_SOC_DAPM_HP("Headphone Jack", n810_jack_event), | 201 | SND_SOC_DAPM_HP("Headphone Jack", n810_jack_event), |
202 | SND_SOC_DAPM_MIC("DMic", NULL), | ||
178 | }; | 203 | }; |
179 | 204 | ||
180 | static const struct snd_soc_dapm_route audio_map[] = { | 205 | static const struct snd_soc_dapm_route audio_map[] = { |
@@ -183,13 +208,18 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
183 | 208 | ||
184 | {"Ext Spk", NULL, "LLOUT"}, | 209 | {"Ext Spk", NULL, "LLOUT"}, |
185 | {"Ext Spk", NULL, "RLOUT"}, | 210 | {"Ext Spk", NULL, "RLOUT"}, |
211 | |||
212 | {"DMic Rate 64", NULL, "Mic Bias 2V"}, | ||
213 | {"Mic Bias 2V", NULL, "DMic"}, | ||
186 | }; | 214 | }; |
187 | 215 | ||
188 | static const char *spk_function[] = {"Off", "On"}; | 216 | static const char *spk_function[] = {"Off", "On"}; |
189 | static const char *jack_function[] = {"Off", "Headphone"}; | 217 | static const char *jack_function[] = {"Off", "Headphone"}; |
218 | static const char *input_function[] = {"ADC", "Digital Mic"}; | ||
190 | static const struct soc_enum n810_enum[] = { | 219 | static const struct soc_enum n810_enum[] = { |
191 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), | 220 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(spk_function), spk_function), |
192 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(jack_function), jack_function), | 221 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(jack_function), jack_function), |
222 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(input_function), input_function), | ||
193 | }; | 223 | }; |
194 | 224 | ||
195 | static const struct snd_kcontrol_new aic33_n810_controls[] = { | 225 | static const struct snd_kcontrol_new aic33_n810_controls[] = { |
@@ -197,6 +227,8 @@ static const struct snd_kcontrol_new aic33_n810_controls[] = { | |||
197 | n810_get_spk, n810_set_spk), | 227 | n810_get_spk, n810_set_spk), |
198 | SOC_ENUM_EXT("Jack Function", n810_enum[1], | 228 | SOC_ENUM_EXT("Jack Function", n810_enum[1], |
199 | n810_get_jack, n810_set_jack), | 229 | n810_get_jack, n810_set_jack), |
230 | SOC_ENUM_EXT("Input Select", n810_enum[2], | ||
231 | n810_get_input, n810_set_input), | ||
200 | }; | 232 | }; |
201 | 233 | ||
202 | static int n810_aic33_init(struct snd_soc_codec *codec) | 234 | static int n810_aic33_init(struct snd_soc_codec *codec) |
@@ -248,6 +280,8 @@ static struct snd_soc_machine snd_soc_machine_n810 = { | |||
248 | /* Audio private data */ | 280 | /* Audio private data */ |
249 | static struct aic3x_setup_data n810_aic33_setup = { | 281 | static struct aic3x_setup_data n810_aic33_setup = { |
250 | .i2c_address = 0x18, | 282 | .i2c_address = 0x18, |
283 | .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, | ||
284 | .gpio_func[1] = AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT, | ||
251 | }; | 285 | }; |
252 | 286 | ||
253 | /* Audio subsystem */ | 287 | /* Audio subsystem */ |