瀏覽代碼

Update v4.19 patches

Changes:
 - SAM:
   - Move and split drivers to closer reflect upstreaming process
   - Various updates to HID and battery/AC drivers for upstreaming

 - Hotplug:
   - various fixes and improvements

 - GPE:
   - Fix Kconfig dependency

Links:
 - kernel: https://github.com/linux-surface/kernel/commit/e9b2f6699c7f4d74fe742a95526bcb6f706bf495
 - SAM: https://github.com/linux-surface/surface-aggregator-module/commit/bee2add45fb668a794406ce6a648cece4fd00d51
 - GPE: https://github.com/linux-surface/surface-gpe/commit/6ecfdb39050129bf17e5f1fff784e4df7aa56171
 - Hotplug: https://github.com/linux-surface/surface-hotplug/commit/595ed62f24417b2ac97f4658cfc30776c9b888cf
Maximilian Luz 4 年之前
父節點
當前提交
6a597d784b

+ 7 - 2
configs/surface-4.19.config

@@ -12,12 +12,17 @@ CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION=n
 CONFIG_SURFACE_AGGREGATOR_BUS=y
 CONFIG_SURFACE_AGGREGATOR_CDEV=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_PERFMODE=m
 
+CONFIG_SURFACE_HID=m
+CONFIG_SURFACE_KBD=m
+
+CONFIG_BATTERY_SURFACE=m
+CONFIG_CHARGER_SURFACE=m
+
 #
 # Surface Hotplug
 #

+ 2 - 2
patches/4.19/0001-surface3-power.patch

@@ -1,4 +1,4 @@
-From 30eab94cb03ffd0b3746c86f7799e7c7878ae751 Mon Sep 17 00:00:00 2001
+From 3d7a77fbd3349349026a139375bb35470e51da00 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 18:00:43 +0200
 Subject: [PATCH] platform/x86: Surface 3 battery platform operation region
@@ -653,5 +653,5 @@ index 000000000000..e0af01a60302
 +MODULE_DESCRIPTION("mshw0011 driver");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.30.0
+2.30.1
 

+ 2 - 2
patches/4.19/0002-surface3-touchscreen-dma-fix.patch

@@ -1,4 +1,4 @@
-From 51fff19063114133a8ed4a56c317037c640f5be6 Mon Sep 17 00:00:00 2001
+From ffe11e024a21c0dd64f0caf08319cec04269a491 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] dmaengine: dw: Initialize channel before each transfer
@@ -85,5 +85,5 @@ index 055d83b6cb68..acf64302a2b2 100644
  	channel_clear_bit(dw, MASK.XFER, dwc->mask);
  	channel_clear_bit(dw, MASK.BLOCK, dwc->mask);
 -- 
-2.30.0
+2.30.1
 

+ 2 - 2
patches/4.19/0003-surface3-oemb.patch

@@ -1,4 +1,4 @@
-From be8dd019e9f17e5a9018f03db85b13be6e9d8212 Mon Sep 17 00:00:00 2001
+From 9ca09b99db77fccfdd392c08f9f1462d8896c34f 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
@@ -97,5 +97,5 @@ index 91bb99b69601..8418938b32ad 100644
  };
  
 -- 
-2.30.0
+2.30.1
 

+ 8 - 8
patches/4.19/0004-surface-buttons.patch

@@ -1,4 +1,4 @@
-From 1d63613b6e3f4ca13d96c5fa375bd9c270fc0f2f Mon Sep 17 00:00:00 2001
+From 011f33fea3a1b60fdb13c334ca8c0baf5505c1ae Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 27 Jul 2019 17:51:37 +0200
 Subject: [PATCH] platform/x86: surfacepro3_button: Fix device check
@@ -90,9 +90,9 @@ index 1b491690ce07..96627627060e 100644
  	if (!button)
  		return -ENOMEM;
 -- 
-2.30.0
+2.30.1
 
-From cdd3030d3cdee20d9477c6522a56f0dc875b42ee Mon Sep 17 00:00:00 2001
+From aa63337834f47d68cc3afc1228b73bc0d58ef47b 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
@@ -295,9 +295,9 @@ index 55cd6e0b409c..8f21c062c85d 100644
  };
  
 -- 
-2.30.0
+2.30.1
 
-From c19c5a278f22965fedac76a926407b0ed034ccff Mon Sep 17 00:00:00 2001
+From 1de03bf787e9f9c5366302935696fa9761e46597 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
@@ -384,9 +384,9 @@ index 8f21c062c85d..5983733d78dd 100644
  		}
  
 -- 
-2.30.0
+2.30.1
 
-From 8d02c182a7416657ac7cd3a11a3125570b594cd9 Mon Sep 17 00:00:00 2001
+From aacb92ea862804c86f994811c2de36dc3ae0babf 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
@@ -436,5 +436,5 @@ index 5983733d78dd..c564ea99f47d 100644
  	return 0;
  }
 -- 
-2.30.0
+2.30.1
 

+ 4 - 4
patches/4.19/0005-suspend.patch

@@ -1,4 +1,4 @@
-From 07c7027154d488b008f76ca6ecba7e05cb309387 Mon Sep 17 00:00:00 2001
+From 4a62fe80d0210cf2b7753173670119fcab6994e6 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] nvme: Backport changes for suspend
@@ -122,7 +122,7 @@ index 9c2e7a151e40..8cf74e854610 100644
  void nvme_stop_keep_alive(struct nvme_ctrl *ctrl);
  int nvme_reset_ctrl(struct nvme_ctrl *ctrl);
 diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
-index a52b2f15f372..4b22f45e6e31 100644
+index 82d87d2e280c..55addeff3ce0 100644
 --- a/drivers/nvme/host/pci.c
 +++ b/drivers/nvme/host/pci.c
 @@ -26,6 +26,7 @@
@@ -271,7 +271,7 @@ index a52b2f15f372..4b22f45e6e31 100644
  
  static pci_ers_result_t nvme_error_detected(struct pci_dev *pdev,
  						pci_channel_state_t state)
