aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@nokia.com>2008-06-25 07:58:47 -0400
committerJaroslav Kysela <perex@perex.cz>2008-06-26 03:02:25 -0400
commit90b9e47671d561fdf2802aac4ac749b6c86405e0 (patch)
treeba24458f854a6057f5fd31e95c375488f69ad833 /sound
parentee15ffdb140b1a4fda5f6a3a8b9994031de5edb4 (diff)
ALSA: ASoC: Add digital mic configuration to N810 machine driver
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com> Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/n810.c34
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
47static int n810_spk_func; 47static int n810_spk_func;
48static int n810_jack_func; 48static int n810_jack_func;
49static int n810_dmic_func;
49 50
50static void n810_ext_control(struct snd_soc_codec *codec) 51static 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
155static 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
163static 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
153static int n810_spk_event(struct snd_soc_dapm_widget *w, 177static 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,
175static const struct snd_soc_dapm_widget aic33_dapm_widgets[] = { 199static 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
180static const struct snd_soc_dapm_route audio_map[] = { 205static 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
188static const char *spk_function[] = {"Off", "On"}; 216static const char *spk_function[] = {"Off", "On"};
189static const char *jack_function[] = {"Off", "Headphone"}; 217static const char *jack_function[] = {"Off", "Headphone"};
218static const char *input_function[] = {"ADC", "Digital Mic"};
190static const struct soc_enum n810_enum[] = { 219static 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
195static const struct snd_kcontrol_new aic33_n810_controls[] = { 225static 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
202static int n810_aic33_init(struct snd_soc_codec *codec) 234static 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 */
249static struct aic3x_setup_data n810_aic33_setup = { 281static 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 */