diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-04-09 04:21:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-09 04:33:44 -0400 |
commit | d5ac0100a9027bdf488cf20247b1041f26f796f3 (patch) | |
tree | 0ff84a125b7a94f929824cd3dca9873e1c3271d8 /sound/pci | |
parent | 2206dc949286fe0010c69213d3d8b4c53e6a2295 (diff) |
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>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_generic.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index afc6b1b0898c..46b559832d2c 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -3959,6 +3959,14 @@ static hda_nid_t set_path_power(struct hda_codec *codec, hda_nid_t nid, | |||
3959 | return changed; | 3959 | return changed; |
3960 | } | 3960 | } |
3961 | 3961 | ||
3962 | /* check the jack status for power control */ | ||
3963 | static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) | ||
3964 | { | ||
3965 | if (!is_jack_detectable(codec, pin)) | ||
3966 | return true; | ||
3967 | return snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT; | ||
3968 | } | ||
3969 | |||
3962 | /* power up/down the paths of the given pin according to the jack state; | 3970 | /* power up/down the paths of the given pin according to the jack state; |
3963 | * power = 0/1 : only power up/down if it matches with the jack state, | 3971 | * power = 0/1 : only power up/down if it matches with the jack state, |
3964 | * < 0 : force power up/down to follow the jack sate | 3972 | * < 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, | |||
3973 | if (!codec->power_save_node) | 3981 | if (!codec->power_save_node) |
3974 | return 0; | 3982 | return 0; |
3975 | 3983 | ||
3976 | on = snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT; | 3984 | on = detect_pin_state(codec, pin); |
3985 | |||
3977 | if (power >= 0 && on != power) | 3986 | if (power >= 0 && on != power) |
3978 | return 0; | 3987 | return 0; |
3979 | return set_path_power(codec, pin, on, -1); | 3988 | 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, | |||
4225 | if (codec->power_save_node) { | 4234 | if (codec->power_save_node) { |
4226 | bool on = !mute; | 4235 | bool on = !mute; |
4227 | if (on) | 4236 | if (on) |
4228 | on = snd_hda_jack_detect_state(codec, nid) | 4237 | on = detect_pin_state(codec, nid); |
4229 | != HDA_JACK_NOT_PRESENT; | ||
4230 | set_path_power(codec, nid, on, -1); | 4238 | set_path_power(codec, nid, on, -1); |
4231 | } | 4239 | } |
4232 | } | 4240 | } |