-@@ -2745,9 +2840,11 @@ static struct pci_driver nvme_driver = {
+@@ -2747,9 +2842,11 @@ static struct pci_driver nvme_driver = {
  	.probe		= nvme_probe,
  	.remove		= nvme_remove,
  	.shutdown	= nvme_shutdown,
@@ -330,5 +330,5 @@ index 2fda9893962d..ec6c48ecd7d5 100644
  
  #ifdef CONFIG_PCIEAER
 -- 
-2.30.0
+2.30.1
 

+ 2 - 2
patches/4.19/0006-ipts.patch

@@ -1,4 +1,4 @@
-From 78148d031e16508b47487d916268515c28eb654e Mon Sep 17 00:00:00 2001
+From 7c62ae50bf7a3f8389cc3949b243d9214a8bb675 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 17:58:17 +0200
 Subject: [PATCH] Add support for Intel IPTS touch devices
@@ -7310,5 +7310,5 @@ index 000000000000..f229a3436851
 +
 +#endif // IPTS_H
 -- 
-2.30.0
+2.30.1
 

+ 24 - 24
patches/4.19/0007-wifi.patch

@@ -1,4 +1,4 @@
-From faf432cf6ea117bf9c7e25feaebd4efb64cd0967 Mon Sep 17 00:00:00 2001
+From 50ac84f117b2c010e2bc8dad75cc7846767ed0e5 Mon Sep 17 00:00:00 2001
 From: Chuhong Yuan <hslester96@gmail.com>
 Date: Wed, 24 Jul 2019 19:27:45 +0800
 Subject: [PATCH] mwifiex: pcie: Use dev_get_drvdata
@@ -47,9 +47,9 @@ index 991b9cc18000..2aa0436d3548 100644
  	if (!card->adapter) {
  		dev_err(dev, "adapter structure is not valid\n");
 -- 
-2.30.0
+2.30.1
 
-From 7939aa61d01657948ba1802de7496e4dc9209860 Mon Sep 17 00:00:00 2001
+From 05c1903c69f4fa30129cc36074596d0435b698d7 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Thu, 24 Sep 2020 18:02:06 +0900
 Subject: [PATCH] mwifiex: pcie: skip cancel_work_sync() on reset failure path
@@ -204,9 +204,9 @@ index f7ce9b6db6b4..72d0c01ff359 100644
  
  static inline int
 -- 
-2.30.0
+2.30.1
 
-From c8ddca25de458eef013c4eea1902cb5997fc4be3 Mon Sep 17 00:00:00 2001
+From baf1a7444af8a4f86065206a02b8660d6632ae95 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Mon, 28 Sep 2020 17:46:49 +0900
 Subject: [PATCH] mwifiex: pcie: add DMI-based quirk impl for Surface devices
@@ -412,9 +412,9 @@ index 000000000000..5326ae7e5671
 +
 +void mwifiex_initialize_quirks(struct pcie_service_card *card);
 -- 
-2.30.0
+2.30.1
 
-From 09de9741d492fdcd2179c2e5bab633994dcd0cdf Mon Sep 17 00:00:00 2001
+From 7ebe043beb09663c275d965b3235c0c5c70911b0 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Tue, 29 Sep 2020 17:25:22 +0900
 Subject: [PATCH] mwifiex: pcie: add reset_d3cold quirk for Surface gen4+
@@ -613,9 +613,9 @@ index 5326ae7e5671..8b9dcb5070d8 100644
  void mwifiex_initialize_quirks(struct pcie_service_card *card);
 +int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
 -- 
-2.30.0
+2.30.1
 
-From ef14b99712d098811a158e96301ca12f08fe4119 Mon Sep 17 00:00:00 2001
+From 5a9728867bd36edb546e5bf06e0977e68beb1c21 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Tue, 29 Sep 2020 17:32:22 +0900
 Subject: [PATCH] mwifiex: pcie: add reset_wsid quirk for Surface 3
@@ -792,9 +792,9 @@ index 8b9dcb5070d8..3ef7440418e3 100644
  int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
 +int mwifiex_pcie_reset_wsid_quirk(struct pci_dev *pdev);
 -- 
-2.30.0
+2.30.1
 
-From 7c48ac9c9a00a66df5084d3f39027ce3eb10ac7b Mon Sep 17 00:00:00 2001
+From f1d61def7f51c70790cf8ae0b22c831281a5ca4e Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Wed, 30 Sep 2020 18:08:24 +0900
 Subject: [PATCH] mwifiex: pcie: (OEMB) add quirk for Surface 3 with broken DMI
@@ -854,9 +854,9 @@ index f0a6fa0a7ae5..34dcd84f02a6 100644
  		.ident = "Surface Pro 3",
  		.matches = {
 -- 
-2.30.0
+2.30.1
 
-From 275ef787d33f7d2bdbae87846dcf95b466c76ae5 Mon Sep 17 00:00:00 2001
+From 3ae3412828aab65681d319c8ff10a74fd1269973 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Thu, 24 Sep 2020 01:56:34 +0900
 Subject: [PATCH] mwifiex: pcie: use shutdown_sw()/reinit_sw() on
@@ -996,9 +996,9 @@ index 290427c98630..d80eb18fb0d1 100644
  	return 0;
  }
 -- 
-2.30.0
+2.30.1
 
-From 4b234d1787dda86fe087ccbdb38a31e392986a90 Mon Sep 17 00:00:00 2001
+From 8564bcba6150ba0b488cf165277e639985c74a92 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Mon, 24 Aug 2020 17:11:35 +0900
 Subject: [PATCH] mwifiex: pcie: add enable_device_dump module parameter
@@ -1045,9 +1045,9 @@ index d80eb18fb0d1..ea766584d3b7 100644
  	if (!adapter->devdump_data) {
  		mwifiex_dbg(adapter, ERROR,
 -- 
-2.30.0
+2.30.1
 
-From 942bea1df79dcf86be5ac05e233fdceec95ff275 Mon Sep 17 00:00:00 2001
+From 7c1dba1f2130f1c63bc410bde4e0dae69967f526 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Sun, 4 Oct 2020 00:11:49 +0900
 Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+
@@ -1200,9 +1200,9 @@ index 3ef7440418e3..a95ebac06e13 100644
  void mwifiex_initialize_quirks(struct pcie_service_card *card);
  int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
 -- 
-2.30.0
+2.30.1
 
-From 6baf41b41ea6572a4e1ef0d984868e8adbb5f8a0 Mon Sep 17 00:00:00 2001
+From 8d8c5d10896a18adee83c86b523c1f178a6bc3c1 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Sun, 4 Oct 2020 00:25:48 +0900
 Subject: [PATCH] mwifiex: add allow_ps_mode module parameter
@@ -1262,9 +1262,9 @@ index 650191db25cb..dd1f08a2325f 100644
  }
  
 -- 
-2.30.0
+2.30.1
 
-From 2d60a4ae1a6a376b497369a8d7940d491bfb0619 Mon Sep 17 00:00:00 2001
+From 9e5c18edcbad3af2f24a963b3be35efdd2fbb13a Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Sun, 4 Oct 2020 00:38:48 +0900
 Subject: [PATCH] mwifiex: print message when changing ps_mode
@@ -1297,9 +1297,9 @@ index dd1f08a2325f..ee88da92b97c 100644
  }
  
 -- 
-2.30.0
+2.30.1
 
-From f014d9a6dbd8b94156b27e2af3f27a2e3e2a2ede Mon Sep 17 00:00:00 2001
+From f67574e2c26cfddc57be7a6ca201571c3a559c85 Mon Sep 17 00:00:00 2001
 From: Tsuchiya Yuto <kitakar@gmail.com>
 Date: Sun, 4 Oct 2020 00:59:37 +0900
 Subject: [PATCH] mwifiex: disable ps_mode explicitly by default instead
@@ -1345,5 +1345,5 @@ index 4ed10cf82f9a..ed0fffb9eba6 100644
  
  		if (drcs) {
 -- 
-2.30.0
+2.30.1
 

+ 8 - 7
patches/4.19/0008-surface-gpe.patch

@@ -1,4 +1,4 @@
-From 7b663b34e8a2ebbe4d89107cfd06a5470c064c34 Mon Sep 17 00:00:00 2001
+From 8f9980cec7ae818cbbd96807790d326ae891f60a Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sun, 16 Aug 2020 23:39:56 +0200
 Subject: [PATCH] platform/x86: Add Driver to set up lid GPEs on MS Surface
@@ -31,23 +31,24 @@ declared via the _PRW field.
 Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
 Patchset: surface-gpe
 ---
- drivers/platform/x86/Kconfig       |   9 +
+ drivers/platform/x86/Kconfig       |  10 +
  drivers/platform/x86/Makefile      |   1 +
  drivers/platform/x86/surface_gpe.c | 313 +++++++++++++++++++++++++++++
- 3 files changed, 323 insertions(+)
+ 3 files changed, 324 insertions(+)
  create mode 100644 drivers/platform/x86/surface_gpe.c
 
 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 0d20ffdb5a67..cd2442056cec 100644
+index 0d20ffdb5a67..4321ec171bcd 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -1168,6 +1168,15 @@ config SURFACE_3_POWER_OPREGION
+@@ -1168,6 +1168,16 @@ 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"
++	tristate "Surface GPE/Lid Support Driver"
 +	depends on ACPI
++	depends on DMI
 +	help
 +	  This driver marks the GPEs related to the ACPI lid device found on
 +	  Microsoft Surface devices as wakeup sources and prepares them
@@ -389,5 +390,5 @@ index 000000000000..7eaaeacbf408
 +MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceLaptop2:*");
 +MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurfaceLaptop3:*");
 -- 
-2.30.0
+2.30.1
 

+ 6 - 6
patches/4.19/0009-surface-sam-over-hid.patch

@@ -1,4 +1,4 @@
-From aadd201e4dc578d324e59663bf587effd547147a Mon Sep 17 00:00:00 2001
+From b2c5b55fc64a20e0de8628ae3fe5be92992f0358 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 25 Jul 2020 17:19:53 +0200
 Subject: [PATCH] i2c: acpi: Implement RawBytes read access
@@ -107,9 +107,9 @@ index 8ba4122fb340..f9a24b56fec0 100644
  		dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
  			 accessor_type, client->addr);
 -- 
-2.30.0
+2.30.1
 
-From b6fd7d9754c9e3f807d623b2dbbce1a92b2bcbd8 Mon Sep 17 00:00:00 2001
+From 3fd9c5e2123299fe95888b89e48acc0951cb716a 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
@@ -132,10 +132,10 @@ Patchset: surface-sam-over-hid
  create mode 100644 drivers/platform/x86/sb1_dgpu_sw.c
 
 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index cd2442056cec..52fdf87b21f2 100644
+index 4321ec171bcd..d1d9ebaecf1c 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -1177,6 +1177,13 @@ config SURFACE_GPE
+@@ -1178,6 +1178,13 @@ config SURFACE_GPE
  	  accordingly. It is required on those devices to allow wake-ups from
  	  suspend by opening the lid.
  
@@ -330,5 +330,5 @@ index 000000000000..8c66ed5110fd
 +MODULE_DESCRIPTION("Discrete GPU Power-Switch for Surface Book 1");
 +MODULE_LICENSE("GPL");
 -- 
-2.30.0
+2.30.1
 

文件差異過大導致無法顯示
+ 11784 - 11631
patches/4.19/0010-surface-sam.patch


+ 133 - 111
patches/4.19/0011-surface-hotplug.patch

@@ -1,4 +1,4 @@
-From b63983a6536a99be8da444149232adc6a8d5e6c2 Mon Sep 17 00:00:00 2001
+From c6ec3e5b5b1a52ab00779d096c6afdf600a9c5b2 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Tue, 31 Jul 2018 07:50:37 +0200
 Subject: [PATCH] PCI: pciehp: Differentiate between surprise and safe removal
@@ -195,9 +195,9 @@ index 5c58c22e0c08..18f83e554c73 100644
  	pci_lock_rescan_remove();
  
 -- 
-2.30.0
+2.30.1
 
-From f235e14a8a90af341b58041555d2f2eedcfcf46e Mon Sep 17 00:00:00 2001
+From d1d9637d9975bf4c51055a9ce1476c86b9d17d55 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Sun, 19 Aug 2018 16:29:00 +0200
 Subject: [PATCH] PCI: pciehp: Drop unnecessary includes
@@ -334,9 +334,9 @@ index 18f83e554c73..c512b2ed85ed 100644
  #include <linux/types.h>
  #include <linux/pci.h>
 -- 
-2.30.0
+2.30.1
 
-From d2f8db35b8a57856afecb7eac3939e228ede6a38 Mon Sep 17 00:00:00 2001
+From 4e4551f354b1b225a1c8da3889c310fb42d35e59 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Sun, 19 Aug 2018 16:29:00 +0200
 Subject: [PATCH] PCI: pciehp: Drop hotplug_slot_ops wrappers
@@ -547,9 +547,9 @@ index d4b7049cbc70..576362d0b1cd 100644
  	struct pci_dev *pdev = ctrl_dev(ctrl);
  	u16 stat_mask = 0, ctrl_mask = 0;
 -- 
-2.30.0
+2.30.1
 
-From 130b0053672f79bb9afc3dbfe7ef0e93114aa176 Mon Sep 17 00:00:00 2001
+From 01074b180b2cd3e2a9a64c3f6050a94b644cbab0 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Sat, 8 Sep 2018 09:59:01 +0200
 Subject: [PATCH] PCI: pciehp: Tolerate Presence Detect hardwired to zero
@@ -745,9 +745,9 @@ index 576362d0b1cd..7f4173d6771a 100644
  			pciehp_power_off_slot(ctrl->slot);
  		}
 -- 
-2.30.0
+2.30.1
 
-From c10f22ffa0b0bb52c0bcef1b261e4e2173bd2d91 Mon Sep 17 00:00:00 2001
+From e13fc0694036cbf187b3c90892cd41bdee149f45 Mon Sep 17 00:00:00 2001
 From: Patrick Talbert <ptalbert@redhat.com>
 Date: Wed, 5 Sep 2018 09:12:53 +0200
 Subject: [PATCH] PCI/ASPM: Do not initialize link state when aspm_disabled is
@@ -790,9 +790,9 @@ index cb474338f39d..18aa830e79e4 100644
  
  	if (pdev->link_state)
 -- 
-2.30.0
+2.30.1
 
-From 5e68e471040f1e81e9374ac2da3cf2439997d1ec Mon Sep 17 00:00:00 2001
+From 6eef763e4e66b0c36b8f48c1a51ee8c59f14cb92 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Sun, 19 Aug 2018 16:29:00 +0200
 Subject: [PATCH] PCI: Simplify disconnected marking
@@ -876,9 +876,9 @@ index 2c3b5bd59b18..dee5a7507403 100644
  
  	result = reset_link(udev, service);
 -- 
-2.30.0
+2.30.1
 
-From c53dc649b8cb265ef4d409d43a1dec2aec4c4f17 Mon Sep 17 00:00:00 2001
+From a656221bf84eda4e2a4ece3e2f88d6d54234b64d Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Tue, 18 Sep 2018 21:46:17 +0200
 Subject: [PATCH] PCI: pciehp: Unify controller and slot structs
@@ -2068,9 +2068,9 @@ index 8da87931bd45..b9c1396db6fe 100644
  	ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n",
  		 __func__, pci_domain_nr(parent), parent->number);
 -- 
-2.30.0
+2.30.1
 
-From 66568278cc479142e079bbd8f42e7304e22b67a6 Mon Sep 17 00:00:00 2001
+From 561d3a071aa5e361ac3e1d5aeb591411816d8219 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Sat, 8 Sep 2018 09:59:01 +0200
 Subject: [PATCH] PCI: pciehp: Rename controller struct members for clarity
@@ -2375,9 +2375,9 @@ index 4a17d71e15d3..e4d6ec960630 100644
  }
  
 -- 
