2019-05-27 14:55:05 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2010-12-06 10:43:33 +08:00
|
|
|
/*
|
|
|
|
* MXM WMI driver
|
|
|
|
*
|
|
|
|
* Copyright(C) 2010 Red Hat.
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
2013-12-13 15:29:52 +08:00
|
|
|
#include <linux/mxm-wmi.h>
|
2013-12-03 08:49:16 +08:00
|
|
|
#include <linux/acpi.h>
|
2010-12-06 10:43:33 +08:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Dave Airlie");
|
|
|
|
MODULE_DESCRIPTION("MXM WMI Driver");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
|
|
#define MXM_WMMX_GUID "F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0"
|
|
|
|
|
|
|
|
MODULE_ALIAS("wmi:"MXM_WMMX_GUID);
|
|
|
|
|
|
|
|
#define MXM_WMMX_FUNC_MXDS 0x5344584D /* "MXDS" */
|
2011-05-09 09:40:25 +08:00
|
|
|
#define MXM_WMMX_FUNC_MXMX 0x53445344 /* "MXMX" */
|
2010-12-06 10:43:33 +08:00
|
|
|
|
|
|
|
struct mxds_args {
|
|
|
|
u32 func;
|
|
|
|
u32 args;
|
|
|
|
u32 xarg;
|
|
|
|
};
|
|
|
|
|
|
|
|
int mxm_wmi_call_mxds(int adapter)
|
|
|
|
{
|
|
|
|
struct mxds_args args = {
|
|
|
|
.func = MXM_WMMX_FUNC_MXDS,
|
|
|
|
.args = 0,
|
|
|
|
.xarg = 1,
|
|
|
|
};
|
|
|
|
struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
|
|
|
|
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
printk("calling mux switch %d\n", adapter);
|
2011-05-09 09:40:25 +08:00
|
|
|
|
platform/x86: mxm-wmi: Evaluate wmi method with instance number 0x0
According to MXM 2.1 specification, there is the only one instance of the
WMI GUID F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0 and so it is instance 0x0.
MXM 2.1 specification:
https://lekensteyn.nl/files/docs/mxm-2.1-software-spec.pdf
_WDG dump:
// Methods GUID {F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0}
0x3C, 0x5C, 0xCB, 0xF6, 0xAE, 0x9C, 0xBD, 0x4E, 0xB5, 0x77, 0x93,
0x1E, 0xA3, 0x2A, 0x2C, 0xC0,
0x4D, 0x58, // Object ID "MX" = method "WMMX"
1, // Instance Count
0x02, // Flags (WMIACPI_REGFLAG_METHOD)
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-08-12 15:44:15 +08:00
|
|
|
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
|
2010-12-06 10:43:33 +08:00
|
|
|
&output);
|
|
|
|
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return status;
|
|
|
|
|
|
|
|
printk("mux switched %d\n", status);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
|
|
|
|
|
2011-05-09 09:40:25 +08:00
|
|
|
int mxm_wmi_call_mxmx(int adapter)
|
|
|
|
{
|
|
|
|
struct mxds_args args = {
|
|
|
|
.func = MXM_WMMX_FUNC_MXMX,
|
|
|
|
.args = 0,
|
|
|
|
.xarg = 1,
|
|
|
|
};
|
|
|
|
struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
|
|
|
|
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
printk("calling mux switch %d\n", adapter);
|
|
|
|
|
platform/x86: mxm-wmi: Evaluate wmi method with instance number 0x0
According to MXM 2.1 specification, there is the only one instance of the
WMI GUID F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0 and so it is instance 0x0.
MXM 2.1 specification:
https://lekensteyn.nl/files/docs/mxm-2.1-software-spec.pdf
_WDG dump:
// Methods GUID {F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0}
0x3C, 0x5C, 0xCB, 0xF6, 0xAE, 0x9C, 0xBD, 0x4E, 0xB5, 0x77, 0x93,
0x1E, 0xA3, 0x2A, 0x2C, 0xC0,
0x4D, 0x58, // Object ID "MX" = method "WMMX"
1, // Instance Count
0x02, // Flags (WMIACPI_REGFLAG_METHOD)
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-08-12 15:44:15 +08:00
|
|
|
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
|
2011-05-09 09:40:25 +08:00
|
|
|
&output);
|
|
|
|
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return status;
|
|
|
|
|
|
|
|
printk("mux mutex set switched %d\n", status);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(mxm_wmi_call_mxmx);
|
|
|
|
|
2010-12-06 10:43:33 +08:00
|
|
|
bool mxm_wmi_supported(void)
|
|
|
|
{
|
|
|
|
bool guid_valid;
|
|
|
|
guid_valid = wmi_has_guid(MXM_WMMX_GUID);
|
|
|
|
return guid_valid;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(mxm_wmi_supported);
|
|
|
|
|
|
|
|
static int __init mxm_wmi_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit mxm_wmi_exit(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(mxm_wmi_init);
|
|
|
|
module_exit(mxm_wmi_exit);
|