1 // SPDX-License-Identifier: GPL-2.0
2 /* Helper functions for Dell Mic Mute LED control;
3 * to be included from codec driver
6 #if IS_ENABLED(CONFIG_DELL_LAPTOP)
7 #include <linux/dell-led.h>
9 static int (*dell_micmute_led_set_func
)(int);
11 static void dell_micmute_update(struct hda_codec
*codec
)
13 struct hda_gen_spec
*spec
= codec
->spec
;
15 dell_micmute_led_set_func(spec
->micmute_led
.led_value
);
18 static void alc_fixup_dell_wmi(struct hda_codec
*codec
,
19 const struct hda_fixup
*fix
, int action
)
21 bool removefunc
= false;
23 if (action
== HDA_FIXUP_ACT_PROBE
) {
24 if (!dell_micmute_led_set_func
)
25 dell_micmute_led_set_func
= symbol_request(dell_micmute_led_set
);
26 if (!dell_micmute_led_set_func
) {
27 codec_warn(codec
, "Failed to find dell wmi symbol dell_micmute_led_set\n");
31 removefunc
= (dell_micmute_led_set_func(false) < 0) ||
32 (snd_hda_gen_add_micmute_led(codec
,
33 dell_micmute_update
) < 0);
36 if (dell_micmute_led_set_func
&& (action
== HDA_FIXUP_ACT_FREE
|| removefunc
)) {
37 symbol_put(dell_micmute_led_set
);
38 dell_micmute_led_set_func
= NULL
;
42 #else /* CONFIG_DELL_LAPTOP */
43 static void alc_fixup_dell_wmi(struct hda_codec
*codec
,
44 const struct hda_fixup
*fix
, int action
)
48 #endif /* CONFIG_DELL_LAPTOP */