Update v4.19 patches

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

Links:
- SAM: af4bb01042
- kernel: 8bb4052b6b
This commit is contained in:
Maximilian Luz 2020-10-22 18:20:27 +02:00
parent c42e473ff0
commit 3d9db379b4
No known key found for this signature in database
GPG key ID: 70EC0937F6C26F02
16 changed files with 3248 additions and 961 deletions

View file

@ -1,8 +1,10 @@
From 68915ae484c9d8881ed344ee3c639b1d11d8f29c Mon Sep 17 00:00:00 2001
From 7712e7c7b39ac4af2c8d4d5a9a22ecc0d5a25077 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 28 Sep 2019 18:00:43 +0200
Subject: [PATCH 01/11] surface3-power
Subject: [PATCH] platform/x86: Surface 3 battery platform operation region
support
Patchset: surface3-power
---
drivers/platform/x86/Kconfig | 7 +
drivers/platform/x86/Makefile | 1 +

View file

@ -1,8 +1,34 @@
From 26e5e3d5780b48ef1f2a7115ef7a1ef1f4bf1e67 Mon Sep 17 00:00:00 2001
From 6893037808c47ada1b0bf8705ebe7f60dfd600b0 Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Sun, 5 Jul 2020 14:56:20 +0300
Subject: [PATCH 02/11] surface3-touchscreen-dma-fix
Subject: [PATCH] dmaengine: dw: Initialize channel before each transfer
In some cases DMA can be used only with a consumer which does runtime power
management and on the platforms, that have DMA auto power gating logic
(see comments in the drivers/acpi/acpi_lpss.c), may result in DMA losing
its context. Simple mitigation of this issue is to initialize channel
each time the consumer initiates a transfer.
Fixes: cfdf5b6cc598 ("dw_dmac: add support for Lynxpoint DMA controllers")
Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206403
Link: https://lore.kernel.org/r/20200705115620.51929-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
(cherry picked from commit 99ba8b9b0d9780e9937eb1d488d120e9e5c2533d)
[Reason for cherry-picking this commit:
This commit fixes touch input when using DMA mode on Surface 3's
touchscreen.
Note: this commit was not backported to v4.19 by upstream. For now,
backport this patch ourselves.]
[ Conflicts:
drivers/dma/dw/core.c
Resolved conflict by accepting current change then removed
DW_DMA_IS_INITIALIZED lines]
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Patchset: surface3-touchscreen-dma-fix
---
drivers/dma/dw/core.c | 12 ------------
1 file changed, 12 deletions(-)

View file

@ -1,8 +1,38 @@
From 118ae75f050cf4934c6b97d11f088492c2a628aa 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 03/11] surface3-oemb
From bbc85da670e31aa65b92bead468c33f5d50ff55b 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 +++++++++

View file

