Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/sound/hda/codecs/helpers/ideapad_hotkey_led.c
26489 views
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 */
37
38