aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-12-05 21:43:33 -0500
committerDave Airlie <airlied@redhat.com>2011-05-03 23:38:33 -0400
commit99b38b4acc0d7dbbab443273577cff60080fcfad (patch)
treef9eea8812d35db76e80d56489c4c0cab18032910 /drivers/platform
parentd4a3b10c16a1bdb09483233bd7aeac684ccc160a (diff)
platform/x86: add MXM WMI driver.
MXM is a laptop graphics card form-factor + interface specification, this adds an initial stub driver to talk to the MXM WMI interface. The only method used is the MUX switching method needed to do switchable graphics on the nvidia chipsets. Signed-off-by: Dave Airlie <airlied@redhat.com> Acked-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/Kconfig7
-rw-r--r--drivers/platform/x86/Makefile1
-rw-r--r--drivers/platform/x86/mxm-wmi.c85
3 files changed, 93 insertions, 0 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 0485e394712a..94914572dd7f 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -753,4 +753,11 @@ config SAMSUNG_LAPTOP
753 To compile this driver as a module, choose M here: the module 753 To compile this driver as a module, choose M here: the module
754 will be called samsung-laptop. 754 will be called samsung-laptop.
755 755
756config MXM_WMI
757 tristate "WMI support for MXM Laptop Graphics"
758 depends on WMI
759 ---help---
760 MXM is a standard for laptop graphics cards, the WMI interface
761 is required for switchable nvidia graphics machines
762
756endif # X86_PLATFORM_DEVICES 763endif # X86_PLATFORM_DEVICES
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 029e8861d086..a7ab3bc7b3a1 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -42,3 +42,4 @@ obj-$(CONFIG_XO15_EBOOK) += xo15-ebook.o
42obj-$(CONFIG_IBM_RTL) += ibm_rtl.o 42obj-$(CONFIG_IBM_RTL) += ibm_rtl.o
43obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o 43obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o
44obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o 44obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o
45obj-$(CONFIG_MXM_WMI) += mxm-wmi.o
diff --git a/drivers/platform/x86/mxm-wmi.c b/drivers/platform/x86/mxm-wmi.c
new file mode 100644
index 000000000000..12b6f341e72b
--- /dev/null
+++ b/drivers/platform/x86/mxm-wmi.c
@@ -0,0 +1,85 @@
1/*
2 * MXM WMI driver
3 *
4 * Copyright(C) 2010 Red Hat.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/init.h>
23#include <acpi/acpi_bus.h>
24#include <acpi/acpi_drivers.h>
25
26MODULE_AUTHOR("Dave Airlie");
27MODULE_DESCRIPTION("MXM WMI Driver");
28MODULE_LICENSE("GPL");
29
30#define MXM_WMMX_GUID "F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0"
31
32MODULE_ALIAS("wmi:"MXM_WMMX_GUID);
33
34#define MXM_WMMX_FUNC_MXDS 0x5344584D /* "MXDS" */
35
36struct mxds_args {
37 u32 func;
38 u32 args;
39 u32 xarg;
40};
41
42int mxm_wmi_call_mxds(int adapter)
43{
44 struct mxds_args args = {
45 .func = MXM_WMMX_FUNC_MXDS,
46 .args = 0,
47 .xarg = 1,
48 };
49 struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
50 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
51 acpi_status status;
52
53 printk("calling mux switch %d\n", adapter);
54
55 status = wmi_evaluate_method(MXM_WMMX_GUID, 0x1, adapter, &input,
56 &output);
57
58 if (ACPI_FAILURE(status))
59 return status;
60
61 printk("mux switched %d\n", status);
62 return 0;
63
64}
65EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
66
67bool mxm_wmi_supported(void)
68{
69 bool guid_valid;
70 guid_valid = wmi_has_guid(MXM_WMMX_GUID);
71 return guid_valid;
72}
73EXPORT_SYMBOL_GPL(mxm_wmi_supported);
74
75static int __init mxm_wmi_init(void)
76{
77 return 0;
78}
79
80static void __exit mxm_wmi_exit(void)
81{
82}
83
84module_init(mxm_wmi_init);
85module_exit(mxm_wmi_exit);