Update v5.8 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: 233bcf2785
- SAM: 08bbb7272a
This commit is contained in:
Maximilian Luz 2020-08-18 06:08:22 +02:00
parent 4b1be0cff3
commit 402c979bcd
No known key found for this signature in database
GPG key ID: 70EC0937F6C26F02
17 changed files with 6892 additions and 5488 deletions

View file

@ -6,15 +6,14 @@ 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_VHF=m
CONFIG_SURFACE_SAM_KBD=m
CONFIG_SURFACE_SAM_DTX=m
CONFIG_SURFACE_SAM_HPS=m
CONFIG_SURFACE_SAM_SID=m
CONFIG_SURFACE_SAM_SID_GPELID=m
CONFIG_SURFACE_SAM_SID_PERFMODE=m
CONFIG_SURFACE_SAM_SID_VHF=m
CONFIG_SURFACE_SAM_SID_POWER=m
CONFIG_SURFACE_SAM_PERFMODE=m
CONFIG_SURFACE_SAM_HID=m
CONFIG_SURFACE_SAM_PSY=m
#
@ -32,3 +31,4 @@ CONFIG_INPUT_SOC_BUTTON_ARRAY=m
CONFIG_SURFACE_3_BUTTON=m
CONFIG_SURFACE_3_POWER_OPREGION=m
CONFIG_SURFACE_PRO3_BUTTON=m
CONFIG_SURFACE_GPE=m

View file

