Commit d3be95ef authored by Kailang Yang's avatar Kailang Yang Committed by Takashi Iwai
Browse files

ALSA: hda/realtek - Fixed Speaker Mute LED for HP EliteBoard G1a platform



On the HP EliteBoard G1a platform (models without a headphone jack).
the speaker mute LED failed to function. The Sysfs ctl-led info showed
empty values because the standard LED registration couldn't correctly
bind to the master switch.
Adding this patch will fix and enable the speaker mute LED feature.

Tested-by: default avatarChris Chiu <chris.chiu@canonical.com>
Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/279e929e884849df84687dbd67f20037@realtek.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 50c8f83c
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -3725,21 +3725,41 @@ static void alc245_tas2781_spi_hp_fixup_muteled(struct hda_codec *codec,
	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x0);
	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
}

static void alc245_hp_spk_mute_led_update(void *private_data, int enabled)
{
	struct hda_codec *codec = private_data;
	unsigned int val;

	val = enabled ? 0x08 : 0x04; /* 0x08 led on, 0x04 led off */
	alc_update_coef_idx(codec, 0x0b, 0x0c, val);
}

/* JD2: mute led GPIO3: micmute led */
static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec,
					  const struct hda_fixup *fix, int action)
{
	struct alc_spec *spec = codec->spec;
	hda_nid_t hp_pin = alc_get_hp_pin(spec);
	static const hda_nid_t conn[] = { 0x02 };

	switch (action) {
	case HDA_FIXUP_ACT_PRE_PROBE:
		if (!hp_pin) {
			spec->gen.vmaster_mute.hook = alc245_hp_spk_mute_led_update;
			spec->gen.vmaster_mute_led = 1;
		}
		spec->gen.auto_mute_via_amp = 1;
		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
		break;
	case HDA_FIXUP_ACT_INIT:
		if (!hp_pin)
			alc245_hp_spk_mute_led_update(codec, !spec->gen.master_mute);
		break;
	}

	tas2781_fixup_txnw_i2c(codec, fix, action);
	if (hp_pin)
		alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
}