Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /* Helper functions for Thinkpad LED control;
0003  * to be included from codec driver
0004  */
0005 
0006 #if IS_ENABLED(CONFIG_THINKPAD_ACPI)
0007 
0008 #include <linux/acpi.h>
0009 #include <linux/leds.h>
0010 
0011 static bool is_thinkpad(struct hda_codec *codec)
0012 {
0013     return (codec->core.subsystem_id >> 16 == 0x17aa) &&
0014            (acpi_dev_found("LEN0068") || acpi_dev_found("LEN0268") ||
0015         acpi_dev_found("IBM0068"));
0016 }
0017 
0018 static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,
0019                     const struct hda_fixup *fix, int action)
0020 {
0021     if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0022         if (!is_thinkpad(codec))
0023             return;
0024         snd_hda_gen_add_mute_led_cdev(codec, NULL);
0025         snd_hda_gen_add_micmute_led_cdev(codec, NULL);
0026     }
0027 }
0028 
0029 #else /* CONFIG_THINKPAD_ACPI */
0030 
0031 static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,
0032                     const struct hda_fixup *fix, int action)
0033 {
0034 }
0035 
0036 #endif /* CONFIG_THINKPAD_ACPI */