@ -1,13 +1,117 @@
From b9404424ac5fb0521a36308323493abd8a1d0df7 Mon Sep 17 00:00:00 2001
From f6d0899d982873dad26c280ebc52be5470556b30 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 27 Jul 2019 17:51:37 +0200
Subject: [PATCH 04/11] surface-buttons
Subject: [PATCH] platform/x86: surfacepro3_button: Fix device check
Do not use the surfacepro3_button driver on newer Microsoft Surface
models, only use it on the Surface Pro 3 and 4. Newer models (5th, 6th
and possibly future generations) use the same device as the Surface Pro
4 to represent their volume and power buttons (MSHW0040), but their
actual implementation is significantly different. This patch ensures
that the surfacepro3_button driver is only used on the Pro 3 and 4
models, allowing a different driver to bind on other models.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-buttons
---
drivers/input/misc/Kconfig | 6 +-
drivers/input/misc/soc_button_array.c | 114 +++++++++++++++++++---
drivers/platform/x86/surfacepro3_button.c | 47 +++++++++
3 files changed, 151 insertions(+), 16 deletions(-)
drivers/platform/x86/surfacepro3_button.c | 47 +++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
index 1b491690ce07..96627627060e 100644
--- a/drivers/platform/x86/surfacepro3_button.c
+++ b/drivers/platform/x86/surfacepro3_button.c
@@ -24,6 +24,12 @@
#define SURFACE_BUTTON_OBJ_NAME "VGBI"
#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3/4 Buttons"
+#define MSHW0040_DSM_REVISION 0x01
+#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision
+static const guid_t MSHW0040_DSM_UUID =
+ GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65,
+ 0x49, 0x80, 0x35);
+
#define SURFACE_BUTTON_NOTIFY_TABLET_MODE 0xc8
#define SURFACE_BUTTON_NOTIFY_PRESS_POWER 0xc6
@@ -146,6 +152,44 @@ static int surface_button_resume(struct device *dev)
}
#endif
+/*
+ * Surface Pro 4 and Surface Book 2 / Surface Pro 2017 use the same device
+ * ID (MSHW0040) for the power/volume buttons. Make sure this is the right
+ * device by checking for the _DSM method and OEM Platform Revision.
+ *
+ * Returns true if the driver should bind to this device, i.e. the device is
+ * either MSWH0028 (Pro 3) or MSHW0040 on a Pro 4 or Book 1.
+ */
+static bool surface_button_check_MSHW0040(struct acpi_device *dev)
+{
+ acpi_handle handle = dev->handle;
+ union acpi_object *result;
+ u64 oem_platform_rev = 0; // valid revisions are nonzero
+
+ // get OEM platform revision
+ result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID,
+ MSHW0040_DSM_REVISION,
+ MSHW0040_DSM_GET_OMPR,
+ NULL, ACPI_TYPE_INTEGER);
+
+ /*
+ * If evaluating the _DSM fails, the method is not present. This means
+ * that we have either MSHW0028 or MSHW0040 on Pro 4 or Book 1, so we
+ * should use this driver. We use revision 0 indicating it is
+ * unavailable.
+ */
+
+ if (result) {
+ oem_platform_rev = result->integer.value;
+ ACPI_FREE(result);
+ }
+
+ dev_dbg(&dev->dev, "OEM Platform Revision %llu\n", oem_platform_rev);
+
+ return oem_platform_rev == 0;
+}
+
+
static int surface_button_add(struct acpi_device *device)
{
struct surface_button *button;
@@ -158,6 +202,9 @@ static int surface_button_add(struct acpi_device *device)
strlen(SURFACE_BUTTON_OBJ_NAME)))
return -ENODEV;
+ if (!surface_button_check_MSHW0040(device))
+ return -ENODEV;
+
button = kzalloc(sizeof(struct surface_button), GFP_KERNEL);
if (!button)
return -ENOMEM;
--
2.28.0
From a8202a8b7e876c56055d62ab2dea519af0071297 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 27 Jul 2019 17:52:01 +0200
Subject: [PATCH] Input: soc_button_array - Add support for newer surface
devices
Power and volume button support for 5th and 6th generation Microsoft
Surface devices via soc_button_array.
Note that these devices use the same MSHW0040 device as on the Surface
Pro 4, however the implementation is different (GPIOs vs. ACPI
notifications). Thus some checking is required to ensure we only load
this driver on the correct devices.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-buttons
---
drivers/input/misc/Kconfig | 6 +-
drivers/input/misc/soc_button_array.c | 105 +++++++++++++++++++++++---
2 files changed, 96 insertions(+), 15 deletions(-)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index ca59a2be9bc5..ea69610370e8 100644
@ -28,7 +132,7 @@ index ca59a2be9bc5..ea69610370e8 100644
To compile this driver as a module, choose M here: the
module will be called soc_button_array.
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 55cd6e0b409c..c564ea99f47d 100644
index 55cd6e0b409c..8f21c062c85d 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -29,6 +29,11 @@ struct soc_button_info {
@ -43,29 +147,22 @@ index 55cd6e0b409c..c564ea99f47d 100644
/*
* Some of the buttons like volume up/down are auto repeat, while others
* are not. To support both, we register two platform devices, and put
@@ -91,8 +96,20 @@ soc_button_device_create(struct platform_device *pdev,
@@ -91,8 +96,13 @@ soc_button_device_create(struct platform_device *pdev,
continue;
gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
- if (!gpio_is_valid(gpio))
+ if (!gpio_is_valid(gpio)) {
+ /*
+ * Skip GPIO if not present. Note we deliberately
+ * ignore -EPROBE_DEFER errors here. On some devices
+ * Intel is using so called virtual GPIOs which are not
+ * GPIOs at all but some way for AML code to check some
+ * random status bits without need a custom opregion.
+ * In some cases the resources table we parse points to
+ * such a virtual GPIO, since these are not real GPIOs
+ * we do not have a driver for these so they will never
+ * show up, therefor we ignore -EPROBE_DEFER.
+ */
+ if (gpio < 0 && gpio != -ENOENT) {
+ error = gpio;
+ goto err_free_mem;
+ } else if (!gpio_is_valid(gpio)) {
+ /* Skip GPIO if not present */
continue;
+ }
gpio_keys[n_buttons].type = info->event_type;
gpio_keys[n_buttons].code = info->event_code;
@@ -309,23 +326,26 @@ static int soc_button_remove(struct platform_device *pdev)
@@ -309,23 +319,26 @@ static int soc_button_remove(struct platform_device *pdev)
static int soc_button_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@ -100,18 +197,16 @@ index 55cd6e0b409c..c564ea99f47d 100644
}
error = gpiod_count(dev, NULL);
@@ -357,8 +377,8 @@ static int soc_button_probe(struct platform_device *pdev)
@@ -357,7 +370,7 @@ static int soc_button_probe(struct platform_device *pdev)
if (!priv->children[0] && !priv->children[1])
return -ENODEV;
- if (!id->driver_data)
- devm_kfree(dev, button_info);
+ if (!device_data || !device_data->button_info)
+ devm_kfree(dev, (void *)button_info);
devm_kfree(dev, button_info);
return 0;
}
@@ -368,7 +388,7 @@ static int soc_button_probe(struct platform_device *pdev)
@@ -368,7 +381,7 @@ static int soc_button_probe(struct platform_device *pdev)
* is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC
* Platforms"
*/
@ -120,7 +215,7 @@ index 55cd6e0b409c..c564ea99f47d 100644
{ "power", 0, EV_KEY, KEY_POWER, false, true },
{ "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
{ "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
@@ -377,9 +397,77 @@ static struct soc_button_info soc_button_PNP0C40[] = {
@@ -377,9 +390,77 @@ static struct soc_button_info soc_button_PNP0C40[] = {
{ }
};
@ -199,78 +294,147 @@ index 55cd6e0b409c..c564ea99f47d 100644
{ }
};
diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
index 1b491690ce07..96627627060e 100644
--- a/drivers/platform/x86/surfacepro3_button.c
+++ b/drivers/platform/x86/surfacepro3_button.c
@@ -24,6 +24,12 @@
#define SURFACE_BUTTON_OBJ_NAME "VGBI"
#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3/4 Buttons"
+#define MSHW0040_DSM_REVISION 0x01
+#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision
+static const guid_t MSHW0040_DSM_UUID =
+ GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65,
+ 0x49, 0x80, 0x35);
+
#define SURFACE_BUTTON_NOTIFY_TABLET_MODE 0xc8
#define SURFACE_BUTTON_NOTIFY_PRESS_POWER 0xc6
@@ -146,6 +152,44 @@ static int surface_button_resume(struct device *dev)
}
#endif
+/*
+ * Surface Pro 4 and Surface Book 2 / Surface Pro 2017 use the same device
+ * ID (MSHW0040) for the power/volume buttons. Make sure this is the right
+ * device by checking for the _DSM method and OEM Platform Revision.
+ *
+ * Returns true if the driver should bind to this device, i.e. the device is
+ * either MSWH0028 (Pro 3) or MSHW0040 on a Pro 4 or Book 1.
+ */
+static bool surface_button_check_MSHW0040(struct acpi_device *dev)
+{
+ acpi_handle handle = dev->handle;
+ union acpi_object *result;
+ u64 oem_platform_rev = 0; // valid revisions are nonzero
+
+ // get OEM platform revision
+ result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID,
+ MSHW0040_DSM_REVISION,
+ MSHW0040_DSM_GET_OMPR,
+ NULL, ACPI_TYPE_INTEGER);
+
+ /*
+ * If evaluating the _DSM fails, the method is not present. This means
+ * that we have either MSHW0028 or MSHW0040 on Pro 4 or Book 1, so we
+ * should use this driver. We use revision 0 indicating it is
+ * unavailable.
+ */
+
+ if (result) {
+ oem_platform_rev = result->integer.value;
+ ACPI_FREE(result);
+ }
+
+ dev_dbg(&dev->dev, "OEM Platform Revision %llu\n", oem_platform_rev);
+
+ return oem_platform_rev == 0;
+}
+
+
static int surface_button_add(struct acpi_device *device)
{
struct surface_button *button;
@@ -158,6 +202,9 @@ static int surface_button_add(struct acpi_device *device)
strlen(SURFACE_BUTTON_OBJ_NAME)))
return -ENODEV;
+ if (!surface_button_check_MSHW0040(device))
+ return -ENODEV;
+
button = kzalloc(sizeof(struct surface_button), GFP_KERNEL);
if (!button)
return -ENOMEM;
--
2.28.0
From 0f703888a68cbdbd9bafae8b601a7180c8126eb8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoide@redhat.com>
Date: Sat, 5 Oct 2019 14:11:58 +0200
Subject: [PATCH] Input: soc_button_array - partial revert of support for newer
surface devices
Commit c394159310d0 ("Input: soc_button_array - add support for newer
surface devices") not only added support for the MSHW0040 ACPI HID,
but for some reason it also makes changes to the error handling of the
soc_button_lookup_gpio() call in soc_button_device_create(). Note ideally
this seamingly unrelated change would have been made in a separate commit,
with a message explaining the what and why of this change.
I guess this change may have been added to deal with -EPROBE_DEFER errors,
but in case of the existing support for PNP0C40 devices, treating
-EPROBE_DEFER as any other error is deliberate, see the comment this
commit adds for why.
The actual returning of -EPROBE_DEFER to the caller of soc_button_probe()
introduced by the new error checking causes a serious regression:
On devices with so called virtual GPIOs soc_button_lookup_gpio() will
always return -EPROBE_DEFER for these fake GPIOs, when this happens
during the second call of soc_button_device_create() we already have
successfully registered our first child. This causes the kernel to think
we are making progress with probing things even though we unregister the
child before again before we return the -EPROBE_DEFER. Since we are making
progress the kernel will retry deferred-probes again immediately ending
up stuck in a loop with the following showing in dmesg:
[ 124.022697] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6537
[ 124.040764] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6538
[ 124.056967] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6539
[ 124.072143] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6540
[ 124.092373] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6541
[ 124.108065] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6542
[ 124.128483] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6543
[ 124.147141] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6544
[ 124.165070] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6545
[ 124.179775] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6546
[ 124.202726] input: gpio-keys as /devices/platform/INTCFD9:00/gpio-keys.0.auto/input/input6547
<continues on and on and on>
And 1 CPU core being stuck at 100% and udev hanging since it is waiting
for the modprobe of soc_button_array to return.
This patch reverts the soc_button_lookup_gpio() error handling changes,
fixing this regression.
Fixes: c394159310d0 ("Input: soc_button_array - add support for newer surface devices")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205031
Cc: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Patchset: surface-buttons
---
drivers/input/misc/soc_button_array.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 8f21c062c85d..5983733d78dd 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -96,11 +96,18 @@ soc_button_device_create(struct platform_device *pdev,
continue;
gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
- if (gpio < 0 && gpio != -ENOENT) {
- error = gpio;
- goto err_free_mem;
- } else if (!gpio_is_valid(gpio)) {
- /* Skip GPIO if not present */
+ if (!gpio_is_valid(gpio)) {
+ /*
+ * Skip GPIO if not present. Note we deliberately
+ * ignore -EPROBE_DEFER errors here. On some devices
+ * Intel is using so called virtual GPIOs which are not
+ * GPIOs at all but some way for AML code to check some
+ * random status bits without need a custom opregion.
+ * In some cases the resources table we parse points to
+ * such a virtual GPIO, since these are not real GPIOs
+ * we do not have a driver for these so they will never
+ * show up, therefor we ignore -EPROBE_DEFER.
+ */
continue;
}
--
2.28.0
From 38ad6b1492e4126a664f6247bd7dc8ee87a10c76 Mon Sep 17 00:00:00 2001
From: "Tsuchiya Yuto (kitakar5525)" <kitakar@gmail.com>
Date: Mon, 11 May 2020 17:40:21 +0900
Subject: [PATCH] Input: soc_button_array - fix Wdiscarded-qualifiers for
kernels below 4.20
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is a warning from compiler when building v4.19-surface kernel that
backported button patches from newer kernels.
drivers/input/misc/soc_button_array.c: In function soc_button_probe:
drivers/input/misc/soc_button_array.c:381:19: warning: passing argument 2 of devm_kfree discards const qualifier from pointer target type [-Wdiscarded-qualifiers]
381 | devm_kfree(dev, button_info);
| ^~~~~~~~~~~
In file included from ./include/linux/input.h:22,
from drivers/input/misc/soc_button_array.c:14:
./include/linux/device.h:695:50: note: expected void * but argument is of type const struct soc_button_info *
695 | extern void devm_kfree(struct device *dev, void *p);
| ~~~~~~^
This warning happens bacause commit 0571967dfb5d25 ("devres: constify p
in devm_kfree()") has not been applied to v4.19 series (available after
v4.20-rc1).
This commit casts button_info to (void *) when calling devm_kfree() to
avoid compiler warning.
Fixes: b892fc124285ba ("Input: soc_button_array - Add support for newer surface devices")
Signed-off-by: Tsuchiya Yuto (kitakar5525) <kitakar@gmail.com>
Patchset: surface-buttons
---
drivers/input/misc/soc_button_array.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 5983733d78dd..c564ea99f47d 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -378,7 +378,7 @@ static int soc_button_probe(struct platform_device *pdev)
return -ENODEV;
if (!device_data || !device_data->button_info)
- devm_kfree(dev, button_info);
+ devm_kfree(dev, (void *)button_info);
return 0;
}
--
2.28.0

View file

@ -1,8 +1,26 @@
From fb6b7e1a29e622cf19c57c17f397661ec9dae1da Mon Sep 17 00:00:00 2001
From 8273cec8ad42f5a6d2349347878331069c296f07 Mon Sep 17 00:00:00 2001
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
Date: Sat, 28 Sep 2019 17:48:21 +0200
Subject: [PATCH 05/11] suspend
Subject: [PATCH] nvme: Backport changes for suspend
Backported commits are:
- torvalds/linux@4eaefe8c621c6195c91044396ed8060c179f7aae
(nvme-pci: Allow PCI bus-level PM to be used if ASPM is disabled)
- torvalds/linux@accd2dd72c8f087441d725dd916688171519e4e6
(PCI/ASPM: Add pcie_aspm_enabled())
- torvalds/linux@d916b1be94b6dc8d293abed2451f3062f6af7551
(nvme-pci: use host managed power state for suspend)
- torvalds/linux@1a87ee657c530bb2f3e39e4ac184d48f5f959cda
(nvme: export get and set features)
- torvalds/linux@d6135c3a1ec0cddda7b8b8e1b5b4abeeafd98289
(nvme-pci: Sync queues on reset)
Patchset: suspend
---
drivers/nvme/host/core.c | 36 ++++++++++++--
drivers/nvme/host/nvme.h | 7 +++

View file

@ -1,8 +1,9 @@
From f4a9111f3d630f2ad9a1746caa0d5c0bc319cb13 Mon Sep 17 00:00:00 2001
From 067c4fbb383132758816350e07d5003b48d14fda Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 28 Sep 2019 17:58:17 +0200
Subject: [PATCH 06/11] ipts
Subject: [PATCH] Add support for Intel IPTS touch devices
Patchset: ipts
---
drivers/gpu/drm/i915/Makefile | 3 +
drivers/gpu/drm/i915/i915_debugfs.c | 63 +-

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,35 @@
From 5796288595a85c616fb0b3eabd9e7a240d519287 Mon Sep 17 00:00:00 2001
From a80e327970c6f03b0516fd354f2df0563b1497f2 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 16 Aug 2020 23:39:56 +0200
Subject: [PATCH 10/11] 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 10/11] surface-gpe
create mode 100644 drivers/platform/x86/surface_gpe.c
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 1e1ec7e562e8..0b50f1e4c437 100644
index 0d20ffdb5a67..cd2442056cec 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1175,6 +1175,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.
@@ -1168,6 +1168,15 @@ config SURFACE_3_POWER_OPREGION
Select this option to enable support for ACPI operation
region of the Surface 3 battery platform driver.
+config SURFACE_GPE
+ tristate "Surface GPE/Lid Driver"
@ -31,13 +58,13 @@ index 1e1ec7e562e8..0b50f1e4c437 100644
tristate "Intel P-Unit IPC Driver"
---help---
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 3911b95487c7..0dfc55b07a48 100644
index 2ea90039a3e4..49238e9d4abf 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -83,6 +83,7 @@ obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
@@ -82,6 +82,7 @@ obj-$(CONFIG_TOUCHSCREEN_DMI) += touchscreen_dmi.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
obj-$(CONFIG_SURFACE_BOOK1_DGPU_SWITCH) += sb1_dgpu_sw.o
+obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o
obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o
obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU) += intel_bxtwc_tmu.o

