Selaa lähdekoodia

Update v5.4 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/531e6519a892711c74e9aa7ffa3f83cb2050f22f
 - 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 vuotta sitten
vanhempi
commit
5399769982

+ 7 - 2
configs/surface-5.4.config

@@ -6,12 +6,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/5.4/0001-surface3-power.patch

@@ -1,4 +1,4 @@
-From 97796e7d29cf461df923c61fe70f6ca236c4997f Mon Sep 17 00:00:00 2001
+From 5848e2fba8c859e7a4cc8e7663fb5371997770f5 Mon Sep 17 00:00:00 2001
 From: qzed <qzed@users.noreply.github.com>
 Date: Tue, 17 Sep 2019 17:17:56 +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/5.4/0002-surface3-oemb.patch

@@ -1,4 +1,4 @@
-From 37fd7de62d1aa0a910f97dc4eb37cecb7c28393e Mon Sep 17 00:00:00 2001
+From b2d676c08fd273e13731ce67d2836855ba6ebf0f 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 d0fb43c2b9f6..0e938713cb13 100644
  };
  
 -- 
-2.30.0
+2.30.1
 

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

@@ -1,4 +1,4 @@
-From 06e17723ae88ae7030681b499b965eeffb7337a5 Mon Sep 17 00:00:00 2001
+From 582e2708b267722ff0b91a71307f321e2c840159 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
@@ -154,9 +154,9 @@ index f7ce9b6db6b4..72d0c01ff359 100644
  
  static inline int
 -- 
-2.30.0
+2.30.1
 
-From d27c246316c2c8d8615b43fc68e1a620d1998940 Mon Sep 17 00:00:00 2001
+From ab13f94d3cde1dd9e1e86546ed6469f76018207b 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
@@ -362,9 +362,9 @@ index 000000000000..5326ae7e5671
 +
 +void mwifiex_initialize_quirks(struct pcie_service_card *card);
 -- 
-2.30.0
+2.30.1
 
-From c2ac862bd2dd1183e158a76950500a7560218987 Mon Sep 17 00:00:00 2001
+From 90eedd60f6dfb6578f0f9c09520b6169adc87d74 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+
@@ -563,9 +563,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 b8ae7bac392c8a965e1d4d2d6d1ef550597ef47f Mon Sep 17 00:00:00 2001
+From d4c3664053583b97dbcdeea4dc37da854215f471 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
@@ -742,9 +742,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 e9db9491f97d658cf5c000a4ab07f1272e3bee59 Mon Sep 17 00:00:00 2001
+From ff7424694a69509c694c0ff5a968e6e43fe9315a 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
@@ -804,9 +804,9 @@ index f0a6fa0a7ae5..34dcd84f02a6 100644
  		.ident = "Surface Pro 3",
  		.matches = {
 -- 
-2.30.0
+2.30.1
 
-From 053f2f3cc88d60a2978004704395dc8c914671fe Mon Sep 17 00:00:00 2001
+From 861079133a6881425e234bdc62da525f37c60386 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
@@ -946,9 +946,9 @@ index 263d918767bd..bd6791dc3a0f 100644
  	return 0;
  }
 -- 
-2.30.0
+2.30.1
 
-From d002bafb6f43d694650f1a910edb3672c8de641f Mon Sep 17 00:00:00 2001
+From e5b5d7b27a53fcff871603a3c7fb4f505d029c00 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
@@ -995,9 +995,9 @@ index bd6791dc3a0f..d7ff898c1767 100644
  	if (!adapter->devdump_data) {
  		mwifiex_dbg(adapter, ERROR,
 -- 
-2.30.0
+2.30.1
 
-From 55b4bf63af39b2422dac63d89253e66a9a87e0f2 Mon Sep 17 00:00:00 2001
+From d27add3beb83d75f4e20559ace0341946533ef17 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+
@@ -1150,9 +1150,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 ea3c4820fc14f520366a5d61fb11637a8d09519a Mon Sep 17 00:00:00 2001
+From b19749fd1a6563a4d7d76bcc503b383bd112665d 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
@@ -1212,9 +1212,9 @@ index 9e6dc289ec3e..20f5ee3fe7e3 100644
  }
  
 -- 
-2.30.0
+2.30.1
 
-From 6282406f43441ff1c45e9f326380f62cfd1154cb Mon Sep 17 00:00:00 2001
+From c86b4bca63e8d57ddab8e484c158e0dde4044e5e 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
@@ -1247,9 +1247,9 @@ index 20f5ee3fe7e3..8020a2929069 100644
  }
  
 -- 
