Commit 000703f44c77b152cd966eaf06f4ab043274ff46

Authored by Dave Airlie
1 parent f19467c509

mxm/wmi: add MXMX interface entry point.

The MXMX method appears to be a mutex of some sort.

Signed-off-by: Dave Airlie <airlied@redhat.com>

Showing 3 changed files with 29 additions and 1 deletions Side-by-side Diff

drivers/gpu/drm/nouveau/nouveau_acpi.c
... ... @@ -150,6 +150,7 @@
150 150  
151 151 static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id)
152 152 {
  153 + mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
153 154 mxm_wmi_call_mxds(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
154 155 return nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id, NULL);
155 156 }
drivers/platform/x86/mxm-wmi.c
... ... @@ -32,6 +32,7 @@
32 32 MODULE_ALIAS("wmi:"MXM_WMMX_GUID);
33 33  
34 34 #define MXM_WMMX_FUNC_MXDS 0x5344584D /* "MXDS" */
  35 +#define MXM_WMMX_FUNC_MXMX 0x53445344 /* "MXMX" */
35 36  
36 37 struct mxds_args {
37 38 u32 func;
... ... @@ -51,7 +52,7 @@
51 52 acpi_status status;
52 53  
53 54 printk("calling mux switch %d\n", adapter);
54   -
  55 +
55 56 status = wmi_evaluate_method(MXM_WMMX_GUID, 0x1, adapter, &input,
56 57 &output);
57 58  
... ... @@ -63,6 +64,31 @@
63 64  
64 65 }
65 66 EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
  67 +
  68 +int mxm_wmi_call_mxmx(int adapter)
  69 +{
  70 + struct mxds_args args = {
  71 + .func = MXM_WMMX_FUNC_MXMX,
  72 + .args = 0,
  73 + .xarg = 1,
  74 + };
  75 + struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
  76 + struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
  77 + acpi_status status;
  78 +
  79 + printk("calling mux switch %d\n", adapter);
  80 +
  81 + status = wmi_evaluate_method(MXM_WMMX_GUID, 0x1, adapter, &input,
  82 + &output);
  83 +
  84 + if (ACPI_FAILURE(status))
  85 + return status;
  86 +
  87 + printk("mux mutex set switched %d\n", status);
  88 + return 0;
  89 +
  90 +}
  91 +EXPORT_SYMBOL_GPL(mxm_wmi_call_mxmx);
66 92  
67 93 bool mxm_wmi_supported(void)
68 94 {
include/linux/mxm-wmi.h
... ... @@ -27,6 +27,7 @@
27 27 /* integrated adapter */
28 28 #define MXM_MXDS_ADAPTER_IGD 0x10
29 29 int mxm_wmi_call_mxds(int adapter);
  30 +int mxm_wmi_call_mxmx(int adapter);
30 31 bool mxm_wmi_supported(void);
31 32  
32 33 #endif