View file

@ -1,15 +1,57 @@
From b91f59f3002ceab95cae05a5bc6c9428063b1485 Mon Sep 17 00:00:00 2001
From bcb8584fbaa4854a8bcfc35c167712df1230cd5a Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH 09/11] 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 eb0569359387..c2b5a2aca731 100644
@ -64,13 +106,38 @@ index eb0569359387..c2b5a2aca731 100644
default:
dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
accessor_type, client->addr);
--
2.28.0
From 53e895a0bfdf74dddb2f295f4d4e1ab93229fc40 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 0d20ffdb5a67..1e1ec7e562e8 100644
index cd2442056cec..52fdf87b21f2 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1168,6 +1168,13 @@ config SURFACE_3_POWER_OPREGION
Select this option to enable support for ACPI operation
region of the Surface 3 battery platform driver.
@@ -1177,6 +1177,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 0d20ffdb5a67..1e1ec7e562e8 100644
tristate "Intel P-Unit IPC Driver"
---help---
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 2ea90039a3e4..3911b95487c7 100644
index 49238e9d4abf..6b028d1ee802 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -82,6 +82,7 @@ obj-$(CONFIG_TOUCHSCREEN_DMI) += touchscreen_dmi.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
@@ -83,6 +83,7 @@ obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o
+obj-$(CONFIG_SURFACE_BOOK1_DGPU_SWITCH) += sb1_dgpu_sw.o
obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o
obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU) += intel_bxtwc_tmu.o

