Update v5.4 patches

Changes:
- SAM:
  - Fix a bug preventing SSAM client devices to be registered on the
    Surface Book 3.
  - Introduce SSAM device domains.
  - Rename modules, drivers, and source directories.
  - Split-up main header file.
  - Update and improve Kconfig options and help texts.
  - Internal restructuring, cleanup, and documentation.

- GPE:
  - Cleanup, fixes, and restructuring.

Links:
- SAM: 4b3ee5ad71
- GPE: 7c017f4d52
- kernel: 70d365e78c
This commit is contained in:
Maximilian Luz 2020-09-17 23:25:44 +02:00
parent 821bb27beb
commit 536da55ec6
No known key found for this signature in database
GPG key ID: 70EC0937F6C26F02
8 changed files with 5051 additions and 4836 deletions

View file

@ -1,19 +1,19 @@
# #
# Surface Aggregator Module # Surface Aggregator Module
# #
CONFIG_GPIO_SYSFS=y # required for SURFACE_SAM_HPS CONFIG_GPIO_SYSFS=y # required for SURFACE_HOTPLUG
CONFIG_SURFACE_SAM=m CONFIG_SURFACE_AGGREGATOR=m
CONFIG_SURFACE_SAM_SSH=m CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION=n
CONFIG_SURFACE_SAM_SSH_ERROR_INJECTION=n CONFIG_SURFACE_AGGREGATOR_BUS=y
CONFIG_SURFACE_SAM_DEBUGFS=m CONFIG_SURFACE_AGGREGATOR_DEBUGFS=m
CONFIG_SURFACE_SAM_DEVICE_HUB=m CONFIG_SURFACE_AGGREGATOR_REGISTRY=m
CONFIG_SURFACE_SAM_SAN=m CONFIG_SURFACE_ACPI_NOTIFY=m
CONFIG_SURFACE_SAM_KBD=m CONFIG_SURFACE_BATTERY=m
CONFIG_SURFACE_SAM_DTX=m CONFIG_SURFACE_DTX=m
CONFIG_SURFACE_SAM_HPS=m CONFIG_SURFACE_HID=m
CONFIG_SURFACE_SAM_PERFMODE=m CONFIG_SURFACE_HOTPLUG=m
CONFIG_SURFACE_SAM_HID=m CONFIG_SURFACE_KEYBOARD=m
CONFIG_SURFACE_SAM_PSY=m CONFIG_SURFACE_PERFMODE=m
# #
# IPTS touchscreen # IPTS touchscreen

View file

@ -1,4 +1,4 @@
From 0d51533624bd156df8d97aa4280040c7c7e362b4 Mon Sep 17 00:00:00 2001 From d882e5f0af12470cc9c8bdf33acde2ca60cf027f Mon Sep 17 00:00:00 2001
From: qzed <qzed@users.noreply.github.com> From: qzed <qzed@users.noreply.github.com>
Date: Tue, 17 Sep 2019 17:17:56 +0200 Date: Tue, 17 Sep 2019 17:17:56 +0200
Subject: [PATCH 1/7] surface3-power Subject: [PATCH 1/7] surface3-power

View file

@ -1,4 +1,4 @@
From 644f7558884abc017463703239a02ba1b2255e04 Mon Sep 17 00:00:00 2001 From f5e1881913400187c698b3ddfd68d015c077d671 Mon Sep 17 00:00:00 2001
From: Chih-Wei Huang <cwhuang@linux.org.tw> From: Chih-Wei Huang <cwhuang@linux.org.tw>
Date: Tue, 18 Sep 2018 11:01:37 +0800 Date: Tue, 18 Sep 2018 11:01:37 +0800
Subject: [PATCH 2/7] surface3-oemb Subject: [PATCH 2/7] surface3-oemb

View file

@ -1,4 +1,4 @@
From 830c1239c7459f608d566b142f426b67805814ca Mon Sep 17 00:00:00 2001 From abac510de08eda2e3700f3d55fe82bb62a3b0360 Mon Sep 17 00:00:00 2001
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com> From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
Date: Thu, 20 Feb 2020 16:51:11 +0900 Date: Thu, 20 Feb 2020 16:51:11 +0900
Subject: [PATCH 3/7] wifi Subject: [PATCH 3/7] wifi

View file

@ -1,4 +1,4 @@
From 79bbcb2e3777ae6c824cacdbf03898e0a8301a69 Mon Sep 17 00:00:00 2001 From 687a6a4f4b10a78839a0d64db38ca07baab7e80a Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io> From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Mon, 27 Jan 2020 21:16:20 +0100 Date: Mon, 27 Jan 2020 21:16:20 +0100
Subject: [PATCH 4/7] ipts Subject: [PATCH 4/7] ipts

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
From 09acd33442aaf0bafa6b2cefeb9c2b1d170c9888 Mon Sep 17 00:00:00 2001 From 8561306d5bcf7c1a58c3036b514f571cf14f618b Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com> From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200 Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH 6/7] surface-sam-over-hid Subject: [PATCH 6/7] surface-sam-over-hid

