mirror of https://gitee.com/openkylin/linux.git
[ALSA] hda-codec - Fix the initial mixer state of ALC262 sony-assamd model
Many of ALC262 codes don't call the automute function at the beginning, which may keep the silence until the HP jack is replugged. Now proper init_hook is added. Also, sony-assamd model doesn't handle the widget 0x14 properly, thus calling automute isn't enough. Now Front switch handles both widgets. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
parent
b87c464ea2
commit
5b31954e4b
|
@ -7140,9 +7140,28 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
|
||||||
{ } /* end */
|
{ } /* end */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int alc262_sony_sw_put(struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
unsigned long private_save = kcontrol->private_value;
|
||||||
|
int change;
|
||||||
|
kcontrol->private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT);
|
||||||
|
change = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
|
||||||
|
kcontrol->private_value = private_save;
|
||||||
|
change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
static struct snd_kcontrol_new alc262_sony_mixer[] = {
|
static struct snd_kcontrol_new alc262_sony_mixer[] = {
|
||||||
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
|
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
|
||||||
HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
|
{
|
||||||
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.name = "Front Playback Switch",
|
||||||
|
.info = snd_hda_mixer_amp_switch_info,
|
||||||
|
.get = snd_hda_mixer_amp_switch_get,
|
||||||
|
.put = alc262_sony_sw_put,
|
||||||
|
.private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
|
||||||
|
},
|
||||||
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
|
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
|
||||||
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
|
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
|
||||||
HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
|
HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
|
||||||
|
@ -7269,20 +7288,17 @@ static struct hda_verb alc262_sony_unsol_verbs[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* mute/unmute internal speaker according to the hp jack and mute state */
|
/* mute/unmute internal speaker according to the hp jack and mute state */
|
||||||
static void alc262_hippo_automute(struct hda_codec *codec, int force)
|
static void alc262_hippo_automute(struct hda_codec *codec)
|
||||||
{
|
{
|
||||||
struct alc_spec *spec = codec->spec;
|
struct alc_spec *spec = codec->spec;
|
||||||
unsigned int mute;
|
unsigned int mute;
|
||||||
|
unsigned int present;
|
||||||
|
|
||||||
if (force || !spec->sense_updated) {
|
/* need to execute and sync at first */
|
||||||
unsigned int present;
|
snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
|
||||||
/* need to execute and sync at first */
|
present = snd_hda_codec_read(codec, 0x15, 0,
|
||||||
snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
|
AC_VERB_GET_PIN_SENSE, 0);
|
||||||
present = snd_hda_codec_read(codec, 0x15, 0,
|
spec->jack_present = (present & 0x80000000) != 0;
|
||||||
AC_VERB_GET_PIN_SENSE, 0);
|
|
||||||
spec->jack_present = (present & 0x80000000) != 0;
|
|
||||||
spec->sense_updated = 1;
|
|
||||||
}
|
|
||||||
if (spec->jack_present) {
|
if (spec->jack_present) {
|
||||||
/* mute internal speaker */
|
/* mute internal speaker */
|
||||||
snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
|
snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
|
||||||
|
@ -7306,24 +7322,19 @@ static void alc262_hippo_unsol_event(struct hda_codec *codec,
|
||||||
{
|
{
|
||||||
if ((res >> 26) != ALC880_HP_EVENT)
|
if ((res >> 26) != ALC880_HP_EVENT)
|
||||||
return;
|
return;
|
||||||
alc262_hippo_automute(codec, 1);
|
alc262_hippo_automute(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void alc262_hippo1_automute(struct hda_codec *codec, int force)
|
static void alc262_hippo1_automute(struct hda_codec *codec)
|
||||||
{
|
{
|
||||||
struct alc_spec *spec = codec->spec;
|
|
||||||
unsigned int mute;
|
unsigned int mute;
|
||||||
|
unsigned int present;
|
||||||
|
|
||||||
if (force || !spec->sense_updated) {
|
snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
|
||||||
unsigned int present;
|
present = snd_hda_codec_read(codec, 0x1b, 0,
|
||||||
/* need to execute and sync at first */
|
AC_VERB_GET_PIN_SENSE, 0);
|
||||||
snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
|
present = (present & 0x80000000) != 0;
|
||||||
present = snd_hda_codec_read(codec, 0x1b, 0,
|
if (present) {
|
||||||
AC_VERB_GET_PIN_SENSE, 0);
|
|
||||||
spec->jack_present = (present & 0x80000000) != 0;
|
|
||||||
spec->sense_updated = 1;
|
|
||||||
}
|
|
||||||
if (spec->jack_present) {
|
|
||||||
/* mute internal speaker */
|
/* mute internal speaker */
|
||||||
snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
|
snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
|
||||||
0x80, 0x80);
|
0x80, 0x80);
|
||||||
|
@ -7346,7 +7357,7 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
|
||||||
{
|
{
|
||||||
if ((res >> 26) != ALC880_HP_EVENT)
|
if ((res >> 26) != ALC880_HP_EVENT)
|
||||||
return;
|
return;
|
||||||
alc262_hippo1_automute(codec, 1);
|
alc262_hippo1_automute(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7923,6 +7934,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
|
||||||
SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
|
SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
|
||||||
SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
|
SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
|
||||||
SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
|
SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
|
||||||
|
SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
|
||||||
SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
|
SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
|
||||||
SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
|
SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
|
||||||
SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
|
SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
|
||||||
|
@ -7951,6 +7963,7 @@ static struct alc_config_preset alc262_presets[] = {
|
||||||
.channel_mode = alc262_modes,
|
.channel_mode = alc262_modes,
|
||||||
.input_mux = &alc262_capture_source,
|
.input_mux = &alc262_capture_source,
|
||||||
.unsol_event = alc262_hippo_unsol_event,
|
.unsol_event = alc262_hippo_unsol_event,
|
||||||
|
.init_hook = alc262_hippo_automute,
|
||||||
},
|
},
|
||||||
[ALC262_HIPPO_1] = {
|
[ALC262_HIPPO_1] = {
|
||||||
.mixers = { alc262_hippo1_mixer },
|
.mixers = { alc262_hippo1_mixer },
|
||||||
|
@ -7963,6 +7976,7 @@ static struct alc_config_preset alc262_presets[] = {
|
||||||
.channel_mode = alc262_modes,
|
.channel_mode = alc262_modes,
|
||||||
.input_mux = &alc262_capture_source,
|
.input_mux = &alc262_capture_source,
|
||||||
.unsol_event = alc262_hippo1_unsol_event,
|
.unsol_event = alc262_hippo1_unsol_event,
|
||||||
|
.init_hook = alc262_hippo1_automute,
|
||||||
},
|
},
|
||||||
[ALC262_FUJITSU] = {
|
[ALC262_FUJITSU] = {
|
||||||
.mixers = { alc262_fujitsu_mixer },
|
.mixers = { alc262_fujitsu_mixer },
|
||||||
|
@ -8027,6 +8041,7 @@ static struct alc_config_preset alc262_presets[] = {
|
||||||
.channel_mode = alc262_modes,
|
.channel_mode = alc262_modes,
|
||||||
.input_mux = &alc262_capture_source,
|
.input_mux = &alc262_capture_source,
|
||||||
.unsol_event = alc262_hippo_unsol_event,
|
.unsol_event = alc262_hippo_unsol_event,
|
||||||
|
.init_hook = alc262_hippo_automute,
|
||||||
},
|
},
|
||||||
[ALC262_BENQ_T31] = {
|
[ALC262_BENQ_T31] = {
|
||||||
.mixers = { alc262_benq_t31_mixer },
|
.mixers = { alc262_benq_t31_mixer },
|
||||||
|
@ -8038,6 +8053,7 @@ static struct alc_config_preset alc262_presets[] = {
|
||||||
.channel_mode = alc262_modes,
|
.channel_mode = alc262_modes,
|
||||||
.input_mux = &alc262_capture_source,
|
.input_mux = &alc262_capture_source,
|
||||||
.unsol_event = alc262_hippo_unsol_event,
|
.unsol_event = alc262_hippo_unsol_event,
|
||||||
|
.init_hook = alc262_hippo_automute,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue