diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2011-01-10 10:34:15 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-10 10:47:17 -0500 |
commit | 860cffd57acff68e8bc5465f4dd3b7d338fb8e62 (patch) | |
tree | 131003fee909adba5b3c24d08cd8539af1de29cb /sound/pci/oxygen | |
parent | af39917d5a59d82f50bf9f5fadaa53944e5abf76 (diff) |
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>
Diffstat (limited to 'sound/pci/oxygen')
-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, | |||
434 | return 0; | 434 | return 0; |
435 | } | 435 | } |
436 | 436 | ||
437 | static int spdif_loopback_get(struct snd_kcontrol *ctl, | 437 | static int spdif_bit_switch_get(struct snd_kcontrol *ctl, |
438 | struct snd_ctl_elem_value *value) | 438 | struct snd_ctl_elem_value *value) |
439 | { | 439 | { |
440 | struct oxygen *chip = ctl->private_data; | 440 | struct oxygen *chip = ctl->private_data; |
441 | u32 bit = ctl->private_value; | ||
441 | 442 | ||
442 | value->value.integer.value[0] = | 443 | value->value.integer.value[0] = |
443 | !!(oxygen_read32(chip, OXYGEN_SPDIF_CONTROL) | 444 | !!(oxygen_read32(chip, OXYGEN_SPDIF_CONTROL) & bit); |
444 | & OXYGEN_SPDIF_LOOPBACK); | ||
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | static int spdif_loopback_put(struct snd_kcontrol *ctl, | 448 | static int spdif_bit_switch_put(struct snd_kcontrol *ctl, |
449 | struct snd_ctl_elem_value *value) | 449 | struct snd_ctl_elem_value *value) |
450 | { | 450 | { |
451 | struct oxygen *chip = ctl->private_data; | 451 | struct oxygen *chip = ctl->private_data; |
452 | u32 bit = ctl->private_value; | ||
452 | u32 oldreg, newreg; | 453 | u32 oldreg, newreg; |
453 | int changed; | 454 | int changed; |
454 | 455 | ||
455 | spin_lock_irq(&chip->reg_lock); | 456 | spin_lock_irq(&chip->reg_lock); |
456 | oldreg = oxygen_read32(chip, OXYGEN_SPDIF_CONTROL); | 457 | oldreg = oxygen_read32(chip, OXYGEN_SPDIF_CONTROL); |
457 | if (value->value.integer.value[0]) | 458 | if (value->value.integer.value[0]) |
458 | newreg = oldreg | OXYGEN_SPDIF_LOOPBACK; | 459 | newreg = oldreg | bit; |
459 | else | 460 | else |
460 | newreg = oldreg & ~OXYGEN_SPDIF_LOOPBACK; | 461 | newreg = oldreg & ~bit; |
461 | changed = newreg != oldreg; | 462 | changed = newreg != oldreg; |
462 | if (changed) | 463 | if (changed) |
463 | oxygen_write32(chip, OXYGEN_SPDIF_CONTROL, newreg); | 464 | oxygen_write32(chip, OXYGEN_SPDIF_CONTROL, newreg); |
@@ -835,8 +836,17 @@ static const struct snd_kcontrol_new spdif_input_controls[] = { | |||
835 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
836 | .name = SNDRV_CTL_NAME_IEC958("Loopback ", NONE, SWITCH), | 837 | .name = SNDRV_CTL_NAME_IEC958("Loopback ", NONE, SWITCH), |
837 | .info = snd_ctl_boolean_mono_info, | 838 | .info = snd_ctl_boolean_mono_info, |
838 | .get = spdif_loopback_get, | 839 | .get = spdif_bit_switch_get, |
839 | .put = spdif_loopback_put, | 840 | .put = spdif_bit_switch_put, |
841 | .private_value = OXYGEN_SPDIF_LOOPBACK, | ||
842 | }, | ||
843 | { | ||
844 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
845 | .name = SNDRV_CTL_NAME_IEC958("Validity Check ",CAPTURE,SWITCH), | ||
846 | .info = snd_ctl_boolean_mono_info, | ||
847 | .get = spdif_bit_switch_get, | ||
848 | .put = spdif_bit_switch_put, | ||
849 | .private_value = OXYGEN_SPDIF_SPDVALID, | ||
840 | }, | 850 | }, |
841 | }; | 851 | }; |
842 | 852 | ||