-2.30.0
+2.30.1
 
-From d68427cdc69ec1683b85f6502be6fd977ef9863d Mon Sep 17 00:00:00 2001
+From 0bffe54a88dab69db359641bec117adf8a8dc7ab 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
@@ -1295,5 +1295,5 @@ index 4ed10cf82f9a..ed0fffb9eba6 100644
  
  		if (drcs) {
 -- 
-2.30.0
+2.30.1
 

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

@@ -1,4 +1,4 @@
-From 863c231e1cc6ec12c47819a1c1121db9d80ec88b Mon Sep 17 00:00:00 2001
+From 964a397cb3e5ed3c8887f4203c27c8a28c2f166d Mon Sep 17 00:00:00 2001
 From: Dorian Stoll <dorian.stoll@tmsp.io>
 Date: Mon, 27 Jan 2020 21:16:20 +0100
 Subject: [PATCH] mei: Add IPTS device IDs
@@ -51,9 +51,9 @@ index 75ab2ffbf235..78790904d77c 100644
  	{MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)},
  
 -- 
-2.30.0
+2.30.1
 
-From e5db54a618d5f4c7325e52abaae5d302cfc446e8 Mon Sep 17 00:00:00 2001
+From 749e05593270579c5ac9c692204f1e104be42b67 Mon Sep 17 00:00:00 2001
 From: Dorian Stoll <dorian.stoll@tmsp.io>
 Date: Fri, 20 Dec 2019 23:15:58 +0100
 Subject: [PATCH] uapi: Add MEI bus ID
@@ -77,9 +77,9 @@ index 9a61c28ed3ae..47fc20975245 100644
  /*
   * MT_TOOL types
 -- 
-2.30.0
+2.30.1
 
-From e402b004f197426819ed17bb3e1ec89fe1001157 Mon Sep 17 00:00:00 2001
+From 73dcca12dbedbe0ca69958d2997a7fec4a64f139 Mon Sep 17 00:00:00 2001
 From: Dorian Stoll <dorian.stoll@tmsp.io>
 Date: Mon, 27 Jan 2020 21:22:42 +0100
 Subject: [PATCH] input: Add support for Intel Precise Touch & Stylus
@@ -2085,5 +2085,5 @@ index 000000000000..5b93add1eac2
 +
 +#endif /* _IPTS_STYLUS_H_ */
 -- 
-2.30.0
+2.30.1
 

+ 8 - 7
patches/5.4/0005-surface-gpe.patch

@@ -1,4 +1,4 @@
-From 8a49d9d3c28983fcacbb4dd0d7e8113a100d2b54 Mon Sep 17 00:00:00 2001
+From 12089e42e9edf09773bf3236cb9a6267b268a556 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 | 321 +++++++++++++++++++++++++++++
- 3 files changed, 331 insertions(+)
+ 3 files changed, 332 insertions(+)
  create mode 100644 drivers/platform/x86/surface_gpe.c
 
 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 56b1cf96ff57..12cf0d723f21 100644
+index 56b1cf96ff57..5d3110a7a7fa 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -1217,6 +1217,15 @@ config SURFACE_3_POWER_OPREGION
+@@ -1217,6 +1217,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
@@ -397,5 +398,5 @@ index 000000000000..86f6991b1215
 +MODULE_LICENSE("GPL");
 +MODULE_ALIAS("dmi:*:svnMicrosoftCorporation:pnSurface*:*");
 -- 
-2.30.0
+2.30.1
 

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

