mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
![Takashi Iwai](/assets/img/avatar_default.png)
Convert the mute LED handling in Realtek codec to the new vmaster mute helper. A point to be cautiously handled is that the value passed to the callback is inverted; the vmaster passes "enabled" (0 = mute), while LED classdev passes "brightness" (1 = mute). The code in Thinkpad helper is also converted. In that case, just call the new function and remove the open-code. Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Link: https://lore.kernel.org/r/20200618110842.27238-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
36 lines
887 B
C
36 lines
887 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Helper functions for Thinkpad LED control;
|
|
* to be included from codec driver
|
|
*/
|
|
|
|
#if IS_ENABLED(CONFIG_THINKPAD_ACPI)
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/leds.h>
|
|
|
|
static bool is_thinkpad(struct hda_codec *codec)
|
|
{
|
|
return (codec->core.subsystem_id >> 16 == 0x17aa) &&
|
|
(acpi_dev_found("LEN0068") || acpi_dev_found("LEN0268") ||
|
|
acpi_dev_found("IBM0068"));
|
|
}
|
|
|
|
static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,
|
|
const struct hda_fixup *fix, int action)
|
|
{
|
|
if (action == HDA_FIXUP_ACT_PROBE) {
|
|
if (!is_thinkpad(codec))
|
|
return;
|
|
snd_hda_gen_add_mute_led_cdev(codec, NULL);
|
|
snd_hda_gen_add_micmute_led_cdev(codec, NULL);
|
|
}
|
|
}
|
|
|
|
#else /* CONFIG_THINKPAD_ACPI */
|
|
|
|
static void hda_fixup_thinkpad_acpi(struct hda_codec *codec,
|
|
const struct hda_fixup *fix, int action)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_THINKPAD_ACPI */
|