-2.30.0
+2.30.1
 
-From f2b741a4e0b8b35bdb59e993dae758f61c5088b5 Mon Sep 17 00:00:00 2001
+From 2569dde86684d3ac54af3cbcdfd61afc409d2116 Mon Sep 17 00:00:00 2001
 From: Lukas Wunner <lukas@wunner.de>
 Date: Sat, 8 Sep 2018 09:59:01 +0200
 Subject: [PATCH] PCI: pciehp: Reshuffle controller struct for clarity
@@ -2506,9 +2506,9 @@ index 2499489158cc..df82a0335515 100644
  	int request_result;
  	wait_queue_head_t requester;
 -- 
-2.30.0
+2.30.1
 
-From b2b5683cb9c5e7a04b7eb116f3ceecfcc33367a0 Mon Sep 17 00:00:00 2001
+From 580a8e7376f9c3b3206626811d8dc2a01b08e259 Mon Sep 17 00:00:00 2001
 From: Keith Busch <keith.busch@intel.com>
 Date: Thu, 20 Sep 2018 10:27:17 -0600
 Subject: [PATCH] PCI: Make link active reporting detection generic
@@ -2703,9 +2703,9 @@ index ec6c48ecd7d5..74c8e9190fed 100644
  	atomic_t	enable_cnt;	/* pci_enable_device has been called */
  
 -- 
