Skip to content

Commit d466887

Browse files
Jackie Dongtiwai
authored andcommitted
ALSA: hda: Support for Ideapad hotkey mute LEDs
New ideapad helper file with support for handling FN key mute LEDs. Update conexant and realtec codec to add LED support. Suggested-by: Mark Pearson <[email protected]> Signed-off-by: Jackie Dong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent d80c400 commit d466887

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Ideapad helper functions for Lenovo Ideapad LED control,
4+
* It should be included from codec driver.
5+
*/
6+
7+
#if IS_ENABLED(CONFIG_IDEAPAD_LAPTOP)
8+
9+
#include <linux/acpi.h>
10+
#include <linux/leds.h>
11+
12+
static bool is_ideapad(struct hda_codec *codec)
13+
{
14+
return (codec->core.subsystem_id >> 16 == 0x17aa) &&
15+
(acpi_dev_found("LHK2019") || acpi_dev_found("VPC2004"));
16+
}
17+
18+
static void hda_fixup_ideapad_acpi(struct hda_codec *codec,
19+
const struct hda_fixup *fix, int action)
20+
{
21+
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
22+
if (!is_ideapad(codec))
23+
return;
24+
snd_hda_gen_add_mute_led_cdev(codec, NULL);
25+
snd_hda_gen_add_micmute_led_cdev(codec, NULL);
26+
}
27+
}
28+
29+
#else /* CONFIG_IDEAPAD_LAPTOP */
30+
31+
static void hda_fixup_ideapad_acpi(struct hda_codec *codec,
32+
const struct hda_fixup *fix, int action)
33+
{
34+
}
35+
36+
#endif /* CONFIG_IDEAPAD_LAPTOP */

sound/pci/hda/patch_conexant.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ enum {
291291
CXT_FIXUP_GPIO1,
292292
CXT_FIXUP_ASPIRE_DMIC,
293293
CXT_FIXUP_THINKPAD_ACPI,
294+
CXT_FIXUP_LENOVO_XPAD_ACPI,
294295
CXT_FIXUP_OLPC_XO,
295296
CXT_FIXUP_CAP_MIX_AMP,
296297
CXT_FIXUP_TOSHIBA_P105,
@@ -313,6 +314,9 @@ enum {
313314
/* for hda_fixup_thinkpad_acpi() */
314315
#include "thinkpad_helper.c"
315316

317+
/* for hda_fixup_ideapad_acpi() */
318+
#include "ideapad_hotkey_led_helper.c"
319+
316320
static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
317321
const struct hda_fixup *fix, int action)
318322
{
@@ -928,6 +932,12 @@ static const struct hda_fixup cxt_fixups[] = {
928932
.type = HDA_FIXUP_FUNC,
929933
.v.func = hda_fixup_thinkpad_acpi,
930934
},
935+
[CXT_FIXUP_LENOVO_XPAD_ACPI] = {
936+
.type = HDA_FIXUP_FUNC,
937+
.v.func = hda_fixup_ideapad_acpi,
938+
.chained = true,
939+
.chain_id = CXT_FIXUP_THINKPAD_ACPI,
940+
},
931941
[CXT_FIXUP_OLPC_XO] = {
932942
.type = HDA_FIXUP_FUNC,
933943
.v.func = cxt_fixup_olpc_xo,
@@ -1119,7 +1129,7 @@ static const struct hda_quirk cxt5066_fixups[] = {
11191129
SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
11201130
SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
11211131
SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
1122-
SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
1132+
SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad/Ideapad", CXT_FIXUP_LENOVO_XPAD_ACPI),
11231133
SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
11241134
SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205),
11251135
HDA_CODEC_QUIRK(0x2782, 0x12c3, "Sirius Gen1", CXT_PINCFG_TOP_SPEAKER),
@@ -1133,6 +1143,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = {
11331143
{ .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" },
11341144
{ .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" },
11351145
{ .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" },
1146+
{ .id = CXT_FIXUP_LENOVO_XPAD_ACPI, .name = "thinkpad-ideapad" },
11361147
{ .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
11371148
{ .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
11381149
{ .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },

sound/pci/hda/patch_realtek.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6932,6 +6932,15 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
69326932
hda_fixup_thinkpad_acpi(codec, fix, action);
69336933
}
69346934

6935+
/* for hda_fixup_ideapad_acpi() */
6936+
#include "ideapad_hotkey_led_helper.c"
6937+
6938+
static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
6939+
const struct hda_fixup *fix, int action)
6940+
{
6941+
hda_fixup_ideapad_acpi(codec, fix, action);
6942+
}
6943+
69356944
/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
69366945
static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
69376946
const struct hda_fixup *fix,
@@ -7554,6 +7563,7 @@ enum {
75547563
ALC290_FIXUP_SUBWOOFER,
75557564
ALC290_FIXUP_SUBWOOFER_HSJACK,
75567565
ALC269_FIXUP_THINKPAD_ACPI,
7566+
ALC269_FIXUP_LENOVO_XPAD_ACPI,
75577567
ALC269_FIXUP_DMIC_THINKPAD_ACPI,
75587568
ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
75597569
ALC269VC_FIXUP_INFINIX_Y4_MAX,
@@ -8325,6 +8335,12 @@ static const struct hda_fixup alc269_fixups[] = {
83258335
.chained = true,
83268336
.chain_id = ALC269_FIXUP_SKU_IGNORE,
83278337
},
8338+
[ALC269_FIXUP_LENOVO_XPAD_ACPI] = {
8339+
.type = HDA_FIXUP_FUNC,
8340+
.v.func = alc_fixup_ideapad_acpi,
8341+
.chained = true,
8342+
.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8343+
},
83288344
[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
83298345
.type = HDA_FIXUP_FUNC,
83308346
.v.func = alc_fixup_inv_dmic,
@@ -11064,7 +11080,7 @@ static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
1106411080
SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
1106511081
SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
1106611082
SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11067-
SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
11083+
SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo XPAD", ALC269_FIXUP_LENOVO_XPAD_ACPI),
1106811084
SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
1106911085
{}
1107011086
};
@@ -11129,6 +11145,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
1112911145
{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
1113011146
{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
1113111147
{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11148+
{.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
1113211149
{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
1113311150
{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
1113411151
{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},

0 commit comments

Comments
 (0)