@@ -1,4 +1,4 @@
-From 026ad3f65be8a3f3a5dffad423a2dde7251a01b0 Mon Sep 17 00:00:00 2001
+From 578d687c64724fa8b16c5c9fd2a2a37e7a968da7 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 c70983780ae7..1c90651161a6 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 0a1661bae14793c84a3d9c440bcf825ffb64e370 Mon Sep 17 00:00:00 2001
+From 36ea4af952dfd9f8ae04030dc4fe6334bd034669 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 12cf0d723f21..f06a0bf92890 100644
+index 5d3110a7a7fa..8e95839341e8 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -1226,6 +1226,13 @@ config SURFACE_GPE
+@@ -1227,6 +1227,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
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 11856 - 11704
patches/5.4/0007-surface-sam.patch


+ 91 - 69
patches/5.4/0008-surface-hotplug.patch

@@ -1,4 +1,4 @@
-From d3f60896ae2a2fb6c6b610e230916d2a81b24e2f Mon Sep 17 00:00:00 2001
+From d60ac44982cb1b4c8555a30e411ffec54056e0dc 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
@@ -58,9 +58,9 @@ index 89dece8a4132..fd34c8743cbc 100644
  	bridge = pci_upstream_bridge(dev);
  	if (bridge)
 -- 
-2.30.0
+2.30.1
 
-From 32bc35a7ad400888222f5cf083d080e646f5e9ef Mon Sep 17 00:00:00 2001
+From 79034c754cd06ff12003b5ba38ef24706feb2b7c 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
@@ -131,9 +131,9 @@ index e401f040f157..418927872ae6 100644
  	&dev_attr_vendor.attr,
  	&dev_attr_device.attr,
 -- 
-2.30.0
+2.30.1
 
-From 6ebd60f882ad789a2dc4b8c7d681b16bb3e227f1 Mon Sep 17 00:00:00 2001
+From 14b245813cd398b61cf0507f7fdd6b54acdb5530 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
@@ -146,40 +146,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 f06a0bf92890..3353aa9a9617 100644
+index b5a103d0ccd2..f0c17b65bb5b 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -756,6 +756,18 @@ config ACPI_WMI
+@@ -756,6 +756,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 a1e70973257c..7a6b5ce38cc0 100644
+index 328830619b21..1bdad1722521 100644
 --- a/drivers/platform/x86/Makefile
 +++ b/drivers/platform/x86/Makefile
-@@ -87,6 +87,7 @@ obj-$(CONFIG_SURFACE_PRO3_BUTTON)	+= surfacepro3_button.o
+@@ -93,6 +93,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
@@ -189,13 +196,13 @@ index a1e70973257c..7a6b5ce38cc0 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
@@ -205,7 +212,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>
@@ -235,8 +242,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
 +
@@ -249,11 +255,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,
 +};
 +
@@ -264,15 +269,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);
@@ -285,42 +294,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)
@@ -350,17 +354,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;
 +	}
 +
@@ -389,11 +392,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;
 +
@@ -407,15 +432,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;
 +		}
 +	}
 +
@@ -425,19 +456,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[] = {
@@ -461,5 +483,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/5.4/0009-surface-typecover.patch

@@ -1,4 +1,4 @@
-From 8a77d6cf83747db2b3de6e84eec497f07a6d49a6 Mon Sep 17 00:00:00 2001
+From 5aa632a7f8b50ef883c5f12703a9787b1afa8b64 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 d91e6679afb1..11bf0d87523d 100644
  	{ .driver_data = MT_CLS_GOOGLE,
  		HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
 -- 
-2.30.0
+2.30.1
 

+ 2 - 2
patches/5.4/0010-surface-sensors.patch

@@ -1,4 +1,4 @@
-From da8e015edd4236fd6994164c01ecae7916d64aab Mon Sep 17 00:00:00 2001
+From 0da844f153e038ebf1dc3da125f8f5f37f8e9786 Mon Sep 17 00:00:00 2001
 From: Max Leiter <maxwell.leiter@gmail.com>
 Date: Sat, 19 Dec 2020 17:50:55 -0800
 Subject: [PATCH] iio:light:apds9960 add detection for MSHW0184 ACPI device in
@@ -50,5 +50,5 @@ index c5dfb9a6b5a1..ee4a576dc62c 100644
  	.probe		= apds9960_probe,
  	.remove		= apds9960_remove,
 -- 
-2.30.0
+2.30.1
 

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä