|
@@ -1713,6 +1713,65 @@ static int snd_hdsp_put_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_e
|
|
|
return change;
|
|
|
}
|
|
|
|
|
|
+#define HDSP_TOGGLE_SETTING(xname, xindex) \
|
|
|
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
|
|
+ .name = xname, \
|
|
|
+ .private_value = xindex, \
|
|
|
+ .info = snd_hdsp_info_toggle_setting, \
|
|
|
+ .get = snd_hdsp_get_toggle_setting, \
|
|
|
+ .put = snd_hdsp_put_toggle_setting \
|
|
|
+}
|
|
|
+
|
|
|
+static int hdsp_toggle_setting(struct hdsp *hdsp, u32 regmask)
|
|
|
+{
|
|
|
+ return (hdsp->control_register & regmask) ? 1 : 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int hdsp_set_toggle_setting(struct hdsp *hdsp, u32 regmask, int out)
|
|
|
+{
|
|
|
+ if (out)
|
|
|
+ hdsp->control_register |= regmask;
|
|
|
+ else
|
|
|
+ hdsp->control_register &= ~regmask;
|
|
|
+ hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+#define snd_hdsp_info_toggle_setting snd_ctl_boolean_mono_info
|
|
|
+
|
|
|
+static int snd_hdsp_get_toggle_setting(struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
|
|
|
+ u32 regmask = kcontrol->private_value;
|
|
|
+
|
|
|
+ spin_lock_irq(&hdsp->lock);
|
|
|
+ ucontrol->value.integer.value[0] = hdsp_toggle_setting(hdsp, regmask);
|
|
|
+ spin_unlock_irq(&hdsp->lock);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int snd_hdsp_put_toggle_setting(struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
|
|
|
+ u32 regmask = kcontrol->private_value;
|
|
|
+ int change;
|
|
|
+ unsigned int val;
|
|
|
+
|
|
|
+ if (!snd_hdsp_use_is_exclusive(hdsp))
|
|
|
+ return -EBUSY;
|
|
|
+ val = ucontrol->value.integer.value[0] & 1;
|
|
|
+ spin_lock_irq(&hdsp->lock);
|
|
|
+ change = (int) val != hdsp_toggle_setting(hdsp, regmask);
|
|
|
+ if (change)
|
|
|
+ hdsp_set_toggle_setting(hdsp, regmask, val);
|
|
|
+ spin_unlock_irq(&hdsp->lock);
|
|
|
+ return change;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
#define HDSP_SPDIF_OUT(xname, xindex) \
|
|
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
|
|
|
.info = snd_hdsp_info_spdif_bits, \
|