aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-09-09 06:20:29 -0400
committerTakashi Iwai <tiwai@suse.de>2010-09-09 04:53:30 -0400
commit435feac648cab190990aa0bf9355f77d1f082db3 (patch)
tree28e02199d1c50391e3b883253b37ecb7f8154690 /sound/pci/oxygen
parent9bac84edf0360ac94a27308778ef98dc9068777c (diff)
ALSA: virtuoso: add Xonar DS headphone jack detection
Now that the polarity of the headphone detection pin is known, replace the debugging message with a proper jack plug input device. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r--sound/pci/oxygen/xonar_wm87x6.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
index fb3f95ccafa1..9d57b5eee3f5 100644
--- a/sound/pci/oxygen/xonar_wm87x6.c
+++ b/sound/pci/oxygen/xonar_wm87x6.c
@@ -25,8 +25,8 @@
25 * SPI 0 -> WM8766 (surround, center/LFE, back) 25 * SPI 0 -> WM8766 (surround, center/LFE, back)
26 * SPI 1 -> WM8776 (front, input) 26 * SPI 1 -> WM8776 (front, input)
27 * 27 *
28 * GPIO 4 <- headphone detect 28 * GPIO 4 <- headphone detect, 0 = plugged
29 * GPIO 6 -> route input jack to input 1/2 (1/0) 29 * GPIO 6 -> route input jack to mic-in (0) or line-in (1)
30 * GPIO 7 -> enable output to speakers 30 * GPIO 7 -> enable output to speakers
31 * GPIO 8 -> enable output to speakers 31 * GPIO 8 -> enable output to speakers
32 * 32 *
@@ -42,6 +42,7 @@
42#include <linux/delay.h> 42#include <linux/delay.h>
43#include <sound/control.h> 43#include <sound/control.h>
44#include <sound/core.h> 44#include <sound/core.h>
45#include <sound/jack.h>
45#include <sound/pcm.h> 46#include <sound/pcm.h>
46#include <sound/pcm_params.h> 47#include <sound/pcm_params.h>
47#include <sound/tlv.h> 48#include <sound/tlv.h>
@@ -63,6 +64,7 @@ struct xonar_wm87x6 {
63 struct snd_kcontrol *line_adcmux_control; 64 struct snd_kcontrol *line_adcmux_control;
64 struct snd_kcontrol *mic_adcmux_control; 65 struct snd_kcontrol *mic_adcmux_control;
65 struct snd_kcontrol *lc_controls[13]; 66 struct snd_kcontrol *lc_controls[13];
67 struct snd_jack *hp_jack;
66}; 68};
67 69
68static void wm8776_write(struct oxygen *chip, 70static void wm8776_write(struct oxygen *chip,
@@ -177,6 +179,16 @@ static void wm8776_init(struct oxygen *chip)
177 wm8776_registers_init(chip); 179 wm8776_registers_init(chip);
178} 180}
179 181
182static void xonar_ds_report_hp_jack(struct oxygen *chip)
183{
184 struct xonar_wm87x6 *data = chip->model_data;
185 u16 bits;
186
187 bits = oxygen_read16(chip, OXYGEN_GPIO_DATA);
188 snd_jack_report(data->hp_jack,
189 bits & GPIO_DS_HP_DETECT ? 0 : SND_JACK_HEADPHONE);
190}
191
180static void xonar_ds_init(struct oxygen *chip) 192static void xonar_ds_init(struct oxygen *chip)
181{ 193{
182 struct xonar_wm87x6 *data = chip->model_data; 194 struct xonar_wm87x6 *data = chip->model_data;
@@ -195,6 +207,10 @@ static void xonar_ds_init(struct oxygen *chip)
195 207
196 xonar_enable_output(chip); 208 xonar_enable_output(chip);
197 209
210 snd_jack_new(chip->card, "Headphone",
211 SND_JACK_HEADPHONE, &data->hp_jack);
212 xonar_ds_report_hp_jack(chip);
213
198 snd_component_add(chip->card, "WM8776"); 214 snd_component_add(chip->card, "WM8776");
199 snd_component_add(chip->card, "WM8766"); 215 snd_component_add(chip->card, "WM8766");
200} 216}
@@ -332,10 +348,7 @@ static void update_wm87x6_mute(struct oxygen *chip)
332 348
333static void xonar_ds_gpio_changed(struct oxygen *chip) 349static void xonar_ds_gpio_changed(struct oxygen *chip)
334{ 350{
335 u16 bits; 351 xonar_ds_report_hp_jack(chip);
336
337 bits = oxygen_read16(chip, OXYGEN_GPIO_DATA);
338 snd_printk(KERN_INFO "HP detect: %d\n", !!(bits & GPIO_DS_HP_DETECT));
339} 352}
340 353
341static int wm8776_bit_switch_get(struct snd_kcontrol *ctl, 354static int wm8776_bit_switch_get(struct snd_kcontrol *ctl,