Commit 02f21c9d authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela

[ALSA] oxygen: add SPDIF loopback control

Add a mixer control for the SPDIF loopback function.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 08c8efe6
...@@ -408,6 +408,37 @@ static int spdif_input_default_get(struct snd_kcontrol *ctl, ...@@ -408,6 +408,37 @@ static int spdif_input_default_get(struct snd_kcontrol *ctl,
return 0; 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, static int ac97_switch_get(struct snd_kcontrol *ctl,
struct snd_ctl_elem_value *value) struct snd_ctl_elem_value *value)
{ {
...@@ -620,6 +651,13 @@ static const struct snd_kcontrol_new controls[] = { ...@@ -620,6 +651,13 @@ static const struct snd_kcontrol_new controls[] = {
.info = spdif_info, .info = spdif_info,
.get = spdif_input_default_get, .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[] = { static const struct snd_kcontrol_new ac97_controls[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment