aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorMatthew Ranostay <mranostay@embeddedalley.com>2008-09-27 18:13:47 -0400
committerJaroslav Kysela <perex@perex.cz>2008-10-10 07:41:43 -0400
commit00ef50c242f05381cd3fbf56bbda28155cbbb7c8 (patch)
tree903055d629c09a1e5af8ec1f955614f78af47510 /sound/pci
parentf3911c5ab93e4295938b2013104d2986ea601454 (diff)
ALSA: hda: SPDIF stream muting support
Added support for muting S/DPIF outs using the 'Digital Playback Source' muxs on supporting codecs. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_sigmatel.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f9b256388921..05661f7f3ce1 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -138,6 +138,7 @@ struct sigmatel_spec {
138 unsigned int mic_switch: 1; 138 unsigned int mic_switch: 1;
139 unsigned int alt_switch: 1; 139 unsigned int alt_switch: 1;
140 unsigned int hp_detect: 1; 140 unsigned int hp_detect: 1;
141 unsigned int spdif_mute: 1;
141 142
142 /* gpio lines */ 143 /* gpio lines */
143 unsigned int eapd_mask; 144 unsigned int eapd_mask;
@@ -547,10 +548,32 @@ static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol,
547{ 548{
548 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
549 struct sigmatel_spec *spec = codec->spec; 550 struct sigmatel_spec *spec = codec->spec;
551 struct hda_input_mux *smux = &spec->private_smux;
550 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 552 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
553 int err, val;
554 hda_nid_t nid;
551 555
552 return snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, 556 err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol,
553 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); 557 spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]);
558 if (err < 0)
559 return err;
560
561 if (spec->spdif_mute) {
562 if (smux_idx == 0)
563 nid = spec->multiout.dig_out_nid;
564 else
565 nid = codec->slave_dig_outs[smux_idx - 1];
566 if (spec->cur_smux[smux_idx] == smux->num_items - 1)
567 val = AMP_OUT_MUTE;
568 if (smux_idx == 0)
569 nid = spec->multiout.dig_out_nid;
570 else
571 nid = codec->slave_dig_outs[smux_idx - 1];
572 /* un/mute SPDIF out */
573 snd_hda_codec_write_cache(codec, nid, 0,
574 AC_VERB_SET_AMP_GAIN_MUTE, val);
575 }
576 return 0;
554} 577}
555 578
556static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 579static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
@@ -1228,6 +1251,15 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1228 return err; 1251 return err;
1229 } 1252 }
1230 if (spec->num_smuxes > 0) { 1253 if (spec->num_smuxes > 0) {
1254 int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid);
1255 struct hda_input_mux *smux = &spec->private_smux;
1256 /* check for mute support on SPDIF out */
1257 if (wcaps & AC_WCAP_OUT_AMP) {
1258 smux->items[smux->num_items].label = "Off";
1259 smux->items[smux->num_items].index = 0;
1260 smux->num_items++;
1261 spec->spdif_mute = 1;
1262 }
1231 stac_smux_mixer.count = spec->num_smuxes; 1263 stac_smux_mixer.count = spec->num_smuxes;
1232 err = snd_ctl_add(codec->bus->card, 1264 err = snd_ctl_add(codec->bus->card,
1233 snd_ctl_new1(&stac_smux_mixer, codec)); 1265 snd_ctl_new1(&stac_smux_mixer, codec));
@@ -4377,7 +4409,6 @@ again:
4377 4409
4378 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); 4410 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids);
4379 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); 4411 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
4380 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
4381 4412
4382 switch (spec->board_config) { 4413 switch (spec->board_config) {
4383 case STAC_HP_M4: 4414 case STAC_HP_M4: