Update v5.4 patches
Changes: SAM: - Move lid/GPE workaround into separate independent module. - A bus and device type has been implemented for SAM devices. - Detach devices attached to the base when the cliboard is being detached on the Surface Book 3. - Internal restructuring. Links: - kernel:713c0f7364
- SAM:08bbb7272a
This commit is contained in:
parent
5507e69098
commit
df00235d1d
|
@ -6,15 +6,14 @@ CONFIG_SURFACE_SAM=m
|
||||||
CONFIG_SURFACE_SAM_SSH=m
|
CONFIG_SURFACE_SAM_SSH=m
|
||||||
CONFIG_SURFACE_SAM_SSH_ERROR_INJECTION=n
|
CONFIG_SURFACE_SAM_SSH_ERROR_INJECTION=n
|
||||||
CONFIG_SURFACE_SAM_DEBUGFS=m
|
CONFIG_SURFACE_SAM_DEBUGFS=m
|
||||||
|
CONFIG_SURFACE_SAM_DEVICE_HUB=m
|
||||||
CONFIG_SURFACE_SAM_SAN=m
|
CONFIG_SURFACE_SAM_SAN=m
|
||||||
CONFIG_SURFACE_SAM_VHF=m
|
CONFIG_SURFACE_SAM_KBD=m
|
||||||
CONFIG_SURFACE_SAM_DTX=m
|
CONFIG_SURFACE_SAM_DTX=m
|
||||||
CONFIG_SURFACE_SAM_HPS=m
|
CONFIG_SURFACE_SAM_HPS=m
|
||||||
CONFIG_SURFACE_SAM_SID=m
|
CONFIG_SURFACE_SAM_PERFMODE=m
|
||||||
CONFIG_SURFACE_SAM_SID_GPELID=m
|
CONFIG_SURFACE_SAM_HID=m
|
||||||
CONFIG_SURFACE_SAM_SID_PERFMODE=m
|
CONFIG_SURFACE_SAM_PSY=m
|
||||||
CONFIG_SURFACE_SAM_SID_VHF=m
|
|
||||||
CONFIG_SURFACE_SAM_SID_POWER=m
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# IPTS touchscreen
|
# IPTS touchscreen
|
||||||
|
@ -28,3 +27,4 @@ CONFIG_INPUT_SOC_BUTTON_ARRAY=m
|
||||||
CONFIG_SURFACE_3_BUTTON=m
|
CONFIG_SURFACE_3_BUTTON=m
|
||||||
CONFIG_SURFACE_3_POWER_OPREGION=m
|
CONFIG_SURFACE_3_POWER_OPREGION=m
|
||||||
CONFIG_SURFACE_PRO3_BUTTON=m
|
CONFIG_SURFACE_PRO3_BUTTON=m
|
||||||
|
CONFIG_SURFACE_GPE=m
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
From 14170de6d5e067c52508fbd1964b586154611f8d Mon Sep 17 00:00:00 2001
|
From e269396b1bc4a908773a17c7388799a6f6195f17 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/6] surface3-power
|
Subject: [PATCH 1/7] surface3-power
|
||||||
|
|
||||||
---
|
---
|
||||||
drivers/platform/x86/Kconfig | 7 +
|
drivers/platform/x86/Kconfig | 7 +
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
From 13678467f26a34ff4a23c0581233d894a05e65b5 Mon Sep 17 00:00:00 2001
|
From 507791c5b0ac5154d355ae427f6e10fd556dad09 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/6] surface3-oemb
|
Subject: [PATCH 2/7] surface3-oemb
|
||||||
|
|
||||||
---
|
---
|
||||||
drivers/platform/x86/surface3-wmi.c | 7 +++++++
|
drivers/platform/x86/surface3-wmi.c | 7 +++++++
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
From de6c10d7cb76f7303b91fafe33572b0fdb705395 Mon Sep 17 00:00:00 2001
|
From 7b819c4959f97547a78bc9edabd8d050766960a4 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 5/6] wifi
|
Subject: [PATCH 3/7] wifi
|
||||||
|
|
||||||
---
|
---
|
||||||
.../net/wireless/marvell/mwifiex/cfg80211.c | 26 ++++++
|
.../net/wireless/marvell/mwifiex/cfg80211.c | 26 ++++++
|
|
@ -1,7 +1,7 @@
|
||||||
From eed561223bfe2cd6ff92e65ba89211a4bad92517 Mon Sep 17 00:00:00 2001
|
From da23c8318d6c30907a1e97b17bf659aa524b86a6 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 6/6] ipts
|
Subject: [PATCH 4/7] ipts
|
||||||
|
|
||||||
---
|
---
|
||||||
drivers/input/touchscreen/Kconfig | 2 +
|
drivers/input/touchscreen/Kconfig | 2 +
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
From e0785bb83ac72633ffed972f49e580a38a2eab2f Mon Sep 17 00:00:00 2001
|
From 11e72af9f067e83da940140fe0df8ab5d2e489e6 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 4/6] surface-sam-over-hid
|
Subject: [PATCH 6/7] surface-sam-over-hid
|
||||||
|
|
||||||
---
|
---
|
||||||
drivers/i2c/i2c-core-acpi.c | 35 +++++++++++++++++++++++++++++++++++
|
drivers/i2c/i2c-core-acpi.c | 35 +++++++++++++++++++++++++++++++++++
|
355
patches/5.4/0007-surface-gpe.patch
Normal file
355
patches/5.4/0007-surface-gpe.patch
Normal file
|
@ -0,0 +1,355 @@
|
||||||
|
From 5244bafd498d4a7e8be9d994bf8a476ccd5968c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
|
Date: Sun, 16 Aug 2020 23:39:56 +0200
|
||||||
|
Subject: [PATCH 7/7] surface-gpe
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/platform/x86/Kconfig | 9 +
|
||||||
|
drivers/platform/x86/Makefile | 1 +
|
||||||
|
drivers/platform/x86/surface_gpe.c | 302 +++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 312 insertions(+)
|
||||||
|
create mode 100644 drivers/platform/x86/surface_gpe.c
|
||||||
|
|
||||||
|
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
|
||||||
|
index 348c795019fa4..105a238328a2c 100644
|
||||||
|
--- a/drivers/platform/x86/Kconfig
|
||||||
|
+++ b/drivers/platform/x86/Kconfig
|
||||||
|
@@ -1216,6 +1216,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"
|
||||||
|
+ depends on ACPI
|
||||||
|
+ help
|
||||||
|
+ This driver marks the GPEs related to the ACPI lid device found on
|
||||||
|
+ Microsoft Surface devices as wakeup sources and prepares them
|
||||||
|
+ accordingly. It is required on those devices to allow wake-ups from
|
||||||
|
+ suspend by opening the lid.
|
||||||
|
+
|
||||||
|
config INTEL_PUNIT_IPC
|
||||||
|
tristate "Intel P-Unit IPC Driver"
|
||||||
|
---help---
|
||||||
|
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
|
||||||
|
index 6dd955ad9bf18..5db303f43bda7 100644
|
||||||
|
--- a/drivers/platform/x86/Makefile
|
||||||
|
+++ b/drivers/platform/x86/Makefile
|
||||||
|
@@ -86,6 +86,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_GPE) += surface_gpe.o
|
||||||
|
obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o
|
||||||
|
obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU) += intel_bxtwc_tmu.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
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000..3031a94cddeb7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/platform/x86/surface_gpe.c
|
||||||
|
@@ -0,0 +1,302 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
+/*
|
||||||
|
+ * Surface GPE/Lid driver to enable wakeup from suspend via the lid by
|
||||||
|
+ * properly configuring the respective GPEs.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/acpi.h>
|
||||||
|
+#include <linux/dmi.h>
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/platform_device.h>
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+struct surface_lid_device {
|
||||||
|
+ u32 gpe_number;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct surface_lid_device lid_device_l17 = {
|
||||||
|
+ .gpe_number = 0x17,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct surface_lid_device lid_device_l4D = {
|
||||||
|
+ .gpe_number = 0x4D,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct surface_lid_device lid_device_l4F = {
|
||||||
|
+ .gpe_number = 0x4F,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct surface_lid_device lid_device_l57 = {
|
||||||
|
+ .gpe_number = 0x57,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+// Note: When changing this don't forget to change the MODULE_ALIAS below.
|
||||||
|
+static const struct dmi_system_id dmi_lid_device_table[] = {
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 4",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 4"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l17,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 5",
|
||||||
|
+ .matches = {
|
||||||
|
+ /*
|
||||||
|
+ * We match for SKU here due to generic product name
|
||||||
|
+ * "Surface Pro".
|
||||||
|
+ */
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Pro_1796"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l4F,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 5 (LTE)",
|
||||||
|
+ .matches = {
|
||||||
|
+ /*
|
||||||
|
+ * We match for SKU here due to generic product name
|
||||||
|
+ * "Surface Pro"
|
||||||
|
+ */
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Pro_1807"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l4F,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 6",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 6"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l4F,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 7",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 7"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l4D,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Book 1",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l17,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Book 2",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book 2"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l17,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Book 3",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book 3"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l4D,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Laptop 1",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l57,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Laptop 2",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop 2"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l57,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Laptop 3 (Intel 13\")",
|
||||||
|
+ .matches = {
|
||||||
|
+ /*
|
||||||
|
+ * We match for SKU here due to different vairants: The
|
||||||
|
+ * AMD (15") version does not rely on GPEs.
|
||||||
|
+ */
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Laptop_3_1867:1868"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&lid_device_l4D,
|
||||||
|
+ },
|
||||||
|
+ { }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int surface_lid_enable_wakeup(struct device *dev,
|
||||||
|
+ const struct surface_lid_device *lid,
|
||||||
|
+ bool enable)
|
||||||
|
+{
|
||||||
|
+ int action = enable ? ACPI_GPE_ENABLE : ACPI_GPE_DISABLE;
|
||||||
|
+ acpi_status status;
|
||||||
|
+
|
||||||
|
+ 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);
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int surface_gpe_suspend(struct device *dev)
|
||||||
|
+{
|
||||||
|
+ const struct surface_lid_device *lid;
|
||||||
|
+
|
||||||
|
+ lid = dev_get_platdata(dev);
|
||||||
|
+ return surface_lid_enable_wakeup(dev, lid, true);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int surface_gpe_resume(struct device *dev)
|
||||||
|
+{
|
||||||
|
+ const struct surface_lid_device *lid;
|
||||||
|
+
|
||||||
|
+ lid = dev_get_platdata(dev);
|
||||||
|
+ return surface_lid_enable_wakeup(dev, lid, false);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static SIMPLE_DEV_PM_OPS(surface_gpe_pm, surface_gpe_suspend, surface_gpe_resume);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int surface_gpe_probe(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ const struct surface_lid_device *lid;
|
||||||
|
+ int status;
|
||||||
|
+
|
||||||
|
+ lid = dev_get_platdata(&pdev->dev);
|
||||||
|
+ if (!lid)
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
+ status = acpi_mark_gpe_for_wake(NULL, lid->gpe_number);
|
||||||
|
+ if (status) {
|
||||||
|
+ dev_err(&pdev->dev, "failed to mark GPE for wake: %d\n", status);
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ status = acpi_enable_gpe(NULL, lid->gpe_number);
|
||||||
|
+ if (status) {
|
||||||
|
+ dev_err(&pdev->dev, "failed to enable GPE: %d\n", status);
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ status = surface_lid_enable_wakeup(&pdev->dev, lid, false);
|
||||||
|
+ if (status) {
|
||||||
|
+ acpi_disable_gpe(NULL, lid->gpe_number);
|
||||||
|
+ return status;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int surface_gpe_remove(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct surface_lid_device *lid = dev_get_platdata(&pdev->dev);
|
||||||
|
+
|
||||||
|
+ /* restore default behavior without this module */
|
||||||
|
+ surface_lid_enable_wakeup(&pdev->dev, lid, false);
|
||||||
|
+ acpi_disable_gpe(NULL, lid->gpe_number);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static struct platform_driver surface_gpe_driver = {
|
||||||
|
+ .probe = surface_gpe_probe,
|
||||||
|
+ .remove = surface_gpe_remove,
|
||||||
|
+ .driver = {
|
||||||
|
+ .name = "surface_gpe",
|
||||||
|
+ .pm = &surface_gpe_pm,
|
||||||
|
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static struct platform_device *surface_gpe_device;
|
||||||
|
+
|
||||||
|
+static int __init surface_gpe_init(void)
|
||||||
|
+{
|
||||||
|
+ const struct dmi_system_id *match;
|
||||||
|
+ const struct surface_lid_device *lid;
|
||||||
|
+
|
||||||
|
+ struct platform_device *pdev;
|
||||||
|
+ int status;
|
||||||
|
+
|
||||||
|
+ surface_gpe_device = NULL;
|
||||||
|
+
|
||||||
|
+ match = dmi_first_match(dmi_lid_device_table);
|
||||||
|
+ if (!match) {
|
||||||
|
+ pr_info(KBUILD_MODNAME": no device detected, exiting\n");
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ lid = match->driver_data;
|
||||||
|
+
|
||||||
|
+ status = platform_driver_register(&surface_gpe_driver);
|
||||||
|
+ if (status)
|
||||||
|
+ return status;
|
||||||
|
+
|
||||||
|
+ pdev = platform_device_alloc("surface_gpe", PLATFORM_DEVID_NONE);
|
||||||
|
+ if (!pdev) {
|
||||||
|
+ platform_driver_unregister(&surface_gpe_driver);
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ status = platform_device_add_data(pdev, lid, sizeof(*lid));
|
||||||
|
+ if (status) {
|
||||||
|
+ platform_device_put(pdev);
|
||||||
|
+ platform_driver_unregister(&surface_gpe_driver);
|
||||||
|
+ return status;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ status = platform_device_add(pdev);
|
||||||
|
+ if (status) {
|
||||||
|
+ platform_device_put(pdev);
|
||||||
|
+ platform_driver_unregister(&surface_gpe_driver);
|
||||||
|
+ return status;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ surface_gpe_device = pdev;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void __exit surface_gpe_exit(void)
|
||||||
|
+{
|
||||||
|
+ if (!surface_gpe_device)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ platform_device_unregister(surface_gpe_device);
|
||||||
|
+ platform_driver_unregister(&surface_gpe_driver);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+module_init(surface_gpe_init);
|
||||||
|
+module_exit(surface_gpe_exit);
|
||||||
|
+
|
||||||
|
+MODULE_AUTHOR("Maximilian Luz <luzmaximilian@gmail.com>");
|
||||||
|
+MODULE_DESCRIPTION("Surface GPE/Lid Driver");
|
||||||
|
+MODULE_LICENSE("GPL");
|
||||||
|
+
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfacePro:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfacePro4:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfacePro6:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfacePro7:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceBook:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceBook2:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceBook3:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceLaptop:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceLaptop2:*");
|
||||||
|
+MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceLaptop3:*");
|
||||||
|
--
|
||||||
|
2.28.0
|
||||||
|
|
Loading…
Reference in a new issue