aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-01 11:42:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-01 11:42:21 -0400
commiteb7046e9bf466cebfcfbcdf640e41d9e3a80086c (patch)
tree7d998f56e306de4c1a78355f219e38b75cfe3866
parent5b7449810ae6d652629c550d3974c8453836d229 (diff)
parent3b692c55e58d06ba9b17c66784cab5a95ba5be9b (diff)
Merge tag 'platform-drivers-x86-v4.20-1' of git://git.infradead.org/linux-platform-drivers-x86
Pull x86 platform driver updates from Darren Hart: - Move the Dell dcdbas and dell_rbu drivers into platform/drivers/x86 as they are closely coupled with other drivers in this location. - Improve _init* usage for acerhdf and fix some usage issues with messages and module parameters. - Simplify asus-wmi by calling ACPI/WMI methods directly, eliminating workqueue overhead, eliminate double reporting of keyboard backlight. - Fix wake from USB failure on Bay Trail devices (intel_int0002_vgpio). - Notify intel_telemetry users when IPC1 device is not enabled. - Update various drivers with new laptop model IDs. - Update several intel drivers to use SPDX identifers and order headers alphabetically. * tag 'platform-drivers-x86-v4.20-1' of git://git.infradead.org/linux-platform-drivers-x86: (64 commits) HID: asus: only support backlight when it's not driven by WMI platform/x86: asus-wmi: export function for evaluating WMI methods platform/x86: asus-wmi: Only notify kbd LED hw_change by fn-key pressed platform/x86: wmi: declare device_type structure as constant platform/x86: ideapad: Add Y530-15ICH to no_hw_rfkill platform/x86: Add Intel AtomISP2 dummy / power-management driver platform/x86: touchscreen_dmi: Add min-x and min-y settings for various models platform/x86: touchscreen_dmi: Add info for the Onda V80 Plus v3 tablet platform/x86: touchscreen_dmi: Add info for the Trekstor Primetab T13B tablet platform/x86: intel_telemetry: Get rid of custom macro platform/x86: intel_telemetry: report debugfs failure MAINTAINERS: intel_telemetry: Update maintainers info platform/x86: Add LG Gram laptop special features driver platform/x86: asus-wmi: Simplify the keyboard brightness updating process platform/x86: touchscreen_dmi: Add info for the Trekstor Primebook C11 convertible platform/x86: mlx-platform: Properly use mlxplat_mlxcpld_msn201x_items MAINTAINERS: intel_pmc_core: Update MAINTAINERS firmware: dcdbas: include linux/io.h platform/x86: intel-wmi-thunderbolt: Add dynamic debugging platform/x86: intel-wmi-thunderbolt: Convert to use SPDX identifier ...
-rw-r--r--Documentation/ABI/testing/sysfs-platform-lg-laptop35
-rw-r--r--Documentation/laptops/lg-laptop.rst81
-rw-r--r--MAINTAINERS31
-rw-r--r--drivers/firmware/Kconfig28
-rw-r--r--drivers/firmware/Makefile2
-rw-r--r--drivers/hid/Kconfig1
-rw-r--r--drivers/hid/hid-asus.c23
-rw-r--r--drivers/platform/x86/Kconfig59
-rw-r--r--drivers/platform/x86/Makefile4
-rw-r--r--drivers/platform/x86/acerhdf.c68
-rw-r--r--drivers/platform/x86/asus-wmi.c119
-rw-r--r--drivers/platform/x86/dcdbas.c (renamed from drivers/firmware/dcdbas.c)125
-rw-r--r--drivers/platform/x86/dcdbas.h (renamed from drivers/firmware/dcdbas.h)10
-rw-r--r--drivers/platform/x86/dell-smbios-smm.c2
-rw-r--r--drivers/platform/x86/dell_rbu.c (renamed from drivers/firmware/dell_rbu.c)8
-rw-r--r--drivers/platform/x86/ideapad-laptop.c9
-rw-r--r--drivers/platform/x86/intel-hid.c12
-rw-r--r--drivers/platform/x86/intel-rst.c23
-rw-r--r--drivers/platform/x86/intel-smartconnect.c22
-rw-r--r--drivers/platform/x86/intel-wmi-thunderbolt.c18
-rw-r--r--drivers/platform/x86/intel_atomisp2_pm.c119
-rw-r--r--drivers/platform/x86/intel_bxtwc_tmu.c13
-rw-r--r--drivers/platform/x86/intel_cht_int33fe.c7
-rw-r--r--drivers/platform/x86/intel_chtdc_ti_pwrbtn.c1
-rw-r--r--drivers/platform/x86/intel_int0002_vgpio.c29
-rw-r--r--drivers/platform/x86/intel_ips.c15
-rw-r--r--drivers/platform/x86/intel_ips.h13
-rw-r--r--drivers/platform/x86/intel_menlow.c28
-rw-r--r--drivers/platform/x86/intel_mid_powerbtn.c18
-rw-r--r--drivers/platform/x86/intel_mid_thermal.c30
-rw-r--r--drivers/platform/x86/intel_oaktrail.c32
-rw-r--r--drivers/platform/x86/intel_pmc_core.c11
-rw-r--r--drivers/platform/x86/intel_pmc_core.h11
-rw-r--r--drivers/platform/x86/intel_pmc_ipc.c35
-rw-r--r--drivers/platform/x86/intel_punit_ipc.c12
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c16
-rw-r--r--drivers/platform/x86/intel_scu_ipcutil.c24
-rw-r--r--drivers/platform/x86/intel_telemetry_core.c12
-rw-r--r--drivers/platform/x86/intel_telemetry_debugfs.c27
-rw-r--r--drivers/platform/x86/intel_telemetry_pltdrv.c12
-rw-r--r--drivers/platform/x86/intel_turbo_max_3.c18
-rw-r--r--drivers/platform/x86/lg-laptop.c700
-rw-r--r--drivers/platform/x86/mlx-platform.c2
-rw-r--r--drivers/platform/x86/touchscreen_dmi.c107
-rw-r--r--drivers/platform/x86/wmi.c6
-rw-r--r--include/linux/platform_data/x86/asus-wmi.h101
-rw-r--r--kernel/trace/trace_printk.c2
47 files changed, 1587 insertions, 494 deletions
diff --git a/Documentation/ABI/testing/sysfs-platform-lg-laptop b/Documentation/ABI/testing/sysfs-platform-lg-laptop
new file mode 100644
index 000000000000..cf47749b19df
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-platform-lg-laptop
@@ -0,0 +1,35 @@
1What: /sys/devices/platform/lg-laptop/reader_mode
2Date: October 2018
3KernelVersion: 4.20
4Contact: "Matan Ziv-Av <matan@svgalib.org>
5Description:
6 Control reader mode. 1 means on, 0 means off.
7
8What: /sys/devices/platform/lg-laptop/fn_lock
9Date: October 2018
10KernelVersion: 4.20
11Contact: "Matan Ziv-Av <matan@svgalib.org>
12Description:
13 Control FN lock mode. 1 means on, 0 means off.
14
15What: /sys/devices/platform/lg-laptop/battery_care_limit
16Date: October 2018
17KernelVersion: 4.20
18Contact: "Matan Ziv-Av <matan@svgalib.org>
19Description:
20 Maximal battery charge level. Accepted values are 80 or 100.
21
22What: /sys/devices/platform/lg-laptop/fan_mode
23Date: October 2018
24KernelVersion: 4.20
25Contact: "Matan Ziv-Av <matan@svgalib.org>
26Description:
27 Control fan mode. 1 for performance mode, 0 for silent mode.
28
29What: /sys/devices/platform/lg-laptop/usb_charge
30Date: October 2018
31KernelVersion: 4.20
32Contact: "Matan Ziv-Av <matan@svgalib.org>
33Description:
34 Control USB port charging when device is turned off.
35 1 means on, 0 means off.
diff --git a/Documentation/laptops/lg-laptop.rst b/Documentation/laptops/lg-laptop.rst
new file mode 100644
index 000000000000..e486fe7ddc35
--- /dev/null
+++ b/Documentation/laptops/lg-laptop.rst
@@ -0,0 +1,81 @@
1.. SPDX-License-Identifier: GPL-2.0+
2LG Gram laptop extra features
3=============================
4
5By Matan Ziv-Av <matan@svgalib.org>
6
7
8Hotkeys
9-------
10
11The following FN keys are ignored by the kernel without this driver:
12- FN-F1 (LG control panel) - Generates F15
13- FN-F5 (Touchpad toggle) - Generates F13
14- FN-F6 (Airplane mode) - Generates RFKILL
15- FN-F8 (Keyboard backlight) - Generates F16.
16 This key also changes keyboard backlight mode.
17- FN-F9 (Reader mode) - Generates F14
18
19The rest of the FN key work without a need for a special driver.
20
21
22Reader mode
23-----------
24
25Writing 0/1 to /sys/devices/platform/lg-laptop/reader_mode disables/enables
26reader mode. In this mode the screen colors change (blue color reduced),
27and the reader mode indicator LED (on F9 key) turns on.
28
29
30FN Lock
31-------
32
33Writing 0/1 to /sys/devices/platform/lg-laptop/fn_lock disables/enables
34FN lock.
35
36
37Battery care limit
38------------------
39
40Writing 80/100 to /sys/devices/platform/lg-laptop/battery_care_limit
41sets the maximum capacity to charge the battery. Limiting the charge
42reduces battery capacity loss over time.
43
44This value is reset to 100 when the kernel boots.
45
46
47Fan mode
48--------
49
50Writing 1/0 to /sys/devices/platform/lg-laptop/fan_mode disables/enables
51the fan silent mode.
52
53
54USB charge
55----------
56
57Writing 0/1 to /sys/devices/platform/lg-laptop/usb_charge disables/enables
58charging another device from the USB port while the device is turned off.
59
60This value is reset to 0 when the kernel boots.
61
62
63LEDs
64~~~~
65
66The are two LED devices supported by the driver:
67
68Keyboard backlight
69------------------
70
71A led device named kbd_led controls the keyboard backlight. There are three
72lighting level: off (0), low (127) and high (255).
73
74The keyboard backlight is also controlled by the key combination FN-F8
75which cycles through those levels.
76
77
78Touchpad indicator LED
79----------------------
80
81On the F5 key. Controlled by led device names tpad_led.
diff --git a/MAINTAINERS b/MAINTAINERS
index 1c0f771b859e..245ba32f5364 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -376,7 +376,7 @@ F: drivers/platform/x86/i2c-multi-instantiate.c
376ACPI PMIC DRIVERS 376ACPI PMIC DRIVERS
377M: "Rafael J. Wysocki" <rjw@rjwysocki.net> 377M: "Rafael J. Wysocki" <rjw@rjwysocki.net>
378M: Len Brown <lenb@kernel.org> 378M: Len Brown <lenb@kernel.org>
379R: Andy Shevchenko <andy@infradead.org> 379R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
380R: Mika Westerberg <mika.westerberg@linux.intel.com> 380R: Mika Westerberg <mika.westerberg@linux.intel.com>
381L: linux-acpi@vger.kernel.org 381L: linux-acpi@vger.kernel.org
382Q: https://patchwork.kernel.org/project/linux-acpi/list/ 382Q: https://patchwork.kernel.org/project/linux-acpi/list/
@@ -4207,6 +4207,12 @@ M: Pali Rohár <pali.rohar@gmail.com>
4207S: Maintained 4207S: Maintained
4208F: drivers/platform/x86/dell-rbtn.* 4208F: drivers/platform/x86/dell-rbtn.*
4209 4209
4210DELL REMOTE BIOS UPDATE DRIVER
4211M: Stuart Hayes <stuart.w.hayes@gmail.com>
4212L: platform-driver-x86@vger.kernel.org
4213S: Maintained
4214F: drivers/platform/x86/dell_rbu.c
4215
4210DELL LAPTOP SMM DRIVER 4216DELL LAPTOP SMM DRIVER
4211M: Pali Rohár <pali.rohar@gmail.com> 4217M: Pali Rohár <pali.rohar@gmail.com>
4212S: Maintained 4218S: Maintained
@@ -4214,10 +4220,11 @@ F: drivers/hwmon/dell-smm-hwmon.c
4214F: include/uapi/linux/i8k.h 4220F: include/uapi/linux/i8k.h
4215 4221
4216DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas) 4222DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas)
4217M: Doug Warzecha <Douglas_Warzecha@dell.com> 4223M: Stuart Hayes <stuart.w.hayes@gmail.com>
4224L: platform-driver-x86@vger.kernel.org
4218S: Maintained 4225S: Maintained
4219F: Documentation/dcdbas.txt 4226F: Documentation/dcdbas.txt
4220F: drivers/firmware/dcdbas.* 4227F: drivers/platform/x86/dcdbas.*
4221 4228
4222DELL WMI NOTIFICATIONS DRIVER 4229DELL WMI NOTIFICATIONS DRIVER
4223M: Matthew Garrett <mjg59@srcf.ucam.org> 4230M: Matthew Garrett <mjg59@srcf.ucam.org>
@@ -7347,6 +7354,12 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
7347S: Supported 7354S: Supported
7348F: sound/soc/intel/ 7355F: sound/soc/intel/
7349 7356
7357INTEL ATOMISP2 DUMMY / POWER-MANAGEMENT DRIVER
7358M: Hans de Goede <hdegoede@redhat.com>
7359L: platform-driver-x86@vger.kernel.org
7360S: Maintained
7361F: drivers/platform/x86/intel_atomisp2_pm.c
7362
7350INTEL C600 SERIES SAS CONTROLLER DRIVER 7363INTEL C600 SERIES SAS CONTROLLER DRIVER
7351M: Intel SCU Linux support <intel-linux-scu@intel.com> 7364M: Intel SCU Linux support <intel-linux-scu@intel.com>
7352M: Artur Paszkiewicz <artur.paszkiewicz@intel.com> 7365M: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
@@ -7533,7 +7546,6 @@ M: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
7533M: Vishwanath Somayaji <vishwanath.somayaji@intel.com> 7546M: Vishwanath Somayaji <vishwanath.somayaji@intel.com>
7534L: platform-driver-x86@vger.kernel.org 7547L: platform-driver-x86@vger.kernel.org
7535S: Maintained 7548S: Maintained
7536F: arch/x86/include/asm/pmc_core.h
7537F: drivers/platform/x86/intel_pmc_core* 7549F: drivers/platform/x86/intel_pmc_core*
7538 7550
7539INTEL PMC/P-Unit IPC DRIVER 7551INTEL PMC/P-Unit IPC DRIVER
@@ -7577,7 +7589,8 @@ F: drivers/infiniband/hw/i40iw/
7577F: include/uapi/rdma/i40iw-abi.h 7589F: include/uapi/rdma/i40iw-abi.h
7578 7590
7579INTEL TELEMETRY DRIVER 7591INTEL TELEMETRY DRIVER
7580M: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com> 7592M: Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
7593M: "David E. Box" <david.e.box@linux.intel.com>
7581L: platform-driver-x86@vger.kernel.org 7594L: platform-driver-x86@vger.kernel.org
7582S: Maintained 7595S: Maintained
7583F: arch/x86/include/asm/intel_telemetry.h 7596F: arch/x86/include/asm/intel_telemetry.h
@@ -8310,6 +8323,14 @@ W: http://legousb.sourceforge.net/
8310S: Maintained 8323S: Maintained
8311F: drivers/usb/misc/legousbtower.c 8324F: drivers/usb/misc/legousbtower.c
8312 8325
8326LG LAPTOP EXTRAS
8327M: Matan Ziv-Av <matan@svgalib.org>
8328L: platform-driver-x86@vger.kernel.org
8329S: Maintained
8330F: Documentation/ABI/testing/sysfs-platform-lg-laptop
8331F: Documentation/laptops/lg-laptop.rst
8332F: drivers/platform/x86/lg-laptop.c
8333
8313LG2160 MEDIA DRIVER 8334LG2160 MEDIA DRIVER
8314M: Michael Krufky <mkrufky@linuxtv.org> 8335M: Michael Krufky <mkrufky@linuxtv.org>
8315L: linux-media@vger.kernel.org 8336L: linux-media@vger.kernel.org
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 7670e8dda829..7273e5082b41 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -145,34 +145,6 @@ config EFI_PCDP
145 See DIG64_HCDPv20_042804.pdf available from 145 See DIG64_HCDPv20_042804.pdf available from
146 <http://www.dig64.org/specifications/> 146 <http://www.dig64.org/specifications/>
147 147
148config DELL_RBU
149 tristate "BIOS update support for DELL systems via sysfs"
150 depends on X86
151 select FW_LOADER
152 select FW_LOADER_USER_HELPER
153 help
154 Say m if you want to have the option of updating the BIOS for your
155 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
156 supporting application to communicate with the BIOS regarding the new
157 image for the image update to take effect.
158 See <file:Documentation/dell_rbu.txt> for more details on the driver.
159
160config DCDBAS
161 tristate "Dell Systems Management Base Driver"
162 depends on X86
163 help
164 The Dell Systems Management Base Driver provides a sysfs interface
165 for systems management software to perform System Management
166 Interrupts (SMIs) and Host Control Actions (system power cycle or
167 power off after OS shutdown) on certain Dell systems.
168
169 See <file:Documentation/dcdbas.txt> for more details on the driver
170 and the Dell systems on which Dell systems management software makes
171 use of this driver.
172
173 Say Y or M here to enable the driver for use by Dell systems
174 management software such as Dell OpenManage.
175
176config DMIID 148config DMIID
177 bool "Export DMI identification via sysfs to userspace" 149 bool "Export DMI identification via sysfs to userspace"
178 depends on DMI 150 depends on DMI
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 13660a951437..3158dffd9914 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -11,8 +11,6 @@ obj-$(CONFIG_DMI) += dmi_scan.o
11obj-$(CONFIG_DMI_SYSFS) += dmi-sysfs.o 11obj-$(CONFIG_DMI_SYSFS) += dmi-sysfs.o
12obj-$(CONFIG_EDD) += edd.o 12obj-$(CONFIG_EDD) += edd.o
13obj-$(CONFIG_EFI_PCDP) += pcdp.o 13obj-$(CONFIG_EFI_PCDP) += pcdp.o
14obj-$(CONFIG_DELL_RBU) += dell_rbu.o
15obj-$(CONFIG_DCDBAS) += dcdbas.o
16obj-$(CONFIG_DMIID) += dmi-id.o 14obj-$(CONFIG_DMIID) += dmi-id.o
17obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o 15obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o
18obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o 16obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 5ed319e3b084..41e9935fc584 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -149,6 +149,7 @@ config HID_APPLEIR
149config HID_ASUS 149config HID_ASUS
150 tristate "Asus" 150 tristate "Asus"
151 depends on LEDS_CLASS 151 depends on LEDS_CLASS
152 depends on ASUS_WMI || ASUS_WMI=n
152 ---help--- 153 ---help---
153 Support for Asus notebook built-in keyboard and touchpad via i2c, and 154 Support for Asus notebook built-in keyboard and touchpad via i2c, and
154 the Asus Republic of Gamers laptop keyboard special keys. 155 the Asus Republic of Gamers laptop keyboard special keys.
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 88a5672f42cd..dc6d6477e961 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -29,6 +29,7 @@
29#include <linux/dmi.h> 29#include <linux/dmi.h>
30#include <linux/hid.h> 30#include <linux/hid.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/platform_data/x86/asus-wmi.h>
32#include <linux/input/mt.h> 33#include <linux/input/mt.h>
33#include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */ 34#include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */
34 35
@@ -349,6 +350,24 @@ static void asus_kbd_backlight_work(struct work_struct *work)
349 hid_err(led->hdev, "Asus failed to set keyboard backlight: %d\n", ret); 350 hid_err(led->hdev, "Asus failed to set keyboard backlight: %d\n", ret);
350} 351}
351 352
353/* WMI-based keyboard backlight LED control (via asus-wmi driver) takes
354 * precedence. We only activate HID-based backlight control when the
355 * WMI control is not available.
356 */
357static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev)
358{
359 u32 value;
360 int ret;
361
362 ret = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2,
363 ASUS_WMI_DEVID_KBD_BACKLIGHT, 0, &value);
364 hid_dbg(hdev, "WMI backlight check: rc %d value %x", ret, value);
365 if (ret)
366 return false;
367
368 return !!(value & ASUS_WMI_DSTS_PRESENCE_BIT);
369}
370
352static int asus_kbd_register_leds(struct hid_device *hdev) 371static int asus_kbd_register_leds(struct hid_device *hdev)
353{ 372{
354 struct asus_drvdata *drvdata = hid_get_drvdata(hdev); 373 struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
@@ -436,7 +455,9 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
436 455
437 drvdata->input = input; 456 drvdata->input = input;
438 457
439 if (drvdata->enable_backlight && asus_kbd_register_leds(hdev)) 458 if (drvdata->enable_backlight &&
459 !asus_kbd_wmi_led_control_present(hdev) &&
460 asus_kbd_register_leds(hdev))
440 hid_warn(hdev, "Failed to initialize backlight.\n"); 461 hid_warn(hdev, "Failed to initialize backlight.\n");
441 462
442 return 0; 463 return 0;
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index bdac939de223..54f6a40c75c6 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -60,7 +60,10 @@ config ACERHDF
60 60
61 After loading this driver the BIOS is still in control of the fan. 61 After loading this driver the BIOS is still in control of the fan.
62 To let the kernel handle the fan, do: 62 To let the kernel handle the fan, do:
63 echo -n enabled > /sys/class/thermal/thermal_zone0/mode 63 echo -n enabled > /sys/class/thermal/thermal_zoneN/mode
64 where N=0,1,2... depending on the number of thermal nodes and the
65 detection order of your particular system. The "type" parameter
66 in the same node directory will tell you if it is "acerhdf".
64 67
65 For more information about this driver see 68 For more information about this driver see
66 <http://piie.net/files/acerhdf_README.txt> 69 <http://piie.net/files/acerhdf_README.txt>
@@ -105,6 +108,22 @@ config ASUS_LAPTOP
105 108
106 If you have an ACPI-compatible ASUS laptop, say Y or M here. 109 If you have an ACPI-compatible ASUS laptop, say Y or M here.
107 110
111config DCDBAS
112 tristate "Dell Systems Management Base Driver"
113 depends on X86
114 help
115 The Dell Systems Management Base Driver provides a sysfs interface
116 for systems management software to perform System Management
117 Interrupts (SMIs) and Host Control Actions (system power cycle or
118 power off after OS shutdown) on certain Dell systems.
119
120 See <file:Documentation/dcdbas.txt> for more details on the driver
121 and the Dell systems on which Dell systems management software makes
122 use of this driver.
123
124 Say Y or M here to enable the driver for use by Dell systems
125 management software such as Dell OpenManage.
126
108# 127#
109# The DELL_SMBIOS driver depends on ACPI_WMI and/or DCDBAS if those 128# The DELL_SMBIOS driver depends on ACPI_WMI and/or DCDBAS if those
110# backends are selected. The "depends" line prevents a configuration 129# backends are selected. The "depends" line prevents a configuration
@@ -227,6 +246,18 @@ config DELL_RBTN
227 To compile this driver as a module, choose M here: the module will 246 To compile this driver as a module, choose M here: the module will
228 be called dell-rbtn. 247 be called dell-rbtn.
229 248
249config DELL_RBU
250 tristate "BIOS update support for DELL systems via sysfs"
251 depends on X86
252 select FW_LOADER
253 select FW_LOADER_USER_HELPER
254 help
255 Say m if you want to have the option of updating the BIOS for your
256 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
257 supporting application to communicate with the BIOS regarding the new
258 image for the image update to take effect.
259 See <file:Documentation/dell_rbu.txt> for more details on the driver.
260
230 261
231config FUJITSU_LAPTOP 262config FUJITSU_LAPTOP
232 tristate "Fujitsu Laptop Extras" 263 tristate "Fujitsu Laptop Extras"
@@ -336,6 +367,20 @@ config HP_WMI
336 To compile this driver as a module, choose M here: the module will 367 To compile this driver as a module, choose M here: the module will
337 be called hp-wmi. 368 be called hp-wmi.
338 369
370config LG_LAPTOP
371 tristate "LG Laptop Extras"
372 depends on ACPI
373 depends on ACPI_WMI
374 depends on INPUT
375 select INPUT_SPARSEKMAP
376 select LEDS_CLASS
377 help
378 This driver adds support for hotkeys as well as control of keyboard
379 backlight, battery maximum charge level and various other ACPI
380 features.
381
382 If you have an LG Gram laptop, say Y or M here.
383
339config MSI_LAPTOP 384config MSI_LAPTOP
340 tristate "MSI Laptop Extras" 385 tristate "MSI Laptop Extras"
341 depends on ACPI 386 depends on ACPI
@@ -1231,6 +1276,18 @@ config I2C_MULTI_INSTANTIATE
1231 To compile this driver as a module, choose M here: the module 1276 To compile this driver as a module, choose M here: the module
1232 will be called i2c-multi-instantiate. 1277 will be called i2c-multi-instantiate.
1233 1278
1279config INTEL_ATOMISP2_PM
1280 tristate "Intel AtomISP2 dummy / power-management driver"
1281 depends on PCI && IOSF_MBI && PM
1282 help
1283 Power-management driver for Intel's Image Signal Processor found on
1284 Bay and Cherry Trail devices. This dummy driver's sole purpose is to
1285 turn the ISP off (put it in D3) to save power and to allow entering
1286 of S0ix modes.
1287
1288 To compile this driver as a module, choose M here: the module
1289 will be called intel_atomisp2_pm.
1290
1234endif # X86_PLATFORM_DEVICES 1291endif # X86_PLATFORM_DEVICES
1235 1292
1236config PMC_ATOM 1293config PMC_ATOM
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index e6d1becf81ce..39ae94135406 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -9,9 +9,11 @@ obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o
9obj-$(CONFIG_ASUS_WIRELESS) += asus-wireless.o 9obj-$(CONFIG_ASUS_WIRELESS) += asus-wireless.o
10obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o 10obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
11obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o 11obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o
12obj-$(CONFIG_LG_LAPTOP) += lg-laptop.o
12obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 13obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
13obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o 14obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o
14obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o 15obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
16obj-$(CONFIG_DCDBAS) += dcdbas.o
15obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o 17obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o
16dell-smbios-objs := dell-smbios-base.o 18dell-smbios-objs := dell-smbios-base.o
17dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o 19dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o
@@ -23,6 +25,7 @@ obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o
23obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o 25obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o
24obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o 26obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o
25obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o 27obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
28obj-$(CONFIG_DELL_RBU) += dell_rbu.o
26obj-$(CONFIG_ACER_WMI) += acer-wmi.o 29obj-$(CONFIG_ACER_WMI) += acer-wmi.o
27obj-$(CONFIG_ACER_WIRELESS) += acer-wireless.o 30obj-$(CONFIG_ACER_WIRELESS) += acer-wireless.o
28obj-$(CONFIG_ACERHDF) += acerhdf.o 31obj-$(CONFIG_ACERHDF) += acerhdf.o
@@ -92,3 +95,4 @@ obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o
92obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o 95obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o
93obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o 96obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o
94obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o 97obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o
98obj-$(CONFIG_INTEL_ATOMISP2_PM) += intel_atomisp2_pm.o
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index ea22591ee66f..505224225378 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -86,6 +86,7 @@ static unsigned int interval = 10;
86static unsigned int fanon = 60000; 86static unsigned int fanon = 60000;
87static unsigned int fanoff = 53000; 87static unsigned int fanoff = 53000;
88static unsigned int verbose; 88static unsigned int verbose;
89static unsigned int list_supported;
89static unsigned int fanstate = ACERHDF_FAN_AUTO; 90static unsigned int fanstate = ACERHDF_FAN_AUTO;
90static char force_bios[16]; 91static char force_bios[16];
91static char force_product[16]; 92static char force_product[16];
@@ -104,10 +105,12 @@ module_param(fanoff, uint, 0600);
104MODULE_PARM_DESC(fanoff, "Turn the fan off below this temperature"); 105MODULE_PARM_DESC(fanoff, "Turn the fan off below this temperature");
105module_param(verbose, uint, 0600); 106module_param(verbose, uint, 0600);
106MODULE_PARM_DESC(verbose, "Enable verbose dmesg output"); 107MODULE_PARM_DESC(verbose, "Enable verbose dmesg output");
108module_param(list_supported, uint, 0600);
109MODULE_PARM_DESC(list_supported, "List supported models and BIOS versions");
107module_param_string(force_bios, force_bios, 16, 0); 110module_param_string(force_bios, force_bios, 16, 0);
108MODULE_PARM_DESC(force_bios, "Force BIOS version and omit BIOS check"); 111MODULE_PARM_DESC(force_bios, "Pretend system has this known supported BIOS version");
109module_param_string(force_product, force_product, 16, 0); 112module_param_string(force_product, force_product, 16, 0);
110MODULE_PARM_DESC(force_product, "Force BIOS product and omit BIOS check"); 113MODULE_PARM_DESC(force_product, "Pretend system is this known supported model");
111 114
112/* 115/*
113 * cmd_off: to switch the fan completely off and check if the fan is off 116 * cmd_off: to switch the fan completely off and check if the fan is off
@@ -130,7 +133,7 @@ static const struct manualcmd mcmd = {
130 .moff = 0xff, 133 .moff = 0xff,
131}; 134};
132 135
133/* BIOS settings */ 136/* BIOS settings - only used during probe */
134struct bios_settings { 137struct bios_settings {
135 const char *vendor; 138 const char *vendor;
136 const char *product; 139 const char *product;
@@ -141,8 +144,18 @@ struct bios_settings {
141 int mcmd_enable; 144 int mcmd_enable;
142}; 145};
143 146
147/* This could be a daughter struct in the above, but not worth the redirect */
148struct ctrl_settings {
149 u8 fanreg;
150 u8 tempreg;
151 struct fancmd cmd;
152 int mcmd_enable;
153};
154
155static struct ctrl_settings ctrl_cfg __read_mostly;
156
144/* Register addresses and values for different BIOS versions */ 157/* Register addresses and values for different BIOS versions */
145static const struct bios_settings bios_tbl[] = { 158static const struct bios_settings bios_tbl[] __initconst = {
146 /* AOA110 */ 159 /* AOA110 */
147 {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0}, 160 {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
148 {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0}, 161 {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
@@ -233,6 +246,7 @@ static const struct bios_settings bios_tbl[] = {
233 {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00}, 0}, 246 {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00}, 0},
234 {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00}, 0}, 247 {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00}, 0},
235 {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0}, 248 {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
249 {"Gateway", "LT31", "v1.3307", 0x55, 0x58, {0x9e, 0x00}, 0},
236 /* Packard Bell */ 250 /* Packard Bell */
237 {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00}, 0}, 251 {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00}, 0},
238 {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00}, 0}, 252 {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00}, 0},
@@ -256,8 +270,6 @@ static const struct bios_settings bios_tbl[] = {
256 {"", "", "", 0, 0, {0, 0}, 0} 270 {"", "", "", 0, 0, {0, 0}, 0}
257}; 271};
258 272
259static const struct bios_settings *bios_cfg __read_mostly;
260
261/* 273/*
262 * this struct is used to instruct thermal layer to use bang_bang instead of 274 * this struct is used to instruct thermal layer to use bang_bang instead of
263 * default governor for acerhdf 275 * default governor for acerhdf
@@ -270,7 +282,7 @@ static int acerhdf_get_temp(int *temp)
270{ 282{
271 u8 read_temp; 283 u8 read_temp;
272 284
273 if (ec_read(bios_cfg->tempreg, &read_temp)) 285 if (ec_read(ctrl_cfg.tempreg, &read_temp))
274 return -EINVAL; 286 return -EINVAL;
275 287
276 *temp = read_temp * 1000; 288 *temp = read_temp * 1000;
@@ -282,10 +294,10 @@ static int acerhdf_get_fanstate(int *state)
282{ 294{
283 u8 fan; 295 u8 fan;
284 296
285 if (ec_read(bios_cfg->fanreg, &fan)) 297 if (ec_read(ctrl_cfg.fanreg, &fan))
286 return -EINVAL; 298 return -EINVAL;
287 299
288 if (fan != bios_cfg->cmd.cmd_off) 300 if (fan != ctrl_cfg.cmd.cmd_off)
289 *state = ACERHDF_FAN_AUTO; 301 *state = ACERHDF_FAN_AUTO;
290 else 302 else
291 *state = ACERHDF_FAN_OFF; 303 *state = ACERHDF_FAN_OFF;
@@ -306,13 +318,13 @@ static void acerhdf_change_fanstate(int state)
306 state = ACERHDF_FAN_AUTO; 318 state = ACERHDF_FAN_AUTO;
307 } 319 }
308 320
309 cmd = (state == ACERHDF_FAN_OFF) ? bios_cfg->cmd.cmd_off 321 cmd = (state == ACERHDF_FAN_OFF) ? ctrl_cfg.cmd.cmd_off
310 : bios_cfg->cmd.cmd_auto; 322 : ctrl_cfg.cmd.cmd_auto;
311 fanstate = state; 323 fanstate = state;
312 324
313 ec_write(bios_cfg->fanreg, cmd); 325 ec_write(ctrl_cfg.fanreg, cmd);
314 326
315 if (bios_cfg->mcmd_enable && state == ACERHDF_FAN_OFF) { 327 if (ctrl_cfg.mcmd_enable && state == ACERHDF_FAN_OFF) {
316 if (verbose) 328 if (verbose)
317 pr_notice("turning off fan manually\n"); 329 pr_notice("turning off fan manually\n");
318 ec_write(mcmd.mreg, mcmd.moff); 330 ec_write(mcmd.mreg, mcmd.moff);
@@ -615,10 +627,11 @@ static int str_starts_with(const char *str, const char *start)
615} 627}
616 628
617/* check hardware */ 629/* check hardware */
618static int acerhdf_check_hardware(void) 630static int __init acerhdf_check_hardware(void)
619{ 631{
620 char const *vendor, *version, *product; 632 char const *vendor, *version, *product;
621 const struct bios_settings *bt = NULL; 633 const struct bios_settings *bt = NULL;
634 int found = 0;
622 635
623 /* get BIOS data */ 636 /* get BIOS data */
624 vendor = dmi_get_system_info(DMI_SYS_VENDOR); 637 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
@@ -632,6 +645,17 @@ static int acerhdf_check_hardware(void)
632 645
633 pr_info("Acer Aspire One Fan driver, v.%s\n", DRV_VER); 646 pr_info("Acer Aspire One Fan driver, v.%s\n", DRV_VER);
634 647
648 if (list_supported) {
649 pr_info("List of supported Manufacturer/Model/BIOS:\n");
650 pr_info("---------------------------------------------------\n");
651 for (bt = bios_tbl; bt->vendor[0]; bt++) {
652 pr_info("%-13s | %-17s | %-10s\n", bt->vendor,
653 bt->product, bt->version);
654 }
655 pr_info("---------------------------------------------------\n");
656 return -ECANCELED;
657 }
658
635 if (force_bios[0]) { 659 if (force_bios[0]) {
636 version = force_bios; 660 version = force_bios;
637 pr_info("forcing BIOS version: %s\n", version); 661 pr_info("forcing BIOS version: %s\n", version);
@@ -657,30 +681,36 @@ static int acerhdf_check_hardware(void)
657 if (str_starts_with(vendor, bt->vendor) && 681 if (str_starts_with(vendor, bt->vendor) &&
658 str_starts_with(product, bt->product) && 682 str_starts_with(product, bt->product) &&
659 str_starts_with(version, bt->version)) { 683 str_starts_with(version, bt->version)) {
660 bios_cfg = bt; 684 found = 1;
661 break; 685 break;
662 } 686 }
663 } 687 }
664 688
665 if (!bios_cfg) { 689 if (!found) {
666 pr_err("unknown (unsupported) BIOS version %s/%s/%s, please report, aborting!\n", 690 pr_err("unknown (unsupported) BIOS version %s/%s/%s, please report, aborting!\n",
667 vendor, product, version); 691 vendor, product, version);
668 return -EINVAL; 692 return -EINVAL;
669 } 693 }
670 694
695 /* Copy control settings from BIOS table before we free it. */
696 ctrl_cfg.fanreg = bt->fanreg;
697 ctrl_cfg.tempreg = bt->tempreg;
698 memcpy(&ctrl_cfg.cmd, &bt->cmd, sizeof(struct fancmd));
699 ctrl_cfg.mcmd_enable = bt->mcmd_enable;
700
671 /* 701 /*
672 * if started with kernel mode off, prevent the kernel from switching 702 * if started with kernel mode off, prevent the kernel from switching
673 * off the fan 703 * off the fan
674 */ 704 */
675 if (!kernelmode) { 705 if (!kernelmode) {
676 pr_notice("Fan control off, to enable do:\n"); 706 pr_notice("Fan control off, to enable do:\n");
677 pr_notice("echo -n \"enabled\" > /sys/class/thermal/thermal_zone0/mode\n"); 707 pr_notice("echo -n \"enabled\" > /sys/class/thermal/thermal_zoneN/mode # N=0,1,2...\n");
678 } 708 }
679 709
680 return 0; 710 return 0;
681} 711}
682 712
683static int acerhdf_register_platform(void) 713static int __init acerhdf_register_platform(void)
684{ 714{
685 int err = 0; 715 int err = 0;
686 716
@@ -712,7 +742,7 @@ static void acerhdf_unregister_platform(void)
712 platform_driver_unregister(&acerhdf_driver); 742 platform_driver_unregister(&acerhdf_driver);
713} 743}
714 744
715static int acerhdf_register_thermal(void) 745static int __init acerhdf_register_thermal(void)
716{ 746{
717 cl_dev = thermal_cooling_device_register("acerhdf-fan", NULL, 747 cl_dev = thermal_cooling_device_register("acerhdf-fan", NULL,
718 &acerhdf_cooling_ops); 748 &acerhdf_cooling_ops);
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 93ee2d5466f8..c285a16675ee 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -43,6 +43,7 @@
43#include <linux/hwmon-sysfs.h> 43#include <linux/hwmon-sysfs.h>
44#include <linux/debugfs.h> 44#include <linux/debugfs.h>
45#include <linux/seq_file.h> 45#include <linux/seq_file.h>
46#include <linux/platform_data/x86/asus-wmi.h>
46#include <linux/platform_device.h> 47#include <linux/platform_device.h>
47#include <linux/thermal.h> 48#include <linux/thermal.h>
48#include <linux/acpi.h> 49#include <linux/acpi.h>
@@ -69,89 +70,6 @@ MODULE_LICENSE("GPL");
69#define NOTIFY_KBD_BRTDWN 0xc5 70#define NOTIFY_KBD_BRTDWN 0xc5
70#define NOTIFY_KBD_BRTTOGGLE 0xc7 71#define NOTIFY_KBD_BRTTOGGLE 0xc7
71 72
72/* WMI Methods */
73#define ASUS_WMI_METHODID_SPEC 0x43455053 /* BIOS SPECification */
74#define ASUS_WMI_METHODID_SFBD 0x44424653 /* Set First Boot Device */
75#define ASUS_WMI_METHODID_GLCD 0x44434C47 /* Get LCD status */
76#define ASUS_WMI_METHODID_GPID 0x44495047 /* Get Panel ID?? (Resol) */
77#define ASUS_WMI_METHODID_QMOD 0x444F4D51 /* Quiet MODe */
78#define ASUS_WMI_METHODID_SPLV 0x4C425053 /* Set Panel Light Value */
79#define ASUS_WMI_METHODID_AGFN 0x4E464741 /* FaN? */
80#define ASUS_WMI_METHODID_SFUN 0x4E554653 /* FUNCtionalities */
81#define ASUS_WMI_METHODID_SDSP 0x50534453 /* Set DiSPlay output */
82#define ASUS_WMI_METHODID_GDSP 0x50534447 /* Get DiSPlay output */
83#define ASUS_WMI_METHODID_DEVP 0x50564544 /* DEVice Policy */
84#define ASUS_WMI_METHODID_OSVR 0x5256534F /* OS VeRsion */
85#define ASUS_WMI_METHODID_DSTS 0x53544344 /* Device STatuS */
86#define ASUS_WMI_METHODID_DSTS2 0x53545344 /* Device STatuS #2*/
87#define ASUS_WMI_METHODID_BSTS 0x53545342 /* Bios STatuS ? */
88#define ASUS_WMI_METHODID_DEVS 0x53564544 /* DEVice Set */
89#define ASUS_WMI_METHODID_CFVS 0x53564643 /* CPU Frequency Volt Set */
90#define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
91#define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
92#define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
93
94#define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
95
96/* Wireless */
97#define ASUS_WMI_DEVID_HW_SWITCH 0x00010001
98#define ASUS_WMI_DEVID_WIRELESS_LED 0x00010002
99#define ASUS_WMI_DEVID_CWAP 0x00010003
100#define ASUS_WMI_DEVID_WLAN 0x00010011
101#define ASUS_WMI_DEVID_WLAN_LED 0x00010012
102#define ASUS_WMI_DEVID_BLUETOOTH 0x00010013
103#define ASUS_WMI_DEVID_GPS 0x00010015
104#define ASUS_WMI_DEVID_WIMAX 0x00010017
105#define ASUS_WMI_DEVID_WWAN3G 0x00010019
106#define ASUS_WMI_DEVID_UWB 0x00010021
107
108/* Leds */
109/* 0x000200XX and 0x000400XX */
110#define ASUS_WMI_DEVID_LED1 0x00020011
111#define ASUS_WMI_DEVID_LED2 0x00020012
112#define ASUS_WMI_DEVID_LED3 0x00020013
113#define ASUS_WMI_DEVID_LED4 0x00020014
114#define ASUS_WMI_DEVID_LED5 0x00020015
115#define ASUS_WMI_DEVID_LED6 0x00020016
116
117/* Backlight and Brightness */
118#define ASUS_WMI_DEVID_ALS_ENABLE 0x00050001 /* Ambient Light Sensor */
119#define ASUS_WMI_DEVID_BACKLIGHT 0x00050011
120#define ASUS_WMI_DEVID_BRIGHTNESS 0x00050012
121#define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021
122#define ASUS_WMI_DEVID_LIGHT_SENSOR 0x00050022 /* ?? */
123#define ASUS_WMI_DEVID_LIGHTBAR 0x00050025
124
125/* Misc */
126#define ASUS_WMI_DEVID_CAMERA 0x00060013
127
128/* Storage */
129#define ASUS_WMI_DEVID_CARDREADER 0x00080013
130
131/* Input */
132#define ASUS_WMI_DEVID_TOUCHPAD 0x00100011
133#define ASUS_WMI_DEVID_TOUCHPAD_LED 0x00100012
134
135/* Fan, Thermal */
136#define ASUS_WMI_DEVID_THERMAL_CTRL 0x00110011
137#define ASUS_WMI_DEVID_FAN_CTRL 0x00110012
138
139/* Power */
140#define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012
141
142/* Deep S3 / Resume on LID open */
143#define ASUS_WMI_DEVID_LID_RESUME 0x00120031
144
145/* DSTS masks */
146#define ASUS_WMI_DSTS_STATUS_BIT 0x00000001
147#define ASUS_WMI_DSTS_UNKNOWN_BIT 0x00000002
148#define ASUS_WMI_DSTS_PRESENCE_BIT 0x00010000
149#define ASUS_WMI_DSTS_USER_BIT 0x00020000
150#define ASUS_WMI_DSTS_BIOS_BIT 0x00040000
151#define ASUS_WMI_DSTS_BRIGHTNESS_MASK 0x000000FF
152#define ASUS_WMI_DSTS_MAX_BRIGTH_MASK 0x0000FF00
153#define ASUS_WMI_DSTS_LIGHTBAR_MASK 0x0000000F
154
155#define ASUS_FAN_DESC "cpu_fan" 73#define ASUS_FAN_DESC "cpu_fan"
156#define ASUS_FAN_MFUN 0x13 74#define ASUS_FAN_MFUN 0x13
157#define ASUS_FAN_SFUN_READ 0x06 75#define ASUS_FAN_SFUN_READ 0x06
@@ -239,7 +157,6 @@ struct asus_wmi {
239 int lightbar_led_wk; 157 int lightbar_led_wk;
240 struct workqueue_struct *led_workqueue; 158 struct workqueue_struct *led_workqueue;
241 struct work_struct tpd_led_work; 159 struct work_struct tpd_led_work;
242 struct work_struct kbd_led_work;
243 struct work_struct wlan_led_work; 160 struct work_struct wlan_led_work;
244 struct work_struct lightbar_led_work; 161 struct work_struct lightbar_led_work;
245 162
@@ -302,8 +219,7 @@ static void asus_wmi_input_exit(struct asus_wmi *asus)
302 asus->inputdev = NULL; 219 asus->inputdev = NULL;
303} 220}
304 221
305static int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, 222int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval)
306 u32 *retval)
307{ 223{
308 struct bios_args args = { 224 struct bios_args args = {
309 .arg0 = arg0, 225 .arg0 = arg0,
@@ -339,6 +255,7 @@ exit:
339 255
340 return 0; 256 return 0;
341} 257}
258EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method);
342 259
343static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args) 260static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args)
344{ 261{
@@ -456,12 +373,9 @@ static enum led_brightness tpd_led_get(struct led_classdev *led_cdev)
456 return read_tpd_led_state(asus); 373 return read_tpd_led_state(asus);
457} 374}
458 375
459static void kbd_led_update(struct work_struct *work) 376static void kbd_led_update(struct asus_wmi *asus)
460{ 377{
461 int ctrl_param = 0; 378 int ctrl_param = 0;
462 struct asus_wmi *asus;
463
464 asus = container_of(work, struct asus_wmi, kbd_led_work);
465 379
466 /* 380 /*
467 * bits 0-2: level 381 * bits 0-2: level
@@ -471,7 +385,6 @@ static void kbd_led_update(struct work_struct *work)
471 ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); 385 ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F);
472 386
473 asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); 387 asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL);
474 led_classdev_notify_brightness_hw_changed(&asus->kbd_led, asus->kbd_led_wk);
475} 388}
476 389
477static int kbd_led_read(struct asus_wmi *asus, int *level, int *env) 390static int kbd_led_read(struct asus_wmi *asus, int *level, int *env)
@@ -516,7 +429,7 @@ static void do_kbd_led_set(struct led_classdev *led_cdev, int value)
516 value = 0; 429 value = 0;
517 430
518 asus->kbd_led_wk = value; 431 asus->kbd_led_wk = value;
519 queue_work(asus->led_workqueue, &asus->kbd_led_work); 432 kbd_led_update(asus);
520} 433}
521 434
522static void kbd_led_set(struct led_classdev *led_cdev, 435static void kbd_led_set(struct led_classdev *led_cdev,
@@ -525,6 +438,14 @@ static void kbd_led_set(struct led_classdev *led_cdev,
525 do_kbd_led_set(led_cdev, value); 438 do_kbd_led_set(led_cdev, value);
526} 439}
527 440
441static void kbd_led_set_by_kbd(struct asus_wmi *asus, enum led_brightness value)
442{
443 struct led_classdev *led_cdev = &asus->kbd_led;
444
445 do_kbd_led_set(led_cdev, value);
446 led_classdev_notify_brightness_hw_changed(led_cdev, asus->kbd_led_wk);
447}
448
528static enum led_brightness kbd_led_get(struct led_classdev *led_cdev) 449static enum led_brightness kbd_led_get(struct led_classdev *led_cdev)
529{ 450{
530 struct asus_wmi *asus; 451 struct asus_wmi *asus;
@@ -671,8 +592,6 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
671 592
672 led_val = kbd_led_read(asus, NULL, NULL); 593 led_val = kbd_led_read(asus, NULL, NULL);
673 if (led_val >= 0) { 594 if (led_val >= 0) {
674 INIT_WORK(&asus->kbd_led_work, kbd_led_update);
675
676 asus->kbd_led_wk = led_val; 595 asus->kbd_led_wk = led_val;
677 asus->kbd_led.name = "asus::kbd_backlight"; 596 asus->kbd_led.name = "asus::kbd_backlight";
678 asus->kbd_led.flags = LED_BRIGHT_HW_CHANGED; 597 asus->kbd_led.flags = LED_BRIGHT_HW_CHANGED;
@@ -1746,18 +1665,18 @@ static void asus_wmi_notify(u32 value, void *context)
1746 } 1665 }
1747 1666
1748 if (code == NOTIFY_KBD_BRTUP) { 1667 if (code == NOTIFY_KBD_BRTUP) {
1749 do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1); 1668 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
1750 goto exit; 1669 goto exit;
1751 } 1670 }
1752 if (code == NOTIFY_KBD_BRTDWN) { 1671 if (code == NOTIFY_KBD_BRTDWN) {
1753 do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk - 1); 1672 kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1);
1754 goto exit; 1673 goto exit;
1755 } 1674 }
1756 if (code == NOTIFY_KBD_BRTTOGGLE) { 1675 if (code == NOTIFY_KBD_BRTTOGGLE) {
1757 if (asus->kbd_led_wk == asus->kbd_led.max_brightness) 1676 if (asus->kbd_led_wk == asus->kbd_led.max_brightness)
1758 do_kbd_led_set(&asus->kbd_led, 0); 1677 kbd_led_set_by_kbd(asus, 0);
1759 else 1678 else
1760 do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1); 1679 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
1761 goto exit; 1680 goto exit;
1762 } 1681 }
1763 1682
@@ -2291,7 +2210,7 @@ static int asus_hotk_resume(struct device *device)
2291 struct asus_wmi *asus = dev_get_drvdata(device); 2210 struct asus_wmi *asus = dev_get_drvdata(device);
2292 2211
2293 if (!IS_ERR_OR_NULL(asus->kbd_led.dev)) 2212 if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
2294 queue_work(asus->led_workqueue, &asus->kbd_led_work); 2213 kbd_led_update(asus);
2295 2214
2296 return 0; 2215 return 0;
2297} 2216}
@@ -2327,7 +2246,7 @@ static int asus_hotk_restore(struct device *device)
2327 rfkill_set_sw_state(asus->uwb.rfkill, bl); 2246 rfkill_set_sw_state(asus->uwb.rfkill, bl);
2328 } 2247 }
2329 if (!IS_ERR_OR_NULL(asus->kbd_led.dev)) 2248 if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
2330 queue_work(asus->led_workqueue, &asus->kbd_led_work); 2249 kbd_led_update(asus);
2331 2250
2332 return 0; 2251 return 0;
2333} 2252}
diff --git a/drivers/firmware/dcdbas.c b/drivers/platform/x86/dcdbas.c
index 0bdea60c65dd..88bd7efafe14 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/platform/x86/dcdbas.c
@@ -21,11 +21,13 @@
21 */ 21 */
22 22
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/acpi.h>
24#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
25#include <linux/errno.h> 26#include <linux/errno.h>
26#include <linux/cpu.h> 27#include <linux/cpu.h>
27#include <linux/gfp.h> 28#include <linux/gfp.h>
28#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/io.h>
29#include <linux/kernel.h> 31#include <linux/kernel.h>
30#include <linux/mc146818rtc.h> 32#include <linux/mc146818rtc.h>
31#include <linux/module.h> 33#include <linux/module.h>
@@ -36,12 +38,11 @@
36#include <linux/string.h> 38#include <linux/string.h>
37#include <linux/types.h> 39#include <linux/types.h>
38#include <linux/mutex.h> 40#include <linux/mutex.h>
39#include <asm/io.h>
40 41
41#include "dcdbas.h" 42#include "dcdbas.h"
42 43
43#define DRIVER_NAME "dcdbas" 44#define DRIVER_NAME "dcdbas"
44#define DRIVER_VERSION "5.6.0-3.2" 45#define DRIVER_VERSION "5.6.0-3.3"
45#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver" 46#define DRIVER_DESCRIPTION "Dell Systems Management Base Driver"
46 47
47static struct platform_device *dcdbas_pdev; 48static struct platform_device *dcdbas_pdev;
@@ -49,19 +50,23 @@ static struct platform_device *dcdbas_pdev;
49static u8 *smi_data_buf; 50static u8 *smi_data_buf;
50static dma_addr_t smi_data_buf_handle; 51static dma_addr_t smi_data_buf_handle;
51static unsigned long smi_data_buf_size; 52static unsigned long smi_data_buf_size;
53static unsigned long max_smi_data_buf_size = MAX_SMI_DATA_BUF_SIZE;
52static u32 smi_data_buf_phys_addr; 54static u32 smi_data_buf_phys_addr;
53static DEFINE_MUTEX(smi_data_lock); 55static DEFINE_MUTEX(smi_data_lock);
56static u8 *eps_buffer;
54 57
55static unsigned int host_control_action; 58static unsigned int host_control_action;
56static unsigned int host_control_smi_type; 59static unsigned int host_control_smi_type;
57static unsigned int host_control_on_shutdown; 60static unsigned int host_control_on_shutdown;
58 61
62static bool wsmt_enabled;
63
59/** 64/**
60 * smi_data_buf_free: free SMI data buffer 65 * smi_data_buf_free: free SMI data buffer
61 */ 66 */
62static void smi_data_buf_free(void) 67static void smi_data_buf_free(void)
63{ 68{
64 if (!smi_data_buf) 69 if (!smi_data_buf || wsmt_enabled)
65 return; 70 return;
66 71
67 dev_dbg(&dcdbas_pdev->dev, "%s: phys: %x size: %lu\n", 72 dev_dbg(&dcdbas_pdev->dev, "%s: phys: %x size: %lu\n",
@@ -86,7 +91,7 @@ static int smi_data_buf_realloc(unsigned long size)
86 if (smi_data_buf_size >= size) 91 if (smi_data_buf_size >= size)
87 return 0; 92 return 0;
88 93
89 if (size > MAX_SMI_DATA_BUF_SIZE) 94 if (size > max_smi_data_buf_size)
90 return -EINVAL; 95 return -EINVAL;
91 96
92 /* new buffer is needed */ 97 /* new buffer is needed */
@@ -169,7 +174,7 @@ static ssize_t smi_data_write(struct file *filp, struct kobject *kobj,
169{ 174{
170 ssize_t ret; 175 ssize_t ret;
171 176
172 if ((pos + count) > MAX_SMI_DATA_BUF_SIZE) 177 if ((pos + count) > max_smi_data_buf_size)
173 return -EINVAL; 178 return -EINVAL;
174 179
175 mutex_lock(&smi_data_lock); 180 mutex_lock(&smi_data_lock);
@@ -322,8 +327,20 @@ static ssize_t smi_request_store(struct device *dev,
322 ret = count; 327 ret = count;
323 break; 328 break;
324 case 1: 329 case 1:
325 /* Calling Interface SMI */ 330 /*
326 smi_cmd->ebx = (u32) virt_to_phys(smi_cmd->command_buffer); 331 * Calling Interface SMI
332 *
333 * Provide physical address of command buffer field within
334 * the struct smi_cmd to BIOS.
335 *
336 * Because the address that smi_cmd (smi_data_buf) points to
337 * will be from memremap() of a non-memory address if WSMT
338 * is present, we can't use virt_to_phys() on smi_cmd, so
339 * we have to use the physical address that was saved when
340 * the virtual address for smi_cmd was received.
341 */
342 smi_cmd->ebx = smi_data_buf_phys_addr +
343 offsetof(struct smi_cmd, command_buffer);
327 ret = dcdbas_smi_request(smi_cmd); 344 ret = dcdbas_smi_request(smi_cmd);
328 if (!ret) 345 if (!ret)
329 ret = count; 346 ret = count;
@@ -482,6 +499,93 @@ static void dcdbas_host_control(void)
482 } 499 }
483} 500}
484 501
502/* WSMT */
503
504static u8 checksum(u8 *buffer, u8 length)
505{
506 u8 sum = 0;
507 u8 *end = buffer + length;
508
509 while (buffer < end)
510 sum += *buffer++;
511 return sum;
512}
513
514static inline struct smm_eps_table *check_eps_table(u8 *addr)
515{
516 struct smm_eps_table *eps = (struct smm_eps_table *)addr;
517
518 if (strncmp(eps->smm_comm_buff_anchor, SMM_EPS_SIG, 4) != 0)
519 return NULL;
520
521 if (checksum(addr, eps->length) != 0)
522 return NULL;
523
524 return eps;
525}
526
527static int dcdbas_check_wsmt(void)
528{
529 struct acpi_table_wsmt *wsmt = NULL;
530 struct smm_eps_table *eps = NULL;
531 u64 remap_size;
532 u8 *addr;
533
534 acpi_get_table(ACPI_SIG_WSMT, 0, (struct acpi_table_header **)&wsmt);
535 if (!wsmt)
536 return 0;
537
538 /* Check if WSMT ACPI table shows that protection is enabled */
539 if (!(wsmt->protection_flags & ACPI_WSMT_FIXED_COMM_BUFFERS) ||
540 !(wsmt->protection_flags & ACPI_WSMT_COMM_BUFFER_NESTED_PTR_PROTECTION))
541 return 0;
542
543 /* Scan for EPS (entry point structure) */
544 for (addr = (u8 *)__va(0xf0000);
545 addr < (u8 *)__va(0x100000 - sizeof(struct smm_eps_table));
546 addr += 16) {
547 eps = check_eps_table(addr);
548 if (eps)
549 break;
550 }
551
552 if (!eps) {
553 dev_dbg(&dcdbas_pdev->dev, "found WSMT, but no EPS found\n");
554 return -ENODEV;
555 }
556
557 /*
558 * Get physical address of buffer and map to virtual address.
559 * Table gives size in 4K pages, regardless of actual system page size.
560 */
561 if (upper_32_bits(eps->smm_comm_buff_addr + 8)) {
562 dev_warn(&dcdbas_pdev->dev, "found WSMT, but EPS buffer address is above 4GB\n");
563 return -EINVAL;
564 }
565 /*
566 * Limit remap size to MAX_SMI_DATA_BUF_SIZE + 8 (since the first 8
567 * bytes are used for a semaphore, not the data buffer itself).
568 */
569 remap_size = eps->num_of_4k_pages * PAGE_SIZE;
570 if (remap_size > MAX_SMI_DATA_BUF_SIZE + 8)
571 remap_size = MAX_SMI_DATA_BUF_SIZE + 8;
572 eps_buffer = memremap(eps->smm_comm_buff_addr, remap_size, MEMREMAP_WB);
573 if (!eps_buffer) {
574 dev_warn(&dcdbas_pdev->dev, "found WSMT, but failed to map EPS buffer\n");
575 return -ENOMEM;
576 }
577
578 /* First 8 bytes is for a semaphore, not part of the smi_data_buf */
579 smi_data_buf_phys_addr = eps->smm_comm_buff_addr + 8;
580 smi_data_buf = eps_buffer + 8;
581 smi_data_buf_size = remap_size - 8;
582 max_smi_data_buf_size = smi_data_buf_size;
583 wsmt_enabled = true;
584 dev_info(&dcdbas_pdev->dev,
585 "WSMT found, using firmware-provided SMI buffer.\n");
586 return 1;
587}
588
485/** 589/**
486 * dcdbas_reboot_notify: handle reboot notification for host control 590 * dcdbas_reboot_notify: handle reboot notification for host control
487 */ 591 */
@@ -548,6 +652,11 @@ static int dcdbas_probe(struct platform_device *dev)
548 652
549 dcdbas_pdev = dev; 653 dcdbas_pdev = dev;
550 654
655 /* Check if ACPI WSMT table specifies protected SMI buffer address */
656 error = dcdbas_check_wsmt();
657 if (error < 0)
658 return error;
659
551 /* 660 /*
552 * BIOS SMI calls require buffer addresses be in 32-bit address space. 661 * BIOS SMI calls require buffer addresses be in 32-bit address space.
553 * This is done by setting the DMA mask below. 662 * This is done by setting the DMA mask below.
@@ -635,6 +744,8 @@ static void __exit dcdbas_exit(void)
635 */ 744 */
636 if (dcdbas_pdev) 745 if (dcdbas_pdev)
637 smi_data_buf_free(); 746 smi_data_buf_free();
747 if (eps_buffer)
748 memunmap(eps_buffer);
638 platform_device_unregister(dcdbas_pdev_reg); 749 platform_device_unregister(dcdbas_pdev_reg);
639 platform_driver_unregister(&dcdbas_driver); 750 platform_driver_unregister(&dcdbas_driver);
640} 751}
diff --git a/drivers/firmware/dcdbas.h b/drivers/platform/x86/dcdbas.h
index ca3cb0a54ab6..52729a494b00 100644
--- a/drivers/firmware/dcdbas.h
+++ b/drivers/platform/x86/dcdbas.h
@@ -53,6 +53,7 @@
53#define EXPIRED_TIMER (0) 53#define EXPIRED_TIMER (0)
54 54
55#define SMI_CMD_MAGIC (0x534D4931) 55#define SMI_CMD_MAGIC (0x534D4931)
56#define SMM_EPS_SIG "$SCB"
56 57
57#define DCDBAS_DEV_ATTR_RW(_name) \ 58#define DCDBAS_DEV_ATTR_RW(_name) \
58 DEVICE_ATTR(_name,0600,_name##_show,_name##_store); 59 DEVICE_ATTR(_name,0600,_name##_show,_name##_store);
@@ -103,5 +104,14 @@ struct apm_cmd {
103 104
104int dcdbas_smi_request(struct smi_cmd *smi_cmd); 105int dcdbas_smi_request(struct smi_cmd *smi_cmd);
105 106
107struct smm_eps_table {
108 char smm_comm_buff_anchor[4];
109 u8 length;
110 u8 checksum;
111 u8 version;
112 u64 smm_comm_buff_addr;
113 u64 num_of_4k_pages;
114} __packed;
115
106#endif /* _DCDBAS_H_ */ 116#endif /* _DCDBAS_H_ */
107 117
diff --git a/drivers/platform/x86/dell-smbios-smm.c b/drivers/platform/x86/dell-smbios-smm.c
index 97a90bebc360..ab9b822a6dfe 100644
--- a/drivers/platform/x86/dell-smbios-smm.c
+++ b/drivers/platform/x86/dell-smbios-smm.c
@@ -18,7 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/mutex.h> 19#include <linux/mutex.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include "../../firmware/dcdbas.h" 21#include "dcdbas.h"
22#include "dell-smbios.h" 22#include "dell-smbios.h"
23 23
24static int da_command_address; 24static int da_command_address;
diff --git a/drivers/firmware/dell_rbu.c b/drivers/platform/x86/dell_rbu.c
index fb8af5cb7c9b..ccefa84f7305 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/platform/x86/dell_rbu.c
@@ -45,6 +45,7 @@
45#include <linux/moduleparam.h> 45#include <linux/moduleparam.h>
46#include <linux/firmware.h> 46#include <linux/firmware.h>
47#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
48#include <asm/set_memory.h>
48 49
49MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); 50MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>");
50MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); 51MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems");
@@ -181,6 +182,11 @@ static int create_packet(void *data, size_t length)
181 packet_data_temp_buf = NULL; 182 packet_data_temp_buf = NULL;
182 } 183 }
183 } 184 }
185 /*
186 * set to uncachable or it may never get written back before reboot
187 */
188 set_memory_uc((unsigned long)packet_data_temp_buf, 1 << ordernum);
189
184 spin_lock(&rbu_data.lock); 190 spin_lock(&rbu_data.lock);
185 191
186 newpacket->data = packet_data_temp_buf; 192 newpacket->data = packet_data_temp_buf;
@@ -349,6 +355,8 @@ static void packet_empty_list(void)
349 * to make sure there are no stale RBU packets left in memory 355 * to make sure there are no stale RBU packets left in memory
350 */ 356 */
351 memset(newpacket->data, 0, rbu_data.packetsize); 357 memset(newpacket->data, 0, rbu_data.packetsize);
358 set_memory_wb((unsigned long)newpacket->data,
359 1 << newpacket->ordernum);
352 free_pages((unsigned long) newpacket->data, 360 free_pages((unsigned long) newpacket->data,
353 newpacket->ordernum); 361 newpacket->ordernum);
354 kfree(newpacket); 362 kfree(newpacket);
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index d4f1259ff5a2..b6489cba2985 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -212,7 +212,7 @@ static int read_ec_data(acpi_handle handle, int cmd, unsigned long *data)
212 return 0; 212 return 0;
213 } 213 }
214 } 214 }
215 pr_err("timeout in read_ec_cmd\n"); 215 pr_err("timeout in %s\n", __func__);
216 return -1; 216 return -1;
217} 217}
218 218
@@ -1147,6 +1147,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = {
1147 }, 1147 },
1148 }, 1148 },
1149 { 1149 {
1150 .ident = "Lenovo Legion Y530-15ICH",
1151 .matches = {
1152 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1153 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Legion Y530-15ICH"),
1154 },
1155 },
1156 {
1150 .ident = "Lenovo Legion Y720-15IKB", 1157 .ident = "Lenovo Legion Y720-15IKB",
1151 .matches = { 1158 .matches = {
1152 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1159 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
index 6cf9b7fa5bf0..e28bcf61b126 100644
--- a/drivers/platform/x86/intel-hid.c
+++ b/drivers/platform/x86/intel-hid.c
@@ -1,19 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * Intel HID event & 5 button array driver 3 * Intel HID event & 5 button array driver
3 * 4 *
4 * Copyright (C) 2015 Alex Hung <alex.hung@canonical.com> 5 * Copyright (C) 2015 Alex Hung <alex.hung@canonical.com>
5 * Copyright (C) 2015 Andrew Lutomirski <luto@kernel.org> 6 * Copyright (C) 2015 Andrew Lutomirski <luto@kernel.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */ 7 */
18 8
19#include <linux/acpi.h> 9#include <linux/acpi.h>
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c
index 7344d841f4d9..3b81cb896fed 100644
--- a/drivers/platform/x86/intel-rst.c
+++ b/drivers/platform/x86/intel-rst.c
@@ -1,26 +1,11 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org> 3 * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */ 4 */
18 5
19 6#include <linux/acpi.h>
20#include <linux/init.h>
21#include <linux/module.h> 7#include <linux/module.h>
22#include <linux/slab.h> 8#include <linux/slab.h>
23#include <linux/acpi.h>
24 9
25MODULE_LICENSE("GPL"); 10MODULE_LICENSE("GPL");
26 11
@@ -53,12 +38,10 @@ static ssize_t irst_store_wakeup_events(struct device *dev,
53 acpi = to_acpi_device(dev); 38 acpi = to_acpi_device(dev);
54 39
55 error = kstrtoul(buf, 0, &value); 40 error = kstrtoul(buf, 0, &value);
56
57 if (error) 41 if (error)
58 return error; 42 return error;
59 43
60 status = acpi_execute_simple_method(acpi->handle, "SFFS", value); 44 status = acpi_execute_simple_method(acpi->handle, "SFFS", value);
61
62 if (ACPI_FAILURE(status)) 45 if (ACPI_FAILURE(status))
63 return -EINVAL; 46 return -EINVAL;
64 47
@@ -99,12 +82,10 @@ static ssize_t irst_store_wakeup_time(struct device *dev,
99 acpi = to_acpi_device(dev); 82 acpi = to_acpi_device(dev);
100 83
101 error = kstrtoul(buf, 0, &value); 84 error = kstrtoul(buf, 0, &value);
102
103 if (error) 85 if (error)
104 return error; 86 return error;
105 87
106 status = acpi_execute_simple_method(acpi->handle, "SFTV", value); 88 status = acpi_execute_simple_method(acpi->handle, "SFTV", value);
107
108 if (ACPI_FAILURE(status)) 89 if (ACPI_FAILURE(status))
109 return -EINVAL; 90 return -EINVAL;
110 91
diff --git a/drivers/platform/x86/intel-smartconnect.c b/drivers/platform/x86/intel-smartconnect.c
index bbe4c06c769f..64c2dc93472f 100644
--- a/drivers/platform/x86/intel-smartconnect.c
+++ b/drivers/platform/x86/intel-smartconnect.c
@@ -1,25 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org> 3 * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */ 4 */
18 5
19
20#include <linux/init.h>
21#include <linux/module.h>
22#include <linux/acpi.h> 6#include <linux/acpi.h>
7#include <linux/module.h>
23 8
24MODULE_LICENSE("GPL"); 9MODULE_LICENSE("GPL");
25 10
@@ -44,6 +29,7 @@ static const struct acpi_device_id smartconnect_ids[] = {
44 {"INT33A0", 0}, 29 {"INT33A0", 0},
45 {"", 0} 30 {"", 0}
46}; 31};
32MODULE_DEVICE_TABLE(acpi, smartconnect_ids);
47 33
48static struct acpi_driver smartconnect_driver = { 34static struct acpi_driver smartconnect_driver = {
49 .owner = THIS_MODULE, 35 .owner = THIS_MODULE,
@@ -56,5 +42,3 @@ static struct acpi_driver smartconnect_driver = {
56}; 42};
57 43
58module_acpi_driver(smartconnect_driver); 44module_acpi_driver(smartconnect_driver);
59
60MODULE_DEVICE_TABLE(acpi, smartconnect_ids);
diff --git a/drivers/platform/x86/intel-wmi-thunderbolt.c b/drivers/platform/x86/intel-wmi-thunderbolt.c
index c2257bd06f18..9ded8e2af312 100644
--- a/drivers/platform/x86/intel-wmi-thunderbolt.c
+++ b/drivers/platform/x86/intel-wmi-thunderbolt.c
@@ -1,16 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * WMI Thunderbolt driver 3 * WMI Thunderbolt driver
3 * 4 *
4 * Copyright (C) 2017 Dell Inc. All Rights Reserved. 5 * Copyright (C) 2017 Dell Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */ 6 */
15 7
16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -38,12 +30,16 @@ static ssize_t force_power_store(struct device *dev,
38 input.length = sizeof(u8); 30 input.length = sizeof(u8);
39 input.pointer = &mode; 31 input.pointer = &mode;
40 mode = hex_to_bin(buf[0]); 32 mode = hex_to_bin(buf[0]);
33 dev_dbg(dev, "force_power: storing %#x\n", mode);
41 if (mode == 0 || mode == 1) { 34 if (mode == 0 || mode == 1) {
42 status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID, 0, 1, 35 status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID, 0, 1,
43 &input, NULL); 36 &input, NULL);
44 if (ACPI_FAILURE(status)) 37 if (ACPI_FAILURE(status)) {
38 dev_dbg(dev, "force_power: failed to evaluate ACPI method\n");
45 return -ENODEV; 39 return -ENODEV;
40 }
46 } else { 41 } else {
42 dev_dbg(dev, "force_power: unsupported mode\n");
47 return -EINVAL; 43 return -EINVAL;
48 } 44 }
49 return count; 45 return count;
@@ -95,4 +91,4 @@ module_wmi_driver(intel_wmi_thunderbolt_driver);
95MODULE_ALIAS("wmi:" INTEL_WMI_THUNDERBOLT_GUID); 91MODULE_ALIAS("wmi:" INTEL_WMI_THUNDERBOLT_GUID);
96MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>"); 92MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>");
97MODULE_DESCRIPTION("Intel WMI Thunderbolt force power driver"); 93MODULE_DESCRIPTION("Intel WMI Thunderbolt force power driver");
98MODULE_LICENSE("GPL"); 94MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_atomisp2_pm.c b/drivers/platform/x86/intel_atomisp2_pm.c
new file mode 100644
index 000000000000..9371603a0ac9
--- /dev/null
+++ b/drivers/platform/x86/intel_atomisp2_pm.c
@@ -0,0 +1,119 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Dummy driver for Intel's Image Signal Processor found on Bay and Cherry
4 * Trail devices. The sole purpose of this driver is to allow the ISP to
5 * be put in D3.
6 *
7 * Copyright (C) 2018 Hans de Goede <hdegoede@redhat.com>
8 *
9 * Based on various non upstream patches for ISP support:
10 * Copyright (C) 2010-2017 Intel Corporation. All rights reserved.
11 * Copyright (c) 2010 Silicon Hive www.siliconhive.com.
12 */
13
14#include <linux/delay.h>
15#include <linux/module.h>
16#include <linux/mod_devicetable.h>
17#include <linux/pci.h>
18#include <linux/pm_runtime.h>
19#include <asm/iosf_mbi.h>
20
21/* PCI configuration regs */
22#define PCI_INTERRUPT_CTRL 0x9c
23
24#define PCI_CSI_CONTROL 0xe8
25#define PCI_CSI_CONTROL_PORTS_OFF_MASK 0x7
26
27/* IOSF BT_MBI_UNIT_PMC regs */
28#define ISPSSPM0 0x39
29#define ISPSSPM0_ISPSSC_OFFSET 0
30#define ISPSSPM0_ISPSSC_MASK 0x00000003
31#define ISPSSPM0_ISPSSS_OFFSET 24
32#define ISPSSPM0_ISPSSS_MASK 0x03000000
33#define ISPSSPM0_IUNIT_POWER_ON 0x0
34#define ISPSSPM0_IUNIT_POWER_OFF 0x3
35
36static int isp_probe(struct pci_dev *dev, const struct pci_device_id *id)
37{
38 unsigned long timeout;
39 u32 val;
40
41 pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, 0);
42
43 /*
44 * MRFLD IUNIT DPHY is located in an always-power-on island
45 * MRFLD HW design need all CSI ports are disabled before
46 * powering down the IUNIT.
47 */
48 pci_read_config_dword(dev, PCI_CSI_CONTROL, &val);
49 val |= PCI_CSI_CONTROL_PORTS_OFF_MASK;
50 pci_write_config_dword(dev, PCI_CSI_CONTROL, val);
51
52 /* Write 0x3 to ISPSSPM0 bit[1:0] to power off the IUNIT */
53 iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0,
54 ISPSSPM0_IUNIT_POWER_OFF, ISPSSPM0_ISPSSC_MASK);
55
56 /*
57 * There should be no IUNIT access while power-down is
58 * in progress HW sighting: 4567865
59 * Wait up to 50 ms for the IUNIT to shut down.
60 */
61 timeout = jiffies + msecs_to_jiffies(50);
62 while (1) {
63 /* Wait until ISPSSPM0 bit[25:24] shows 0x3 */
64 iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, &val);
65 val = (val & ISPSSPM0_ISPSSS_MASK) >> ISPSSPM0_ISPSSS_OFFSET;
66 if (val == ISPSSPM0_IUNIT_POWER_OFF)
67 break;
68
69 if (time_after(jiffies, timeout)) {
70 dev_err(&dev->dev, "IUNIT power-off timeout.\n");
71 return -EBUSY;
72 }
73 usleep_range(1000, 2000);
74 }
75
76 pm_runtime_allow(&dev->dev);
77 pm_runtime_put_sync_suspend(&dev->dev);
78
79 return 0;
80}
81
82static void isp_remove(struct pci_dev *dev)
83{
84 pm_runtime_get_sync(&dev->dev);
85 pm_runtime_forbid(&dev->dev);
86}
87
88static int isp_pci_suspend(struct device *dev)
89{
90 return 0;
91}
92
93static int isp_pci_resume(struct device *dev)
94{
95 return 0;
96}
97
98static UNIVERSAL_DEV_PM_OPS(isp_pm_ops, isp_pci_suspend,
99 isp_pci_resume, NULL);
100
101static const struct pci_device_id isp_id_table[] = {
102 { PCI_VDEVICE(INTEL, 0x22b8), },
103 { 0, }
104};
105MODULE_DEVICE_TABLE(pci, isp_id_table);
106
107static struct pci_driver isp_pci_driver = {
108 .name = "intel_atomisp2_pm",
109 .id_table = isp_id_table,
110 .probe = isp_probe,
111 .remove = isp_remove,
112 .driver.pm = &isp_pm_ops,
113};
114
115module_pci_driver(isp_pci_driver);
116
117MODULE_DESCRIPTION("Intel AtomISP2 dummy / power-management drv (for suspend)");
118MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
119MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_bxtwc_tmu.c b/drivers/platform/x86/intel_bxtwc_tmu.c
index 227943a20212..951c105bafc1 100644
--- a/drivers/platform/x86/intel_bxtwc_tmu.c
+++ b/drivers/platform/x86/intel_bxtwc_tmu.c
@@ -1,21 +1,12 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * intel_bxtwc_tmu.c - Intel BXT Whiskey Cove PMIC TMU driver 3 * Intel BXT Whiskey Cove PMIC TMU driver
3 * 4 *
4 * Copyright (C) 2016 Intel Corporation. All rights reserved. 5 * Copyright (C) 2016 Intel Corporation. All rights reserved.
5 * 6 *
6 * This driver adds TMU (Time Management Unit) support for Intel BXT platform. 7 * This driver adds TMU (Time Management Unit) support for Intel BXT platform.
7 * It enables the alarm wake-up functionality in the TMU unit of Whiskey Cove 8 * It enables the alarm wake-up functionality in the TMU unit of Whiskey Cove
8 * PMIC. 9 * PMIC.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version
12 * 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */ 10 */
20 11
21#include <linux/module.h> 12#include <linux/module.h>
diff --git a/drivers/platform/x86/intel_cht_int33fe.c b/drivers/platform/x86/intel_cht_int33fe.c
index f40b1c192106..464fe93657b5 100644
--- a/drivers/platform/x86/intel_cht_int33fe.c
+++ b/drivers/platform/x86/intel_cht_int33fe.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel Cherry Trail ACPI INT33FE pseudo device driver 3 * Intel Cherry Trail ACPI INT33FE pseudo device driver
3 * 4 *
4 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> 5 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Some Intel Cherry Trail based device which ship with Windows 10, have 7 * Some Intel Cherry Trail based device which ship with Windows 10, have
11 * this weird INT33FE ACPI device with a CRS table with 4 I2cSerialBusV2 8 * this weird INT33FE ACPI device with a CRS table with 4 I2cSerialBusV2
12 * resources, for 4 different chips attached to various i2c busses: 9 * resources, for 4 different chips attached to various i2c busses:
@@ -257,4 +254,4 @@ module_platform_driver(cht_int33fe_driver);
257 254
258MODULE_DESCRIPTION("Intel Cherry Trail ACPI INT33FE pseudo device driver"); 255MODULE_DESCRIPTION("Intel Cherry Trail ACPI INT33FE pseudo device driver");
259MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); 256MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
260MODULE_LICENSE("GPL"); 257MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_chtdc_ti_pwrbtn.c b/drivers/platform/x86/intel_chtdc_ti_pwrbtn.c
index 38b8e7cfe88c..0df2e82dd249 100644
--- a/drivers/platform/x86/intel_chtdc_ti_pwrbtn.c
+++ b/drivers/platform/x86/intel_chtdc_ti_pwrbtn.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Power-button driver for Dollar Cove TI PMIC 3 * Power-button driver for Dollar Cove TI PMIC
3 * Copyright (C) 2014 Intel Corp 4 * Copyright (C) 2014 Intel Corp
diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
index e89ad4964dc1..4b8f7305fc8a 100644
--- a/drivers/platform/x86/intel_int0002_vgpio.c
+++ b/drivers/platform/x86/intel_int0002_vgpio.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel INT0002 "Virtual GPIO" driver 3 * Intel INT0002 "Virtual GPIO" driver
3 * 4 *
@@ -9,10 +10,6 @@
9 * 10 *
10 * Author: Dyut Kumar Sil <dyut.k.sil@intel.com> 11 * Author: Dyut Kumar Sil <dyut.k.sil@intel.com>
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * Some peripherals on Bay Trail and Cherry Trail platforms signal a Power 13 * Some peripherals on Bay Trail and Cherry Trail platforms signal a Power
17 * Management Event (PME) to the Power Management Controller (PMC) to wakeup 14 * Management Event (PME) to the Power Management Controller (PMC) to wakeup
18 * the system. When this happens software needs to clear the PME bus 0 status 15 * the system. When this happens software needs to clear the PME bus 0 status
@@ -57,11 +54,7 @@
57#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } 54#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
58 55
59static const struct x86_cpu_id int0002_cpu_ids[] = { 56static const struct x86_cpu_id int0002_cpu_ids[] = {
60/* 57 ICPU(INTEL_FAM6_ATOM_SILVERMONT), /* Valleyview, Bay Trail */
61 * Limit ourselves to Cherry Trail for now, until testing shows we
62 * need to handle the INT0002 device on Baytrail too.
63 * ICPU(INTEL_FAM6_ATOM_SILVERMONT), * Valleyview, Bay Trail *
64 */
65 ICPU(INTEL_FAM6_ATOM_AIRMONT), /* Braswell, Cherry Trail */ 58 ICPU(INTEL_FAM6_ATOM_AIRMONT), /* Braswell, Cherry Trail */
66 {} 59 {}
67}; 60};
@@ -110,6 +103,21 @@ static void int0002_irq_mask(struct irq_data *data)
110 outl(gpe_en_reg, GPE0A_EN_PORT); 103 outl(gpe_en_reg, GPE0A_EN_PORT);
111} 104}
112 105
106static int int0002_irq_set_wake(struct irq_data *data, unsigned int on)
107{
108 struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
109 struct platform_device *pdev = to_platform_device(chip->parent);
110 int irq = platform_get_irq(pdev, 0);
111
112 /* Propagate to parent irq */
113 if (on)
114 enable_irq_wake(irq);
115 else
116 disable_irq_wake(irq);
117
118 return 0;
119}
120
113static irqreturn_t int0002_irq(int irq, void *data) 121static irqreturn_t int0002_irq(int irq, void *data)
114{ 122{
115 struct gpio_chip *chip = data; 123 struct gpio_chip *chip = data;
@@ -132,6 +140,7 @@ static struct irq_chip int0002_irqchip = {
132 .irq_ack = int0002_irq_ack, 140 .irq_ack = int0002_irq_ack,
133 .irq_mask = int0002_irq_mask, 141 .irq_mask = int0002_irq_mask,
134 .irq_unmask = int0002_irq_unmask, 142 .irq_unmask = int0002_irq_unmask,
143 .irq_set_wake = int0002_irq_set_wake,
135}; 144};
136 145
137static int int0002_probe(struct platform_device *pdev) 146static int int0002_probe(struct platform_device *pdev)
@@ -216,4 +225,4 @@ module_platform_driver(int0002_driver);
216 225
217MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); 226MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
218MODULE_DESCRIPTION("Intel INT0002 Virtual GPIO driver"); 227MODULE_DESCRIPTION("Intel INT0002 Virtual GPIO driver");
219MODULE_LICENSE("GPL"); 228MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index c5ece7ef08c6..225638a1b09e 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2009-2010 Intel Corporation 3 * Copyright (c) 2009-2010 Intel Corporation
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 *
16 * Authors: 5 * Authors:
17 * Jesse Barnes <jbarnes@virtuousgeek.org> 6 * Jesse Barnes <jbarnes@virtuousgeek.org>
18 */ 7 */
@@ -1697,6 +1686,6 @@ static struct pci_driver ips_pci_driver = {
1697 1686
1698module_pci_driver(ips_pci_driver); 1687module_pci_driver(ips_pci_driver);
1699 1688
1700MODULE_LICENSE("GPL"); 1689MODULE_LICENSE("GPL v2");
1701MODULE_AUTHOR("Jesse Barnes <jbarnes@virtuousgeek.org>"); 1690MODULE_AUTHOR("Jesse Barnes <jbarnes@virtuousgeek.org>");
1702MODULE_DESCRIPTION("Intelligent Power Sharing Driver"); 1691MODULE_DESCRIPTION("Intelligent Power Sharing Driver");
diff --git a/drivers/platform/x86/intel_ips.h b/drivers/platform/x86/intel_ips.h
index 60f4e3ddbe9f..512ad234ad0d 100644
--- a/drivers/platform/x86/intel_ips.h
+++ b/drivers/platform/x86/intel_ips.h
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (c) 2010 Intel Corporation 3 * Copyright (c) 2010 Intel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
15 */ 4 */
16 5
17void ips_link_to_i915_driver(void); 6void ips_link_to_i915_driver(void);
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index ef9b0af8cdd3..77eb8709c931 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -1,25 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * intel_menlow.c - Intel menlow Driver for thermal management extension 3 * Intel menlow Driver for thermal management extension
3 * 4 *
4 * Copyright (C) 2008 Intel Corp 5 * Copyright (C) 2008 Intel Corp
5 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 6 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
6 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 7 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 * 8 *
24 * This driver creates the sys I/F for programming the sensors. 9 * This driver creates the sys I/F for programming the sensors.
25 * It also implements the driver for intel menlow memory controller (hardware 10 * It also implements the driver for intel menlow memory controller (hardware
@@ -29,20 +14,19 @@
29 14
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 16
17#include <linux/acpi.h>
32#include <linux/kernel.h> 18#include <linux/kernel.h>
33#include <linux/module.h> 19#include <linux/module.h>
34#include <linux/init.h>
35#include <linux/slab.h>
36#include <linux/types.h>
37#include <linux/pci.h> 20#include <linux/pci.h>
38#include <linux/pm.h> 21#include <linux/pm.h>
22#include <linux/slab.h>
39#include <linux/thermal.h> 23#include <linux/thermal.h>
40#include <linux/acpi.h> 24#include <linux/types.h>
41 25
42MODULE_AUTHOR("Thomas Sujith"); 26MODULE_AUTHOR("Thomas Sujith");
43MODULE_AUTHOR("Zhang Rui"); 27MODULE_AUTHOR("Zhang Rui");
44MODULE_DESCRIPTION("Intel Menlow platform specific driver"); 28MODULE_DESCRIPTION("Intel Menlow platform specific driver");
45MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL v2");
46 30
47/* 31/*
48 * Memory controller device control 32 * Memory controller device control
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c
index 5ad44204a9c3..292bace83f1e 100644
--- a/drivers/platform/x86/intel_mid_powerbtn.c
+++ b/drivers/platform/x86/intel_mid_powerbtn.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Power button driver for Intel MID platforms. 3 * Power button driver for Intel MID platforms.
3 * 4 *
@@ -5,18 +6,8 @@
5 * 6 *
6 * Author: Hong Liu <hong.liu@intel.com> 7 * Author: Hong Liu <hong.liu@intel.com>
7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 */ 9 */
18 10
19#include <linux/init.h>
20#include <linux/input.h> 11#include <linux/input.h>
21#include <linux/interrupt.h> 12#include <linux/interrupt.h>
22#include <linux/mfd/intel_msic.h> 13#include <linux/mfd/intel_msic.h>
@@ -121,12 +112,9 @@ static const struct mid_pb_ddata mrfld_ddata = {
121 .setup = mrfld_setup, 112 .setup = mrfld_setup,
122}; 113};
123 114
124#define ICPU(model, ddata) \
125 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (kernel_ulong_t)&ddata }
126
127static const struct x86_cpu_id mid_pb_cpu_ids[] = { 115static const struct x86_cpu_id mid_pb_cpu_ids[] = {
128 ICPU(INTEL_FAM6_ATOM_SALTWELL_MID, mfld_ddata), 116 INTEL_CPU_FAM6(ATOM_SALTWELL_MID, mfld_ddata),
129 ICPU(INTEL_FAM6_ATOM_SILVERMONT_MID, mrfld_ddata), 117 INTEL_CPU_FAM6(ATOM_SILVERMONT_MID, mrfld_ddata),
130 {} 118 {}
131}; 119};
132 120
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index 008a76903cbf..f402e2e74a38 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -1,39 +1,23 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * intel_mid_thermal.c - Intel MID platform thermal driver 3 * Intel MID platform thermal driver
3 * 4 *
4 * Copyright (C) 2011 Intel Corporation 5 * Copyright (C) 2011 Intel Corporation
5 * 6 *
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 * Author: Durgadoss R <durgadoss.r@intel.com> 7 * Author: Durgadoss R <durgadoss.r@intel.com>
23 */ 8 */
24 9
25#define pr_fmt(fmt) "intel_mid_thermal: " fmt 10#define pr_fmt(fmt) "intel_mid_thermal: " fmt
26 11
27#include <linux/module.h> 12#include <linux/device.h>
28#include <linux/init.h>
29#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/mfd/intel_msic.h>
15#include <linux/module.h>
30#include <linux/param.h> 16#include <linux/param.h>
31#include <linux/device.h>
32#include <linux/platform_device.h> 17#include <linux/platform_device.h>
33#include <linux/slab.h>
34#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/slab.h>
35#include <linux/thermal.h> 20#include <linux/thermal.h>
36#include <linux/mfd/intel_msic.h>
37 21
38/* Number of thermal sensors */ 22/* Number of thermal sensors */
39#define MSIC_THERMAL_SENSORS 4 23#define MSIC_THERMAL_SENSORS 4
@@ -567,4 +551,4 @@ module_platform_driver(mid_thermal_driver);
567 551
568MODULE_AUTHOR("Durgadoss R <durgadoss.r@intel.com>"); 552MODULE_AUTHOR("Durgadoss R <durgadoss.r@intel.com>");
569MODULE_DESCRIPTION("Intel Medfield Platform Thermal Driver"); 553MODULE_DESCRIPTION("Intel Medfield Platform Thermal Driver");
570MODULE_LICENSE("GPL"); 554MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
index 5747f63c8d9f..3c0438ba385e 100644
--- a/drivers/platform/x86/intel_oaktrail.c
+++ b/drivers/platform/x86/intel_oaktrail.c
@@ -1,5 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * intel_oaktrail.c - Intel OakTrail Platform support. 3 * Intel OakTrail Platform support
3 * 4 *
4 * Copyright (C) 2010-2011 Intel Corporation 5 * Copyright (C) 2010-2011 Intel Corporation
5 * Author: Yin Kangkai (kangkai.yin@intel.com) 6 * Author: Yin Kangkai (kangkai.yin@intel.com)
@@ -8,21 +9,6 @@
8 * <cezary.jackiewicz (at) gmail.com>, based on MSI driver 9 * <cezary.jackiewicz (at) gmail.com>, based on MSI driver
9 * Copyright (C) 2006 Lennart Poettering <mzxreary (at) 0pointer (dot) de> 10 * Copyright (C) 2006 Lennart Poettering <mzxreary (at) 0pointer (dot) de>
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * 02110-1301, USA.
25 *
26 * This driver does below things: 12 * This driver does below things:
27 * 1. registers itself in the Linux backlight control in 13 * 1. registers itself in the Linux backlight control in
28 * /sys/class/backlight/intel_oaktrail/ 14 * /sys/class/backlight/intel_oaktrail/
@@ -38,18 +24,18 @@
38 24
39#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
40 26
41#include <linux/module.h>
42#include <linux/kernel.h>
43#include <linux/init.h>
44#include <linux/acpi.h> 27#include <linux/acpi.h>
45#include <linux/fb.h> 28#include <linux/backlight.h>
46#include <linux/mutex.h> 29#include <linux/dmi.h>
47#include <linux/err.h> 30#include <linux/err.h>
31#include <linux/fb.h>
48#include <linux/i2c.h> 32#include <linux/i2c.h>
49#include <linux/backlight.h> 33#include <linux/kernel.h>
34#include <linux/module.h>
35#include <linux/mutex.h>
50#include <linux/platform_device.h> 36#include <linux/platform_device.h>
51#include <linux/dmi.h>
52#include <linux/rfkill.h> 37#include <linux/rfkill.h>
38
53#include <acpi/video.h> 39#include <acpi/video.h>
54 40
55#define DRIVER_NAME "intel_oaktrail" 41#define DRIVER_NAME "intel_oaktrail"
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 2d272a3e0176..6b31d410cb09 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel Core SoC Power Management Controller Driver 3 * Intel Core SoC Power Management Controller Driver
3 * 4 *
@@ -6,16 +7,6 @@
6 * 7 *
7 * Authors: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com> 8 * Authors: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
8 * Vishwanath Somayaji <vishwanath.somayaji@intel.com> 9 * Vishwanath Somayaji <vishwanath.somayaji@intel.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 */ 10 */
20 11
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h
index 93a7e99e1f8b..be045348ad86 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel Core SoC Power Management Controller Header File 3 * Intel Core SoC Power Management Controller Header File
3 * 4 *
@@ -6,16 +7,6 @@
6 * 7 *
7 * Authors: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com> 8 * Authors: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
8 * Vishwanath Somayaji <vishwanath.somayaji@intel.com> 9 * Vishwanath Somayaji <vishwanath.somayaji@intel.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 */ 10 */
20 11
21#ifndef PMC_CORE_H 12#ifndef PMC_CORE_H
diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c
index e7edc8c63936..7964ba22ef8d 100644
--- a/drivers/platform/x86/intel_pmc_ipc.c
+++ b/drivers/platform/x86/intel_pmc_ipc.c
@@ -1,39 +1,34 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * intel_pmc_ipc.c: Driver for the Intel PMC IPC mechanism 3 * Driver for the Intel PMC IPC mechanism
3 * 4 *
4 * (C) Copyright 2014-2015 Intel Corporation 5 * (C) Copyright 2014-2015 Intel Corporation
5 * 6 *
6 * This driver is based on Intel SCU IPC driver(intel_scu_opc.c) by 7 * This driver is based on Intel SCU IPC driver(intel_scu_ipc.c) by
7 * Sreedhara DS <sreedhara.ds@intel.com> 8 * Sreedhara DS <sreedhara.ds@intel.com>
8 * 9 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; version 2
12 * of the License.
13 *
14 * PMC running in ARC processor communicates with other entity running in IA 10 * PMC running in ARC processor communicates with other entity running in IA
15 * core through IPC mechanism which in turn messaging between IA core ad PMC. 11 * core through IPC mechanism which in turn messaging between IA core ad PMC.
16 */ 12 */
17 13
18#include <linux/module.h> 14#include <linux/acpi.h>
15#include <linux/atomic.h>
16#include <linux/bitops.h>
19#include <linux/delay.h> 17#include <linux/delay.h>
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/device.h> 18#include <linux/device.h>
23#include <linux/pm.h> 19#include <linux/errno.h>
20#include <linux/interrupt.h>
21#include <linux/io-64-nonatomic-lo-hi.h>
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/notifier.h>
24#include <linux/pci.h> 25#include <linux/pci.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/interrupt.h> 27#include <linux/pm.h>
27#include <linux/pm_qos.h> 28#include <linux/pm_qos.h>
28#include <linux/kernel.h>
29#include <linux/bitops.h>
30#include <linux/sched.h> 29#include <linux/sched.h>
31#include <linux/atomic.h>
32#include <linux/notifier.h>
33#include <linux/suspend.h>
34#include <linux/acpi.h>
35#include <linux/io-64-nonatomic-lo-hi.h>
36#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/suspend.h>
37 32
38#include <asm/intel_pmc_ipc.h> 33#include <asm/intel_pmc_ipc.h>
39 34
@@ -1029,7 +1024,7 @@ static void __exit intel_pmc_ipc_exit(void)
1029 1024
1030MODULE_AUTHOR("Zha Qipeng <qipeng.zha@intel.com>"); 1025MODULE_AUTHOR("Zha Qipeng <qipeng.zha@intel.com>");
1031MODULE_DESCRIPTION("Intel PMC IPC driver"); 1026MODULE_DESCRIPTION("Intel PMC IPC driver");
1032MODULE_LICENSE("GPL"); 1027MODULE_LICENSE("GPL v2");
1033 1028
1034/* Some modules are dependent on this, so init earlier */ 1029/* Some modules are dependent on this, so init earlier */
1035fs_initcall(intel_pmc_ipc_init); 1030fs_initcall(intel_pmc_ipc_init);
diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c
index 2efeab650345..79671927f4ef 100644
--- a/drivers/platform/x86/intel_punit_ipc.c
+++ b/drivers/platform/x86/intel_punit_ipc.c
@@ -1,25 +1,23 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Driver for the Intel P-Unit Mailbox IPC mechanism 3 * Driver for the Intel P-Unit Mailbox IPC mechanism
3 * 4 *
4 * (C) Copyright 2015 Intel Corporation 5 * (C) Copyright 2015 Intel Corporation
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * The heart of the P-Unit is the Foxton microcontroller and its firmware, 7 * The heart of the P-Unit is the Foxton microcontroller and its firmware,
11 * which provide mailbox interface for power management usage. 8 * which provide mailbox interface for power management usage.
12 */ 9 */
13 10
14#include <linux/module.h>
15#include <linux/mod_devicetable.h>
16#include <linux/acpi.h> 11#include <linux/acpi.h>
17#include <linux/delay.h>
18#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/delay.h>
19#include <linux/device.h> 14#include <linux/device.h>
20#include <linux/interrupt.h> 15#include <linux/interrupt.h>
21#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/mod_devicetable.h>
18#include <linux/module.h>
22#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20
23#include <asm/intel_punit_ipc.h> 21#include <asm/intel_punit_ipc.h>
24 22
25/* IPC Mailbox registers */ 23/* IPC Mailbox registers */
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 75c8fef7a482..cdab916fbf92 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -1,14 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * intel_scu_ipc.c: Driver for the Intel SCU IPC mechanism 3 * Driver for the Intel SCU IPC mechanism
3 * 4 *
4 * (C) Copyright 2008-2010,2015 Intel Corporation 5 * (C) Copyright 2008-2010,2015 Intel Corporation
5 * Author: Sreedhara DS (sreedhara.ds@intel.com) 6 * Author: Sreedhara DS (sreedhara.ds@intel.com)
6 * 7 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 *
12 * SCU running in ARC processor communicates with other entity running in IA 8 * SCU running in ARC processor communicates with other entity running in IA
13 * core through IPC mechanism which in turn messaging between IA core ad SCU. 9 * core through IPC mechanism which in turn messaging between IA core ad SCU.
14 * SCU has two IPC mechanism IPC-1 and IPC-2. IPC-1 is used between IA32 and 10 * SCU has two IPC mechanism IPC-1 and IPC-2. IPC-1 is used between IA32 and
@@ -16,14 +12,16 @@
16 * IPC-1 Driver provides an API for power control unit registers (e.g. MSIC) 12 * IPC-1 Driver provides an API for power control unit registers (e.g. MSIC)
17 * along with other APIs. 13 * along with other APIs.
18 */ 14 */
15
19#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/device.h>
20#include <linux/errno.h> 18#include <linux/errno.h>
21#include <linux/init.h> 19#include <linux/init.h>
22#include <linux/device.h>
23#include <linux/pm.h>
24#include <linux/pci.h>
25#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/pci.h>
22#include <linux/pm.h>
26#include <linux/sfi.h> 23#include <linux/sfi.h>
24
27#include <asm/intel-mid.h> 25#include <asm/intel-mid.h>
28#include <asm/intel_scu_ipc.h> 26#include <asm/intel_scu_ipc.h>
29 27
diff --git a/drivers/platform/x86/intel_scu_ipcutil.c b/drivers/platform/x86/intel_scu_ipcutil.c
index aa454241489c..8afe6fa06d7b 100644
--- a/drivers/platform/x86/intel_scu_ipcutil.c
+++ b/drivers/platform/x86/intel_scu_ipcutil.c
@@ -1,32 +1,28 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * intel_scu_ipc.c: Driver for the Intel SCU IPC mechanism 3 * Driver for the Intel SCU IPC mechanism
3 * 4 *
4 * (C) Copyright 2008-2010 Intel Corporation 5 * (C) Copyright 2008-2010 Intel Corporation
5 * Author: Sreedhara DS (sreedhara.ds@intel.com) 6 * Author: Sreedhara DS (sreedhara.ds@intel.com)
6 * 7 *
7 * This program is free software; you can redistribute it and/or 8 * This driver provides IOCTL interfaces to call Intel SCU IPC driver API.
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 *
12 * This driver provides ioctl interfaces to call intel scu ipc driver api
13 */ 9 */
14 10
15#include <linux/module.h>
16#include <linux/kernel.h>
17#include <linux/errno.h> 11#include <linux/errno.h>
18#include <linux/types.h>
19#include <linux/fs.h>
20#include <linux/fcntl.h> 12#include <linux/fcntl.h>
13#include <linux/fs.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
21#include <linux/sched.h> 16#include <linux/sched.h>
22#include <linux/uaccess.h>
23#include <linux/slab.h> 17#include <linux/slab.h>
24#include <linux/init.h> 18#include <linux/types.h>
19#include <linux/uaccess.h>
20
25#include <asm/intel_scu_ipc.h> 21#include <asm/intel_scu_ipc.h>
26 22
27static int major; 23static int major;
28 24
29/* ioctl commnds */ 25/* IOCTL commands */
30#define INTE_SCU_IPC_REGISTER_READ 0 26#define INTE_SCU_IPC_REGISTER_READ 0
31#define INTE_SCU_IPC_REGISTER_WRITE 1 27#define INTE_SCU_IPC_REGISTER_WRITE 1
32#define INTE_SCU_IPC_REGISTER_UPDATE 2 28#define INTE_SCU_IPC_REGISTER_UPDATE 2
diff --git a/drivers/platform/x86/intel_telemetry_core.c b/drivers/platform/x86/intel_telemetry_core.c
index f378621b5fe9..d4040bb222b4 100644
--- a/drivers/platform/x86/intel_telemetry_core.c
+++ b/drivers/platform/x86/intel_telemetry_core.c
@@ -1,17 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel SoC Core Telemetry Driver 3 * Intel SoC Core Telemetry Driver
3 * Copyright (C) 2015, Intel Corporation. 4 * Copyright (C) 2015, Intel Corporation.
4 * All Rights Reserved. 5 * All Rights Reserved.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * Telemetry Framework provides platform related PM and performance statistics. 7 * Telemetry Framework provides platform related PM and performance statistics.
16 * This file provides the core telemetry API implementation. 8 * This file provides the core telemetry API implementation.
17 */ 9 */
@@ -460,4 +452,4 @@ module_exit(telemetry_module_exit);
460 452
461MODULE_AUTHOR("Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>"); 453MODULE_AUTHOR("Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>");
462MODULE_DESCRIPTION("Intel SoC Telemetry Interface"); 454MODULE_DESCRIPTION("Intel SoC Telemetry Interface");
463MODULE_LICENSE("GPL"); 455MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c
index cee08f236292..40bce560eb30 100644
--- a/drivers/platform/x86/intel_telemetry_debugfs.c
+++ b/drivers/platform/x86/intel_telemetry_debugfs.c
@@ -1,17 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel SOC Telemetry debugfs Driver: Currently supports APL 3 * Intel SOC Telemetry debugfs Driver: Currently supports APL
3 * Copyright (c) 2015, Intel Corporation. 4 * Copyright (c) 2015, Intel Corporation.
4 * All Rights Reserved. 5 * All Rights Reserved.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * This file provides the debugfs interfaces for telemetry. 7 * This file provides the debugfs interfaces for telemetry.
16 * /sys/kernel/debug/telemetry/pss_info: Shows Primary Control Sub-Sys Counters 8 * /sys/kernel/debug/telemetry/pss_info: Shows Primary Control Sub-Sys Counters
17 * /sys/kernel/debug/telemetry/ioss_info: Shows IO Sub-System Counters 9 * /sys/kernel/debug/telemetry/ioss_info: Shows IO Sub-System Counters
@@ -72,9 +64,6 @@
72#define TELEM_IOSS_DX_D0IX_EVTS 25 64#define TELEM_IOSS_DX_D0IX_EVTS 25
73#define TELEM_IOSS_PG_EVTS 30 65#define TELEM_IOSS_PG_EVTS 30
74 66
75#define TELEM_DEBUGFS_CPU(model, data) \
76 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)&data}
77
78#define TELEM_CHECK_AND_PARSE_EVTS(EVTID, EVTNUM, BUF, EVTLOG, EVTDAT, MASK) { \ 67#define TELEM_CHECK_AND_PARSE_EVTS(EVTID, EVTNUM, BUF, EVTLOG, EVTDAT, MASK) { \
79 if (evtlog[index].telem_evtid == (EVTID)) { \ 68 if (evtlog[index].telem_evtid == (EVTID)) { \
80 for (idx = 0; idx < (EVTNUM); idx++) \ 69 for (idx = 0; idx < (EVTNUM); idx++) \
@@ -319,8 +308,8 @@ static struct telemetry_debugfs_conf telem_apl_debugfs_conf = {
319}; 308};
320 309
321static const struct x86_cpu_id telemetry_debugfs_cpu_ids[] = { 310static const struct x86_cpu_id telemetry_debugfs_cpu_ids[] = {
322 TELEM_DEBUGFS_CPU(INTEL_FAM6_ATOM_GOLDMONT, telem_apl_debugfs_conf), 311 INTEL_CPU_FAM6(ATOM_GOLDMONT, telem_apl_debugfs_conf),
323 TELEM_DEBUGFS_CPU(INTEL_FAM6_ATOM_GOLDMONT_PLUS, telem_apl_debugfs_conf), 312 INTEL_CPU_FAM6(ATOM_GOLDMONT_PLUS, telem_apl_debugfs_conf),
324 {} 313 {}
325}; 314};
326 315
@@ -951,12 +940,16 @@ static int __init telemetry_debugfs_init(void)
951 debugfs_conf = (struct telemetry_debugfs_conf *)id->driver_data; 940 debugfs_conf = (struct telemetry_debugfs_conf *)id->driver_data;
952 941
953 err = telemetry_pltconfig_valid(); 942 err = telemetry_pltconfig_valid();
954 if (err < 0) 943 if (err < 0) {
944 pr_info("Invalid pltconfig, ensure IPC1 device is enabled in BIOS\n");
955 return -ENODEV; 945 return -ENODEV;
946 }
956 947
957 err = telemetry_debugfs_check_evts(); 948 err = telemetry_debugfs_check_evts();
958 if (err < 0) 949 if (err < 0) {
950 pr_info("telemetry_debugfs_check_evts failed\n");
959 return -EINVAL; 951 return -EINVAL;
952 }
960 953
961 register_pm_notifier(&pm_notifier); 954 register_pm_notifier(&pm_notifier);
962 955
@@ -1037,4 +1030,4 @@ module_exit(telemetry_debugfs_exit);
1037MODULE_AUTHOR("Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>"); 1030MODULE_AUTHOR("Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>");
1038MODULE_DESCRIPTION("Intel SoC Telemetry debugfs Interface"); 1031MODULE_DESCRIPTION("Intel SoC Telemetry debugfs Interface");
1039MODULE_VERSION(DRIVER_VERSION); 1032MODULE_VERSION(DRIVER_VERSION);
1040MODULE_LICENSE("GPL"); 1033MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_telemetry_pltdrv.c b/drivers/platform/x86/intel_telemetry_pltdrv.c
index fcc6bee51a42..df8565bad595 100644
--- a/drivers/platform/x86/intel_telemetry_pltdrv.c
+++ b/drivers/platform/x86/intel_telemetry_pltdrv.c
@@ -1,17 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel SOC Telemetry Platform Driver: Currently supports APL 3 * Intel SOC Telemetry Platform Driver: Currently supports APL
3 * Copyright (c) 2015, Intel Corporation. 4 * Copyright (c) 2015, Intel Corporation.
4 * All Rights Reserved. 5 * All Rights Reserved.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * This file provides the platform specific telemetry implementation for APL. 7 * This file provides the platform specific telemetry implementation for APL.
16 * It used the PUNIT and PMC IPC interfaces for configuring the counters. 8 * It used the PUNIT and PMC IPC interfaces for configuring the counters.
17 * The accumulated results are fetched from SRAM. 9 * The accumulated results are fetched from SRAM.
@@ -1242,4 +1234,4 @@ module_exit(telemetry_module_exit);
1242MODULE_AUTHOR("Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>"); 1234MODULE_AUTHOR("Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>");
1243MODULE_DESCRIPTION("Intel SoC Telemetry Platform Driver"); 1235MODULE_DESCRIPTION("Intel SoC Telemetry Platform Driver");
1244MODULE_VERSION(DRIVER_VERSION); 1236MODULE_VERSION(DRIVER_VERSION);
1245MODULE_LICENSE("GPL"); 1237MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/intel_turbo_max_3.c b/drivers/platform/x86/intel_turbo_max_3.c
index a6d5aa0c3c47..7b9cc841ab65 100644
--- a/drivers/platform/x86/intel_turbo_max_3.c
+++ b/drivers/platform/x86/intel_turbo_max_3.c
@@ -1,28 +1,20 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel Turbo Boost Max Technology 3.0 legacy (non HWP) enumeration driver 3 * Intel Turbo Boost Max Technology 3.0 legacy (non HWP) enumeration driver
3 * Copyright (c) 2017, Intel Corporation. 4 * Copyright (c) 2017, Intel Corporation.
4 * All rights reserved. 5 * All rights reserved.
5 * 6 *
6 * Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 7 * Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 */ 8 */
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 9#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19 10
20#include <linux/kernel.h> 11#include <linux/cpufeature.h>
12#include <linux/cpuhotplug.h>
21#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h>
22#include <linux/topology.h> 15#include <linux/topology.h>
23#include <linux/workqueue.h> 16#include <linux/workqueue.h>
24#include <linux/cpuhotplug.h> 17
25#include <linux/cpufeature.h>
26#include <asm/cpu_device_id.h> 18#include <asm/cpu_device_id.h>
27#include <asm/intel-family.h> 19#include <asm/intel-family.h>
28 20
diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
new file mode 100644
index 000000000000..c0bb1f864dfe
--- /dev/null
+++ b/drivers/platform/x86/lg-laptop.c
@@ -0,0 +1,700 @@
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * lg-laptop.c - LG Gram ACPI features and hotkeys Driver
4 *
5 * Copyright (C) 2018 Matan Ziv-Av <matan@svgalib.org>
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
10#include <linux/acpi.h>
11#include <linux/input.h>
12#include <linux/input/sparse-keymap.h>
13#include <linux/kernel.h>
14#include <linux/leds.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/types.h>
18
19#define LED_DEVICE(_name, max) struct led_classdev _name = { \
20 .name = __stringify(_name), \
21 .max_brightness = max, \
22 .brightness_set = _name##_set, \
23 .brightness_get = _name##_get, \
24}
25
26MODULE_AUTHOR("Matan Ziv-Av");
27MODULE_DESCRIPTION("LG WMI Hotkey Driver");
28MODULE_LICENSE("GPL");
29
30#define WMI_EVENT_GUID0 "E4FB94F9-7F2B-4173-AD1A-CD1D95086248"
31#define WMI_EVENT_GUID1 "023B133E-49D1-4E10-B313-698220140DC2"
32#define WMI_EVENT_GUID2 "37BE1AC0-C3F2-4B1F-BFBE-8FDEAF2814D6"
33#define WMI_EVENT_GUID3 "911BAD44-7DF8-4FBB-9319-BABA1C4B293B"
34#define WMI_METHOD_WMAB "C3A72B38-D3EF-42D3-8CBB-D5A57049F66D"
35#define WMI_METHOD_WMBB "2B4F501A-BD3C-4394-8DCF-00A7D2BC8210"
36#define WMI_EVENT_GUID WMI_EVENT_GUID0
37
38#define WMAB_METHOD "\\XINI.WMAB"
39#define WMBB_METHOD "\\XINI.WMBB"
40#define SB_GGOV_METHOD "\\_SB.GGOV"
41#define GOV_TLED 0x2020008
42#define WM_GET 1
43#define WM_SET 2
44#define WM_KEY_LIGHT 0x400
45#define WM_TLED 0x404
46#define WM_FN_LOCK 0x407
47#define WM_BATT_LIMIT 0x61
48#define WM_READER_MODE 0xBF
49#define WM_FAN_MODE 0x33
50#define WMBB_USB_CHARGE 0x10B
51#define WMBB_BATT_LIMIT 0x10C
52
53#define PLATFORM_NAME "lg-laptop"
54
55MODULE_ALIAS("wmi:" WMI_EVENT_GUID0);
56MODULE_ALIAS("wmi:" WMI_EVENT_GUID1);
57MODULE_ALIAS("wmi:" WMI_EVENT_GUID2);
58MODULE_ALIAS("wmi:" WMI_EVENT_GUID3);
59MODULE_ALIAS("wmi:" WMI_METHOD_WMAB);
60MODULE_ALIAS("wmi:" WMI_METHOD_WMBB);
61MODULE_ALIAS("acpi*:LGEX0815:*");
62
63static struct platform_device *pf_device;
64static struct input_dev *wmi_input_dev;
65
66static u32 inited;
67#define INIT_INPUT_WMI_0 0x01
68#define INIT_INPUT_WMI_2 0x02
69#define INIT_INPUT_ACPI 0x04
70#define INIT_TPAD_LED 0x08
71#define INIT_KBD_LED 0x10
72#define INIT_SPARSE_KEYMAP 0x80
73
74static const struct key_entry wmi_keymap[] = {
75 {KE_KEY, 0x70, {KEY_F15} }, /* LG control panel (F1) */
76 {KE_KEY, 0x74, {KEY_F13} }, /* Touchpad toggle (F5) */
77 {KE_KEY, 0xf020000, {KEY_F14} }, /* Read mode (F9) */
78 {KE_KEY, 0x10000000, {KEY_F16} },/* Keyboard backlight (F8) - pressing
79 * this key both sends an event and
80 * changes backlight level.
81 */
82 {KE_KEY, 0x80, {KEY_RFKILL} },
83 {KE_END, 0}
84};
85
86static int ggov(u32 arg0)
87{
88 union acpi_object args[1];
89 union acpi_object *r;
90 acpi_status status;
91 acpi_handle handle;
92 struct acpi_object_list arg;
93 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
94 int res;
95
96 args[0].type = ACPI_TYPE_INTEGER;
97 args[0].integer.value = arg0;
98
99 status = acpi_get_handle(NULL, (acpi_string) SB_GGOV_METHOD, &handle);
100 if (ACPI_FAILURE(status)) {
101 pr_err("Cannot get handle");
102 return -ENODEV;
103 }
104
105 arg.count = 1;
106 arg.pointer = args;
107
108 status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
109 if (ACPI_FAILURE(status)) {
110 acpi_handle_err(handle, "GGOV: call failed.\n");
111 return -EINVAL;
112 }
113
114 r = buffer.pointer;
115 if (r->type != ACPI_TYPE_INTEGER) {
116 kfree(r);
117 return -EINVAL;
118 }
119
120 res = r->integer.value;
121 kfree(r);
122
123 return res;
124}
125
126static union acpi_object *lg_wmab(u32 method, u32 arg1, u32 arg2)
127{
128 union acpi_object args[3];
129 acpi_status status;
130 acpi_handle handle;
131 struct acpi_object_list arg;
132 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
133
134 args[0].type = ACPI_TYPE_INTEGER;
135 args[0].integer.value = method;
136 args[1].type = ACPI_TYPE_INTEGER;
137 args[1].integer.value = arg1;
138 args[2].type = ACPI_TYPE_INTEGER;
139 args[2].integer.value = arg2;
140
141 status = acpi_get_handle(NULL, (acpi_string) WMAB_METHOD, &handle);
142 if (ACPI_FAILURE(status)) {
143 pr_err("Cannot get handle");
144 return NULL;
145 }
146
147 arg.count = 3;
148 arg.pointer = args;
149
150 status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
151 if (ACPI_FAILURE(status)) {
152 acpi_handle_err(handle, "WMAB: call failed.\n");
153 return NULL;
154 }
155
156 return buffer.pointer;
157}
158
159static union acpi_object *lg_wmbb(u32 method_id, u32 arg1, u32 arg2)
160{
161 union acpi_object args[3];
162 acpi_status status;
163 acpi_handle handle;
164 struct acpi_object_list arg;
165 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
166 u8 buf[32];
167
168 *(u32 *)buf = method_id;
169 *(u32 *)(buf + 4) = arg1;
170 *(u32 *)(buf + 16) = arg2;
171 args[0].type = ACPI_TYPE_INTEGER;
172 args[0].integer.value = 0; /* ignored */
173 args[1].type = ACPI_TYPE_INTEGER;
174 args[1].integer.value = 1; /* Must be 1 or 2. Does not matter which */
175 args[2].type = ACPI_TYPE_BUFFER;
176 args[2].buffer.length = 32;
177 args[2].buffer.pointer = buf;
178
179 status = acpi_get_handle(NULL, (acpi_string)WMBB_METHOD, &handle);
180 if (ACPI_FAILURE(status)) {
181 pr_err("Cannot get handle");
182 return NULL;
183 }
184
185 arg.count = 3;
186 arg.pointer = args;
187
188 status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
189 if (ACPI_FAILURE(status)) {
190 acpi_handle_err(handle, "WMAB: call failed.\n");
191 return NULL;
192 }
193
194 return (union acpi_object *)buffer.pointer;
195}
196
197static void wmi_notify(u32 value, void *context)
198{
199 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
200 union acpi_object *obj;
201 acpi_status status;
202 long data = (long)context;
203
204 pr_debug("event guid %li\n", data);
205 status = wmi_get_event_data(value, &response);
206 if (ACPI_FAILURE(status)) {
207 pr_err("Bad event status 0x%x\n", status);
208 return;
209 }
210
211 obj = (union acpi_object *)response.pointer;
212 if (!obj)
213 return;
214
215 if (obj->type == ACPI_TYPE_INTEGER) {
216 int eventcode = obj->integer.value;
217 struct key_entry *key;
218
219 key =
220 sparse_keymap_entry_from_scancode(wmi_input_dev, eventcode);
221 if (key && key->type == KE_KEY)
222 sparse_keymap_report_entry(wmi_input_dev, key, 1, true);
223 }
224
225 pr_debug("Type: %i Eventcode: 0x%llx\n", obj->type,
226 obj->integer.value);
227 kfree(response.pointer);
228}
229
230static void wmi_input_setup(void)
231{
232 acpi_status status;
233
234 wmi_input_dev = input_allocate_device();
235 if (wmi_input_dev) {
236 wmi_input_dev->name = "LG WMI hotkeys";
237 wmi_input_dev->phys = "wmi/input0";
238 wmi_input_dev->id.bustype = BUS_HOST;
239
240 if (sparse_keymap_setup(wmi_input_dev, wmi_keymap, NULL) ||
241 input_register_device(wmi_input_dev)) {
242 pr_info("Cannot initialize input device");
243 input_free_device(wmi_input_dev);
244 return;
245 }
246
247 inited |= INIT_SPARSE_KEYMAP;
248 status = wmi_install_notify_handler(WMI_EVENT_GUID0, wmi_notify,
249 (void *)0);
250 if (ACPI_SUCCESS(status))
251 inited |= INIT_INPUT_WMI_0;
252
253 status = wmi_install_notify_handler(WMI_EVENT_GUID2, wmi_notify,
254 (void *)2);
255 if (ACPI_SUCCESS(status))
256 inited |= INIT_INPUT_WMI_2;
257 } else {
258 pr_info("Cannot allocate input device");
259 }
260}
261
262static void acpi_notify(struct acpi_device *device, u32 event)
263{
264 struct key_entry *key;
265
266 acpi_handle_debug(device->handle, "notify: %d\n", event);
267 if (inited & INIT_SPARSE_KEYMAP) {
268 key = sparse_keymap_entry_from_scancode(wmi_input_dev, 0x80);
269 if (key && key->type == KE_KEY)
270 sparse_keymap_report_entry(wmi_input_dev, key, 1, true);
271 }
272}
273
274static ssize_t fan_mode_store(struct device *dev,
275 struct device_attribute *attr,
276 const char *buffer, size_t count)
277{
278 bool value;
279 union acpi_object *r;
280 u32 m;
281 int ret;
282
283 ret = kstrtobool(buffer, &value);
284 if (ret)
285 return ret;
286
287 r = lg_wmab(WM_FAN_MODE, WM_GET, 0);
288 if (!r)
289 return -EIO;
290
291 if (r->type != ACPI_TYPE_INTEGER) {
292 kfree(r);
293 return -EIO;
294 }
295
296 m = r->integer.value;
297 kfree(r);
298 r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4));
299 kfree(r);
300 r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value);
301 kfree(r);
302
303 return count;
304}
305
306static ssize_t fan_mode_show(struct device *dev,
307 struct device_attribute *attr, char *buffer)
308{
309 unsigned int status;
310 union acpi_object *r;
311
312 r = lg_wmab(WM_FAN_MODE, WM_GET, 0);
313 if (!r)
314 return -EIO;
315
316 if (r->type != ACPI_TYPE_INTEGER) {
317 kfree(r);
318 return -EIO;
319 }
320
321 status = r->integer.value & 0x01;
322 kfree(r);
323
324 return snprintf(buffer, PAGE_SIZE, "%d\n", status);
325}
326
327static ssize_t usb_charge_store(struct device *dev,
328 struct device_attribute *attr,
329 const char *buffer, size_t count)
330{
331 bool value;
332 union acpi_object *r;
333 int ret;
334
335 ret = kstrtobool(buffer, &value);
336 if (ret)
337 return ret;
338
339 r = lg_wmbb(WMBB_USB_CHARGE, WM_SET, value);
340 if (!r)
341 return -EIO;
342
343 kfree(r);
344 return count;
345}
346
347static ssize_t usb_charge_show(struct device *dev,
348 struct device_attribute *attr, char *buffer)
349{
350 unsigned int status;
351 union acpi_object *r;
352
353 r = lg_wmbb(WMBB_USB_CHARGE, WM_GET, 0);
354 if (!r)
355 return -EIO;
356
357 if (r->type != ACPI_TYPE_BUFFER) {
358 kfree(r);
359 return -EIO;
360 }
361
362 status = !!r->buffer.pointer[0x10];
363
364 kfree(r);
365
366 return snprintf(buffer, PAGE_SIZE, "%d\n", status);
367}
368
369static ssize_t reader_mode_store(struct device *dev,
370 struct device_attribute *attr,
371 const char *buffer, size_t count)
372{
373 bool value;
374 union acpi_object *r;
375 int ret;
376
377 ret = kstrtobool(buffer, &value);
378 if (ret)
379 return ret;
380
381 r = lg_wmab(WM_READER_MODE, WM_SET, value);
382 if (!r)
383 return -EIO;
384
385 kfree(r);
386 return count;
387}
388
389static ssize_t reader_mode_show(struct device *dev,
390 struct device_attribute *attr, char *buffer)
391{
392 unsigned int status;
393 union acpi_object *r;
394
395 r = lg_wmab(WM_READER_MODE, WM_GET, 0);
396 if (!r)
397 return -EIO;
398
399 if (r->type != ACPI_TYPE_INTEGER) {
400 kfree(r);
401 return -EIO;
402 }
403
404 status = !!r->integer.value;
405
406 kfree(r);
407
408 return snprintf(buffer, PAGE_SIZE, "%d\n", status);
409}
410
411static ssize_t fn_lock_store(struct device *dev,
412 struct device_attribute *attr,
413 const char *buffer, size_t count)
414{
415 bool value;
416 union acpi_object *r;
417 int ret;
418
419 ret = kstrtobool(buffer, &value);
420 if (ret)
421 return ret;
422
423 r = lg_wmab(WM_FN_LOCK, WM_SET, value);
424 if (!r)
425 return -EIO;
426
427 kfree(r);
428 return count;
429}
430
431static ssize_t fn_lock_show(struct device *dev,
432 struct device_attribute *attr, char *buffer)
433{
434 unsigned int status;
435 union acpi_object *r;
436
437 r = lg_wmab(WM_FN_LOCK, WM_GET, 0);
438 if (!r)
439 return -EIO;
440
441 if (r->type != ACPI_TYPE_BUFFER) {
442 kfree(r);
443 return -EIO;
444 }
445
446 status = !!r->buffer.pointer[0];
447 kfree(r);
448
449 return snprintf(buffer, PAGE_SIZE, "%d\n", status);
450}
451
452static ssize_t battery_care_limit_store(struct device *dev,
453 struct device_attribute *attr,
454 const char *buffer, size_t count)
455{
456 unsigned long value;
457 int ret;
458
459 ret = kstrtoul(buffer, 10, &value);
460 if (ret)
461 return ret;
462
463 if (value == 100 || value == 80) {
464 union acpi_object *r;
465
466 r = lg_wmab(WM_BATT_LIMIT, WM_SET, value);
467 if (!r)
468 return -EIO;
469
470 kfree(r);
471 return count;
472 }
473
474 return -EINVAL;
475}
476
477static ssize_t battery_care_limit_show(struct device *dev,
478 struct device_attribute *attr,
479 char *buffer)
480{
481 unsigned int status;
482 union acpi_object *r;
483
484 r = lg_wmab(WM_BATT_LIMIT, WM_GET, 0);
485 if (!r)
486 return -EIO;
487
488 if (r->type != ACPI_TYPE_INTEGER) {
489 kfree(r);
490 return -EIO;
491 }
492
493 status = r->integer.value;
494 kfree(r);
495 if (status != 80 && status != 100)
496 status = 0;
497
498 return snprintf(buffer, PAGE_SIZE, "%d\n", status);
499}
500
501static DEVICE_ATTR_RW(fan_mode);
502static DEVICE_ATTR_RW(usb_charge);
503static DEVICE_ATTR_RW(reader_mode);
504static DEVICE_ATTR_RW(fn_lock);
505static DEVICE_ATTR_RW(battery_care_limit);
506
507static struct attribute *dev_attributes[] = {
508 &dev_attr_fan_mode.attr,
509 &dev_attr_usb_charge.attr,
510 &dev_attr_reader_mode.attr,
511 &dev_attr_fn_lock.attr,
512 &dev_attr_battery_care_limit.attr,
513 NULL
514};
515
516static const struct attribute_group dev_attribute_group = {
517 .attrs = dev_attributes,
518};
519
520static void tpad_led_set(struct led_classdev *cdev,
521 enum led_brightness brightness)
522{
523 union acpi_object *r;
524
525 r = lg_wmab(WM_TLED, WM_SET, brightness > LED_OFF);
526 kfree(r);
527}
528
529static enum led_brightness tpad_led_get(struct led_classdev *cdev)
530{
531 return ggov(GOV_TLED) > 0 ? LED_ON : LED_OFF;
532}
533
534static LED_DEVICE(tpad_led, 1);
535
536static void kbd_backlight_set(struct led_classdev *cdev,
537 enum led_brightness brightness)
538{
539 u32 val;
540 union acpi_object *r;
541
542 val = 0x22;
543 if (brightness <= LED_OFF)
544 val = 0;
545 if (brightness >= LED_FULL)
546 val = 0x24;
547 r = lg_wmab(WM_KEY_LIGHT, WM_SET, val);
548 kfree(r);
549}
550
551static enum led_brightness kbd_backlight_get(struct led_classdev *cdev)
552{
553 union acpi_object *r;
554 int val;
555
556 r = lg_wmab(WM_KEY_LIGHT, WM_GET, 0);
557
558 if (!r)
559 return LED_OFF;
560
561 if (r->type != ACPI_TYPE_BUFFER || r->buffer.pointer[1] != 0x05) {
562 kfree(r);
563 return LED_OFF;
564 }
565
566 switch (r->buffer.pointer[0] & 0x27) {
567 case 0x24:
568 val = LED_FULL;
569 break;
570 case 0x22:
571 val = LED_HALF;
572 break;
573 default:
574 val = LED_OFF;
575 }
576
577 kfree(r);
578
579 return val;
580}
581
582static LED_DEVICE(kbd_backlight, 255);
583
584static void wmi_input_destroy(void)
585{
586 if (inited & INIT_INPUT_WMI_2)
587 wmi_remove_notify_handler(WMI_EVENT_GUID2);
588
589 if (inited & INIT_INPUT_WMI_0)
590 wmi_remove_notify_handler(WMI_EVENT_GUID0);
591
592 if (inited & INIT_SPARSE_KEYMAP)
593 input_unregister_device(wmi_input_dev);
594
595 inited &= ~(INIT_INPUT_WMI_0 | INIT_INPUT_WMI_2 | INIT_SPARSE_KEYMAP);
596}
597
598static struct platform_driver pf_driver = {
599 .driver = {
600 .name = PLATFORM_NAME,
601 }
602};
603
604static int acpi_add(struct acpi_device *device)
605{
606 int ret;
607
608 if (pf_device)
609 return 0;
610
611 ret = platform_driver_register(&pf_driver);
612 if (ret)
613 return ret;
614
615 pf_device = platform_device_register_simple(PLATFORM_NAME,
616 PLATFORM_DEVID_NONE,
617 NULL, 0);
618 if (IS_ERR(pf_device)) {
619 ret = PTR_ERR(pf_device);
620 pf_device = NULL;
621 pr_err("unable to register platform device\n");
622 goto out_platform_registered;
623 }
624
625 ret = sysfs_create_group(&pf_device->dev.kobj, &dev_attribute_group);
626 if (ret)
627 goto out_platform_device;
628
629 if (!led_classdev_register(&pf_device->dev, &kbd_backlight))
630 inited |= INIT_KBD_LED;
631
632 if (!led_classdev_register(&pf_device->dev, &tpad_led))
633 inited |= INIT_TPAD_LED;
634
635 wmi_input_setup();
636
637 return 0;
638
639out_platform_device:
640 platform_device_unregister(pf_device);
641out_platform_registered:
642 platform_driver_unregister(&pf_driver);
643 return ret;
644}
645
646static int acpi_remove(struct acpi_device *device)
647{
648 sysfs_remove_group(&pf_device->dev.kobj, &dev_attribute_group);
649 if (inited & INIT_KBD_LED)
650 led_classdev_unregister(&kbd_backlight);
651
652 if (inited & INIT_TPAD_LED)
653 led_classdev_unregister(&tpad_led);
654
655 wmi_input_destroy();
656 platform_device_unregister(pf_device);
657 pf_device = NULL;
658 platform_driver_unregister(&pf_driver);
659
660 return 0;
661}
662
663static const struct acpi_device_id device_ids[] = {
664 {"LGEX0815", 0},
665 {"", 0}
666};
667MODULE_DEVICE_TABLE(acpi, device_ids);
668
669static struct acpi_driver acpi_driver = {
670 .name = "LG Gram Laptop Support",
671 .class = "lg-laptop",
672 .ids = device_ids,
673 .ops = {
674 .add = acpi_add,
675 .remove = acpi_remove,
676 .notify = acpi_notify,
677 },
678 .owner = THIS_MODULE,
679};
680
681static int __init acpi_init(void)
682{
683 int result;
684
685 result = acpi_bus_register_driver(&acpi_driver);
686 if (result < 0) {
687 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error registering driver\n"));
688 return -ENODEV;
689 }
690
691 return 0;
692}
693
694static void __exit acpi_exit(void)
695{
696 acpi_bus_unregister_driver(&acpi_driver);
697}
698
699module_init(acpi_init);
700module_exit(acpi_exit);
diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c
index d89936c93ba0..c2c3a1a19879 100644
--- a/drivers/platform/x86/mlx-platform.c
+++ b/drivers/platform/x86/mlx-platform.c
@@ -575,7 +575,7 @@ static struct mlxreg_core_item mlxplat_mlxcpld_msn201x_items[] = {
575 575
576static 576static
577struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_msn201x_data = { 577struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_msn201x_data = {
578 .items = mlxplat_mlxcpld_msn21xx_items, 578 .items = mlxplat_mlxcpld_msn201x_items,
579 .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn201x_items), 579 .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn201x_items),
580 .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 580 .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET,
581 .mask = MLXPLAT_CPLD_AGGR_MASK_DEF, 581 .mask = MLXPLAT_CPLD_AGGR_MASK_DEF,
diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
index cb204f973491..5f2d7ea912b5 100644
--- a/drivers/platform/x86/touchscreen_dmi.c
+++ b/drivers/platform/x86/touchscreen_dmi.c
@@ -42,10 +42,13 @@ static const struct ts_dmi_data chuwi_hi8_data = {
42}; 42};
43 43
44static const struct property_entry chuwi_hi8_pro_props[] = { 44static const struct property_entry chuwi_hi8_pro_props[] = {
45 PROPERTY_ENTRY_U32("touchscreen-min-x", 6),
46 PROPERTY_ENTRY_U32("touchscreen-min-y", 3),
45 PROPERTY_ENTRY_U32("touchscreen-size-x", 1728), 47 PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
46 PROPERTY_ENTRY_U32("touchscreen-size-y", 1148), 48 PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
47 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 49 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
48 PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hi8-pro.fw"), 50 PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hi8-pro.fw"),
51 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
49 PROPERTY_ENTRY_BOOL("silead,home-button"), 52 PROPERTY_ENTRY_BOOL("silead,home-button"),
50 { } 53 { }
51}; 54};
@@ -56,6 +59,8 @@ static const struct ts_dmi_data chuwi_hi8_pro_data = {
56}; 59};
57 60
58static const struct property_entry chuwi_vi8_props[] = { 61static const struct property_entry chuwi_vi8_props[] = {
62 PROPERTY_ENTRY_U32("touchscreen-min-x", 4),
63 PROPERTY_ENTRY_U32("touchscreen-min-y", 6),
59 PROPERTY_ENTRY_U32("touchscreen-size-x", 1724), 64 PROPERTY_ENTRY_U32("touchscreen-size-x", 1724),
60 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), 65 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
61 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 66 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
@@ -88,9 +93,9 @@ static const struct ts_dmi_data chuwi_vi10_data = {
88 93
89static const struct property_entry connect_tablet9_props[] = { 94static const struct property_entry connect_tablet9_props[] = {
90 PROPERTY_ENTRY_U32("touchscreen-min-x", 9), 95 PROPERTY_ENTRY_U32("touchscreen-min-x", 9),
91 PROPERTY_ENTRY_U32("touchscreen-min-y", 8), 96 PROPERTY_ENTRY_U32("touchscreen-min-y", 10),
92 PROPERTY_ENTRY_U32("touchscreen-size-x", 1664), 97 PROPERTY_ENTRY_U32("touchscreen-size-x", 1664),
93 PROPERTY_ENTRY_U32("touchscreen-size-y", 878), 98 PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
94 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), 99 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
95 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 100 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
96 PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-connect-tablet9.fw"), 101 PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-connect-tablet9.fw"),
@@ -104,8 +109,10 @@ static const struct ts_dmi_data connect_tablet9_data = {
104}; 109};
105 110
106static const struct property_entry cube_iwork8_air_props[] = { 111static const struct property_entry cube_iwork8_air_props[] = {
107 PROPERTY_ENTRY_U32("touchscreen-size-x", 1660), 112 PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
108 PROPERTY_ENTRY_U32("touchscreen-size-y", 900), 113 PROPERTY_ENTRY_U32("touchscreen-min-y", 3),
114 PROPERTY_ENTRY_U32("touchscreen-size-x", 1664),
115 PROPERTY_ENTRY_U32("touchscreen-size-y", 896),
109 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 116 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
110 PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-cube-iwork8-air.fw"), 117 PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-cube-iwork8-air.fw"),
111 PROPERTY_ENTRY_U32("silead,max-fingers", 10), 118 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
@@ -179,11 +186,14 @@ static const struct ts_dmi_data gp_electronic_t701_data = {
179}; 186};
180 187
181static const struct property_entry itworks_tw891_props[] = { 188static const struct property_entry itworks_tw891_props[] = {
189 PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
190 PROPERTY_ENTRY_U32("touchscreen-min-y", 5),
182 PROPERTY_ENTRY_U32("touchscreen-size-x", 1600), 191 PROPERTY_ENTRY_U32("touchscreen-size-x", 1600),
183 PROPERTY_ENTRY_U32("touchscreen-size-y", 890), 192 PROPERTY_ENTRY_U32("touchscreen-size-y", 896),
184 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), 193 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
185 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 194 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
186 PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-itworks-tw891.fw"), 195 PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-itworks-tw891.fw"),
196 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
187 { } 197 { }
188}; 198};
189 199
@@ -207,8 +217,10 @@ static const struct ts_dmi_data jumper_ezpad_6_pro_data = {
207}; 217};
208 218
209static const struct property_entry jumper_ezpad_mini3_props[] = { 219static const struct property_entry jumper_ezpad_mini3_props[] = {
220 PROPERTY_ENTRY_U32("touchscreen-min-x", 23),
221 PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
210 PROPERTY_ENTRY_U32("touchscreen-size-x", 1700), 222 PROPERTY_ENTRY_U32("touchscreen-size-x", 1700),
211 PROPERTY_ENTRY_U32("touchscreen-size-y", 1150), 223 PROPERTY_ENTRY_U32("touchscreen-size-y", 1138),
212 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 224 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
213 PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-jumper-ezpad-mini3.fw"), 225 PROPERTY_ENTRY_STRING("firmware-name", "gsl3676-jumper-ezpad-mini3.fw"),
214 PROPERTY_ENTRY_U32("silead,max-fingers", 10), 226 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
@@ -237,6 +249,24 @@ static const struct ts_dmi_data onda_obook_20_plus_data = {
237 .properties = onda_obook_20_plus_props, 249 .properties = onda_obook_20_plus_props,
238}; 250};
239 251
252static const struct property_entry onda_v80_plus_v3_props[] = {
253 PROPERTY_ENTRY_U32("touchscreen-min-x", 22),
254 PROPERTY_ENTRY_U32("touchscreen-min-y", 15),
255 PROPERTY_ENTRY_U32("touchscreen-size-x", 1698),
256 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
257 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
258 PROPERTY_ENTRY_STRING("firmware-name",
259 "gsl3676-onda-v80-plus-v3.fw"),
260 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
261 PROPERTY_ENTRY_BOOL("silead,home-button"),
262 { }
263};
264
265static const struct ts_dmi_data onda_v80_plus_v3_data = {
266 .acpi_name = "MSSL1680:00",
267 .properties = onda_v80_plus_v3_props,
268};
269
240static const struct property_entry onda_v820w_32g_props[] = { 270static const struct property_entry onda_v820w_32g_props[] = {
241 PROPERTY_ENTRY_U32("touchscreen-size-x", 1665), 271 PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
242 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), 272 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
@@ -322,11 +352,14 @@ static const struct ts_dmi_data pov_mobii_wintab_p800w_v20_data = {
322}; 352};
323 353
324static const struct property_entry pov_mobii_wintab_p800w_v21_props[] = { 354static const struct property_entry pov_mobii_wintab_p800w_v21_props[] = {
325 PROPERTY_ENTRY_U32("touchscreen-size-x", 1800), 355 PROPERTY_ENTRY_U32("touchscreen-min-x", 1),
326 PROPERTY_ENTRY_U32("touchscreen-size-y", 1150), 356 PROPERTY_ENTRY_U32("touchscreen-min-y", 8),
357 PROPERTY_ENTRY_U32("touchscreen-size-x", 1794),
358 PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
327 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 359 PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
328 PROPERTY_ENTRY_STRING("firmware-name", 360 PROPERTY_ENTRY_STRING("firmware-name",
329 "gsl3692-pov-mobii-wintab-p800w.fw"), 361 "gsl3692-pov-mobii-wintab-p800w.fw"),
362 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
330 PROPERTY_ENTRY_BOOL("silead,home-button"), 363 PROPERTY_ENTRY_BOOL("silead,home-button"),
331 { } 364 { }
332}; 365};
@@ -366,6 +399,22 @@ static const struct ts_dmi_data teclast_x98plus2_data = {
366 .properties = teclast_x98plus2_props, 399 .properties = teclast_x98plus2_props,
367}; 400};
368 401
402static const struct property_entry trekstor_primebook_c11_props[] = {
403 PROPERTY_ENTRY_U32("touchscreen-size-x", 1970),
404 PROPERTY_ENTRY_U32("touchscreen-size-y", 1530),
405 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
406 PROPERTY_ENTRY_STRING("firmware-name",
407 "gsl1680-trekstor-primebook-c11.fw"),
408 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
409 PROPERTY_ENTRY_BOOL("silead,home-button"),
410 { }
411};
412
413static const struct ts_dmi_data trekstor_primebook_c11_data = {
414 .acpi_name = "MSSL1680:00",
415 .properties = trekstor_primebook_c11_props,
416};
417
369static const struct property_entry trekstor_primebook_c13_props[] = { 418static const struct property_entry trekstor_primebook_c13_props[] = {
370 PROPERTY_ENTRY_U32("touchscreen-size-x", 2624), 419 PROPERTY_ENTRY_U32("touchscreen-size-x", 2624),
371 PROPERTY_ENTRY_U32("touchscreen-size-y", 1920), 420 PROPERTY_ENTRY_U32("touchscreen-size-y", 1920),
@@ -381,6 +430,22 @@ static const struct ts_dmi_data trekstor_primebook_c13_data = {
381 .properties = trekstor_primebook_c13_props, 430 .properties = trekstor_primebook_c13_props,
382}; 431};
383 432
433static const struct property_entry trekstor_primetab_t13b_props[] = {
434 PROPERTY_ENTRY_U32("touchscreen-size-x", 2500),
435 PROPERTY_ENTRY_U32("touchscreen-size-y", 1900),
436 PROPERTY_ENTRY_STRING("firmware-name",
437 "gsl1680-trekstor-primetab-t13b.fw"),
438 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
439 PROPERTY_ENTRY_BOOL("silead,home-button"),
440 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
441 { }
442};
443
444static const struct ts_dmi_data trekstor_primetab_t13b_data = {
445 .acpi_name = "MSSL1680:00",
446 .properties = trekstor_primetab_t13b_props,
447};
448
384static const struct property_entry trekstor_surftab_twin_10_1_props[] = { 449static const struct property_entry trekstor_surftab_twin_10_1_props[] = {
385 PROPERTY_ENTRY_U32("touchscreen-size-x", 1900), 450 PROPERTY_ENTRY_U32("touchscreen-size-x", 1900),
386 PROPERTY_ENTRY_U32("touchscreen-size-y", 1280), 451 PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
@@ -397,6 +462,8 @@ static const struct ts_dmi_data trekstor_surftab_twin_10_1_data = {
397}; 462};
398 463
399static const struct property_entry trekstor_surftab_wintron70_props[] = { 464static const struct property_entry trekstor_surftab_wintron70_props[] = {
465 PROPERTY_ENTRY_U32("touchscreen-min-x", 12),
466 PROPERTY_ENTRY_U32("touchscreen-min-y", 8),
400 PROPERTY_ENTRY_U32("touchscreen-size-x", 884), 467 PROPERTY_ENTRY_U32("touchscreen-size-x", 884),
401 PROPERTY_ENTRY_U32("touchscreen-size-y", 632), 468 PROPERTY_ENTRY_U32("touchscreen-size-y", 632),
402 PROPERTY_ENTRY_STRING("firmware-name", 469 PROPERTY_ENTRY_STRING("firmware-name",
@@ -556,6 +623,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
556 }, 623 },
557 }, 624 },
558 { 625 {
626 /* ONDA V80 plus v3 (P80PSBG9V3A01501) */
627 .driver_data = (void *)&onda_v80_plus_v3_data,
628 .matches = {
629 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONDA"),
630 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "V80 PLUS")
631 },
632 },
633 {
559 /* ONDA V820w DualOS */ 634 /* ONDA V820w DualOS */
560 .driver_data = (void *)&onda_v820w_32g_data, 635 .driver_data = (void *)&onda_v820w_32g_data,
561 .matches = { 636 .matches = {
@@ -641,6 +716,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
641 }, 716 },
642 }, 717 },
643 { 718 {
719 /* Trekstor Primebook C11 */
720 .driver_data = (void *)&trekstor_primebook_c11_data,
721 .matches = {
722 DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
723 DMI_MATCH(DMI_PRODUCT_NAME, "Primebook C11"),
724 },
725 },
726 {
644 /* Trekstor Primebook C13 */ 727 /* Trekstor Primebook C13 */
645 .driver_data = (void *)&trekstor_primebook_c13_data, 728 .driver_data = (void *)&trekstor_primebook_c13_data,
646 .matches = { 729 .matches = {
@@ -649,6 +732,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
649 }, 732 },
650 }, 733 },
651 { 734 {
735 /* Trekstor Primetab T13B */
736 .driver_data = (void *)&trekstor_primetab_t13b_data,
737 .matches = {
738 DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"),
739 DMI_MATCH(DMI_PRODUCT_NAME, "Primetab T13B"),
740 },
741 },
742 {
652 /* TrekStor SurfTab twin 10.1 ST10432-8 */ 743 /* TrekStor SurfTab twin 10.1 ST10432-8 */
653 .driver_data = (void *)&trekstor_surftab_twin_10_1_data, 744 .driver_data = (void *)&trekstor_surftab_twin_10_1_data,
654 .matches = { 745 .matches = {
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 04791ea5d97b..bea35be68706 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -987,19 +987,19 @@ static struct bus_type wmi_bus_type = {
987 .remove = wmi_dev_remove, 987 .remove = wmi_dev_remove,
988}; 988};
989 989
990static struct device_type wmi_type_event = { 990static const struct device_type wmi_type_event = {
991 .name = "event", 991 .name = "event",
992 .groups = wmi_event_groups, 992 .groups = wmi_event_groups,
993 .release = wmi_dev_release, 993 .release = wmi_dev_release,
994}; 994};
995 995
996static struct device_type wmi_type_method = { 996static const struct device_type wmi_type_method = {
997 .name = "method", 997 .name = "method",
998 .groups = wmi_method_groups, 998 .groups = wmi_method_groups,
999 .release = wmi_dev_release, 999 .release = wmi_dev_release,
1000}; 1000};
1001 1001
1002static struct device_type wmi_type_data = { 1002static const struct device_type wmi_type_data = {
1003 .name = "data", 1003 .name = "data",
1004 .groups = wmi_data_groups, 1004 .groups = wmi_data_groups,
1005 .release = wmi_dev_release, 1005 .release = wmi_dev_release,
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
new file mode 100644
index 000000000000..53dfc2541960
--- /dev/null
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -0,0 +1,101 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __PLATFORM_DATA_X86_ASUS_WMI_H
3#define __PLATFORM_DATA_X86_ASUS_WMI_H
4
5#include <linux/errno.h>
6#include <linux/types.h>
7
8/* WMI Methods */
9#define ASUS_WMI_METHODID_SPEC 0x43455053 /* BIOS SPECification */
10#define ASUS_WMI_METHODID_SFBD 0x44424653 /* Set First Boot Device */
11#define ASUS_WMI_METHODID_GLCD 0x44434C47 /* Get LCD status */
12#define ASUS_WMI_METHODID_GPID 0x44495047 /* Get Panel ID?? (Resol) */
13#define ASUS_WMI_METHODID_QMOD 0x444F4D51 /* Quiet MODe */
14#define ASUS_WMI_METHODID_SPLV 0x4C425053 /* Set Panel Light Value */
15#define ASUS_WMI_METHODID_AGFN 0x4E464741 /* FaN? */
16#define ASUS_WMI_METHODID_SFUN 0x4E554653 /* FUNCtionalities */
17#define ASUS_WMI_METHODID_SDSP 0x50534453 /* Set DiSPlay output */
18#define ASUS_WMI_METHODID_GDSP 0x50534447 /* Get DiSPlay output */
19#define ASUS_WMI_METHODID_DEVP 0x50564544 /* DEVice Policy */
20#define ASUS_WMI_METHODID_OSVR 0x5256534F /* OS VeRsion */
21#define ASUS_WMI_METHODID_DSTS 0x53544344 /* Device STatuS */
22#define ASUS_WMI_METHODID_DSTS2 0x53545344 /* Device STatuS #2*/
23#define ASUS_WMI_METHODID_BSTS 0x53545342 /* Bios STatuS ? */
24#define ASUS_WMI_METHODID_DEVS 0x53564544 /* DEVice Set */
25#define ASUS_WMI_METHODID_CFVS 0x53564643 /* CPU Frequency Volt Set */
26#define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
27#define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
28#define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
29
30#define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
31
32/* Wireless */
33#define ASUS_WMI_DEVID_HW_SWITCH 0x00010001
34#define ASUS_WMI_DEVID_WIRELESS_LED 0x00010002
35#define ASUS_WMI_DEVID_CWAP 0x00010003
36#define ASUS_WMI_DEVID_WLAN 0x00010011
37#define ASUS_WMI_DEVID_WLAN_LED 0x00010012
38#define ASUS_WMI_DEVID_BLUETOOTH 0x00010013
39#define ASUS_WMI_DEVID_GPS 0x00010015
40#define ASUS_WMI_DEVID_WIMAX 0x00010017
41#define ASUS_WMI_DEVID_WWAN3G 0x00010019
42#define ASUS_WMI_DEVID_UWB 0x00010021
43
44/* Leds */
45/* 0x000200XX and 0x000400XX */
46#define ASUS_WMI_DEVID_LED1 0x00020011
47#define ASUS_WMI_DEVID_LED2 0x00020012
48#define ASUS_WMI_DEVID_LED3 0x00020013
49#define ASUS_WMI_DEVID_LED4 0x00020014
50#define ASUS_WMI_DEVID_LED5 0x00020015
51#define ASUS_WMI_DEVID_LED6 0x00020016
52
53/* Backlight and Brightness */
54#define ASUS_WMI_DEVID_ALS_ENABLE 0x00050001 /* Ambient Light Sensor */
55#define ASUS_WMI_DEVID_BACKLIGHT 0x00050011
56#define ASUS_WMI_DEVID_BRIGHTNESS 0x00050012
57#define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021
58#define ASUS_WMI_DEVID_LIGHT_SENSOR 0x00050022 /* ?? */
59#define ASUS_WMI_DEVID_LIGHTBAR 0x00050025
60
61/* Misc */
62#define ASUS_WMI_DEVID_CAMERA 0x00060013
63
64/* Storage */
65#define ASUS_WMI_DEVID_CARDREADER 0x00080013
66
67/* Input */
68#define ASUS_WMI_DEVID_TOUCHPAD 0x00100011
69#define ASUS_WMI_DEVID_TOUCHPAD_LED 0x00100012
70
71/* Fan, Thermal */
72#define ASUS_WMI_DEVID_THERMAL_CTRL 0x00110011
73#define ASUS_WMI_DEVID_FAN_CTRL 0x00110012
74
75/* Power */
76#define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012
77
78/* Deep S3 / Resume on LID open */
79#define ASUS_WMI_DEVID_LID_RESUME 0x00120031
80
81/* DSTS masks */
82#define ASUS_WMI_DSTS_STATUS_BIT 0x00000001
83#define ASUS_WMI_DSTS_UNKNOWN_BIT 0x00000002
84#define ASUS_WMI_DSTS_PRESENCE_BIT 0x00010000
85#define ASUS_WMI_DSTS_USER_BIT 0x00020000
86#define ASUS_WMI_DSTS_BIOS_BIT 0x00040000
87#define ASUS_WMI_DSTS_BRIGHTNESS_MASK 0x000000FF
88#define ASUS_WMI_DSTS_MAX_BRIGTH_MASK 0x0000FF00
89#define ASUS_WMI_DSTS_LIGHTBAR_MASK 0x0000000F
90
91#if IS_REACHABLE(CONFIG_ASUS_WMI)
92int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval);
93#else
94static inline int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1,
95 u32 *retval)
96{
97 return -ENODEV;
98}
99#endif
100
101#endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index b0875b327f5c..c3fd849d4a8f 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -115,7 +115,7 @@ static int module_trace_bprintk_format_notify(struct notifier_block *self,
115 * section, then we need to read the link list pointers. The trick is 115 * section, then we need to read the link list pointers. The trick is
116 * we pass the address of the string to the seq function just like 116 * we pass the address of the string to the seq function just like
117 * we do for the kernel core formats. To get back the structure that 117 * we do for the kernel core formats. To get back the structure that
118 * holds the format, we simply use containerof() and then go to the 118 * holds the format, we simply use container_of() and then go to the
119 * next format in the list. 119 * next format in the list.
120 */ 120 */
121static const char ** 121static const char **