@ -1,7 +1,7 @@
From 0ea332f8971bbe537bbc43bb76ef790981ce001d Mon Sep 17 00:00:00 2001
From 2c4a9a758701d9535cfea70f9047be8b2502fbeb 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/5] surface3-oemb
Subject: [PATCH 1/6] surface3-oemb
---
drivers/platform/x86/surface3-wmi.c | 7 +++++++
@ -10,7 +10,7 @@ Subject: [PATCH 1/5] surface3-oemb
3 files changed, 24 insertions(+)
diff --git a/drivers/platform/x86/surface3-wmi.c b/drivers/platform/x86/surface3-wmi.c
index 130b6f52a600..801083aa56d6 100644
index 130b6f52a6001..801083aa56d6d 100644
--- a/drivers/platform/x86/surface3-wmi.c
+++ b/drivers/platform/x86/surface3-wmi.c
@@ -37,6 +37,13 @@ static const struct dmi_system_id surface3_dmi_table[] = {
@ -28,7 +28,7 @@ index 130b6f52a600..801083aa56d6 100644
{ }
};
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index e2e1d5b03b38..5ff38592ba6d 100644
index e2e1d5b03b381..5ff38592ba6db 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3687,6 +3687,15 @@ static const struct dmi_system_id dmi_platform_data[] = {
@ -48,7 +48,7 @@ index e2e1d5b03b38..5ff38592ba6d 100644
/*
* Match for the GPDwin which unfortunately uses somewhat
diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
index 2752dc955733..ef36a316e2ed 100644
index 2752dc9557334..ef36a316e2ed6 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
@@ -27,6 +27,14 @@ static const struct dmi_system_id cht_table[] = {
@ -67,5 +67,5 @@ index 2752dc955733..ef36a316e2ed 100644
};
--
2.26.2
2.28.0

View file

@ -1,7 +1,7 @@
From e20265c4b4f99cc46dfb5e481dff4a2be2ed3fd5 Mon Sep 17 00:00:00 2001
From 076007872b31698668c84bafaaf6fd50615b2a3c Mon Sep 17 00:00:00 2001
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
Date: Thu, 20 Feb 2020 16:51:11 +0900
Subject: [PATCH 4/5] wifi
Subject: [PATCH 2/6] wifi
---
.../net/wireless/marvell/mwifiex/cfg80211.c | 26 ++++++
@ -10,7 +10,7 @@ Subject: [PATCH 4/5] wifi
3 files changed, 84 insertions(+), 57 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 4e4f59c17ded..528eedfbf41c 100644
index 4e4f59c17ded3..528eedfbf41c9 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -25,6 +25,11 @@
@ -54,7 +54,7 @@ index 4e4f59c17ded..528eedfbf41c 100644
}
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 87b4ccca4b9a..3bdad5e80ecb 100644
index 87b4ccca4b9a2..3bdad5e80ecbb 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -146,38 +146,45 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
@ -188,7 +188,7 @@ index 87b4ccca4b9a..3bdad5e80ecb 100644
pdev->vendor, pdev->device, pdev->revision);
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index 8bd355d7974e..256c8c38deee 100644
index 8bd355d7974e9..256c8c38deee3 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -2247,7 +2247,6 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
@ -251,5 +251,5 @@ index 8bd355d7974e..256c8c38deee 100644
if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
/* Send cmd to FW to enable/disable 11D function */
--
2.26.2
2.28.0

View file

@ -1,7 +1,7 @@
From 07c20de9e6a02450959a26c17210380b0ea8ff16 Mon Sep 17 00:00:00 2001
From af4c75c92212afdc79d068e5d63b779bda70b49c Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Thu, 30 Jul 2020 13:21:53 +0200
Subject: [PATCH 5/5] ipts
Subject: [PATCH 3/6] ipts
---
drivers/misc/Kconfig | 1 +
@ -37,7 +37,7 @@ Subject: [PATCH 5/5] ipts
create mode 100644 drivers/misc/ipts/uapi.h
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index e1b1ba5e2b92..be901ffc66fe 100644
index e1b1ba5e2b925..be901ffc66fee 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -472,4 +472,5 @@ source "drivers/misc/ocxl/Kconfig"
@ -47,7 +47,7 @@ index e1b1ba5e2b92..be901ffc66fe 100644
+source "drivers/misc/ipts/Kconfig"
endmenu
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c7bd01ac6291..f97938d777e1 100644
index c7bd01ac62917..f97938d777e13 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -57,3 +57,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o
@ -57,7 +57,7 @@ index c7bd01ac6291..f97938d777e1 100644
+obj-$(CONFIG_MISC_IPTS) += ipts/
diff --git a/drivers/misc/ipts/Kconfig b/drivers/misc/ipts/Kconfig
new file mode 100644
index 000000000000..7dce12245a4f
index 0000000000000..7dce12245a4f1
--- /dev/null
+++ b/drivers/misc/ipts/Kconfig
@@ -0,0 +1,13 @@
@ -76,7 +76,7 @@ index 000000000000..7dce12245a4f
+ module will be called ipts.
diff --git a/drivers/misc/ipts/Makefile b/drivers/misc/ipts/Makefile
new file mode 100644
index 000000000000..a7232badd8b8
index 0000000000000..a7232badd8b89
--- /dev/null
+++ b/drivers/misc/ipts/Makefile
@@ -0,0 +1,11 @@
@ -93,7 +93,7 @@ index 000000000000..a7232badd8b8
+ipts-objs += uapi.o
diff --git a/drivers/misc/ipts/context.h b/drivers/misc/ipts/context.h
new file mode 100644
index 000000000000..d24fd6ac026b
index 0000000000000..d24fd6ac026b9
--- /dev/null
+++ b/drivers/misc/ipts/context.h
@@ -0,0 +1,125 @@
@ -224,7 +224,7 @@ index 000000000000..d24fd6ac026b
+#endif /* _IPTS_CONTEXT_H_ */
diff --git a/drivers/misc/ipts/control.c b/drivers/misc/ipts/control.c
new file mode 100644
index 000000000000..857bcf498752
index 0000000000000..857bcf4987525
--- /dev/null
+++ b/drivers/misc/ipts/control.c
@@ -0,0 +1,63 @@
@ -293,7 +293,7 @@ index 000000000000..857bcf498752
+}
diff --git a/drivers/misc/ipts/control.h b/drivers/misc/ipts/control.h
new file mode 100644
index 000000000000..718cde10dd2c
index 0000000000000..718cde10dd2cd
--- /dev/null
+++ b/drivers/misc/ipts/control.h
@@ -0,0 +1,17 @@
@ -316,7 +316,7 @@ index 000000000000..718cde10dd2c
+#endif /* _IPTS_CONTROL_H_ */
diff --git a/drivers/misc/ipts/init.c b/drivers/misc/ipts/init.c
new file mode 100644
index 000000000000..c2f237feed11
index 0000000000000..c2f237feed11e
--- /dev/null
+++ b/drivers/misc/ipts/init.c
@@ -0,0 +1,87 @@
@ -409,7 +409,7 @@ index 000000000000..c2f237feed11
+MODULE_LICENSE("GPL");
diff --git a/drivers/misc/ipts/protocol.h b/drivers/misc/ipts/protocol.h
new file mode 100644
index 000000000000..c8b412899ec4
index 0000000000000..c8b412899ec4d
--- /dev/null
+++ b/drivers/misc/ipts/protocol.h
@@ -0,0 +1,236 @@
@ -651,7 +651,7 @@ index 000000000000..c8b412899ec4
+#endif /* _IPTS_PROTOCOL_H_ */
diff --git a/drivers/misc/ipts/receiver.c b/drivers/misc/ipts/receiver.c
new file mode 100644
index 000000000000..bf78b64249a5
index 0000000000000..bf78b64249a5b
--- /dev/null
+++ b/drivers/misc/ipts/receiver.c
@@ -0,0 +1,202 @@
@ -859,7 +859,7 @@ index 000000000000..bf78b64249a5
+}
diff --git a/drivers/misc/ipts/receiver.h b/drivers/misc/ipts/receiver.h
new file mode 100644
index 000000000000..d7939ddbaae9
index 0000000000000..d7939ddbaae95
--- /dev/null
+++ b/drivers/misc/ipts/receiver.h
@@ -0,0 +1,10 @@
@ -875,7 +875,7 @@ index 000000000000..d7939ddbaae9
+#endif /* _IPTS_RECEIVER_H_ */
diff --git a/drivers/misc/ipts/resources.c b/drivers/misc/ipts/resources.c
new file mode 100644
index 000000000000..9f2b60bb7a70
index 0000000000000..9f2b60bb7a70e
--- /dev/null
+++ b/drivers/misc/ipts/resources.c
@@ -0,0 +1,133 @@
@ -1014,7 +1014,7 @@ index 000000000000..9f2b60bb7a70
+}
diff --git a/drivers/misc/ipts/resources.h b/drivers/misc/ipts/resources.h
new file mode 100644
index 000000000000..cf9807b0dbe6
index 0000000000000..cf9807b0dbe62
--- /dev/null
+++ b/drivers/misc/ipts/resources.h
@@ -0,0 +1,11 @@
@ -1031,7 +1031,7 @@ index 000000000000..cf9807b0dbe6
+#endif /* _IPTS_RESOURCES_H_ */
diff --git a/drivers/misc/ipts/uapi.c b/drivers/misc/ipts/uapi.c
new file mode 100644
index 000000000000..f6f7b2cabd83
index 0000000000000..f6f7b2cabd836
--- /dev/null
+++ b/drivers/misc/ipts/uapi.c
@@ -0,0 +1,297 @@
@ -1334,7 +1334,7 @@ index 000000000000..f6f7b2cabd83
+}
diff --git a/drivers/misc/ipts/uapi.h b/drivers/misc/ipts/uapi.h
new file mode 100644
index 000000000000..7d7eabc74b17
index 0000000000000..7d7eabc74b17d
--- /dev/null
+++ b/drivers/misc/ipts/uapi.h
@@ -0,0 +1,11 @@
@ -1350,7 +1350,7 @@ index 000000000000..7d7eabc74b17
+
+#endif /* _IPTS_UAPI_H_ */
diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
index 7becfc768bbc..0824ef27b08b 100644
index 7becfc768bbcc..0824ef27b08bb 100644
--- a/drivers/misc/mei/hw-me-regs.h
+++ b/drivers/misc/mei/hw-me-regs.h
@@ -59,6 +59,7 @@
@ -1378,7 +1378,7 @@ index 7becfc768bbc..0824ef27b08b 100644
#define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 2a3f2fd5df50..319158fd4393 100644
index 2a3f2fd5df507..319158fd43930 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -68,6 +68,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
@ -1406,5 +1406,5 @@ index 2a3f2fd5df50..319158fd4393 100644
{MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)},
{MEI_PCI_DEVICE(MEI_DEV_ID_TGP_H, MEI_ME_PCH15_SPS_CFG)},
--
2.26.2
2.28.0

