Commit c38217e1 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

ALSA: hda - Fix EAPD vmaster hook for AD1884 & co

commit 8f0b3b7e upstream.

ad1884_fixup_hp_eapd() tries to set the NID for controlling the
speaker EAPD from the pin configuration.  But the current code can't
work expectedly since it sets spec->eapd_nid before calling the
generic parser where the autocfg pins are set up.

This patch changes the function to set spec->eapd_nid after the
generic parser call while it sets vmaster hook unconditionally.  The
spec->eapd_nid check is moved in the hook function itself instead.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 79d295ce
...@@ -2112,6 +2112,9 @@ static void ad_vmaster_eapd_hook(void *private_data, int enabled) ...@@ -2112,6 +2112,9 @@ static void ad_vmaster_eapd_hook(void *private_data, int enabled)
{ {
struct hda_codec *codec = private_data; struct hda_codec *codec = private_data;
struct ad198x_spec *spec = codec->spec; struct ad198x_spec *spec = codec->spec;
if (!spec->eapd_nid)
return;
snd_hda_codec_update_cache(codec, spec->eapd_nid, 0, snd_hda_codec_update_cache(codec, spec->eapd_nid, 0,
AC_VERB_SET_EAPD_BTLENABLE, AC_VERB_SET_EAPD_BTLENABLE,
enabled ? 0x02 : 0x00); enabled ? 0x02 : 0x00);
...@@ -3601,13 +3604,16 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec, ...@@ -3601,13 +3604,16 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec,
{ {
struct ad198x_spec *spec = codec->spec; struct ad198x_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE) { switch (action) {
case HDA_FIXUP_ACT_PRE_PROBE:
spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
break;
case HDA_FIXUP_ACT_PROBE:
if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
spec->eapd_nid = spec->gen.autocfg.line_out_pins[0]; spec->eapd_nid = spec->gen.autocfg.line_out_pins[0];
else else
spec->eapd_nid = spec->gen.autocfg.speaker_pins[0]; spec->eapd_nid = spec->gen.autocfg.speaker_pins[0];
if (spec->eapd_nid) break;
spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
} }
} }
......
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