Update v5.8 patches

Changes:
 - SAM:
   - Update DTX driver state after resume.
   - Add DTX Documentation, misc. fixes, and cleanup.

 - IPTS:
   This implements a new and refined UAPI interface that should improve
   stability during suspend and move some responsibility into userspace,
   making the driver simpler.

   It also fixes some sleep issues due to improper shutdown of the device.

   Shortlog:
     0a4a44c Add missing include
     31ae03d Improve error handling of ipts_control_* functions
     287dea0 Prevent lockups if stop is called from the receiver thread
     b737a9c On remove, wait until CLEAR_MEM_WINDOW returned.
     c5b66a5 Add GET_DEVICE_READY ioctl
     af0f84a Seperate UAPI initialization and device probing
     4ae7674 Patch the MEI bus to allow sending commands on remove
     27772bc Just a few refactorings...

Links:
- SAM: af4bb01042
- IPTS: 0a4a44c2a9
- kernel: 6e8bb10ad8
This commit is contained in:
Maximilian Luz 2020-10-22 18:27:17 +02:00
parent bc7af3a34d
commit 7c0e669f67
No known key found for this signature in database
GPG key ID: 70EC0937F6C26F02
12 changed files with 4030 additions and 1986 deletions

View file

@ -1,8 +1,38 @@
From 463107b4f3a4b794406270c8333e66619bdadf05 Mon Sep 17 00:00:00 2001
From: Chih-Wei Huang <cwhuang@linux.org.tw>
Date: Tue, 18 Sep 2018 11:01:37 +0800
Subject: [PATCH 1/7] surface3-oemb
From 783117ef972d0dcc29d1065e4609690c9093a8c3 Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 18 Oct 2020 16:42:44 +0900
Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI
table
On some Surface 3, the DMI table gets corrupted for unknown reasons
and breaks existing DMI matching used for device-specific quirks.
This commit adds the (broken) DMI data into dmi_system_id tables used
for quirks so that each driver can enable quirks even on the affected
systems.
On affected systems, DMI data will look like this:
$ grep . /sys/devices/virtual/dmi/id/{bios_vendor,board_name,board_vendor,\
chassis_vendor,product_name,sys_vendor}
/sys/devices/virtual/dmi/id/bios_vendor:American Megatrends Inc.
/sys/devices/virtual/dmi/id/board_name:OEMB
/sys/devices/virtual/dmi/id/board_vendor:OEMB
/sys/devices/virtual/dmi/id/chassis_vendor:OEMB
/sys/devices/virtual/dmi/id/product_name:OEMB
/sys/devices/virtual/dmi/id/sys_vendor:OEMB
Expected:
$ grep . /sys/devices/virtual/dmi/id/{bios_vendor,board_name,board_vendor,\
chassis_vendor,product_name,sys_vendor}
/sys/devices/virtual/dmi/id/bios_vendor:American Megatrends Inc.
/sys/devices/virtual/dmi/id/board_name:Surface 3
/sys/devices/virtual/dmi/id/board_vendor:Microsoft Corporation
/sys/devices/virtual/dmi/id/chassis_vendor:Microsoft Corporation
/sys/devices/virtual/dmi/id/product_name:Surface 3
/sys/devices/virtual/dmi/id/sys_vendor:Microsoft Corporation
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Patchset: surface3-oemb
---
drivers/platform/x86/surface3-wmi.c | 7 +++++++
sound/soc/codecs/rt5645.c | 9 +++++++++

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,35 @@
From 3965e53a7027b6a17201233cabe6ed146d2f53ea Mon Sep 17 00:00:00 2001
From aa25cec8fd87df94cabc33c37cc0a2778d63f3d4 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 16 Aug 2020 23:39:56 +0200
Subject: [PATCH 6/7] surface-gpe
Subject: [PATCH] platform/x86: Add Driver to set up lid GPEs on MS Surface
device
Conventionally, wake-up events for a specific device, in our case the
lid device, are managed via the ACPI _PRW field. While this does not
seem strictly necessary based on ACPI spec, the kernel disables GPE
wakeups to avoid non-wakeup interrupts preventing suspend by default and
only enables GPEs associated via the _PRW field with a wake-up capable
device. This behavior has been introduced in commit
f941d3e41da7f86bdb9dcc1977c2bcc6b89bfe47
ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle
and is described in more detail in its commit message.
Unfortunately, on MS Surface devices, there is no _PRW field present on
the lid device, thus no GPE is associated with it, and therefore the GPE
responsible for sending the status-change notification to the lid gets
disabled during suspend, making it impossible to wake the device via the
lid.
This patch introduces a pseudo-device and respective driver which, based
on some DMI matching, mark the corresponding GPE of the lid device for
wake and enable it during suspend. The behavior of this driver models
the behavior of the ACPI/PM core for normal wakeup GPEs, properly
declared via the _PRW field.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-gpe
---
drivers/platform/x86/Kconfig | 9 +
drivers/platform/x86/Makefile | 1 +
@ -11,12 +38,12 @@ Subject: [PATCH 6/7] surface-gpe
create mode 100644 drivers/platform/x86/surface_gpe.c
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 14db2795ff63..c64267319696 100644
index a5ad36083b67..01752d1f40f8 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -886,6 +886,15 @@ config SURFACE_BOOK1_DGPU_SWITCH
This driver provides a sysfs switch to set the power-state of the
discrete GPU found on the Microsoft Surface Book 1.
@@ -880,6 +880,15 @@ config SURFACE_PRO3_BUTTON
help
This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3/4 tablet.
+config SURFACE_GPE
+ tristate "Surface GPE/Lid Driver"
@ -31,13 +58,13 @@ index 14db2795ff63..c64267319696 100644
tristate "MSI Laptop Extras"
depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 5156523b5863..ef0c3fcab319 100644
index 2b85852a1a87..a64ce216719a 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -86,6 +86,7 @@ obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
@@ -85,6 +85,7 @@ obj-$(CONFIG_SURFACE3_WMI) += surface3-wmi.o
obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
obj-$(CONFIG_SURFACE_BOOK1_DGPU_SWITCH) += sb1_dgpu_sw.o
+obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o
# MSI