View file

@ -1,8 +1,8 @@
From e134b2f1c836a5beef7d16d86393744387bb4830 Mon Sep 17 00:00:00 2001
From c523e2ba98307da63f228ec499d9f011e4ebd916 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 11/11] 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/4.19/0008-surface-gpe.patch

View file

@ -1 +0,0 @@
../../../patches/4.19/0008-surface-sam.patch

View file

@ -1 +0,0 @@
../../../patches/4.19/0010-surface-gpe.patch

View file

@ -0,0 +1 @@
../../../patches/4.19/0010-surface-sam.patch

View file

@ -27,9 +27,9 @@ source=(
0005-suspend.patch
0006-ipts.patch
0007-wifi.patch
0008-surface-sam.patch
0008-surface-gpe.patch
0009-surface-sam-over-hid.patch
0010-surface-gpe.patch
0010-surface-sam.patch
0011-i2c-core-Restore-acpi_walk_dep_device_list-getting-c.patch
)
validpgpkeys=(
@ -42,17 +42,17 @@ sha256sums=('c7b134c6d45f77df0909c225300e64379d7f9d69abd9ad73ff6a289aa2b6a36e'
'4e68572e7cc4c5368f0236e0792660ae8498373988625dca46e509399a7eaea6'
'a13581d3c6dc595206e4fe7fcf6b542e7a1bdbe96101f0f010fc5be49f99baf2'
'1c4963e4a911e74ed56f1fe0065c31201edca9a5e3f89eb30b7063f9981ebdd8'
'3892c3974f53e87e2efa059326359c3108bba1a411eecd5a2b614174384e8755'
'e73d7567a23d10babda2124a65337c8f57ff61fbb1c65a629afdfcc7a3d542e2'
'33c4264b920e2e4466de8369e3f2fcf3383c2e0eb68dacff82e107ae9f8d2354'
'20c72eea089af4ca105bec93bd7c7e91c2e8fbe5d24c88188e4ca2c77699a7ab'
'776ce945b51e59c543e19cc9e006b5047b22ec06255c2cce1163152aa3c65894'
'6185565a16689190140e6fe19df4d51fac4eeb1ac4a927855ec555f2274d7d0c'
'd205cf4756307c6c0909e26ca4b2ca45354a82df29255cd5809caf4b6aed41e1'
'0f5f2b61befacc735689604af5f6641b6b490d83745f4c78d13e9d2621e6f383'
'227182760913e58b9e42efd3315136379bd2c0a6cb5116ac7659baf98a40dcfe'
'f50f44b4c132387923ee0fd1209ec860e4ab9d33ef03155ae36596d52f8e3ae4'
'2de700c366cf3273f49d02efc5dc0416a5ff12eccf3d7847f21f1923458f1883')
'111b4f7814d49c06f3f328feba30c8991e423acce36aa9c737a31489a64b9e5d'
'b85aa40e2c3c04514aa14538c7486653cc987276acffae532e3b8516d3328bfc'
'602fb64b0b2073e0b016f39be34d86113fb0b3e63b4490cc26611d1313b3665e'
'99bc4ce339713433a06d936bb6c339d2797b6bec8e7af91be017bcf30bc658b3'
'0d0bd51185191cdc29405db26cfa8d79debb85aa090931672b8ac5c3ee4a7e10'
'0383649af9c5f63c47b515d03e9279a4090fec1fb32a9d47692a491c80f5a1b5'
'e5fd01b8fdb8c53f46ac58fdffd4d7a75f009217e5f2a484ac00a6bb9968eab4'
'4a5c643ec9a3c3e15ceff45e024fce0462dc314b516fe0620de6858178d96fc8'
'f28bc22540ad92769c4bd787140ab759f665f262f1c9cb8827010d8c8f6c5d4c'
'71deb9a7421a7ba3be46059e5246a2900b1d1cd206339716f1fb9f1c848731d7'
'12dd1c955d2b9123afaad2690d65905ea394f297ba27ab4fec32dd5655553c8c')
export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase