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

ALSA: hda - Fix invalid pin powermap without jack detection

commit 7a9744cb upstream.

When a driver is set up without the jack detection explicitly (either
by passing a model option or via a specific fixup), the pin powermap
of IDT/STAC codecs is set up wrongly, resulting in the silence
output.  It's because of a logic failure in stac_init_power_map().
It tries to avoid creating a callback for the pins that have other
auto-hp and auto-mic callbacks, but the check is done in a wrong way
at a wrong time.  The stac_init_power_map() should be called after
creating other jack detection ctls, and the jack callback should be
created only for jack-detectable widgets.

This patch fixes the check in stac_init_power_map() and its callee
at the right place, after snd_hda_gen_build_controls().
Reported-by: default avatarAdam Richter <adam_richter2004@yahoo.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 26f3f4fd
...@@ -565,8 +565,8 @@ static void stac_init_power_map(struct hda_codec *codec) ...@@ -565,8 +565,8 @@ static void stac_init_power_map(struct hda_codec *codec)
if (snd_hda_jack_tbl_get(codec, nid)) if (snd_hda_jack_tbl_get(codec, nid))
continue; continue;
if (def_conf == AC_JACK_PORT_COMPLEX && if (def_conf == AC_JACK_PORT_COMPLEX &&
!(spec->vref_mute_led_nid == nid || spec->vref_mute_led_nid != nid &&
is_jack_detectable(codec, nid))) { is_jack_detectable(codec, nid)) {
snd_hda_jack_detect_enable_callback(codec, nid, snd_hda_jack_detect_enable_callback(codec, nid,
STAC_PWR_EVENT, STAC_PWR_EVENT,
jack_update_power); jack_update_power);
...@@ -4263,11 +4263,18 @@ static int stac_parse_auto_config(struct hda_codec *codec) ...@@ -4263,11 +4263,18 @@ static int stac_parse_auto_config(struct hda_codec *codec)
return err; return err;
} }
stac_init_power_map(codec);
return 0; return 0;
} }
static int stac_build_controls(struct hda_codec *codec)
{
int err = snd_hda_gen_build_controls(codec);
if (err < 0)
return err;
stac_init_power_map(codec);
return 0;
}
static int stac_init(struct hda_codec *codec) static int stac_init(struct hda_codec *codec)
{ {
...@@ -4379,7 +4386,7 @@ static int stac_suspend(struct hda_codec *codec) ...@@ -4379,7 +4386,7 @@ static int stac_suspend(struct hda_codec *codec)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static const struct hda_codec_ops stac_patch_ops = { static const struct hda_codec_ops stac_patch_ops = {
.build_controls = snd_hda_gen_build_controls, .build_controls = stac_build_controls,
.build_pcms = snd_hda_gen_build_pcms, .build_pcms = snd_hda_gen_build_pcms,
.init = stac_init, .init = stac_init,
.free = stac_free, .free = stac_free,
......
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