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

Commit 5dbd5ec6 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Fix invalid bit values passed to snd_hda_codec_amp_stereo()



The mask and value parameters passed to snd_hda_codec_amp_stereo()
should be 8-bit values for mute and volume.  Passing AMP_IN_MUTE() is
wrong, which is found in many places in patch_realtek.c as a left-over
from the conversion to snd_hda_codec_amp_stereo().

Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9ec8ddad
Loading
Loading
Loading
Loading
+26 −26
Original line number Diff line number Diff line
@@ -12459,11 +12459,11 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
	unsigned char bits;
	present = snd_hda_jack_detect(codec, 0x15);
	bits = present ? AMP_IN_MUTE(0) : 0;
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
}
static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
@@ -13482,11 +13482,11 @@ static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
	unsigned char bits;
	present = snd_hda_jack_detect(codec, 0x15);
	bits = present ? AMP_IN_MUTE(0) : 0;
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
			AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
			AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_write(codec, 0x20, 0,
			AC_VERB_SET_COEF_INDEX, 0x0c);
@@ -13511,11 +13511,11 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
	/* Check port replicator headphone socket */
	present |= snd_hda_jack_detect(codec, 0x1a);
	bits = present ? AMP_IN_MUTE(0) : 0;
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
			AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
			AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_write(codec, 0x20, 0,
			AC_VERB_SET_COEF_INDEX, 0x0c);
@@ -13646,11 +13646,11 @@ static void alc269_speaker_automute(struct hda_codec *codec)
	unsigned char bits;
	present = snd_hda_jack_detect(codec, nid);
	bits = present ? AMP_IN_MUTE(0) : 0;
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
}
/* unsolicited event for HP jack sensing */
@@ -17115,9 +17115,9 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec)
	present = snd_hda_jack_detect(codec, 0x21);
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
}
static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
@@ -17128,13 +17128,13 @@ static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
	present = snd_hda_jack_detect(codec, 0x21);
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
}
static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
@@ -17145,13 +17145,13 @@ static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
	present = snd_hda_jack_detect(codec, 0x15);
	bits = present ? HDA_AMP_MUTE : 0;
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
	snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
				AMP_IN_MUTE(0), bits);
				 HDA_AMP_MUTE, bits);
}
static void alc662_f5z_speaker_automute(struct hda_codec *codec)
@@ -17190,14 +17190,14 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
	if (present1 || present2) {
		snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
				AMP_IN_MUTE(0), AMP_IN_MUTE(0));
					 HDA_AMP_MUTE, HDA_AMP_MUTE);
		snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
				AMP_IN_MUTE(0), AMP_IN_MUTE(0));
					 HDA_AMP_MUTE, HDA_AMP_MUTE);
	} else {
		snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
				AMP_IN_MUTE(0), 0);
					 HDA_AMP_MUTE, 0);
		snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
				AMP_IN_MUTE(0), 0);
					 HDA_AMP_MUTE, 0);
	}
}