Commit de5d674c authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'fix/hda' into for-linus

* fix/hda:
  ALSA: hda - Fix mute control with some ALC262 models
  ALSA: hda - Restore GPIO1 properly at resume with AD1984A
  ALSA: hda - Use snprintf() to be safer
parents f35e2965 8de56b7d
...@@ -3754,7 +3754,7 @@ static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -3754,7 +3754,7 @@ static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol,
int mute = (!ucontrol->value.integer.value[0] && int mute = (!ucontrol->value.integer.value[0] &&
!ucontrol->value.integer.value[1]); !ucontrol->value.integer.value[1]);
/* toggle GPIO1 according to the mute state */ /* toggle GPIO1 according to the mute state */
snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
mute ? 0x02 : 0x0); mute ? 0x02 : 0x0);
return ret; return ret;
} }
......
...@@ -10631,6 +10631,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, ...@@ -10631,6 +10631,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
alc262_lenovo_3000_automute(codec, 1); alc262_lenovo_3000_automute(codec, 1);
} }
static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
int dir, int idx, long *valp)
{
int i, change = 0;
for (i = 0; i < 2; i++, valp++)
change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
HDA_AMP_MUTE,
*valp ? 0 : HDA_AMP_MUTE);
return change;
}
/* bind hp and internal speaker mute (with plug check) */ /* bind hp and internal speaker mute (with plug check) */
static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
...@@ -10639,13 +10651,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -10639,13 +10651,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
long *valp = ucontrol->value.integer.value; long *valp = ucontrol->value.integer.value;
int change; int change;
change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
HDA_AMP_MUTE, change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
valp ? 0 : HDA_AMP_MUTE);
change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
HDA_AMP_MUTE,
valp ? 0 : HDA_AMP_MUTE);
if (change) if (change)
alc262_fujitsu_automute(codec, 0); alc262_fujitsu_automute(codec, 0);
return change; return change;
...@@ -10680,10 +10687,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -10680,10 +10687,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
long *valp = ucontrol->value.integer.value; long *valp = ucontrol->value.integer.value;
int change; int change;
change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
HDA_AMP_MUTE,
valp ? 0 : HDA_AMP_MUTE);
if (change) if (change)
alc262_lenovo_3000_automute(codec, 0); alc262_lenovo_3000_automute(codec, 0);
return change; return change;
...@@ -11854,12 +11858,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -11854,12 +11858,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
long *valp = ucontrol->value.integer.value; long *valp = ucontrol->value.integer.value;
int change; int change;
change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
HDA_AMP_MUTE,
valp[0] ? 0 : HDA_AMP_MUTE);
change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
HDA_AMP_MUTE,
valp[1] ? 0 : HDA_AMP_MUTE);
if (change) if (change)
alc268_acer_automute(codec, 0); alc268_acer_automute(codec, 0);
return change; return change;
......
...@@ -4066,7 +4066,7 @@ static int stac92xx_add_jack(struct hda_codec *codec, ...@@ -4066,7 +4066,7 @@ static int stac92xx_add_jack(struct hda_codec *codec,
jack->nid = nid; jack->nid = nid;
jack->type = type; jack->type = type;
sprintf(name, "%s at %s %s Jack", snprintf(name, sizeof(name), "%s at %s %s Jack",
snd_hda_get_jack_type(def_conf), snd_hda_get_jack_type(def_conf),
snd_hda_get_jack_connectivity(def_conf), snd_hda_get_jack_connectivity(def_conf),
snd_hda_get_jack_location(def_conf)); snd_hda_get_jack_location(def_conf));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment