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

Commit 6942c103 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Skip pin capability sanity check for bogus values



Some old codecs like ALC880 seem to give a bogus pin capability value 0
occasionally.  This breaks the new sanity check in snd_hda_set_pin_ctl().
Skip the sanity checks in such a case.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4740860b
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -4827,14 +4827,14 @@ int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin,
{
{
	if (val) {
	if (val) {
		unsigned int cap = snd_hda_query_pin_caps(codec, pin);
		unsigned int cap = snd_hda_query_pin_caps(codec, pin);
		if (val & AC_PINCTL_OUT_EN) {
		if (cap && (val & AC_PINCTL_OUT_EN)) {
			if (!(cap & AC_PINCAP_OUT))
			if (!(cap & AC_PINCAP_OUT))
				val &= ~(AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
				val &= ~(AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
			else if ((val & AC_PINCTL_HP_EN) &&
			else if ((val & AC_PINCTL_HP_EN) &&
				 !(cap & AC_PINCAP_HP_DRV))
				 !(cap & AC_PINCAP_HP_DRV))
				val &= ~AC_PINCTL_HP_EN;
				val &= ~AC_PINCTL_HP_EN;
		}
		}
		if (val & AC_PINCTL_IN_EN) {
		if (cap && (val & AC_PINCTL_IN_EN)) {
			if (!(cap & AC_PINCAP_IN))
			if (!(cap & AC_PINCAP_IN))
				val &= ~(AC_PINCTL_IN_EN | AC_PINCTL_VREFEN);
				val &= ~(AC_PINCTL_IN_EN | AC_PINCTL_VREFEN);
		}
		}