-2.30.0
+2.30.1
 
-From df496c591f4b1c0fa77f732d2aaaf67d45444546 Mon Sep 17 00:00:00 2001
+From f70ebf21b624e9c1cc00bf3ad27cb883c5a59d1c Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:53:53 -0500
 Subject: [PATCH] PCI: Do not skip power-managed bridges in pci_enable_wake()
@@ -2754,9 +2754,9 @@ index 25b0fe79420f..6a0dc12187ed 100644
  
  	/* Don't do the same thing twice in a row for one device. */
 -- 
-2.30.0
+2.30.1
 
-From aebee92343c39b3104b8dcbe6ac24b84e8b6b5b6 Mon Sep 17 00:00:00 2001
+From af417f9fd8e00fdabf69d6c928b524a079cbcfbb Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:38:19 -0500
 Subject: [PATCH] PCI: pciehp: Disable hotplug interrupt during suspend
@@ -2868,9 +2868,9 @@ index 0693870a9e24..b5c7f5ef597a 100644
   * pciehp has a 1:1 bus:slot relationship so we ultimately want a secondary
   * bus reset of the bridge, but at the same time we want to ensure that it is
 -- 
-2.30.0
+2.30.1
 
-From 22444a6c9e7dc204d10bc7df7afa9f302f9a2c1d Mon Sep 17 00:00:00 2001
+From 83bc09e60eee0e67590d229ce2429ac76581b4aa Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:41:46 -0500
 Subject: [PATCH] PCI: pciehp: Do not handle events if interrupts are masked
