Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad35879a authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Add mute LED support for HP laptop with ALC269



Some HP laptops have a mute LED that is controlled over the unused
MIC2 VREF pin.  Implement the LED updater like patch_sigmatel.c for this
model.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c35c9d5d
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -3467,6 +3467,10 @@ static int alc_init(struct hda_codec *codec)
	if (spec->init_hook)
		spec->init_hook(codec);
#ifdef CONFIG_SND_HDA_POWER_SAVE
	if (codec->patch_ops.check_power_status)
		codec->patch_ops.check_power_status(codec, 0x01);
#endif
	return 0;
}
@@ -3827,6 +3831,10 @@ static int alc_resume(struct hda_codec *codec)
	codec->patch_ops.init(codec);
	snd_hda_codec_resume_amp(codec);
	snd_hda_codec_resume_cache(codec);
#ifdef CONFIG_SND_HDA_POWER_SAVE
	if (codec->patch_ops.check_power_status)
		codec->patch_ops.check_power_status(codec, 0x01);
#endif
	return 0;
}
#endif
@@ -13983,6 +13991,34 @@ static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
	/* NID is set in alc_build_pcms */
};
#ifdef CONFIG_SND_HDA_POWER_SAVE
static int alc269_mic2_for_mute_led(struct hda_codec *codec)
{
	switch (codec->subsystem_id) {
	case 0x103c1586:
		return 1;
	}
	return 0;
}
static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
{
	/* update mute-LED according to the speaker mute state */
	if (nid == 0x01 || nid == 0x14) {
		int pinval;
		if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
		    HDA_AMP_MUTE)
			pinval = 0x24;
		else
			pinval = 0x20;
		/* mic2 vref pin is used for mute LED control */
		snd_hda_codec_write(codec, 0x19, 0,
				    AC_VERB_SET_PIN_WIDGET_CONTROL, pinval);
	}
	return alc_check_power_status(codec, nid);
}
#endif /* CONFIG_SND_HDA_POWER_SAVE */
/*
 * BIOS auto configuration
 */
@@ -14330,6 +14366,8 @@ static int patch_alc269(struct hda_codec *codec)
#ifdef CONFIG_SND_HDA_POWER_SAVE
	if (!spec->loopback.amplist)
		spec->loopback.amplist = alc269_loopbacks;
	if (alc269_mic2_for_mute_led(codec))
		codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
#endif
	return 0;