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 = 0/1 : only power up/down if it matches with the jack state,
* < 0 : force power up/down to follow the jack sate
if (!codec->power_save_node)
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)
return 0;
return set_path_power(codec, pin, on, -1);
if (codec->power_save_node) {
bool on = !mute;
if (on)
- on = snd_hda_jack_detect_state(codec, nid)
- != HDA_JACK_NOT_PRESENT;
+ on = detect_pin_state(codec, nid);
set_path_power(codec, nid, on, -1);
}
}