@@ -2910,9 +2910,9 @@ index b5c7f5ef597a..242b9f30210a 100644
  
  	/*
 -- 
-2.30.0
+2.30.1
 
-From 6c84300d115a3b0e3a74a773f686834665e29efe Mon Sep 17 00:00:00 2001
+From 4922b32274a5b699f7e1976dda9b55c21476b399 Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:41:47 -0500
 Subject: [PATCH] PCI/portdrv: Resume upon exit from system suspend if left
@@ -2963,9 +2963,9 @@ index 23a5a0c2c3fe..5badf8a1ce0a 100644
  	if (pci_bridge_d3_possible(dev)) {
  		/*
 -- 
-2.30.0
+2.30.1
 
-From a4f6dff3069f9e7de10e93e8b19f263deddbf902 Mon Sep 17 00:00:00 2001
+From b8269200290bfc69d1eb1a4bbb4c2f7f2db7fc77 Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:41:48 -0500
 Subject: [PATCH] PCI/portdrv: Add runtime PM hooks for port service drivers
@@ -3075,9 +3075,9 @@ index 5badf8a1ce0a..59d2567e2db2 100644
  };
  
 -- 
-2.30.0
+2.30.1
 
-From 4e6fea38d9539ae22de646bc11c74db56c5b39eb Mon Sep 17 00:00:00 2001
+From b5e250fe37307bc562451f4b3171bc9112e13166 Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:41:49 -0500
 Subject: [PATCH] PCI: pciehp: Implement runtime PM callbacks
@@ -3132,9 +3132,9 @@ index 8e6e4ce869fb..e5de25ebc4cf 100644
  };
  
 -- 
-2.30.0
+2.30.1
 
-From 66ee2bafce6e1d4a57d40566aa769654b672889b Mon Sep 17 00:00:00 2001
+From a226b5411414301513e36c3698022347a88f34ed Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:57:05 -0500
 Subject: [PATCH] ACPI / property: Allow multiple property compatible _DSD
@@ -3427,9 +3427,9 @@ index 019468f072b7..2b2d92863923 100644
  		       void **valptr);
  int acpi_dev_prop_read_single(struct acpi_device *adev,
 -- 
-2.30.0
+2.30.1
 
-From 6fd470c78b119778c26d33b66d077768071deae8 Mon Sep 17 00:00:00 2001
+From 6bd89d871c667263d811129a6df4206e846ba405 Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 27 Sep 2018 16:57:14 -0500
 Subject: [PATCH] PCI / ACPI: Whitelist D3 for more PCIe hotplug ports
@@ -3592,9 +3592,9 @@ index e9ede82ee2c2..0a5efc437bd1 100644
  	int (*set_state)(struct pci_dev *dev, pci_power_t state);
  	pci_power_t (*get_state)(struct pci_dev *dev);
 -- 
-2.30.0
+2.30.1
 
-From 6a9cb4adc9b9977b96ebb3bfa24781227134f25e Mon Sep 17 00:00:00 2001
+From a67484471ab3dac5cd7722b95d0304d4d2f6597f Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Mon, 7 Jan 2019 16:09:40 +0300
 Subject: [PATCH] PCI: pciehp: Assign ctrl->slot_ctrl before writing it to
@@ -3646,9 +3646,9 @@ index 242b9f30210a..7074d4923811 100644
  	/*
  	 * Controllers with the Intel CF118 and similar errata advertise
 -- 
-2.30.0
+2.30.1
 
-From 9930b5f74a80ab2726eb9bc9b5fb5867f6e11155 Mon Sep 17 00:00:00 2001
+From 035b9b44d38de57cd4274538bb83f97e88be9d40 Mon Sep 17 00:00:00 2001
 From: Mika Westerberg <mika.westerberg@linux.intel.com>
 Date: Thu, 31 Jan 2019 20:07:46 +0300
 Subject: [PATCH] PCI: pciehp: Disable Data Link Layer State Changed event on
@@ -3735,9 +3735,9 @@ index 7074d4923811..a37ff79a6e9e 100644
  
  /*
 -- 
-2.30.0
+2.30.1
 
-From 41a48a80db0ef8735680192fffb47ceee80990a1 Mon Sep 17 00:00:00 2001
+From 71c780397f5df6089e59337a6b8c5349553d0080 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Thu, 29 Oct 2020 22:04:38 +0100
 Subject: [PATCH] PCI: Allow D3cold for hot-plug ports on Surface Books
@@ -3820,9 +3820,9 @@ index c5fd51d7f153..737d3a34e623 100644
  		if (dmi_check_system(bridge_d3_blacklist))
  			return false;
 -- 
-2.30.0
+2.30.1
 
-From 1e986e86d95c2363e37159d761aaa174dedd4762 Mon Sep 17 00:00:00 2001
+From 75a7bb2d62538131ec7ec7a672ed5d9b2c0f0842 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Mon, 9 Nov 2020 14:23:00 +0100
 Subject: [PATCH] PCI: Run platform power transition on initial D0 entry
@@ -3882,9 +3882,9 @@ index 737d3a34e623..f72651684719 100644
  	bridge = pci_upstream_bridge(dev);
  	if (bridge)
 -- 
-2.30.0
+2.30.1
 
-From 721822b3add605c0c14ccfdad7610cbc8001e6e7 Mon Sep 17 00:00:00 2001
+From 05f32f984be2b20defcdde87e6767a1ebff578fc Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 31 Oct 2020 20:46:33 +0100
 Subject: [PATCH] PCI: Add sysfs attribute for PCI device power state
@@ -3955,9 +3955,9 @@ index 1edf5a1836ea..ee1518650d55 100644
  	&dev_attr_vendor.attr,
  	&dev_attr_device.attr,
 -- 
-2.30.0
+2.30.1
 
-From 7d15e2ca136be1ee071b72a973ee0be15da1651d Mon Sep 17 00:00:00 2001
+From bc3339efb04e86fcce1eb8011842f1fadab1f118 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Mon, 14 Dec 2020 20:50:59 +0100
 Subject: [PATCH] platform/x86: Add Surface Hotplug driver
@@ -3970,40 +3970,47 @@ appropriate signal to the PCIe hot-plug driver core.
 Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
 Patchset: surface-hotplug
 ---
- drivers/platform/x86/Kconfig           |  12 ++
+ drivers/platform/x86/Kconfig           |  19 ++
  drivers/platform/x86/Makefile          |   1 +
- drivers/platform/x86/surface_hotplug.c | 267 +++++++++++++++++++++++++
- 3 files changed, 280 insertions(+)
+ drivers/platform/x86/surface_hotplug.c | 282 +++++++++++++++++++++++++
+ 3 files changed, 302 insertions(+)
  create mode 100644 drivers/platform/x86/surface_hotplug.c
 
 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 52fdf87b21f2..4b8757bb0146 100644
+index 9aed8f6941cc..d48bf3b2fdfd 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -708,6 +708,18 @@ config ACPI_WMI
+@@ -708,6 +708,25 @@ config ACPI_WMI
  	  It is safe to enable this driver even if your DSDT doesn't define
  	  any ACPI-WMI devices.
  
 +config SURFACE_HOTPLUG
-+	tristate "Surface Hot-Plug System Driver"
-+	depends on ACPI
-+	default m
++	tristate "Surface Hot-Plug Driver"
++	depends on GPIOLIB
 +	help
-+	  Driver for the Surface discrete GPU (dGPU) hot-plug system.
++	  Driver for out-of-band hot-plug event signaling on Microsoft Surface
++	  devices with hot-pluggable PCIe cards.
 +
-+	  This driver provides support for out-of-band hot-plug event signaling
-+	  on Surface Book 2 and 3 devices. This out-of-band signaling is
-+	  required to notify the kernel of any hot-plug events when the dGPU is
-+	  powered off, i.e. in D3cold.
++	  This driver is used on Surface Book (2 and 3) devices with a
++	  hot-pluggable discrete GPU (dGPU). When not in use, the dGPU on those
++	  devices can enter D3cold, which prevents in-band (standard) PCIe
++	  hot-plug signaling. Thus, without this driver, detaching the base
++	  containing the dGPU will not correctly update the state of the
++	  corresponding PCIe device if it is in D3cold. This driver adds support
++	  for out-of-band hot-plug notifications, ensuring that the device state
++	  is properly updated even when the device in question is in D3cold.
++
++	  Select M or Y here, if you want to (fully) support hot-plugging of
++	  dGPU devices on the Surface Book 2 and/or 3 during D3cold.
 +
  config WMI_BMOF
  	tristate "WMI embedded Binary MOF driver"
  	depends on ACPI_WMI
 diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
-index 6b028d1ee802..443b52da8060 100644
+index 2737a78616c8..d08f7e254d47 100644
 --- a/drivers/platform/x86/Makefile
 +++ b/drivers/platform/x86/Makefile
-@@ -83,6 +83,7 @@ obj-$(CONFIG_SURFACE_PRO3_BUTTON)	+= surfacepro3_button.o
+@@ -89,6 +89,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
@@ -4013,13 +4020,13 @@ index 6b028d1ee802..443b52da8060 100644
  obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU)	+= intel_bxtwc_tmu.o
 diff --git a/drivers/platform/x86/surface_hotplug.c b/drivers/platform/x86/surface_hotplug.c
 new file mode 100644
-index 000000000000..572fba30cd77
+index 000000000000..cfcc15cfbacb
 --- /dev/null
 +++ b/drivers/platform/x86/surface_hotplug.c
-@@ -0,0 +1,267 @@
+@@ -0,0 +1,282 @@
 +// SPDX-License-Identifier: GPL-2.0+
 +/*
-+ * Surface Book (gen. 2 and later) hot-plug driver.
++ * Surface Book (2 and later) hot-plug driver.
 + *
 + * Surface Book devices (can) have a hot-pluggable discrete GPU (dGPU). This
 + * driver is responsible for out-of-band hot-plug event signaling on these
@@ -4029,7 +4036,7 @@ index 000000000000..572fba30cd77
 + * Event signaling is handled via ACPI, which will generate the appropriate
 + * device-check notifications to be picked up by the PCIe hot-plug driver.
 + *
-+ * Copyright (C) 2019-2020 Maximilian Luz <luzmaximilian@gmail.com>
++ * Copyright (C) 2019-2021 Maximilian Luz <luzmaximilian@gmail.com>
 + */
 +
 +#include <linux/acpi.h>
