1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright(C) 2010 Red Hat.
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/mxm-wmi.h>
11 #include <linux/acpi.h>
13 MODULE_AUTHOR("Dave Airlie");
14 MODULE_DESCRIPTION("MXM WMI Driver");
15 MODULE_LICENSE("GPL");
17 #define MXM_WMMX_GUID "F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0"
19 MODULE_ALIAS("wmi:"MXM_WMMX_GUID);
21 #define MXM_WMMX_FUNC_MXDS 0x5344584D /* "MXDS" */
22 #define MXM_WMMX_FUNC_MXMX 0x53445344 /* "MXMX" */
30 int mxm_wmi_call_mxds(int adapter)
32 struct mxds_args args = {
33 .func = MXM_WMMX_FUNC_MXDS,
37 struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
38 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
41 printk("calling mux switch %d\n", adapter);
43 status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
46 if (ACPI_FAILURE(status))
49 printk("mux switched %d\n", status);
53 EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
55 int mxm_wmi_call_mxmx(int adapter)
57 struct mxds_args args = {
58 .func = MXM_WMMX_FUNC_MXMX,
62 struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
63 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
66 printk("calling mux switch %d\n", adapter);
68 status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
71 if (ACPI_FAILURE(status))
74 printk("mux mutex set switched %d\n", status);
78 EXPORT_SYMBOL_GPL(mxm_wmi_call_mxmx);
80 bool mxm_wmi_supported(void)
83 guid_valid = wmi_has_guid(MXM_WMMX_GUID);
86 EXPORT_SYMBOL_GPL(mxm_wmi_supported);
88 static int __init mxm_wmi_init(void)
93 static void __exit mxm_wmi_exit(void)
97 module_init(mxm_wmi_init);
98 module_exit(mxm_wmi_exit);