View file

@ -1,15 +1,57 @@
From 2e7656defabd8c62b9c36b912386f83b8b757d55 Mon Sep 17 00:00:00 2001
From 256ed7b2d0a06dd15968828ac55d355773b19958 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH 5/7] surface-sam-over-hid
Subject: [PATCH] i2c: acpi: Implement RawBytes read access
Microsoft Surface Pro 4 and Book 1 devices access the MSHW0030 I2C
device via a generic serial bus operation region and RawBytes read
access. On the Surface Book 1, this access is required to turn on (and
off) the discrete GPU.
Multiple things are to note here:
a) The RawBytes access is device/driver dependent. The ACPI
specification states:
> Raw accesses assume that the writer has knowledge of the bus that
> the access is made over and the device that is being accessed. The
> protocol may only ensure that the buffer is transmitted to the
> appropriate driver, but the driver must be able to interpret the
> buffer to communicate to a register.
Thus this implementation may likely not work on other devices
accessing I2C via the RawBytes accessor type.
b) The MSHW0030 I2C device is an HID-over-I2C device which seems to
serve multiple functions:
1. It is the main access point for the legacy-type Surface Aggregator
Module (also referred to as SAM-over-HID, as opposed to the newer
SAM-over-SSH/UART). It has currently not been determined on how
support for the legacy SAM should be implemented. Likely via a
custom HID driver.
2. It seems to serve as the HID device for the Integrated Sensor Hub.
This might complicate matters with regards to implementing a
SAM-over-HID driver required by legacy SAM.
In light of this, the simplest approach has been chosen for now.
However, it may make more sense regarding breakage and compatibility to
either provide functionality for replacing or enhancing the default
operation region handler via some additional API functions, or even to
completely blacklist MSHW0030 from the I2C core and provide a custom
driver for it.
Replacing/enhancing the default operation region handler would, however,
either require some sort of secondary driver and access point for it,
from which the new API functions would be called and the new handler
(part) would be installed, or hard-coding them via some sort of
quirk-like interface into the I2C core.
Patchset: surface-sam-over-hid
---
drivers/i2c/i2c-core-acpi.c | 35 +++++++
drivers/platform/x86/Kconfig | 7 ++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/sb1_dgpu_sw.c | 162 +++++++++++++++++++++++++++++
4 files changed, 205 insertions(+)
create mode 100644 drivers/platform/x86/sb1_dgpu_sw.c
drivers/i2c/i2c-core-acpi.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 2ade99b105b9..60b9cb51d5f7 100644
@ -64,13 +106,38 @@ index 2ade99b105b9..60b9cb51d5f7 100644
default:
dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
accessor_type, client->addr);
--
2.28.0
From 03be5ddae354964501f25958d53525b23c9c6243 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 6 Sep 2020 04:01:19 +0200
Subject: [PATCH] platform/x86: Add driver for Surface Book 1 dGPU switch
Add driver exposing the discrete GPU power-switch of the Microsoft
Surface Book 1 to user-space.
On the Surface Book 1, the dGPU power is controlled via the Surface
System Aggregator Module (SAM). The specific SAM-over-HID command for
this is exposed via ACPI. This module provides a simple driver exposing
the ACPI call via a sysfs parameter to user-space, so that users can
easily power-on/-off the dGPU.
Patchset: surface-sam-over-hid
---
drivers/platform/x86/Kconfig | 7 ++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/sb1_dgpu_sw.c | 162 +++++++++++++++++++++++++++++
3 files changed, 170 insertions(+)
create mode 100644 drivers/platform/x86/sb1_dgpu_sw.c
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 0581a54cf562..14db2795ff63 100644
index 01752d1f40f8..19a560c44511 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -879,6 +879,13 @@ config SURFACE_PRO3_BUTTON
help
This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3/4 tablet.
@@ -889,6 +889,13 @@ config SURFACE_GPE
accordingly. It is required on those devices to allow wake-ups from
suspend by opening the lid.
+config SURFACE_BOOK1_DGPU_SWITCH
+ tristate "Surface Book 1 dGPU Switch Driver"
@ -83,13 +150,13 @@ index 0581a54cf562..14db2795ff63 100644
tristate "MSI Laptop Extras"
depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 2b85852a1a87..5156523b5863 100644
index a64ce216719a..f46d4a3ce746 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -85,6 +85,7 @@ obj-$(CONFIG_SURFACE3_WMI) += surface3-wmi.o
obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
@@ -86,6 +86,7 @@ obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o
+obj-$(CONFIG_SURFACE_BOOK1_DGPU_SWITCH) += sb1_dgpu_sw.o
# MSI