View file

@ -1,4 +1,4 @@
From 19330628c39dba2105c59ca2d3c2b427283ea917 Mon Sep 17 00:00:00 2001 From ed99f20ce9c57d393a3c8ef85dc1509bdefe7ce3 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com> From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 16 Aug 2020 23:39:56 +0200 Date: Sun, 16 Aug 2020 23:39:56 +0200
Subject: [PATCH 7/7] surface-gpe Subject: [PATCH 7/7] surface-gpe
@ -6,8 +6,8 @@ Subject: [PATCH 7/7] surface-gpe
--- ---
drivers/platform/x86/Kconfig | 9 + drivers/platform/x86/Kconfig | 9 +
drivers/platform/x86/Makefile | 1 + drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/surface_gpe.c | 303 +++++++++++++++++++++++++++++ drivers/platform/x86/surface_gpe.c | 307 +++++++++++++++++++++++++++++
3 files changed, 313 insertions(+) 3 files changed, 317 insertions(+)
create mode 100644 drivers/platform/x86/surface_gpe.c create mode 100644 drivers/platform/x86/surface_gpe.c
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
@ -44,16 +44,19 @@ index b3e0a2c6924b..c6e934a73a8d 100644
obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o \ obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o \
diff --git a/drivers/platform/x86/surface_gpe.c b/drivers/platform/x86/surface_gpe.c diff --git a/drivers/platform/x86/surface_gpe.c b/drivers/platform/x86/surface_gpe.c
new file mode 100644 new file mode 100644
index 000000000000..10e563f253b9 index 000000000000..2857e3862ca4
--- /dev/null --- /dev/null
+++ b/drivers/platform/x86/surface_gpe.c +++ b/drivers/platform/x86/surface_gpe.c
@@ -0,0 +1,303 @@ @@ -0,0 +1,307 @@
+// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later
+/* +/*
+ * Surface GPE/Lid driver to enable wakeup from suspend via the lid by + * Surface GPE/Lid driver to enable wakeup from suspend via the lid by
+ * properly configuring the respective GPEs. + * properly configuring the respective GPEs. Required for wakeup via lid on
+ * newer Intel-based Microsoft Surface devices.
+ */ + */
+ +
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/acpi.h> +#include <linux/acpi.h>
+#include <linux/dmi.h> +#include <linux/dmi.h>
+#include <linux/kernel.h> +#include <linux/kernel.h>
@ -205,8 +208,9 @@ index 000000000000..10e563f253b9
+ acpi_status status; + acpi_status status;
+ +
+ status = acpi_set_gpe_wake_mask(NULL, lid->gpe_number, action); + status = acpi_set_gpe_wake_mask(NULL, lid->gpe_number, action);
+ if (status) { + if (ACPI_FAILURE(status)) {
+ dev_err(dev, "failed to set GPE wake mask: %d\n", status); + dev_err(dev, "failed to set GPE wake mask: %s\n",
+ acpi_format_exception(status));
+ return -EINVAL; + return -EINVAL;
+ } + }
+ +
@ -229,40 +233,41 @@ index 000000000000..10e563f253b9
+{ +{
+ struct surface_lid_device *lid; + struct surface_lid_device *lid;
+ u32 gpe_number; + u32 gpe_number;
+ int status; + acpi_status status;
+ int ret;
+ +
+ status = device_property_read_u32(&pdev->dev, "gpe", &gpe_number); + ret = device_property_read_u32(&pdev->dev, "gpe", &gpe_number);
+ if (status) + if (ret) {
+ return -ENODEV; + dev_err(&pdev->dev, "failed to read 'gpe' property: %d\n", ret);
+ + return ret;
+ status = acpi_mark_gpe_for_wake(NULL, gpe_number);
+ if (status) {
+ dev_err(&pdev->dev, "failed to mark GPE for wake: %d\n", status);
+ return -EINVAL;
+ } + }
+ +
+ status = acpi_enable_gpe(NULL, gpe_number); + lid = devm_kzalloc(&pdev->dev, sizeof(*lid), GFP_KERNEL);
+ if (status) {
+ dev_err(&pdev->dev, "failed to enable GPE: %d\n", status);
+ return -EINVAL;
+ }
+
+ lid = devm_kzalloc(&pdev->dev, sizeof(struct surface_lid_device),
+ GFP_KERNEL);
+ if (!lid) + if (!lid)
+ return -ENOMEM; + return -ENOMEM;
+ +
+ lid->gpe_number = gpe_number; + lid->gpe_number = gpe_number;
+ platform_set_drvdata(pdev, lid); + platform_set_drvdata(pdev, lid);
+ +
+ status = surface_lid_enable_wakeup(&pdev->dev, false); + status = acpi_mark_gpe_for_wake(NULL, gpe_number);
+ if (status) { + if (ACPI_FAILURE(status)) {
+ acpi_disable_gpe(NULL, gpe_number); + dev_err(&pdev->dev, "failed to mark GPE for wake: %s\n",
+ platform_set_drvdata(pdev, NULL); + acpi_format_exception(status));
+ return status; + return -EINVAL;
+ } + }
+ +
+ return 0; + status = acpi_enable_gpe(NULL, gpe_number);
+ if (ACPI_FAILURE(status)) {
+ dev_err(&pdev->dev, "failed to enable GPE: %s\n",
+ acpi_format_exception(status));
+ return -EINVAL;
+ }
+
+ ret = surface_lid_enable_wakeup(&pdev->dev, false);
+ if (ret)
+ acpi_disable_gpe(NULL, gpe_number);
+
+ return ret;
+} +}
+ +
+static int surface_gpe_remove(struct platform_device *pdev) +static int surface_gpe_remove(struct platform_device *pdev)
@ -273,7 +278,6 @@ index 000000000000..10e563f253b9
+ surface_lid_enable_wakeup(&pdev->dev, false); + surface_lid_enable_wakeup(&pdev->dev, false);
+ acpi_disable_gpe(NULL, lid->gpe_number); + acpi_disable_gpe(NULL, lid->gpe_number);
+ +
+ platform_set_drvdata(pdev, NULL);
+ return 0; + return 0;
+} +}
+ +
@ -292,58 +296,58 @@ index 000000000000..10e563f253b9
+static int __init surface_gpe_init(void) +static int __init surface_gpe_init(void)
+{ +{
+ const struct dmi_system_id *match; + const struct dmi_system_id *match;
+ const struct property_entry *props;
+ struct platform_device *pdev; + struct platform_device *pdev;
+ struct fwnode_handle *fwnode; + struct fwnode_handle *fwnode;
+ int status; + int status;
+ +
+ match = dmi_first_match(dmi_lid_device_table); + match = dmi_first_match(dmi_lid_device_table);
+ if (!match) { + if (!match) {
+ pr_info(KBUILD_MODNAME": no device detected, exiting\n"); + pr_info("no compatible Microsoft Surface device found, exiting\n");
+ return 0; + return -ENODEV;
+ } + }
+ +
+ props = match->driver_data;
+
+ status = platform_driver_register(&surface_gpe_driver); + status = platform_driver_register(&surface_gpe_driver);
+ if (status) + if (status)
+ return status; + return status;
+ +
+ pdev = platform_device_alloc("surface_gpe", PLATFORM_DEVID_NONE); + fwnode = fwnode_create_software_node(match->driver_data, NULL);
+ if (!pdev) { + if (IS_ERR(fwnode)) {
+ platform_driver_unregister(&surface_gpe_driver); + status = PTR_ERR(fwnode);
+ return -ENOMEM; + goto err_node;
+ } + }
+ +
+ fwnode = fwnode_create_software_node(props, NULL); + pdev = platform_device_alloc("surface_gpe", PLATFORM_DEVID_NONE);
+ if (IS_ERR(fwnode)) { + if (!pdev) {
+ platform_device_put(pdev); + status = -ENOMEM;
+ platform_driver_unregister(&surface_gpe_driver); + goto err_alloc;
+ return PTR_ERR(fwnode);
+ } + }
+ +
+ pdev->dev.fwnode = fwnode; + pdev->dev.fwnode = fwnode;
+ +
+ status = platform_device_add(pdev); + status = platform_device_add(pdev);
+ if (status) { + if (status)
+ platform_device_put(pdev); + goto err_add;
+ platform_driver_unregister(&surface_gpe_driver);
+ return status;
+ }
+ +
+ surface_gpe_device = pdev; + surface_gpe_device = pdev;
+ return 0; + return 0;
+
+err_add:
+ platform_device_put(pdev);
+err_alloc:
+ fwnode_remove_software_node(fwnode);
+err_node:
+ platform_driver_unregister(&surface_gpe_driver);
+ return status;
+} +}
+module_init(surface_gpe_init); +module_init(surface_gpe_init);
+ +
+static void __exit surface_gpe_exit(void) +static void __exit surface_gpe_exit(void)
+{ +{
+ if (!surface_gpe_device) + struct fwnode_handle *fwnode = surface_gpe_device->dev.fwnode;
+ return;
+ +
+ fwnode_remove_software_node(surface_gpe_device->dev.fwnode);
+ platform_device_unregister(surface_gpe_device); + platform_device_unregister(surface_gpe_device);
+ platform_driver_unregister(&surface_gpe_driver); + platform_driver_unregister(&surface_gpe_driver);
+ fwnode_remove_software_node(fwnode);
+} +}
+module_exit(surface_gpe_exit); +module_exit(surface_gpe_exit);
+ +