Linux Audio

Check our new training course

Loading...
v3.1
 
  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#define MXM_WMMX_FUNC_MXMX 0x53445344 /* "MXMX" */
 36
 37struct mxds_args {
 38	u32 func;
 39	u32 args;
 40	u32 xarg;
 41};
 42
 43int mxm_wmi_call_mxds(int adapter)
 44{
 45	struct mxds_args args = {
 46		.func = MXM_WMMX_FUNC_MXDS,
 47		.args = 0,
 48		.xarg = 1,
 49	};
 50	struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
 51	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
 52	acpi_status status;
 53
 54	printk("calling mux switch %d\n", adapter);
 55
 56	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x1, adapter, &input,
 57				     &output);
 58
 59	if (ACPI_FAILURE(status))
 60		return status;
 61
 62	printk("mux switched %d\n", status);
 63	return 0;
 64			    
 65}
 66EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
 67
 68int 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}
 91EXPORT_SYMBOL_GPL(mxm_wmi_call_mxmx);
 92
 93bool mxm_wmi_supported(void)
 94{
 95	bool guid_valid;
 96	guid_valid = wmi_has_guid(MXM_WMMX_GUID);
 97	return guid_valid;
 98}
 99EXPORT_SYMBOL_GPL(mxm_wmi_supported);
100
101static int __init mxm_wmi_init(void)
102{
103	return 0;
104}
105
106static void __exit mxm_wmi_exit(void)
107{
108}
109
110module_init(mxm_wmi_init);
111module_exit(mxm_wmi_exit);
v6.8
 1// SPDX-License-Identifier: GPL-2.0-or-later
 2/*
 3 * MXM WMI driver
 4 *
 5 * Copyright(C) 2010 Red Hat.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 6 */
 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>
12
13MODULE_AUTHOR("Dave Airlie");
14MODULE_DESCRIPTION("MXM WMI Driver");
15MODULE_LICENSE("GPL");
16
17#define MXM_WMMX_GUID "F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0"
18
19MODULE_ALIAS("wmi:"MXM_WMMX_GUID);
20
21#define MXM_WMMX_FUNC_MXDS 0x5344584D /* "MXDS" */
22#define MXM_WMMX_FUNC_MXMX 0x53445344 /* "MXMX" */
23
24struct mxds_args {
25	u32 func;
26	u32 args;
27	u32 xarg;
28};
29
30int mxm_wmi_call_mxds(int adapter)
31{
32	struct mxds_args args = {
33		.func = MXM_WMMX_FUNC_MXDS,
34		.args = 0,
35		.xarg = 1,
36	};
37	struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
 
38	acpi_status status;
39
40	printk("calling mux switch %d\n", adapter);
41
42	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
 
43
44	if (ACPI_FAILURE(status))
45		return status;
46
47	printk("mux switched %d\n", status);
48	return 0;
49			    
50}
51EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
52
53int mxm_wmi_call_mxmx(int adapter)
54{
55	struct mxds_args args = {
56		.func = MXM_WMMX_FUNC_MXMX,
57		.args = 0,
58		.xarg = 1,
59	};
60	struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
 
61	acpi_status status;
62
63	printk("calling mux switch %d\n", adapter);
64
65	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
 
66
67	if (ACPI_FAILURE(status))
68		return status;
69
70	printk("mux mutex set switched %d\n", status);
71	return 0;
72			    
73}
74EXPORT_SYMBOL_GPL(mxm_wmi_call_mxmx);
75
76bool mxm_wmi_supported(void)
77{
78	bool guid_valid;
79	guid_valid = wmi_has_guid(MXM_WMMX_GUID);
80	return guid_valid;
81}
82EXPORT_SYMBOL_GPL(mxm_wmi_supported);
83
84static int __init mxm_wmi_init(void)
85{
86	return 0;
87}
88
89static void __exit mxm_wmi_exit(void)
90{
91}
92
93module_init(mxm_wmi_init);
94module_exit(mxm_wmi_exit);