diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-01-14 02:57:05 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:57 -0500 |
commit | 893e44ba5a7cc05d66b69806defc17dd762c3ba8 (patch) | |
tree | 7fea3aa02fcf9b56c43c22397191e639eeeb3905 /sound | |
parent | 01a3affb2eebfd6c996c36d82bbbc6040eb3a7f1 (diff) |
[ALSA] oxygen: make line-in switch exclusive
The line input cannot be mixed with the other inputs, so we have to mute
the other input switches when it is selected.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/oxygen/oxygen.h | 4 | ||||
-rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 30 |
2 files changed, 33 insertions, 1 deletions
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index a10c37788059..4a0c6634ac96 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -18,6 +18,10 @@ | |||
18 | enum { | 18 | enum { |
19 | CONTROL_SPDIF_PCM, | 19 | CONTROL_SPDIF_PCM, |
20 | CONTROL_SPDIF_INPUT_BITS, | 20 | CONTROL_SPDIF_INPUT_BITS, |
21 | CONTROL_MIC_CAPTURE_SWITCH, | ||
22 | CONTROL_LINE_CAPTURE_SWITCH, | ||
23 | CONTROL_CD_CAPTURE_SWITCH, | ||
24 | CONTROL_AUX_CAPTURE_SWITCH, | ||
21 | CONTROL_COUNT | 25 | CONTROL_COUNT |
22 | }; | 26 | }; |
23 | 27 | ||
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index f7350faada1a..fcb5813183fb 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -402,6 +402,19 @@ static int ac97_switch_get(struct snd_kcontrol *ctl, | |||
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
405 | static void ac97_mute_ctl(struct oxygen *chip, unsigned int control) | ||
406 | { | ||
407 | unsigned int index = chip->controls[control]->private_value & 0xff; | ||
408 | u16 value; | ||
409 | |||
410 | value = oxygen_read_ac97(chip, 0, index); | ||
411 | if (!(value & 0x8000)) { | ||
412 | oxygen_write_ac97(chip, 0, index, value | 0x8000); | ||
413 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
414 | &chip->controls[control]->id); | ||
415 | } | ||
416 | } | ||
417 | |||
405 | static int ac97_switch_put(struct snd_kcontrol *ctl, | 418 | static int ac97_switch_put(struct snd_kcontrol *ctl, |
406 | struct snd_ctl_elem_value *value) | 419 | struct snd_ctl_elem_value *value) |
407 | { | 420 | { |
@@ -422,9 +435,20 @@ static int ac97_switch_put(struct snd_kcontrol *ctl, | |||
422 | change = newreg != oldreg; | 435 | change = newreg != oldreg; |
423 | if (change) { | 436 | if (change) { |
424 | oxygen_write_ac97(chip, 0, index, newreg); | 437 | oxygen_write_ac97(chip, 0, index, newreg); |
425 | if (index == AC97_LINE) | 438 | if (index == AC97_LINE) { |
426 | oxygen_write_ac97_masked(chip, 0, 0x72, | 439 | oxygen_write_ac97_masked(chip, 0, 0x72, |
427 | !!(newreg & 0x8000), 0x0001); | 440 | !!(newreg & 0x8000), 0x0001); |
441 | if (!(newreg & 0x8000)) { | ||
442 | ac97_mute_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH); | ||
443 | ac97_mute_ctl(chip, CONTROL_CD_CAPTURE_SWITCH); | ||
444 | ac97_mute_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH); | ||
445 | } | ||
446 | } else if ((index == AC97_MIC || index == AC97_CD || | ||
447 | index == AC97_VIDEO || index == AC97_AUX) && | ||
448 | bitnr == 15 && !(newreg & 0x8000)) { | ||
449 | ac97_mute_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH); | ||
450 | oxygen_write_ac97_masked(chip, 0, 0x72, 0x0001, 0x0001); | ||
451 | } | ||
428 | } | 452 | } |
429 | mutex_unlock(&chip->mutex); | 453 | mutex_unlock(&chip->mutex); |
430 | return change; | 454 | return change; |
@@ -600,6 +624,10 @@ int oxygen_mixer_init(struct oxygen *chip) | |||
600 | SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), | 624 | SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), |
601 | [CONTROL_SPDIF_INPUT_BITS] = | 625 | [CONTROL_SPDIF_INPUT_BITS] = |
602 | SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT), | 626 | SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT), |
627 | [CONTROL_MIC_CAPTURE_SWITCH] = "Mic Capture Switch", | ||
628 | [CONTROL_LINE_CAPTURE_SWITCH] = "Line Capture Switch", | ||
629 | [CONTROL_CD_CAPTURE_SWITCH] = "CD Capture Switch", | ||
630 | [CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch", | ||
603 | }; | 631 | }; |
604 | unsigned int i, j; | 632 | unsigned int i, j; |
605 | struct snd_kcontrol *ctl; | 633 | struct snd_kcontrol *ctl; |