@@ -4059,8 +4066,7 @@ index 000000000000..572fba30cd77
 +
 +/* 5515a847-ed55-4b27-8352-cd320e10360a */
 +static const guid_t shps_dsm_guid =
-+	GUID_INIT(0x5515a847, 0xed55, 0x4b27, 0x83, 0x52, 0xcd,
-+		  0x32, 0x0e, 0x10, 0x36, 0x0a);
++	GUID_INIT(0x5515a847, 0xed55, 0x4b27, 0x83, 0x52, 0xcd, 0x32, 0x0e, 0x10, 0x36, 0x0a);
 +
 +#define SHPS_DSM_REVISION		1
 +
@@ -4073,11 +4079,10 @@ index 000000000000..572fba30cd77
 +};
 +
 +enum shps_irq_type {
-+	/* NOTE: Must be in order of DSM function */
++	/* NOTE: Must be in order of enum shps_dsm_fn above. */
 +	SHPS_IRQ_TYPE_BASE_PRESENCE	= 0,
 +	SHPS_IRQ_TYPE_DEVICE_POWER	= 1,
 +	SHPS_IRQ_TYPE_DEVICE_PRESENCE	= 2,
-+
 +	SHPS_NUM_IRQS,
 +};
 +
@@ -4088,15 +4093,19 @@ index 000000000000..572fba30cd77
 +};
 +
 +struct shps_device {
-+	struct mutex lock[SHPS_NUM_IRQS];
++	struct mutex lock[SHPS_NUM_IRQS];  /* Protects update in shps_dsm_notify_irq() */
 +	struct gpio_desc *gpio[SHPS_NUM_IRQS];
 +	unsigned int irq[SHPS_NUM_IRQS];
 +};
 +
 +#define SHPS_IRQ_NOT_PRESENT		((unsigned int)-1)
 +