View file

@ -1,8 +1,8 @@
From eacbf7fd1be0f691fdd5562413a5eea98a7210e5 Mon Sep 17 00:00:00 2001
From ccc695a9170dc8469d8637568129d4ed8780448c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 14 Oct 2020 16:41:58 +0200
Subject: [PATCH 7/7] i2c: core: Restore acpi_walk_dep_device_list() getting
called after registering the ACPI i2c devs
Subject: [PATCH] i2c: core: Restore acpi_walk_dep_device_list() getting called
after registering the ACPI i2c devs
Commit 21653a4181ff ("i2c: core: Call i2c_acpi_install_space_handler()
before i2c_acpi_register_devices()")'s intention was to only move the

View file

@ -0,0 +1 @@
../../../patches/5.8/0004-surface-gpe.patch

View file

@ -1 +0,0 @@
../../../patches/5.8/0004-surface-sam.patch

View file

@ -1 +0,0 @@
../../../patches/5.8/0006-surface-gpe.patch

View file

@ -0,0 +1 @@
../../../patches/5.8/0006-surface-sam.patch

View file

@ -28,9 +28,9 @@ source=(
0001-surface3-oemb.patch
0002-wifi.patch
0003-ipts.patch
0004-surface-sam.patch
0004-surface-gpe.patch
0005-surface-sam-over-hid.patch
0006-surface-gpe.patch
0006-surface-sam.patch
0007-i2c-core-Restore-acpi_walk_dep_device_list-getting-c.patch
)
validpgpkeys=(
@ -42,13 +42,13 @@ sha256sums=('1251a7e13c23ad35c38f8e58227fc0183e7087a81ee030766e2db8cbe2453392'
'181330a9cf4517abbbe29b93165bc859ad8ca14a43582f4e1d69aae2b5ecc2c9'
'7f52b09f0bf62d9b2ba162a424ce99caa50cb671f2b78fca1c1dc81e33e9b57f'
'8cd2b019aac6d3807a5cdcbbbe0aad81e63193ff3e8dffd7a79d4a1421b858f6'
'7dc41454b2646c743bf6592bcb0706242469380f8e634b9555a7322d7e015800'
'3005384427716297fe4e7ed77feba56976188f0b411c2ba7da73aef817c41ce0'
'e4245ee8ab19d46d126ce92e0b784944ae7a9c618d5cf5ae11109a946bd75961'
'5521a6d90e50a7a188f69e5f7e769bcb03f1994bf5d99a170e4dc0cf416d2352'
'afbfc31f6139f37753926c0ba1e1670190144d65dae13b2f4a66182cadd36235'
'018c3972a248547a83b3650e3f3b11d83078ea928fdbb3d1b965b3dea0e12973'
'ea2c799e490f3c478a821e00db9b4cd7183d703712f91a8b677de30d6639eb4c')
'a17c433dfa32ab3c967b217b19ff80aca2cfc07b9179a915b2f5695f07b25b5e'
'055f026f07a61cb02071e3cd3f5a93f8b1daf4688c4eebf1d24d7a012e9a0932'
'23c107c34d4d71f10d1ee37c228a8492d737c563493f7b71a01cdbcf1a8a7244'
'63c90132ef46562733a672cf7fc538c2fa9605605f9ed0bc471d48936147bcaf'
'f179f9a2385efee788715ad8acddd68b8cfeee0d79433e22d14341f417dd56da'
'750cc0491366373ceb0f24ab7ede555e4691855cee3c6e89a357169f56bf5981'
'7126649ec8af8127c28507b70cbf3f2ec125e496e98e3ea2a47e65f7234a2134')
export KBUILD_BUILD_HOST=archlinux