View file

@ -1,14 +1,14 @@
From 4d82adb6c864e715ea5236dd0a8c971cf63e2dc1 Mon Sep 17 00:00:00 2001
From eae6ff101dcc0ee68ee9d891553bf557ca54b59e Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH 3/5] surface-sam-over-hid
Subject: [PATCH 5/6] surface-sam-over-hid
---
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
index 2ade99b105b91..60b9cb51d5f7e 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -574,6 +574,28 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
@ -61,5 +61,5 @@ index 2ade99b105b9..60b9cb51d5f7 100644
dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
accessor_type, client->addr);
--
2.26.2
2.28.0

View file

@ -0,0 +1,355 @@
From 85d1a32faced9338b1c0d3cc0ead2655bcf1ad00 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/6] 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 0581a54cf562f..2d0b403842396 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -879,6 +879,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"
+ 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 MSI_LAPTOP
tristate "MSI Laptop Extras"
depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 2b85852a1a872..a64ce216719ab 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
obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
+obj-$(CONFIG_SURFACE_GPE) += surface_gpe.o
# MSI
obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.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

View file

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

View file

@ -0,0 +1 @@
../../../patches/5.8/0002-wifi.patch

View file

@ -0,0 +1 @@
../../../patches/5.8/0003-ipts.patch

