summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/dell_wmi_helper.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:30 +0000
commit76cb841cb886eef6b3bee341a2266c76578724ad (patch)
treef5892e5ba6cc11949952a6ce4ecbe6d516d6ce58 /sound/pci/hda/dell_wmi_helper.c
parentInitial commit. (diff)
downloadlinux-76cb841cb886eef6b3bee341a2266c76578724ad.tar.xz
linux-76cb841cb886eef6b3bee341a2266c76578724ad.zip
Adding upstream version 4.19.249.upstream/4.19.249upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sound/pci/hda/dell_wmi_helper.c')
-rw-r--r--sound/pci/hda/dell_wmi_helper.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/sound/pci/hda/dell_wmi_helper.c b/sound/pci/hda/dell_wmi_helper.c
new file mode 100644
index 000000000..bbd6c87a4
--- /dev/null
+++ b/sound/pci/hda/dell_wmi_helper.c
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Helper functions for Dell Mic Mute LED control;
+ * to be included from codec driver
+ */
+
+#if IS_ENABLED(CONFIG_DELL_LAPTOP)
+#include <linux/dell-led.h>
+
+static int (*dell_micmute_led_set_func)(int);
+
+static void dell_micmute_update(struct hda_codec *codec)
+{
+ struct hda_gen_spec *spec = codec->spec;
+
+ dell_micmute_led_set_func(spec->micmute_led.led_value);
+}
+
+static void alc_fixup_dell_wmi(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+ bool removefunc = false;
+
+ if (action == HDA_FIXUP_ACT_PROBE) {
+ if (!dell_micmute_led_set_func)
+ dell_micmute_led_set_func = symbol_request(dell_micmute_led_set);
+ if (!dell_micmute_led_set_func) {
+ codec_warn(codec, "Failed to find dell wmi symbol dell_micmute_led_set\n");
+ return;
+ }
+
+ removefunc = (dell_micmute_led_set_func(false) < 0) ||
+ (snd_hda_gen_add_micmute_led(codec,
+ dell_micmute_update) < 0);
+ }
+
+ if (dell_micmute_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
+ symbol_put(dell_micmute_led_set);
+ dell_micmute_led_set_func = NULL;
+ }
+}
+
+#else /* CONFIG_DELL_LAPTOP */
+static void alc_fixup_dell_wmi(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+}
+
+#endif /* CONFIG_DELL_LAPTOP */