summaryrefslogtreecommitdiff
path: root/sound/pci/ctxfi/ctmixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ctxfi/ctmixer.c')
-rw-r--r--sound/pci/ctxfi/ctmixer.c73
1 files changed, 70 insertions, 3 deletions
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c
index 496682613db5..fc9fde284fb3 100644
--- a/sound/pci/ctxfi/ctmixer.c
+++ b/sound/pci/ctxfi/ctmixer.c
@@ -547,8 +547,14 @@ static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state)
atc->mic_unmute(atc, state);
else if (MIXER_SPDIFI_C_S == type)
atc->spdif_in_unmute(atc, state);
- else if (MIXER_WAVEF_P_S == type)
- atc->line_front_unmute(atc, state);
+ else if (MIXER_WAVEF_P_S == type) {
+ if (cap.dedicated_rca) {
+ atc->rca_unmute(atc, atc->rca_state ? 0 : state);
+ atc->line_front_unmute(atc, atc->rca_state ? state : 0);
+ } else {
+ atc->line_front_unmute(atc, state);
+ }
+ }
else if (MIXER_WAVES_P_S == type)
atc->line_surround_unmute(atc, state);
else if (MIXER_WAVEC_P_S == type)
@@ -612,6 +618,57 @@ static struct snd_kcontrol_new swh_ctl = {
.put = ct_alsa_mix_switch_put
};
+static int dedicated_rca_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *info)
+{
+ static const char *const names[2] = {
+ "RCA", "Front"
+ };
+
+ return snd_ctl_enum_info(info, 1, 2, names);
+}
+
+static int dedicated_rca_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
+
+ ucontrol->value.enumerated.item[0] = atc->rca_state;
+ return 0;
+}
+
+static int dedicated_rca_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct ct_atc *atc = snd_kcontrol_chip(kcontrol);
+ unsigned int rca_state = ucontrol->value.enumerated.item[0];
+ unsigned char state;
+
+ if (rca_state > 1)
+ return -EINVAL;
+
+ if (rca_state == atc->rca_state)
+ return 0;
+
+ state = get_switch_state(atc->mixer, MIXER_WAVEF_P_S);
+ do_switch(atc, MIXER_WAVEF_P_S, 0);
+
+ atc->rca_state = rca_state;
+ atc->dedicated_rca_select(atc);
+
+ do_switch(atc, MIXER_WAVEF_P_S, state);
+
+ return 1;
+}
+
+static struct snd_kcontrol_new rca_ctl = {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Analog Playback Route",
+ .info = dedicated_rca_info,
+ .get = dedicated_rca_get,
+ .put = dedicated_rca_put,
+};
+
static int ct_spdif_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
@@ -784,7 +841,17 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer)
if (err)
return err;
}
- atc->line_front_unmute(atc, 1);
+
+ if (cap.dedicated_rca) {
+ err = ct_mixer_kcontrol_new(mixer, &rca_ctl);
+ if (err)
+ return err;
+
+ atc->line_front_unmute(atc, 0);
+ atc->rca_unmute(atc, 1);
+ } else {
+ atc->line_front_unmute(atc, 1);
+ }
set_switch_state(mixer, MIXER_WAVEF_P_S, 1);
atc->line_surround_unmute(atc, 0);
set_switch_state(mixer, MIXER_WAVES_P_S, 0);