Explorar o código

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: https://github.com/linux-surface/surface-aggregator-module/commit/4b3ee5ad71982a3de96b0193ad5dba7b884d5ef2
- GPE: https://github.com/linux-surface/surface-gpe/commit/7c017f4d52388cc6d0adfa2acf09407f294bd9b8
- kernel: https://github.com/linux-surface/kernel/commit/70d365e78cb3a979f13581e4c0e88091f28a6387
Maximilian Luz %!s(int64=4) %!d(string=hai) anos
pai
achega
536da55ec6

+ 13 - 13
configs/surface-5.4.config

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

+ 1 - 1
patches/5.4/0001-surface3-power.patch

@@ -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

+ 1 - 1
patches/5.4/0002-surface3-oemb.patch

@@ -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

+ 1 - 1
patches/5.4/0003-wifi.patch

@@ -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

+ 1 - 1
patches/5.4/0004-ipts.patch

@@ -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

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 4319 - 4422
patches/5.4/0005-surface-sam.patch


+ 1 - 1
patches/5.4/0006-surface-sam-over-hid.patch

@@ -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

+ 57 - 53
patches/5.4/0007-surface-gpe.patch

@@ -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 +++++++++++++++++++++++++++++
- 3 files changed, 313 insertions(+)
+ drivers/platform/x86/surface_gpe.c | 307 +++++++++++++++++++++++++++++
+ 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) {
-+		dev_err(dev, "failed to set GPE wake mask: %d\n", status);
++	if (ACPI_FAILURE(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);
-+	if (status)
-+		return -ENODEV;
++	ret = device_property_read_u32(&pdev->dev, "gpe", &gpe_number);
++	if (ret) {
++		dev_err(&pdev->dev, "failed to read 'gpe' property: %d\n", ret);
++		return ret;
++	}
++
++	lid = devm_kzalloc(&pdev->dev, sizeof(*lid), GFP_KERNEL);
++	if (!lid)
++		return -ENOMEM;
++
++	lid->gpe_number = gpe_number;
++	platform_set_drvdata(pdev, lid);
 +
 +
 +	status = acpi_mark_gpe_for_wake(NULL, gpe_number);
 +	status = acpi_mark_gpe_for_wake(NULL, gpe_number);
-+	if (status) {
-+		dev_err(&pdev->dev, "failed to mark GPE for wake: %d\n", status);
++	if (ACPI_FAILURE(status)) {
++		dev_err(&pdev->dev, "failed to mark GPE for wake: %s\n",
++			acpi_format_exception(status));
 +		return -EINVAL;
 +		return -EINVAL;
 +	}
 +	}
 +
 +
 +	status = acpi_enable_gpe(NULL, gpe_number);
 +	status = acpi_enable_gpe(NULL, gpe_number);
-+	if (status) {
-+		dev_err(&pdev->dev, "failed to enable GPE: %d\n", status);
++	if (ACPI_FAILURE(status)) {
++		dev_err(&pdev->dev, "failed to enable GPE: %s\n",
++			acpi_format_exception(status));
 +		return -EINVAL;
 +		return -EINVAL;
 +	}
 +	}
 +
 +
-+	lid = devm_kzalloc(&pdev->dev, sizeof(struct surface_lid_device),
-+			   GFP_KERNEL);
-+	if (!lid)
-+		return -ENOMEM;
-+
-+	lid->gpe_number = gpe_number;
-+	platform_set_drvdata(pdev, lid);
-+
-+	status = surface_lid_enable_wakeup(&pdev->dev, false);
-+	if (status) {
++	ret = surface_lid_enable_wakeup(&pdev->dev, false);
++	if (ret)
 +		acpi_disable_gpe(NULL, gpe_number);
 +		acpi_disable_gpe(NULL, gpe_number);
-+		platform_set_drvdata(pdev, NULL);
-+		return status;
-+	}
 +
 +
-+	return 0;
++	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");
-+		return 0;
++		pr_info("no compatible Microsoft Surface device found, exiting\n");
++		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);
-+	if (!pdev) {
-+		platform_driver_unregister(&surface_gpe_driver);
-+		return -ENOMEM;
++	fwnode = fwnode_create_software_node(match->driver_data, NULL);
++	if (IS_ERR(fwnode)) {
++		status = PTR_ERR(fwnode);
++		goto err_node;
 +	}
 +	}
 +
 +
-+	fwnode = fwnode_create_software_node(props, NULL);
-+	if (IS_ERR(fwnode)) {
-+		platform_device_put(pdev);
-+		platform_driver_unregister(&surface_gpe_driver);
-+		return PTR_ERR(fwnode);
++	pdev = platform_device_alloc("surface_gpe", PLATFORM_DEVID_NONE);
++	if (!pdev) {
++		status = -ENOMEM;
++		goto err_alloc;
 +	}
 +	}
 +
 +
 +	pdev->dev.fwnode = fwnode;
 +	pdev->dev.fwnode = fwnode;
 +
 +
 +	status = platform_device_add(pdev);
 +	status = platform_device_add(pdev);
-+	if (status) {
-+		platform_device_put(pdev);
-+		platform_driver_unregister(&surface_gpe_driver);
-+		return status;
-+	}
++	if (status)
++		goto err_add;
 +
 +
 +	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)
-+		return;
++	struct fwnode_handle *fwnode = surface_gpe_device->dev.fwnode;
 +
 +
-+	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);
 +
 +

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio