diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2011-01-10 16:34:15 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-10 16:47:17 +0100 |
commit | 860cffd57acff68e8bc5465f4dd3b7d338fb8e62 (patch) | |
tree | 131003fee909adba5b3c24d08cd8539af1de29cb | |
parent | af39917d5a59d82f50bf9f5fadaa53944e5abf76 (diff) | |
download | blackbird-op-linux-860cffd57acff68e8bc5465f4dd3b7d338fb8e62.tar.gz blackbird-op-linux-860cffd57acff68e8bc5465f4dd3b7d338fb8e62.zip |
ALSA: oxygen: add digital input validity check switch
Add a mixer control to prevent capturing S/PDIF samples that are not
marked as valid (non-audio or corrupted samples).
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 821df1c9d1d0..9bff14d5895d 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c @@ -434,30 +434,31 @@ 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) +static int spdif_bit_switch_get(struct snd_kcontrol *ctl, + struct snd_ctl_elem_value *value) { struct oxygen *chip = ctl->private_data; + u32 bit = ctl->private_value; value->value.integer.value[0] = - !!(oxygen_read32(chip, OXYGEN_SPDIF_CONTROL) - & OXYGEN_SPDIF_LOOPBACK); + !!(oxygen_read32(chip, OXYGEN_SPDIF_CONTROL) & bit); return 0; } -static int spdif_loopback_put(struct snd_kcontrol *ctl, - struct snd_ctl_elem_value *value) +static int spdif_bit_switch_put(struct snd_kcontrol *ctl, + struct snd_ctl_elem_value *value) { struct oxygen *chip = ctl->private_data; + u32 bit = ctl->private_value; 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; + newreg = oldreg | bit; else - newreg = oldreg & ~OXYGEN_SPDIF_LOOPBACK; + newreg = oldreg & ~bit; changed = newreg != oldreg; if (changed) oxygen_write32(chip, OXYGEN_SPDIF_CONTROL, newreg); @@ -835,8 +836,17 @@ static const struct snd_kcontrol_new spdif_input_controls[] = { .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, + .get = spdif_bit_switch_get, + .put = spdif_bit_switch_put, + .private_value = OXYGEN_SPDIF_LOOPBACK, + }, + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = SNDRV_CTL_NAME_IEC958("Validity Check ",CAPTURE,SWITCH), + .info = snd_ctl_boolean_mono_info, + .get = spdif_bit_switch_get, + .put = spdif_bit_switch_put, + .private_value = OXYGEN_SPDIF_SPDVALID, }, }; |