diff options
Diffstat (limited to 'sound/pci/oxygen/xonar_wm87x6.c')
-rw-r--r-- | sound/pci/oxygen/xonar_wm87x6.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c index dbc4b89d74e..b82c1cfa96f 100644 --- a/sound/pci/oxygen/xonar_wm87x6.c +++ b/sound/pci/oxygen/xonar_wm87x6.c | |||
@@ -53,6 +53,8 @@ struct xonar_wm87x6 { | |||
53 | struct xonar_generic generic; | 53 | struct xonar_generic generic; |
54 | u16 wm8776_regs[0x17]; | 54 | u16 wm8776_regs[0x17]; |
55 | u16 wm8766_regs[0x10]; | 55 | u16 wm8766_regs[0x10]; |
56 | struct snd_kcontrol *line_adcmux_control; | ||
57 | struct snd_kcontrol *mic_adcmux_control; | ||
56 | struct snd_kcontrol *lc_controls[13]; | 58 | struct snd_kcontrol *lc_controls[13]; |
57 | }; | 59 | }; |
58 | 60 | ||
@@ -193,6 +195,7 @@ static void xonar_ds_init(struct oxygen *chip) | |||
193 | static void xonar_ds_cleanup(struct oxygen *chip) | 195 | static void xonar_ds_cleanup(struct oxygen *chip) |
194 | { | 196 | { |
195 | xonar_disable_output(chip); | 197 | xonar_disable_output(chip); |
198 | wm8776_write(chip, WM8776_RESET, 0); | ||
196 | } | 199 | } |
197 | 200 | ||
198 | static void xonar_ds_suspend(struct oxygen *chip) | 201 | static void xonar_ds_suspend(struct oxygen *chip) |
@@ -603,6 +606,7 @@ static int wm8776_input_mux_put(struct snd_kcontrol *ctl, | |||
603 | { | 606 | { |
604 | struct oxygen *chip = ctl->private_data; | 607 | struct oxygen *chip = ctl->private_data; |
605 | struct xonar_wm87x6 *data = chip->model_data; | 608 | struct xonar_wm87x6 *data = chip->model_data; |
609 | struct snd_kcontrol *other_ctl; | ||
606 | unsigned int mux_bit = ctl->private_value; | 610 | unsigned int mux_bit = ctl->private_value; |
607 | u16 reg; | 611 | u16 reg; |
608 | int changed; | 612 | int changed; |
@@ -610,8 +614,18 @@ static int wm8776_input_mux_put(struct snd_kcontrol *ctl, | |||
610 | mutex_lock(&chip->mutex); | 614 | mutex_lock(&chip->mutex); |
611 | reg = data->wm8776_regs[WM8776_ADCMUX]; | 615 | reg = data->wm8776_regs[WM8776_ADCMUX]; |
612 | if (value->value.integer.value[0]) { | 616 | if (value->value.integer.value[0]) { |
613 | reg &= ~0x003; | ||
614 | reg |= mux_bit; | 617 | reg |= mux_bit; |
618 | /* line-in and mic-in are exclusive */ | ||
619 | mux_bit ^= 3; | ||
620 | if (reg & mux_bit) { | ||
621 | reg &= ~mux_bit; | ||
622 | if (mux_bit == 1) | ||
623 | other_ctl = data->line_adcmux_control; | ||
624 | else | ||
625 | other_ctl = data->mic_adcmux_control; | ||
626 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
627 | &other_ctl->id); | ||
628 | } | ||
615 | } else | 629 | } else |
616 | reg &= ~mux_bit; | 630 | reg &= ~mux_bit; |
617 | changed = reg != data->wm8776_regs[WM8776_ADCMUX]; | 631 | changed = reg != data->wm8776_regs[WM8776_ADCMUX]; |
@@ -963,7 +977,13 @@ static int xonar_ds_mixer_init(struct oxygen *chip) | |||
963 | err = snd_ctl_add(chip->card, ctl); | 977 | err = snd_ctl_add(chip->card, ctl); |
964 | if (err < 0) | 978 | if (err < 0) |
965 | return err; | 979 | return err; |
980 | if (!strcmp(ctl->id.name, "Line Capture Switch")) | ||
981 | data->line_adcmux_control = ctl; | ||
982 | else if (!strcmp(ctl->id.name, "Mic Capture Switch")) | ||
983 | data->mic_adcmux_control = ctl; | ||
966 | } | 984 | } |
985 | if (!data->line_adcmux_control || !data->mic_adcmux_control) | ||
986 | return -ENXIO; | ||
967 | BUILD_BUG_ON(ARRAY_SIZE(lc_controls) != ARRAY_SIZE(data->lc_controls)); | 987 | BUILD_BUG_ON(ARRAY_SIZE(lc_controls) != ARRAY_SIZE(data->lc_controls)); |
968 | for (i = 0; i < ARRAY_SIZE(lc_controls); ++i) { | 988 | for (i = 0; i < ARRAY_SIZE(lc_controls); ++i) { |
969 | ctl = snd_ctl_new1(&lc_controls[i], chip); | 989 | ctl = snd_ctl_new1(&lc_controls[i], chip); |