-+static void shps_dsm_notify_irq(struct platform_device *pdev,
-+				enum shps_irq_type type)
++static enum shps_dsm_fn shps_dsm_fn_for_irq(enum shps_irq_type type)
++{
++	return SHPS_DSM_FN_IRQ_BASE_PRESENCE + type;
++}
++
++static void shps_dsm_notify_irq(struct platform_device *pdev, enum shps_irq_type type)
 +{
 +	struct shps_device *sdev = platform_get_drvdata(pdev);
 +	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
@@ -4109,42 +4118,37 @@ index 000000000000..572fba30cd77
 +	value = gpiod_get_value_cansleep(sdev->gpio[type]);
 +	if (value < 0) {
 +		mutex_unlock(&sdev->lock[type]);
-+		dev_err(&pdev->dev, "failed to get gpio: %d (irq=%d)\n",
-+			type, value);
++		dev_err(&pdev->dev, "failed to get gpio: %d (irq=%d)\n", type, value);
 +		return;
 +	}
 +
-+	dev_dbg(&pdev->dev, "IRQ notification via DSM (irq=%d, value=%d)\n",
-+		type, value);
++	dev_dbg(&pdev->dev, "IRQ notification via DSM (irq=%d, value=%d)\n", type, value);
 +
 +	param.type = ACPI_TYPE_INTEGER;
 +	param.integer.value = value;
 +
 +	result = acpi_evaluate_dsm(handle, &shps_dsm_guid, SHPS_DSM_REVISION,
-+				   SHPS_DSM_FN_IRQ_BASE_PRESENCE + type, &param);
++				   shps_dsm_fn_for_irq(type), &param);
 +
 +	if (!result) {
-+		mutex_unlock(&sdev->lock[type]);
-+		dev_err(&pdev->dev,
-+			"IRQ notification via DSM failed (irq=%d, gpio=%d)\n",
++		dev_err(&pdev->dev, "IRQ notification via DSM failed (irq=%d, gpio=%d)\n",
 +			type, value);
-+		return;
-+	}
 +
-+	if (result->type != ACPI_TYPE_BUFFER) {
++	} else if (result->type != ACPI_TYPE_BUFFER) {
 +		dev_err(&pdev->dev,
 +			"IRQ notification via DSM failed: unexpected result type (irq=%d, gpio=%d)\n",
 +			type, value);
-+	}
 +
-+	if (result->buffer.length != 1 || result->buffer.pointer[0] != 0) {
++	} else if (result->buffer.length != 1 || result->buffer.pointer[0] != 0) {
 +		dev_err(&pdev->dev,
 +			"IRQ notification via DSM failed: unexpected result value (irq=%d, gpio=%d)\n",
 +			type, value);
 +	}
 +
 +	mutex_unlock(&sdev->lock[type]);
-+	ACPI_FREE(result);
++
++	if (result)
++		ACPI_FREE(result);
 +}
 +
 +static irqreturn_t shps_handle_irq(int irq, void *data)
@@ -4174,17 +4178,16 @@ index 000000000000..572fba30cd77
 +	struct gpio_desc *gpiod;
 +	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
 +	const char *irq_name;
-+	const int dsm = SHPS_DSM_FN_IRQ_BASE_PRESENCE + type;
++	const int dsm = shps_dsm_fn_for_irq(type);
 +	int status, irq;
 +
-+	/* Initialize as "not present". */
-+	sdev->gpio[type] = NULL;
-+	sdev->irq[type] = SHPS_IRQ_NOT_PRESENT;
-+
-+	/* Only set up interrupts that we actually need. */
++	/*
++	 * Only set up interrupts that we actually need: The Surface Book 3
++	 * does not have a DSM for base presence, so don't set up an interrupt
++	 * for that.
++	 */
 +	if (!acpi_check_dsm(handle, &shps_dsm_guid, SHPS_DSM_REVISION, BIT(dsm))) {
-+		dev_dbg(&pdev->dev, "IRQ notification via DSM not present (irq=%d)\n",
-+			type);
++		dev_dbg(&pdev->dev, "IRQ notification via DSM not present (irq=%d)\n", type);
 +		return 0;
 +	}
 +
@@ -4213,11 +4216,33 @@ index 000000000000..572fba30cd77
 +	return 0;
 +}
 +
