Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/sound/hda/codecs/helpers/thinkpad.c
26489 views
1
// SPDX-License-Identifier: GPL-2.0
2
/* Helper functions for Thinkpad LED control;
3
* to be included from codec driver
4
*/
5
6
#if IS_ENABLED(CONFIG_THINKPAD_ACPI)
7
8
#include <linux/acpi.h>
9
#include <linux/leds.h>
10
11
static bool is_thinkpad(struct hda_codec *codec)
12
{
13
return (codec->core.subsystem_id >> 16 == 0x17aa) &&
14
(acpi_dev_found("LEN0068") || acpi_dev_found("LEN0268") ||
15
acpi_dev_found("IBM0068"));
16
}
17
18
static void hda_fixup_thinkpad_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_thinkpad(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_THINKPAD_ACPI */
30
31
static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,
32
const struct hda_fixup *fix, int action)
33
{
34
}
35
36
#endif /* CONFIG_THINKPAD_ACPI */
37
38