Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01fdf180 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Fix auto-parse of SPDIF input of Realtek codecs



The SPDIF in audio widget must be searched through the list as the widget
that contains the given pin as the connection source.  The current code
was implemented in a reverse way.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0f9f1ee9
Loading
Loading
Loading
Loading
+16 −6
Original line number Original line Diff line number Diff line
@@ -1594,12 +1594,22 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
	}
	}
	if (spec->autocfg.dig_in_pin) {
	if (spec->autocfg.dig_in_pin) {
		hda_nid_t dig_nid;
		dig_nid = codec->start_nid;
		err = snd_hda_get_connections(codec,
		for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
					      spec->autocfg.dig_in_pin,
			unsigned int wcaps = get_wcaps(codec, dig_nid);
					      &dig_nid, 1);
			if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
		if (err > 0)
				continue;
			if (!(wcaps & AC_WCAP_DIGITAL))
				continue;
			if (!(wcaps & AC_WCAP_CONN_LIST))
				continue;
			err = get_connection_index(codec, dig_nid,
						   spec->autocfg.dig_in_pin);
			if (err >= 0) {
				spec->dig_in_nid = dig_nid;
				spec->dig_in_nid = dig_nid;
				break;
			}
		}
	}
	}
}
}