++static int surface_hotplug_remove(struct platform_device *pdev)
++{
++	struct shps_device *sdev = platform_get_drvdata(pdev);
++	int i;
++
++	/* Ensure that IRQs have been fully handled and won't trigger any more. */
++	for (i = 0; i < SHPS_NUM_IRQS; i++) {
++		if (sdev->irq[i] != SHPS_IRQ_NOT_PRESENT)
++			disable_irq(sdev->irq[i]);
++
++		mutex_destroy(&sdev->lock[i]);
++	}
++
++	return 0;
++}
++
 +static int surface_hotplug_probe(struct platform_device *pdev)
 +{
 +	struct shps_device *sdev;
 +	int status, i;
 +
++	/*
++	 * The MSHW0153 device is also present on the Surface Laptop 3,
++	 * however that doesn't have a hot-pluggable PCIe device. It also
++	 * doesn't have any GPIO interrupts/pins under the MSHW0153, so filter
++	 * it out here.
++	 */
 +	if (gpiod_count(&pdev->dev, NULL) < 0)
 +		return -ENODEV;
 +
@@ -4231,15 +4256,21 @@ index 000000000000..572fba30cd77
 +
 +	platform_set_drvdata(pdev, sdev);
 +
++	/*
++	 * Initialize IRQs so that we can safely call surface_hotplug_remove()
++	 * on errors.
++	 */
++	for (i = 0; i < SHPS_NUM_IRQS; i++)
++		sdev->irq[i] = SHPS_IRQ_NOT_PRESENT;
++
 +	/* Set up IRQs. */
 +	for (i = 0; i < SHPS_NUM_IRQS; i++) {
 +		mutex_init(&sdev->lock[i]);
 +
 +		status = shps_setup_irq(pdev, i);
 +		if (status) {
-+			dev_err(&pdev->dev, "failed to set up IRQ %d: %d\n",
-+				i, status);
-+			return status;
++			dev_err(&pdev->dev, "failed to set up IRQ %d: %d\n", i, status);
++			goto err;
 +		}
 +	}
 +
@@ -4249,19 +4280,10 @@ index 000000000000..572fba30cd77
 +			shps_dsm_notify_irq(pdev, i);
 +
 +	return 0;
-+}
-+
-+static int surface_hotplug_remove(struct platform_device *pdev)
-+{
-+	struct shps_device *sdev = platform_get_drvdata(pdev);
-+	int i;
 +
-+	/* Ensure that IRQs have been fully handled and won't trigger any more. */
-+	for (i = 0; i < SHPS_NUM_IRQS; i++)
-+		if (sdev->irq[i] != SHPS_IRQ_NOT_PRESENT)
-+			disable_irq(sdev->irq[i]);
-+
-+	return 0;
++err:
++	surface_hotplug_remove(pdev);
++	return status;
 +}
 +
 +static const struct acpi_device_id surface_hotplug_acpi_match[] = {
@@ -4285,5 +4307,5 @@ index 000000000000..572fba30cd77
 +MODULE_DESCRIPTION("Surface Hot-Plug Signaling Driver for Surface Book Devices");
 +MODULE_LICENSE("GPL");
 -- 
-2.30.0
+2.30.1
 

+ 2 - 2
patches/4.19/0012-surface-typecover.patch

@@ -1,4 +1,4 @@
-From 2be72e4746293200781294991ebf26ef9af95bf6 Mon Sep 17 00:00:00 2001
+From a0320ac4d0a46058222dad44101cd2bf1e2a48b1 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
 Date: Thu, 5 Nov 2020 13:09:45 +0100
 Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when
@@ -229,5 +229,5 @@ index ccda72f748ee..96fb231fd266 100644
  	{ .driver_data = MT_CLS_GOOGLE,
  		HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
 -- 
-2.30.0
+2.30.1
 

+ 13 - 13
pkg/arch/kernel-lts/PKGBUILD

@@ -43,19 +43,19 @@ sha256sums=('d2fdd236e6f31aa8e939f4a686c95417d8571bde3d091fc6a2535937c144195f'
             'SKIP'
             '4e68572e7cc4c5368f0236e0792660ae8498373988625dca46e509399a7eaea6'
             'a13581d3c6dc595206e4fe7fcf6b542e7a1bdbe96101f0f010fc5be49f99baf2'
-            'a019c4c93bb35d007ab47824f5f9aa542a4c9645563012c1a7dfb542d8adcc1b'
-            '07bec3964b4aa87e4858c434ca48614dffa2cceb452d2740a99eb42266b1a8ea'
-            '9bd2176186347f5b2ce4f9c5dcadb26a517801190b243efd958532ac7196d7e5'
-            'b877825c9099b99a79b8439ce47a5339022d1e8d0ca7dee36b2bec5563809aa5'
-            'cf7128510876ff545e593d5c9a672b40bccdcb456a4bd7b605fc71daeee6e58c'
-            '0bc6764317bb059329a2b89b7d185d9a0703bc0df4cbd055b728465955e65367'
-            '00c964842f428f60d6e91c8aebc92c7b98e01cc128c092d022584f7bace7ba23'
-            '7f09a75ee2d4ca24abc2cf5b7d54cf5828830775d2932f76e4f9512d74289ae1'
-            '75afe838e071a97222efe00849018d4af23598fb1fc41b383df4c6af7a81fbf4'
-            'e62d0d0a4deecd317e7b1340245232132f974c85148fffa356d7d7e0b0d5dfc1'
-            '6884bc842bbd56faadb088a29d7a5c2c1d2bc7ebcc61724bda9b3c0688f154a0'
-            'd6cddef1c43fec9d72d5be47e693b7293c44e410943af586c68ea70e20464dd8'
-            '11e0a77f55fabcb087350239bd9cc3e105a78c2db3e894f78adceaf1c3cacde9')
+            'c523d8ba9f02992c34b325cd7b07e27bfead33ecab29877e659a12b2d56b1118'
+            '323ad3cfc3be796d03ee0c38c128d61b8758d18524ff39e1c0e16e257167f8a9'
+            '65f8a21e2a269706ad5f4cc53f21cd1eff7f26cc8177ebaeb3fbbf76c27f285e'
+            '985607cffb1fecab9037090b540896e0c08fdfed3de265d021ebd2ea5bd2e61b'
+            '900cff17f58a66f62be586704c285507c67f282d1d300f03621eb500d2d4ab82'
+            'a0cd9976ef68fdccad944c5c2ce3fc004da4d05d35acd573dfdfe51424f9a0b0'
+            'fca6ef9bca0ad6fc8fd5e588cd5ace60408f2ab32edd7342a0dedc9e2df79851'
+            '9a0ffb7b7ebc480658edca5c5d0f7bb171e98d5ada2ab51052726201ebbd9b2f'
+            'a1c961443f96116e0316354dac6e1ac29913ce2c88da6325e787d7ce68ee8144'
+            '898d34bbe61f91773aff366ad17296652b28e6cbb4761dac11233ef7a76c84f5'
+            '0fb15c0904adc523c24169340201352ff5471191f91b9d482f1771a162cbf8c1'
+            'af21cc2025b7903f2aacc5ea1df15e8f5542c4eec3dd15f89be7d6325c91ed27'
+            '6344493ab81704a83f6c252513315d3bf8774fe6128cc9fac882b80dd8fbf05c')
 
 export KBUILD_BUILD_HOST=archlinux
 export KBUILD_BUILD_USER=$pkgbase

部分文件因文件數量過多而無法顯示