Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=02f21c9d6ba863aa86c33e1335cb1307322f7fb8
Commit:     02f21c9d6ba863aa86c33e1335cb1307322f7fb8
Parent:     08c8efe6925ba712d65ca07877fa169b45f8d502
Author:     Clemens Ladisch <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 22 08:36:03 2008 +0100
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Thu Jan 31 17:30:09 2008 +0100

    [ALSA] oxygen: add SPDIF loopback control
    
    Add a mixer control for the SPDIF loopback function.
    
    Signed-off-by: Clemens Ladisch <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 sound/pci/oxygen/oxygen_mixer.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 0993c29..6b7420f 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -408,6 +408,37 @@ static int spdif_input_default_get(struct snd_kcontrol 
*ctl,
        return 0;
 }
 
+static int spdif_loopback_get(struct snd_kcontrol *ctl,
+                             struct snd_ctl_elem_value *value)
+{
+       struct oxygen *chip = ctl->private_data;
+
+       value->value.integer.value[0] =
+               !!(oxygen_read32(chip, OXYGEN_SPDIF_CONTROL)
+                  & OXYGEN_SPDIF_LOOPBACK);
+       return 0;
+}
+
+static int spdif_loopback_put(struct snd_kcontrol *ctl,
+                             struct snd_ctl_elem_value *value)
+{
+       struct oxygen *chip = ctl->private_data;
+       u32 oldreg, newreg;
+       int changed;
+
+       spin_lock_irq(&chip->reg_lock);
+       oldreg = oxygen_read32(chip, OXYGEN_SPDIF_CONTROL);
+       if (value->value.integer.value[0])
+               newreg = oldreg | OXYGEN_SPDIF_LOOPBACK;
+       else
+               newreg = oldreg & ~OXYGEN_SPDIF_LOOPBACK;
+       changed = newreg != oldreg;
+       if (changed)
+               oxygen_write32(chip, OXYGEN_SPDIF_CONTROL, newreg);
+       spin_unlock_irq(&chip->reg_lock);
+       return changed;
+}
+
 static int ac97_switch_get(struct snd_kcontrol *ctl,
                           struct snd_ctl_elem_value *value)
 {
@@ -620,6 +651,13 @@ static const struct snd_kcontrol_new controls[] = {
                .info = spdif_info,
                .get = spdif_input_default_get,
        },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = SNDRV_CTL_NAME_IEC958("Loopback ", NONE, SWITCH),
+               .info = snd_ctl_boolean_mono_info,
+               .get = spdif_loopback_get,
+               .put = spdif_loopback_put,
+       },
 };
 
 static const struct snd_kcontrol_new ac97_controls[] = {
-
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