提交 5dbd5ec6 编写于 作者: T Takashi Iwai

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: NDan Carpenter <error27@gmail.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 9ec8ddad
...@@ -12459,11 +12459,11 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) ...@@ -12459,11 +12459,11 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
unsigned char bits; unsigned char bits;
present = snd_hda_jack_detect(codec, 0x15); 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, 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, 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, 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) ...@@ -13482,11 +13482,11 @@ static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
unsigned char bits; unsigned char bits;
present = snd_hda_jack_detect(codec, 0x15); 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, 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, 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, snd_hda_codec_write(codec, 0x20, 0,
AC_VERB_SET_COEF_INDEX, 0x0c); AC_VERB_SET_COEF_INDEX, 0x0c);
...@@ -13511,11 +13511,11 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec) ...@@ -13511,11 +13511,11 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
/* Check port replicator headphone socket */ /* Check port replicator headphone socket */
present |= snd_hda_jack_detect(codec, 0x1a); 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, 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, 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, snd_hda_codec_write(codec, 0x20, 0,
AC_VERB_SET_COEF_INDEX, 0x0c); AC_VERB_SET_COEF_INDEX, 0x0c);
...@@ -13646,11 +13646,11 @@ static void alc269_speaker_automute(struct hda_codec *codec) ...@@ -13646,11 +13646,11 @@ static void alc269_speaker_automute(struct hda_codec *codec)
unsigned char bits; unsigned char bits;
present = snd_hda_jack_detect(codec, nid); 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, 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, 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 */ /* unsolicited event for HP jack sensing */
...@@ -17115,9 +17115,9 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec) ...@@ -17115,9 +17115,9 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec)
present = snd_hda_jack_detect(codec, 0x21); present = snd_hda_jack_detect(codec, 0x21);
bits = present ? HDA_AMP_MUTE : 0; bits = present ? HDA_AMP_MUTE : 0;
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 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, 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) 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) ...@@ -17128,13 +17128,13 @@ static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
present = snd_hda_jack_detect(codec, 0x21); present = snd_hda_jack_detect(codec, 0x21);
bits = present ? HDA_AMP_MUTE : 0; bits = present ? HDA_AMP_MUTE : 0;
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 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, 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, 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, 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) 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) ...@@ -17145,13 +17145,13 @@ static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
present = snd_hda_jack_detect(codec, 0x15); present = snd_hda_jack_detect(codec, 0x15);
bits = present ? HDA_AMP_MUTE : 0; bits = present ? HDA_AMP_MUTE : 0;
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 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, 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, 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, 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) 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) ...@@ -17190,14 +17190,14 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
if (present1 || present2) { if (present1 || present2) {
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 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, 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 { } else {
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 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, snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
AMP_IN_MUTE(0), 0); HDA_AMP_MUTE, 0);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册