mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
ALSA: hda/generic - Fix wrong initial power state for fixed pins
When the widget power-saving is enabled, the first automute hook invocation checks through the whole pins and it also tries to synchronize the power state. However, this results in a wrong state because it calls unconditionally snd_hda_jack_detect_state(). This patch adds a check of jack detectability before the actual jack detection call. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
2206dc9492
commit
d5ac0100a9
@ -3959,6 +3959,14 @@ static hda_nid_t set_path_power(struct hda_codec *codec, hda_nid_t nid,
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check the jack status for power control */
|
||||||
|
static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin)
|
||||||
|
{
|
||||||
|
if (!is_jack_detectable(codec, pin))
|
||||||
|
return true;
|
||||||
|
return snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT;
|
||||||
|
}
|
||||||
|
|
||||||
/* power up/down the paths of the given pin according to the jack state;
|
/* power up/down the paths of the given pin according to the jack state;
|
||||||
* power = 0/1 : only power up/down if it matches with the jack state,
|
* power = 0/1 : only power up/down if it matches with the jack state,
|
||||||
* < 0 : force power up/down to follow the jack sate
|
* < 0 : force power up/down to follow the jack sate
|
||||||
@ -3973,7 +3981,8 @@ static hda_nid_t set_pin_power_jack(struct hda_codec *codec, hda_nid_t pin,
|
|||||||
if (!codec->power_save_node)
|
if (!codec->power_save_node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
on = snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT;
|
on = detect_pin_state(codec, pin);
|
||||||
|
|
||||||
if (power >= 0 && on != power)
|
if (power >= 0 && on != power)
|
||||||
return 0;
|
return 0;
|
||||||
return set_path_power(codec, pin, on, -1);
|
return set_path_power(codec, pin, on, -1);
|
||||||
@ -4225,8 +4234,7 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
|
|||||||
if (codec->power_save_node) {
|
if (codec->power_save_node) {
|
||||||
bool on = !mute;
|
bool on = !mute;
|
||||||
if (on)
|
if (on)
|
||||||
on = snd_hda_jack_detect_state(codec, nid)
|
on = detect_pin_state(codec, nid);
|
||||||
!= HDA_JACK_NOT_PRESENT;
|
|
||||||
set_path_power(codec, nid, on, -1);
|
set_path_power(codec, nid, on, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user