View file

@ -1 +0,0 @@
../../../patches/5.8/0003-surface-sam-over-hid.patch

View file

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

View file

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

View file

@ -1 +0,0 @@
../../../patches/5.8/0005-ipts.patch

View file

@ -0,0 +1 @@
../../../patches/5.8/0005-surface-sam-over-hid.patch

View file

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

View file

@ -24,11 +24,13 @@ source=(
surface.config # surface specific options
arch.config # config changes for linux-surface kernel
0001-surface3-oemb.patch
0002-surface-sam.patch
0003-surface-sam-over-hid.patch
0004-wifi.patch
0005-ipts.patch
0001-Add-secureboot-pre-signing-to-the-kernel.patch
0002-surface3-oemb.patch
0003-wifi.patch
0004-ipts.patch
0005-surface-sam.patch
0006-surface-sam-over-hid.patch
0007-surface-gpe.patch
)
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
@ -37,13 +39,15 @@ validpgpkeys=(
)
sha256sums=('1d5d8a6aaa24b1187bdc81f79a0e4b7125c0cb67313a6f9e6f737fea99c82869'
'457d5c9717048cd5334ba3d14dfb37699ac1d2c6dc2fd1df93adb487d6921f2f'
'd2bcd371871d630773c38b40d3c076a7aadbf678e158d1408f43529ab18979aa'
'28d8988615b71b80710cec7d110ad31d078bfd3cb61852c381ab8b6d8bc870b0'
'8dbaa21d2c03621b0c5d96c4fbcc7a839bea5a34a5f2279a409c3b404756e753'
'9102adc1c9738fac08798b807cf82cfbb2a119e9f16cf8a4b9e4fcba71910230'
'bed5eb54856cd413f998fce2e66f797eb2c49cdb3e1b8266848a3f1da169d6d5'
'27f5fe98a19bfd5f3ab2f488491999ae274e7ff846f09b8cfd08b466d2ac4287'
'87d7aee1021582b452476a49b067a4b4776559ffd311c6f2f796d11e048a93e8'
'fb61b61218fb3577800ce948b361ff3c2df4665106a7b73ec79e656135c470b0')
'26d70ece10841a17cb1e84bc6a0f2a9891bbfc5f4575f964447596ef9a5246d8'
'fdca110f7f55e5fe32d3996d45430d97d6eec9fd1f2e9f8ec9ae2dedf023a56d'
'139c3b371a7c09ec8b3e8a930d38352b0dabe5fb960a363f3a04024843c751c9'
'c8efcfc205b563a17100cde52db713852d1974a2e4ad0e394e03b2190b106d86'
'090ae19e5a12f66de0805d799ba1798a7c9a47944e30302b3f6e9faa20203e7f'
'232a6d8131c40e3987f4f028fc4689000c76b67142bf658719e03e0f134cd2df'
'd0f31f536d496052fe4d470f19d0010a5773ceef95ff1b7a3cefcc3202ef78d1')
export KBUILD_BUILD_HOST=archlinux