浏览代码

ALSA: hda - Fix surround-volume parsing for VT1708B codecs

The surround/CLFE/side DACs on VT1708B and co have no amp but the
connected selector widgets have the amp instead.  Fix the parser to
check these selector widgets for the possible mixer controls as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 14 年之前
父节点
当前提交
a934d5a983
共有 1 个文件被更改,包括 16 次插入3 次删除
  1. 16 3
      sound/pci/hda/patch_via.c

+ 16 - 3
sound/pci/hda/patch_via.c

@@ -407,7 +407,10 @@ static int __get_connection_index(struct hda_codec *codec, hda_nid_t mux,
 static bool check_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
 static bool check_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
 			   unsigned int mask)
 			   unsigned int mask)
 {
 {
-	unsigned int caps = get_wcaps(codec, nid);
+	unsigned int caps;
+	if (!nid)
+		return false;
+	caps = get_wcaps(codec, nid);
 	if (dir == HDA_INPUT)
 	if (dir == HDA_INPUT)
 		caps &= AC_WCAP_IN_AMP;
 		caps &= AC_WCAP_IN_AMP;
 	else
 	else
@@ -1635,13 +1638,21 @@ static int create_ch_ctls(struct hda_codec *codec, const char *pfx,
 {
 {
 	struct via_spec *spec = codec->spec;
 	struct via_spec *spec = codec->spec;
 	char name[32];
 	char name[32];
-	hda_nid_t nid;
-	int err;
+	hda_nid_t nid, sel, conn[8];
+	int nums, err;
+
+	/* check selector widget connected to the pin */
+	sel = 0;
+	nums = snd_hda_get_connections(codec, pin, conn, ARRAY_SIZE(conn));
+	if (nums == 1 && conn[0] != pin)
+		sel = conn[0];
 
 
 	if (dac && check_amp_caps(codec, dac, HDA_OUTPUT, AC_AMPCAP_NUM_STEPS))
 	if (dac && check_amp_caps(codec, dac, HDA_OUTPUT, AC_AMPCAP_NUM_STEPS))
 		nid = dac;
 		nid = dac;
 	else if (check_amp_caps(codec, pin, HDA_OUTPUT, AC_AMPCAP_NUM_STEPS))
 	else if (check_amp_caps(codec, pin, HDA_OUTPUT, AC_AMPCAP_NUM_STEPS))
 		nid = pin;
 		nid = pin;
+	else if (check_amp_caps(codec, sel, HDA_OUTPUT, AC_AMPCAP_NUM_STEPS))
+		nid = sel;
 	else
 	else
 		nid = 0;
 		nid = 0;
 	if (nid) {
 	if (nid) {
@@ -1656,6 +1667,8 @@ static int create_ch_ctls(struct hda_codec *codec, const char *pfx,
 		nid = dac;
 		nid = dac;
 	else if (check_amp_caps(codec, pin, HDA_OUTPUT, AC_AMPCAP_MUTE))
 	else if (check_amp_caps(codec, pin, HDA_OUTPUT, AC_AMPCAP_MUTE))
 		nid = pin;
 		nid = pin;
+	else if (check_amp_caps(codec, sel, HDA_OUTPUT, AC_AMPCAP_MUTE))
+		nid = sel;
 	else
 	else
 		nid = 0;
 		nid = 0;
 	if (nid) {
 	if (nid) {