Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=893e44ba5a7cc05d66b69806defc17dd762c3ba8
Commit:     893e44ba5a7cc05d66b69806defc17dd762c3ba8
Parent:     01a3affb2eebfd6c996c36d82bbbc6040eb3a7f1
Author:     Clemens Ladisch <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 14 08:57:05 2008 +0100
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Thu Jan 31 17:29:57 2008 +0100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/pci/oxygen/oxygen.h       |    4 ++++
 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 a10c377..4a0c663 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -18,6 +18,10 @@
 enum {
        CONTROL_SPDIF_PCM,
        CONTROL_SPDIF_INPUT_BITS,
+       CONTROL_MIC_CAPTURE_SWITCH,
+       CONTROL_LINE_CAPTURE_SWITCH,
+       CONTROL_CD_CAPTURE_SWITCH,
+       CONTROL_AUX_CAPTURE_SWITCH,
        CONTROL_COUNT
 };
 
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index f7350fa..fcb5813 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,
        return 0;
 }
 
+static void ac97_mute_ctl(struct oxygen *chip, unsigned int control)
+{
+       unsigned int index = chip->controls[control]->private_value & 0xff;
+       u16 value;
+
+       value = oxygen_read_ac97(chip, 0, index);
+       if (!(value & 0x8000)) {
+               oxygen_write_ac97(chip, 0, index, value | 0x8000);
+               snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
+                              &chip->controls[control]->id);
+       }
+}
+
 static int ac97_switch_put(struct snd_kcontrol *ctl,
                           struct snd_ctl_elem_value *value)
 {
@@ -422,9 +435,20 @@ static int ac97_switch_put(struct snd_kcontrol *ctl,
        change = newreg != oldreg;
        if (change) {
                oxygen_write_ac97(chip, 0, index, newreg);
-               if (index == AC97_LINE)
+               if (index == AC97_LINE) {
                        oxygen_write_ac97_masked(chip, 0, 0x72,
                                                 !!(newreg & 0x8000), 0x0001);
+                       if (!(newreg & 0x8000)) {
+                               ac97_mute_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH);
+                               ac97_mute_ctl(chip, CONTROL_CD_CAPTURE_SWITCH);
+                               ac97_mute_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH);
+                       }
+               } else if ((index == AC97_MIC || index == AC97_CD ||
+                           index == AC97_VIDEO || index == AC97_AUX) &&
+                          bitnr == 15 && !(newreg & 0x8000)) {
+                       ac97_mute_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH);
+                       oxygen_write_ac97_masked(chip, 0, 0x72, 0x0001, 0x0001);
+               }
        }
        mutex_unlock(&chip->mutex);
        return change;
@@ -600,6 +624,10 @@ int oxygen_mixer_init(struct oxygen *chip)
                        SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM),
                [CONTROL_SPDIF_INPUT_BITS] =
                        SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT),
+               [CONTROL_MIC_CAPTURE_SWITCH] = "Mic Capture Switch",
+               [CONTROL_LINE_CAPTURE_SWITCH] = "Line Capture Switch",
+               [CONTROL_CD_CAPTURE_SWITCH] = "CD Capture Switch",
+               [CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch",
        };
        unsigned int i, j;
        struct snd_kcontrol *ctl;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to