Browse Source

Update patches from kernel repo

- surface-acpi:
  - integrate dGPU hot-plug system
  - fix MODULE_ALIAS definitions for auto-loading SID battery and ac
    drivers

- disable DMA for surface3-spi touchscreen driver

- new wifi suspend patch (only 5.3/5.4)

- ipts:
  - do not automatically switch sensor modes (only 5.3)
Maximilian Luz 5 years ago
parent
commit
b931b147da
35 changed files with 4366 additions and 2116 deletions
  1. 1253 121
      patches/4.19/0001-surface-acpi.patch
  2. 3 3
      patches/4.19/0002-suspend.patch
  3. 2 2
      patches/4.19/0003-buttons.patch
  4. 4 4
      patches/4.19/0004-cameras.patch
  5. 2 2
      patches/4.19/0005-ipts.patch
  6. 2 2
      patches/4.19/0006-hid.patch
  7. 3 3
      patches/4.19/0007-sdcard-reader.patch
  8. 3 3
      patches/4.19/0008-wifi.patch
  9. 2 2
      patches/4.19/0009-surface3-power.patch
  10. 2 2
      patches/4.19/0010-mwlwifi.patch
  11. 2 2
      patches/4.19/0011-surface-lte.patch
  12. 5 18
      patches/4.19/0012-ioremap_uc.patch
  13. 0 359
      patches/4.19/0012-surfacebook2-dgpu.patch
  14. 63 0
      patches/4.19/0013-surface3-spi-dma.patch
  15. 1253 121
      patches/5.3/0001-surface-acpi.patch
  16. 2 2
      patches/5.3/0002-buttons.patch
  17. 3 3
      patches/5.3/0003-hid.patch
  18. 0 359
      patches/5.3/0003-surfacebook2-dgpu.patch
  19. 7 7
      patches/5.3/0004-surface3-power.patch
  20. 3 3
      patches/5.3/0005-surface-lte.patch
  21. 171 0
      patches/5.3/0006-wifi.patch
  22. 3 3
      patches/5.3/0007-legacy-i915.patch
  23. 0 267
      patches/5.3/0007-wifi.patch
  24. 10 34
      patches/5.3/0008-ipts.patch
  25. 5 18
      patches/5.3/0009-ioremap_uc.patch
  26. 63 0
      patches/5.3/0010-surface3-spi-dma.patch
  27. 4 17
      patches/5.4/0001-ioremap_uc.patch
  28. 2 2
      patches/5.4/0002-hid.patch
  29. 1253 121
      patches/5.4/0003-surface-acpi.patch
  30. 7 7
      patches/5.4/0004-surface3-power.patch
  31. 0 359
      patches/5.4/0004-surfacebook2-dgpu.patch
  32. 3 3
      patches/5.4/0005-surface-lte.patch
  33. 168 0
      patches/5.4/0006-wifi.patch
  34. 63 0
      patches/5.4/0007-surface3-spi-dma.patch
  35. 0 267
      patches/5.4/0007-wifi.patch

File diff suppressed because it is too large
+ 1253 - 121
patches/4.19/0001-surface-acpi.patch


+ 3 - 3
patches/4.19/0002-suspend.patch

@@ -1,4 +1,4 @@
-From a0440209503a70ceba6353b40ab335528c7f7663 Mon Sep 17 00:00:00 2001
+From 55e646f0c2850aaf2732fa3f8d97aa97c0863837 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 02/13] suspend
@@ -14,7 +14,7 @@ Subject: [PATCH 02/13] suspend
  7 files changed, 182 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index c4ff4f079448..4e050ae8a6d4 100644
+index b2d9bd564960..7c522d2a0f99 100644
 --- a/drivers/nvme/host/core.c
 +++ b/drivers/nvme/host/core.c
 @@ -1049,15 +1049,15 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl,
@@ -364,5 +364,5 @@ index f8576509c7be..a5fa80e72aba 100644
  		.procname	= "sched_child_runs_first",
  		.data		= &sysctl_sched_child_runs_first,
 -- 
-2.24.0
+2.24.1
 

+ 2 - 2
patches/4.19/0003-buttons.patch

@@ -1,4 +1,4 @@
-From f3c4fbbf4bd7222199fff5162a0f790414b7ca29 Mon Sep 17 00:00:00 2001
+From 54e82d57d6201545852600365c240fcf26440226 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 27 Jul 2019 17:51:37 +0200
 Subject: [PATCH 03/13] buttons
@@ -270,5 +270,5 @@ index 1b491690ce07..96627627060e 100644
  	if (!button)
  		return -ENOMEM;
 -- 
-2.24.0
+2.24.1
 

+ 4 - 4
patches/4.19/0004-cameras.patch

@@ -1,4 +1,4 @@
-From 215d8d4ae78f1bfaebdc0fb6b56f2a2e3b0b61b3 Mon Sep 17 00:00:00 2001
+From aba5b117008ee57e9d9d65e971ea75cb9b1bed34 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 17:53:54 +0200
 Subject: [PATCH 04/13] cameras
@@ -21,10 +21,10 @@ Subject: [PATCH 04/13] cameras
  create mode 100644 drivers/staging/ov5693/ov5693.h
 
 diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
-index cf4feff2a48c..db24e360f6ab 100644
+index 063e229ead5e..355777bb8ba8 100644
 --- a/drivers/media/usb/uvc/uvc_driver.c
 +++ b/drivers/media/usb/uvc/uvc_driver.c
-@@ -2367,6 +2367,46 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
+@@ -2389,6 +2389,46 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
   * though they are compliant.
   */
  static const struct usb_device_id uvc_ids[] = {
@@ -2749,5 +2749,5 @@ index 000000000000..79aef69666e8
 +};
 +#endif
 -- 
-2.24.0
+2.24.1
 

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

@@ -1,4 +1,4 @@
-From 678ce41480476ac90e3951e055cfd6448b9d95d6 Mon Sep 17 00:00:00 2001
+From 687d4da6fce826b6d0f02c99420badadb262bcb0 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 17:58:17 +0200
 Subject: [PATCH 05/13] ipts
@@ -6848,5 +6848,5 @@ index 000000000000..bad44fb4f233
 +
 +#endif // INTEL_IPTS_IF_H
 -- 
-2.24.0
+2.24.1
 

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

@@ -1,4 +1,4 @@
-From 24943eb655f03a88c39295916dd25bf5a53cc933 Mon Sep 17 00:00:00 2001
+From 927b2d49811547c673eb3fc16126c8afca385757 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= <blaz@mxxn.io>
 Date: Wed, 6 Nov 2019 19:43:26 +0900
 Subject: [PATCH 06/13] hid
@@ -23,5 +23,5 @@ index b0c8fae7f903..3a359716fb38 100644
  
  static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 -- 
-2.24.0
+2.24.1
 

+ 3 - 3
patches/4.19/0007-sdcard-reader.patch

@@ -1,4 +1,4 @@
-From 9bb4a6a8a1aef64e4fcaa3527108b8e6da35e845 Mon Sep 17 00:00:00 2001
+From 97eabdac0e56338eb68d67eb46d9e589e0621f1f Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 17:59:13 +0200
 Subject: [PATCH 07/13] sdcard-reader
@@ -8,7 +8,7 @@ Subject: [PATCH 07/13] sdcard-reader
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
-index d5fbd36cf462..606e63691d50 100644
+index b33ec768404b..360477fe8d0c 100644
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
 @@ -4171,7 +4171,8 @@ void usb_enable_lpm(struct usb_device *udev)
@@ -22,5 +22,5 @@ index d5fbd36cf462..606e63691d50 100644
  
  	udev->lpm_disable_count--;
 -- 
-2.24.0
+2.24.1
 

+ 3 - 3
patches/4.19/0008-wifi.patch

@@ -1,4 +1,4 @@
-From facdc3529e5ee42e976484f1a5e824867e5bb3df Mon Sep 17 00:00:00 2001
+From eb5625524a9f025ade096508db976f6318387fc4 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 18:00:19 +0200
 Subject: [PATCH 08/13] wifi
@@ -97,7 +97,7 @@ index 1fb76d2f5d3f..fb32379da99d 100644
  
  struct hw_spec_api_rev {
 diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
-index 20cee5c397fb..13e49a3ae812 100644
+index e48b47f42554..15bbcbf1420f 100644
 --- a/drivers/net/wireless/marvell/mwifiex/main.c
 +++ b/drivers/net/wireless/marvell/mwifiex/main.c
 @@ -163,6 +163,7 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
@@ -266,5 +266,5 @@ diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
 old mode 100755
 new mode 100644
 -- 
-2.24.0
+2.24.1
 

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

@@ -1,4 +1,4 @@
-From 310f0563c32936e54eb60e9e2e2ad2280b7f7208 Mon Sep 17 00:00:00 2001
+From e40a7fdd66839e4adfac65ca1ab770d50551d95c Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 18:00:43 +0200
 Subject: [PATCH 09/13] surface3-power
@@ -651,5 +651,5 @@ index 000000000000..e0af01a60302
 +MODULE_DESCRIPTION("mshw0011 driver");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.24.0
+2.24.1
 

+ 2 - 2
patches/4.19/0010-mwlwifi.patch

@@ -1,4 +1,4 @@
-From 64a2a0f032a96a09ee29d63e510f83834b6aa88e Mon Sep 17 00:00:00 2001
+From e256371ddeb11d23ca22a10fc14c00dd7ab8288c Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 18:01:27 +0200
 Subject: [PATCH 10/13] mwlwifi
@@ -19751,5 +19751,5 @@ index 000000000000..b6fdf70c22fb
 +
 +#endif /* _VENDOR_CMD_H_ */
 -- 
-2.24.0
+2.24.1
 

+ 2 - 2
patches/4.19/0011-surface-lte.patch

@@ -1,4 +1,4 @@
-From a9414a3a06df5074fa44c920857104e9eb8f8031 Mon Sep 17 00:00:00 2001
+From e3295d7e95d4ccc587677e9e96664187b10ecec5 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 28 Sep 2019 18:02:03 +0200
 Subject: [PATCH 11/13] surface-lte
@@ -20,5 +20,5 @@ index 613f91add03d..e1428222dd73 100644
  	/* Huawei devices */
  	{DEVICE_HWI(0x03f0, 0x581d)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
 -- 
-2.24.0
+2.24.1
 

+ 5 - 18
patches/4.19/0013-ioremap_uc.patch → patches/4.19/0012-ioremap_uc.patch

@@ -1,15 +1,14 @@
-From 45a30685cf30d7ea4f07d6b3a86aac80feccf32d Mon Sep 17 00:00:00 2001
+From d63ae78ee99fb9c0684a1fb23fed472f0b9ea2b3 Mon Sep 17 00:00:00 2001
 From: Tuowen Zhao <ztuowen@gmail.com>
-Date: Wed, 16 Oct 2019 15:06:27 -0600
-Subject: [PATCH 13/13] ioremap_uc
+Date: Wed, 16 Oct 2019 15:06:28 -0600
+Subject: [PATCH 12/13] ioremap_uc
 
 ---
  Documentation/driver-model/devres.txt |  1 +
- arch/sparc/include/asm/io_64.h        |  1 +
  drivers/mfd/intel-lpss.c              |  2 +-
  include/linux/io.h                    |  2 ++
  lib/devres.c                          | 19 +++++++++++++++++++
- 5 files changed, 24 insertions(+), 1 deletion(-)
+ 4 files changed, 23 insertions(+), 1 deletion(-)
 
 diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
 index 43681ca0837f..7b1ee4190208 100644
@@ -23,18 +22,6 @@ index 43681ca0837f..7b1ee4190208 100644
    devm_ioremap_wc()
    devm_ioremap_resource() : checks resource, requests memory region, ioremaps
    devm_iounmap()
-diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
-index b162c23ae8c2..7a836d21ff0c 100644
---- a/arch/sparc/include/asm/io_64.h
-+++ b/arch/sparc/include/asm/io_64.h
-@@ -409,6 +409,7 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
- }
- 
- #define ioremap_nocache(X,Y)		ioremap((X),(Y))
-+#define ioremap_uc(X,Y)			ioremap((X),(Y))
- #define ioremap_wc(X,Y)			ioremap((X),(Y))
- #define ioremap_wt(X,Y)			ioremap((X),(Y))
- 
 diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
 index ff3fba16e735..37a5bb09d228 100644
 --- a/drivers/mfd/intel-lpss.c
@@ -106,5 +93,5 @@ index faccf1a037d0..97c56f9893a4 100644
   * devm_ioremap_nocache - Managed ioremap_nocache()
   * @dev: Generic device to remap IO address for
 -- 
-2.24.0
+2.24.1
 

+ 0 - 359
patches/4.19/0012-surfacebook2-dgpu.patch

@@ -1,359 +0,0 @@
-From cc366ca006cf7e176d5edfa17c12d844701f543d Mon Sep 17 00:00:00 2001
-From: Maximilian Luz <luzmaximilian@gmail.com>
-Date: Sat, 28 Sep 2019 18:02:33 +0200
-Subject: [PATCH 12/13] surfacebook2-dgpu
-
----
- drivers/platform/x86/Kconfig                 |   9 +
- drivers/platform/x86/Makefile                |   1 +
- drivers/platform/x86/surfacebook2_dgpu_hps.c | 306 +++++++++++++++++++
- 3 files changed, 316 insertions(+)
- create mode 100644 drivers/platform/x86/surfacebook2_dgpu_hps.c
-
-diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 7cee1015981d..75665b560a6f 100644
---- a/drivers/platform/x86/Kconfig
-+++ b/drivers/platform/x86/Kconfig
-@@ -436,6 +436,15 @@ config SURFACE3_WMI
- 	  To compile this driver as a module, choose M here: the module will
- 	  be called surface3-wmi.
- 
-+config SURFACE_BOOK2_DGPU_HPS
-+	tristate "Surface Book 2 dGPU Hot-Plug System Driver"
-+	depends on ACPI
-+	---help---
-+	  This is an experimetnal driver to control the power-state of the
-+	  Surface Book 2 dGPU.
-+
-+	  If you have a Surface Book 2, say Y or M here.
-+
- config THINKPAD_ACPI
- 	tristate "ThinkPad ACPI Laptop Extras"
- 	depends on ACPI
-diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
-index cbea9579c1d2..6eb62f822953 100644
---- a/drivers/platform/x86/Makefile
-+++ b/drivers/platform/x86/Makefile
-@@ -44,6 +44,7 @@ obj-$(CONFIG_ACPI_WMI)		+= wmi.o
- obj-$(CONFIG_MSI_WMI)		+= msi-wmi.o
- obj-$(CONFIG_PEAQ_WMI)		+= peaq-wmi.o
- obj-$(CONFIG_SURFACE3_WMI)	+= surface3-wmi.o
-+obj-$(CONFIG_SURFACE_BOOK2_DGPU_HPS)	+= surfacebook2_dgpu_hps.o
- obj-$(CONFIG_TOPSTAR_LAPTOP)	+= topstar-laptop.o
- obj-$(CONFIG_WMI_BMOF)		+= wmi-bmof.o
- obj-$(CONFIG_INTEL_WMI_THUNDERBOLT)	+= intel-wmi-thunderbolt.o
-diff --git a/drivers/platform/x86/surfacebook2_dgpu_hps.c b/drivers/platform/x86/surfacebook2_dgpu_hps.c
-new file mode 100644
-index 000000000000..7639fb0029d8
---- /dev/null
-+++ b/drivers/platform/x86/surfacebook2_dgpu_hps.c
-@@ -0,0 +1,306 @@
-+#include <linux/acpi.h>
-+#include <linux/gpio.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/platform_device.h>
-+#include <linux/sysfs.h>
-+
-+#include <linux/uaccess.h>
-+
-+
-+#define SB2_SHPS_DSM_REVISION	1
-+#define SB2_SHPS_DSM_GPU_STATE	0x05
-+
-+static const guid_t SB2_SHPS_DSM_UUID =
-+	GUID_INIT(0x5515a847, 0xed55, 0x4b27, 0x83, 0x52, 0xcd,
-+	          0x32, 0x0e, 0x10, 0x36, 0x0a);
-+
-+#define SB2_PARAM_PERM		(S_IRUGO | S_IWUSR)
-+
-+
-+static const struct acpi_gpio_params gpio_base_presence_int = { 0, 0, false };
-+static const struct acpi_gpio_params gpio_base_presence     = { 1, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_power_int    = { 2, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_power        = { 3, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_presence_int = { 4, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_presence     = { 5, 0, false };
-+
-+static const struct acpi_gpio_mapping sb2_mshw0153_acpi_gpios[] = {
-+	{ "base_presence-int-gpio", &gpio_base_presence_int, 1 },
-+	{ "base_presence-gpio",     &gpio_base_presence,     1 },
-+	{ "dgpu_power-int-gpio",    &gpio_dgpu_power_int,    1 },
-+	{ "dgpu_power-gpio",        &gpio_dgpu_power,        1 },
-+	{ "dgpu_presence-int-gpio", &gpio_dgpu_presence_int, 1 },
-+	{ "dgpu_presence-gpio",     &gpio_dgpu_presence,     1 },
-+	{ },
-+};
-+
-+
-+enum sb2_dgpu_power {
-+	SB2_DGPU_POWER_OFF      = 0,
-+	SB2_DGPU_POWER_ON       = 1,
-+
-+	__SB2_DGPU_POWER__START = 0,
-+	__SB2_DGPU_POWER__END   = 1,
-+};
-+
-+enum sb2_param_dgpu_power {
-+	SB2_PARAM_DGPU_POWER_OFF      = SB2_DGPU_POWER_OFF,
-+	SB2_PARAM_DGPU_POWER_ON       = SB2_DGPU_POWER_ON,
-+	SB2_PARAM_DGPU_POWER_AS_IS    = 2,
-+
-+	__SB2_PARAM_DGPU_POWER__START = 0,
-+	__SB2_PARAM_DGPU_POWER__END   = 2,
-+};
-+
-+static const char* sb2_dgpu_power_str(enum sb2_dgpu_power power) {
-+	if (power == SB2_DGPU_POWER_OFF) {
-+		return "off";
-+	} else if (power == SB2_DGPU_POWER_ON) {
-+		return "on";
-+	} else {
-+		return "<invalid>";
-+	}
-+}
-+
-+
-+struct sb2_shps_driver_data {
-+	struct mutex dgpu_power_lock;
-+	enum sb2_dgpu_power dgpu_power;
-+};
-+
-+
-+static int __sb2_shps_dgpu_set_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
-+	union acpi_object *result;
-+	union acpi_object param;
-+
-+	param.type = ACPI_TYPE_INTEGER;
-+	param.integer.value = power == SB2_DGPU_POWER_ON;
-+
-+	result = acpi_evaluate_dsm_typed(handle, &SB2_SHPS_DSM_UUID, SB2_SHPS_DSM_REVISION,
-+	                                 SB2_SHPS_DSM_GPU_STATE, &param, ACPI_TYPE_BUFFER);
-+
-+	if (IS_ERR_OR_NULL(result)) {
-+		return result ? PTR_ERR(result) : -EFAULT;
-+	}
-+
-+	if (result->buffer.length != 1 || result->buffer.pointer[0] != 0) {
-+		return -EIO;
-+	}
-+
-+	drvdata->dgpu_power = power;
-+
-+	printk(KERN_INFO "sb2_shps: dGPU power state set to \'%s\'\n", sb2_dgpu_power_str(power));
-+
-+	ACPI_FREE(result);
-+	return 0;
-+}
-+
-+static int sb2_shps_dgpu_set_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	int status = 0;
-+
-+	if (power < __SB2_DGPU_POWER__START || power > __SB2_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	mutex_lock(&drvdata->dgpu_power_lock);
-+	if (power != drvdata->dgpu_power) {
-+		status = __sb2_shps_dgpu_set_power(pdev, power);
-+	}
-+	mutex_unlock(&drvdata->dgpu_power_lock);
-+
-+	return status;
-+}
-+
-+static int sb2_shps_dgpu_force_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	int status;
-+
-+	if (power < __SB2_DGPU_POWER__START || power > __SB2_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	mutex_lock(&drvdata->dgpu_power_lock);
-+	status = __sb2_shps_dgpu_set_power(pdev, power);
-+	mutex_unlock(&drvdata->dgpu_power_lock);
-+
-+	return status;
-+}
-+
-+
-+static int param_dgpu_power_set(const char *val, const struct kernel_param *kp)
-+{
-+	int power = SB2_PARAM_DGPU_POWER_OFF;
-+	int status;
-+
-+	status = kstrtoint(val, 0, &power);
-+	if (status) {
-+		return status;
-+	}
-+
-+	if (power < __SB2_PARAM_DGPU_POWER__START || power > __SB2_PARAM_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	return param_set_int(val, kp);
-+}
-+
-+static const struct kernel_param_ops param_dgpu_power_ops = {
-+	.set = param_dgpu_power_set,
-+	.get = param_get_int,
-+};
-+
-+static int param_dgpu_power_init = SB2_PARAM_DGPU_POWER_OFF;
-+static int param_dgpu_power_exit = SB2_PARAM_DGPU_POWER_OFF;
-+
-+module_param_cb(dgpu_power_init, &param_dgpu_power_ops, &param_dgpu_power_init, SB2_PARAM_PERM);
-+module_param_cb(dgpu_power_exit, &param_dgpu_power_ops, &param_dgpu_power_exit, SB2_PARAM_PERM);
-+
-+MODULE_PARM_DESC(dgpu_power_init, "dGPU power state to be set on init (0: off / 1: on / 2: as-is)");
-+MODULE_PARM_DESC(dgpu_power_exit, "dGPU power state to be set on exit (0: off / 1: on / 2: as-is)");
-+
-+
-+static ssize_t dgpu_power_show(struct device *dev, struct device_attribute *attr, char *data)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+
-+	return sprintf(data, "%s\n", sb2_dgpu_power_str(drvdata->dgpu_power));
-+}
-+
-+static ssize_t dgpu_power_store(struct device *dev, struct device_attribute *attr,
-+                                const char *data, size_t count)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	bool power = false;
-+	int status;
-+
-+	status = kstrtobool(data, &power);
-+	if (status) {
-+		return status;
-+	}
-+
-+	if (power) {
-+		status = sb2_shps_dgpu_set_power(pdev, SB2_DGPU_POWER_ON);
-+	} else {
-+		status = sb2_shps_dgpu_set_power(pdev, SB2_DGPU_POWER_OFF);
-+	}
-+
-+	return status < 0 ? status : count;
-+}
-+
-+const static DEVICE_ATTR_RW(dgpu_power);
-+
-+
-+#ifdef CONFIG_PM
-+
-+static int sb2_shps_resume(struct device *dev)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+
-+	return sb2_shps_dgpu_force_power(pdev, drvdata->dgpu_power);
-+}
-+
-+static SIMPLE_DEV_PM_OPS(sb2_shps_pm_ops, NULL, sb2_shps_resume);
-+
-+#endif
-+
-+
-+static int sb2_shps_probe(struct platform_device *pdev)
-+{
-+	struct sb2_shps_driver_data *drvdata;
-+	struct acpi_device *shps_dev = ACPI_COMPANION(&pdev->dev);
-+	int status = 0;
-+
-+	if (gpiod_count(&pdev->dev, NULL) < 0) {
-+		return -ENODEV;
-+	}
-+
-+	status = acpi_dev_add_driver_gpios(shps_dev, sb2_mshw0153_acpi_gpios);
-+	if (status) {
-+		return status;
-+	}
-+
-+	drvdata = kzalloc(sizeof(struct sb2_shps_driver_data), GFP_KERNEL);
-+	if (!drvdata) {
-+		status = -ENOMEM;
-+		goto err_alloc_drvdata;
-+	}
-+
-+	mutex_init(&drvdata->dgpu_power_lock);
-+	drvdata->dgpu_power = SB2_DGPU_POWER_OFF;
-+	platform_set_drvdata(pdev, drvdata);
-+
-+	if (param_dgpu_power_init != SB2_PARAM_DGPU_POWER_AS_IS) {
-+		status = sb2_shps_dgpu_force_power(pdev, param_dgpu_power_init);
-+		if (status) {
-+			goto err_set_power;
-+		}
-+	}
-+
-+	status = sysfs_create_file(&pdev->dev.kobj, &dev_attr_dgpu_power.attr);
-+	if (status) {
-+		goto err_sysfs;
-+	}
-+
-+	return 0;
-+
-+err_sysfs:
-+	sb2_shps_dgpu_force_power(pdev, SB2_DGPU_POWER_OFF);
-+err_set_power:
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+err_alloc_drvdata:
-+	acpi_dev_remove_driver_gpios(shps_dev);
-+	return status;
-+}
-+
-+static int sb2_shps_remove(struct platform_device *pdev)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	struct acpi_device *shps_dev = ACPI_COMPANION(&pdev->dev);
-+
-+	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_dgpu_power.attr);
-+
-+	if (param_dgpu_power_exit != SB2_PARAM_DGPU_POWER_AS_IS) {
-+		sb2_shps_dgpu_set_power(pdev, param_dgpu_power_exit);
-+	}
-+	acpi_dev_remove_driver_gpios(shps_dev);
-+
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+
-+	return 0;
-+}
-+
-+
-+static const struct acpi_device_id sb2_shps_acpi_match[] = {
-+	{ "MSHW0153", 0 },
-+	{ },
-+};
-+MODULE_DEVICE_TABLE(acpi, sb2_shps_acpi_match);
-+
-+static struct platform_driver sb2_shps_driver = {
-+	.probe = sb2_shps_probe,
-+	.remove = sb2_shps_remove,
-+	.driver = {
-+		.name = "sb2_shps",
-+		.acpi_match_table = ACPI_PTR(sb2_shps_acpi_match),
-+#ifdef CONFIG_PM
-+		.pm = &sb2_shps_pm_ops,
-+#endif
-+	},
-+};
-+module_platform_driver(sb2_shps_driver);
-+
-+MODULE_AUTHOR("Maximilian Luz <luzmaximilian@gmail.com>");
-+MODULE_DESCRIPTION("Surface Book 2 Hot-Plug System Driver");
-+MODULE_LICENSE("GPL v2");
--- 
-2.24.0
-

+ 63 - 0
patches/4.19/0013-surface3-spi-dma.patch

@@ -0,0 +1,63 @@
+From 981e1123997405f871305892fe26d79ee64abf1d Mon Sep 17 00:00:00 2001
+From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
+Date: Fri, 6 Dec 2019 23:10:30 +0900
+Subject: [PATCH 13/13] surface3-spi dma
+
+---
+ drivers/input/touchscreen/surface3_spi.c | 26 ++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
+index 5db0f1c4ef38..8935ddbc2357 100644
+--- a/drivers/input/touchscreen/surface3_spi.c
++++ b/drivers/input/touchscreen/surface3_spi.c
+@@ -29,6 +29,12 @@
+ #define SURFACE3_REPORT_TOUCH	0xd2
+ #define SURFACE3_REPORT_PEN	0x16
+ 
++bool use_dma = false;
++module_param(use_dma, bool, 0644);
++MODULE_PARM_DESC(use_dma,
++				"Disable DMA mode if you encounter touch input crash. "
++				"(default: false, disabled to avoid crash)");
++
+ struct surface3_ts_data {
+ 	struct spi_device *spi;
+ 	struct gpio_desc *gpiod_rst[2];
+@@ -330,6 +336,13 @@ static int surface3_spi_create_pen_input(struct surface3_ts_data *data)
+ 	return 0;
+ }
+ 
++static bool surface3_spi_can_dma(struct spi_controller *ctlr,
++				struct spi_device *spi,
++				struct spi_transfer *tfr)
++{
++	return use_dma;
++}
++
+ static int surface3_spi_probe(struct spi_device *spi)
+ {
+ 	struct surface3_ts_data *data;
+@@ -372,6 +385,19 @@ static int surface3_spi_probe(struct spi_device *spi)
+ 	if (error)
+ 		return error;
+ 
++	/*
++	 * Set up DMA
++	 *
++	 * TODO: Currently, touch input with DMA seems to be broken.
++	 * On 4.19 LTS, touch input will crash after suspend.
++	 * On recent stable kernel (at least after 5.1), touch input will crash after
++	 * the first touch. No problem with PIO on those kernels.
++	 * Maybe we need to configure DMA here.
++	 *
++	 * Link to issue: https://github.com/jakeday/linux-surface/issues/596
++	 */
++	spi->controller->can_dma = surface3_spi_can_dma;
++
+ 	return 0;
+ }
+ 
+-- 
+2.24.1
+

File diff suppressed because it is too large
+ 1253 - 121
patches/5.3/0001-surface-acpi.patch


+ 2 - 2
patches/5.3/0002-buttons.patch

@@ -1,4 +1,4 @@
-From d836ba289ea5db5f1cee4dbc6c9d01221a485dfb Mon Sep 17 00:00:00 2001
+From 5e6d16a8fb200eb0325061c7a0f10126d69c2466 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Sat, 27 Jul 2019 17:51:37 +0200
 Subject: [PATCH 02/10] buttons
@@ -270,5 +270,5 @@ index 47c6d000465a..ec515223f654 100644
  	if (!button)
  		return -ENOMEM;
 -- 
-2.24.0
+2.24.1
 

+ 3 - 3
patches/5.3/0004-hid.patch → patches/5.3/0003-hid.patch

@@ -1,7 +1,7 @@
-From 4d565b178d767e637429bfe12feeda48cddf1484 Mon Sep 17 00:00:00 2001
+From 36d79941fc26dde7702139c3df51a6f4dc54b64f Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= <blaz@mxxn.io>
 Date: Wed, 6 Nov 2019 19:43:26 +0900
-Subject: [PATCH 04/10] hid
+Subject: [PATCH 03/10] hid
 
 ---
  drivers/hid/hid-core.c | 4 ++++
@@ -23,5 +23,5 @@ index 12149c5c39e4..dea1f9139b5c 100644
  
  static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 -- 
-2.24.0
+2.24.1
 

+ 0 - 359
patches/5.3/0003-surfacebook2-dgpu.patch

@@ -1,359 +0,0 @@
-From 84256bec041bd435d4413fc07841a103c7335583 Mon Sep 17 00:00:00 2001
-From: Maximilian Luz <luzmaximilian@gmail.com>
-Date: Tue, 2 Jul 2019 22:17:46 +0200
-Subject: [PATCH 03/10] surfacebook2-dgpu
-
----
- drivers/platform/x86/Kconfig                 |   9 +
- drivers/platform/x86/Makefile                |   1 +
- drivers/platform/x86/surfacebook2_dgpu_hps.c | 306 +++++++++++++++++++
- 3 files changed, 316 insertions(+)
- create mode 100644 drivers/platform/x86/surfacebook2_dgpu_hps.c
-
-diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 9dea69a1526a..0c8971f1774e 100644
---- a/drivers/platform/x86/Kconfig
-+++ b/drivers/platform/x86/Kconfig
-@@ -481,6 +481,15 @@ config SURFACE3_WMI
- 	  To compile this driver as a module, choose M here: the module will
- 	  be called surface3-wmi.
- 
-+config SURFACE_BOOK2_DGPU_HPS
-+	tristate "Surface Book 2 dGPU Hot-Plug System Driver"
-+	depends on ACPI
-+	---help---
-+	  This is an experimetnal driver to control the power-state of the
-+	  Surface Book 2 dGPU.
-+
-+	  If you have a Surface Book 2, say Y or M here.
-+
- config THINKPAD_ACPI
- 	tristate "ThinkPad ACPI Laptop Extras"
- 	depends on ACPI
-diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
-index 18f5a4ba7244..725dedf5fbfe 100644
---- a/drivers/platform/x86/Makefile
-+++ b/drivers/platform/x86/Makefile
-@@ -48,6 +48,7 @@ obj-$(CONFIG_ACPI_WMI)		+= wmi.o
- obj-$(CONFIG_MSI_WMI)		+= msi-wmi.o
- obj-$(CONFIG_PEAQ_WMI)		+= peaq-wmi.o
- obj-$(CONFIG_SURFACE3_WMI)	+= surface3-wmi.o
-+obj-$(CONFIG_SURFACE_BOOK2_DGPU_HPS)	+= surfacebook2_dgpu_hps.o
- obj-$(CONFIG_TOPSTAR_LAPTOP)	+= topstar-laptop.o
- obj-$(CONFIG_WMI_BMOF)		+= wmi-bmof.o
- obj-$(CONFIG_INTEL_WMI_THUNDERBOLT)	+= intel-wmi-thunderbolt.o
-diff --git a/drivers/platform/x86/surfacebook2_dgpu_hps.c b/drivers/platform/x86/surfacebook2_dgpu_hps.c
-new file mode 100644
-index 000000000000..7639fb0029d8
---- /dev/null
-+++ b/drivers/platform/x86/surfacebook2_dgpu_hps.c
-@@ -0,0 +1,306 @@
-+#include <linux/acpi.h>
-+#include <linux/gpio.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/platform_device.h>
-+#include <linux/sysfs.h>
-+
-+#include <linux/uaccess.h>
-+
-+
-+#define SB2_SHPS_DSM_REVISION	1
-+#define SB2_SHPS_DSM_GPU_STATE	0x05
-+
-+static const guid_t SB2_SHPS_DSM_UUID =
-+	GUID_INIT(0x5515a847, 0xed55, 0x4b27, 0x83, 0x52, 0xcd,
-+	          0x32, 0x0e, 0x10, 0x36, 0x0a);
-+
-+#define SB2_PARAM_PERM		(S_IRUGO | S_IWUSR)
-+
-+
-+static const struct acpi_gpio_params gpio_base_presence_int = { 0, 0, false };
-+static const struct acpi_gpio_params gpio_base_presence     = { 1, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_power_int    = { 2, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_power        = { 3, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_presence_int = { 4, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_presence     = { 5, 0, false };
-+
-+static const struct acpi_gpio_mapping sb2_mshw0153_acpi_gpios[] = {
-+	{ "base_presence-int-gpio", &gpio_base_presence_int, 1 },
-+	{ "base_presence-gpio",     &gpio_base_presence,     1 },
-+	{ "dgpu_power-int-gpio",    &gpio_dgpu_power_int,    1 },
-+	{ "dgpu_power-gpio",        &gpio_dgpu_power,        1 },
-+	{ "dgpu_presence-int-gpio", &gpio_dgpu_presence_int, 1 },
-+	{ "dgpu_presence-gpio",     &gpio_dgpu_presence,     1 },
-+	{ },
-+};
-+
-+
-+enum sb2_dgpu_power {
-+	SB2_DGPU_POWER_OFF      = 0,
-+	SB2_DGPU_POWER_ON       = 1,
-+
-+	__SB2_DGPU_POWER__START = 0,
-+	__SB2_DGPU_POWER__END   = 1,
-+};
-+
-+enum sb2_param_dgpu_power {
-+	SB2_PARAM_DGPU_POWER_OFF      = SB2_DGPU_POWER_OFF,
-+	SB2_PARAM_DGPU_POWER_ON       = SB2_DGPU_POWER_ON,
-+	SB2_PARAM_DGPU_POWER_AS_IS    = 2,
-+
-+	__SB2_PARAM_DGPU_POWER__START = 0,
-+	__SB2_PARAM_DGPU_POWER__END   = 2,
-+};
-+
-+static const char* sb2_dgpu_power_str(enum sb2_dgpu_power power) {
-+	if (power == SB2_DGPU_POWER_OFF) {
-+		return "off";
-+	} else if (power == SB2_DGPU_POWER_ON) {
-+		return "on";
-+	} else {
-+		return "<invalid>";
-+	}
-+}
-+
-+
-+struct sb2_shps_driver_data {
-+	struct mutex dgpu_power_lock;
-+	enum sb2_dgpu_power dgpu_power;
-+};
-+
-+
-+static int __sb2_shps_dgpu_set_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
-+	union acpi_object *result;
-+	union acpi_object param;
-+
-+	param.type = ACPI_TYPE_INTEGER;
-+	param.integer.value = power == SB2_DGPU_POWER_ON;
-+
-+	result = acpi_evaluate_dsm_typed(handle, &SB2_SHPS_DSM_UUID, SB2_SHPS_DSM_REVISION,
-+	                                 SB2_SHPS_DSM_GPU_STATE, &param, ACPI_TYPE_BUFFER);
-+
-+	if (IS_ERR_OR_NULL(result)) {
-+		return result ? PTR_ERR(result) : -EFAULT;
-+	}
-+
-+	if (result->buffer.length != 1 || result->buffer.pointer[0] != 0) {
-+		return -EIO;
-+	}
-+
-+	drvdata->dgpu_power = power;
-+
-+	printk(KERN_INFO "sb2_shps: dGPU power state set to \'%s\'\n", sb2_dgpu_power_str(power));
-+
-+	ACPI_FREE(result);
-+	return 0;
-+}
-+
-+static int sb2_shps_dgpu_set_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	int status = 0;
-+
-+	if (power < __SB2_DGPU_POWER__START || power > __SB2_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	mutex_lock(&drvdata->dgpu_power_lock);
-+	if (power != drvdata->dgpu_power) {
-+		status = __sb2_shps_dgpu_set_power(pdev, power);
-+	}
-+	mutex_unlock(&drvdata->dgpu_power_lock);
-+
-+	return status;
-+}
-+
-+static int sb2_shps_dgpu_force_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	int status;
-+
-+	if (power < __SB2_DGPU_POWER__START || power > __SB2_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	mutex_lock(&drvdata->dgpu_power_lock);
-+	status = __sb2_shps_dgpu_set_power(pdev, power);
-+	mutex_unlock(&drvdata->dgpu_power_lock);
-+
-+	return status;
-+}
-+
-+
-+static int param_dgpu_power_set(const char *val, const struct kernel_param *kp)
-+{
-+	int power = SB2_PARAM_DGPU_POWER_OFF;
-+	int status;
-+
-+	status = kstrtoint(val, 0, &power);
-+	if (status) {
-+		return status;
-+	}
-+
-+	if (power < __SB2_PARAM_DGPU_POWER__START || power > __SB2_PARAM_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	return param_set_int(val, kp);
-+}
-+
-+static const struct kernel_param_ops param_dgpu_power_ops = {
-+	.set = param_dgpu_power_set,
-+	.get = param_get_int,
-+};
-+
-+static int param_dgpu_power_init = SB2_PARAM_DGPU_POWER_OFF;
-+static int param_dgpu_power_exit = SB2_PARAM_DGPU_POWER_OFF;
-+
-+module_param_cb(dgpu_power_init, &param_dgpu_power_ops, &param_dgpu_power_init, SB2_PARAM_PERM);
-+module_param_cb(dgpu_power_exit, &param_dgpu_power_ops, &param_dgpu_power_exit, SB2_PARAM_PERM);
-+
-+MODULE_PARM_DESC(dgpu_power_init, "dGPU power state to be set on init (0: off / 1: on / 2: as-is)");
-+MODULE_PARM_DESC(dgpu_power_exit, "dGPU power state to be set on exit (0: off / 1: on / 2: as-is)");
-+
-+
-+static ssize_t dgpu_power_show(struct device *dev, struct device_attribute *attr, char *data)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+
-+	return sprintf(data, "%s\n", sb2_dgpu_power_str(drvdata->dgpu_power));
-+}
-+
-+static ssize_t dgpu_power_store(struct device *dev, struct device_attribute *attr,
-+                                const char *data, size_t count)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	bool power = false;
-+	int status;
-+
-+	status = kstrtobool(data, &power);
-+	if (status) {
-+		return status;
-+	}
-+
-+	if (power) {
-+		status = sb2_shps_dgpu_set_power(pdev, SB2_DGPU_POWER_ON);
-+	} else {
-+		status = sb2_shps_dgpu_set_power(pdev, SB2_DGPU_POWER_OFF);
-+	}
-+
-+	return status < 0 ? status : count;
-+}
-+
-+const static DEVICE_ATTR_RW(dgpu_power);
-+
-+
-+#ifdef CONFIG_PM
-+
-+static int sb2_shps_resume(struct device *dev)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+
-+	return sb2_shps_dgpu_force_power(pdev, drvdata->dgpu_power);
-+}
-+
-+static SIMPLE_DEV_PM_OPS(sb2_shps_pm_ops, NULL, sb2_shps_resume);
-+
-+#endif
-+
-+
-+static int sb2_shps_probe(struct platform_device *pdev)
-+{
-+	struct sb2_shps_driver_data *drvdata;
-+	struct acpi_device *shps_dev = ACPI_COMPANION(&pdev->dev);
-+	int status = 0;
-+
-+	if (gpiod_count(&pdev->dev, NULL) < 0) {
-+		return -ENODEV;
-+	}
-+
-+	status = acpi_dev_add_driver_gpios(shps_dev, sb2_mshw0153_acpi_gpios);
-+	if (status) {
-+		return status;
-+	}
-+
-+	drvdata = kzalloc(sizeof(struct sb2_shps_driver_data), GFP_KERNEL);
-+	if (!drvdata) {
-+		status = -ENOMEM;
-+		goto err_alloc_drvdata;
-+	}
-+
-+	mutex_init(&drvdata->dgpu_power_lock);
-+	drvdata->dgpu_power = SB2_DGPU_POWER_OFF;
-+	platform_set_drvdata(pdev, drvdata);
-+
-+	if (param_dgpu_power_init != SB2_PARAM_DGPU_POWER_AS_IS) {
-+		status = sb2_shps_dgpu_force_power(pdev, param_dgpu_power_init);
-+		if (status) {
-+			goto err_set_power;
-+		}
-+	}
-+
-+	status = sysfs_create_file(&pdev->dev.kobj, &dev_attr_dgpu_power.attr);
-+	if (status) {
-+		goto err_sysfs;
-+	}
-+
-+	return 0;
-+
-+err_sysfs:
-+	sb2_shps_dgpu_force_power(pdev, SB2_DGPU_POWER_OFF);
-+err_set_power:
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+err_alloc_drvdata:
-+	acpi_dev_remove_driver_gpios(shps_dev);
-+	return status;
-+}
-+
-+static int sb2_shps_remove(struct platform_device *pdev)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	struct acpi_device *shps_dev = ACPI_COMPANION(&pdev->dev);
-+
-+	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_dgpu_power.attr);
-+
-+	if (param_dgpu_power_exit != SB2_PARAM_DGPU_POWER_AS_IS) {
-+		sb2_shps_dgpu_set_power(pdev, param_dgpu_power_exit);
-+	}
-+	acpi_dev_remove_driver_gpios(shps_dev);
-+
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+
-+	return 0;
-+}
-+
-+
-+static const struct acpi_device_id sb2_shps_acpi_match[] = {
-+	{ "MSHW0153", 0 },
-+	{ },
-+};
-+MODULE_DEVICE_TABLE(acpi, sb2_shps_acpi_match);
-+
-+static struct platform_driver sb2_shps_driver = {
-+	.probe = sb2_shps_probe,
-+	.remove = sb2_shps_remove,
-+	.driver = {
-+		.name = "sb2_shps",
-+		.acpi_match_table = ACPI_PTR(sb2_shps_acpi_match),
-+#ifdef CONFIG_PM
-+		.pm = &sb2_shps_pm_ops,
-+#endif
-+	},
-+};
-+module_platform_driver(sb2_shps_driver);
-+
-+MODULE_AUTHOR("Maximilian Luz <luzmaximilian@gmail.com>");
-+MODULE_DESCRIPTION("Surface Book 2 Hot-Plug System Driver");
-+MODULE_LICENSE("GPL v2");
--- 
-2.24.0
-

+ 7 - 7
patches/5.3/0005-surface3-power.patch → patches/5.3/0004-surface3-power.patch

@@ -1,7 +1,7 @@
-From 01219c3aed6f2f1887c4abeac02e90db353fd922 Mon Sep 17 00:00:00 2001
+From 40f02c1a770696c46b38c949f418c561711b6819 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 05/10] surface3-power
+Subject: [PATCH 04/10] surface3-power
 
 ---
  drivers/platform/x86/Kconfig          |   7 +
@@ -11,10 +11,10 @@ Subject: [PATCH 05/10] surface3-power
  create mode 100644 drivers/platform/x86/surface3_power.c
 
 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 0c8971f1774e..c3d68aeec587 100644
+index 9dea69a1526a..275f6498e162 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -1218,6 +1218,13 @@ config SURFACE_3_BUTTON
+@@ -1209,6 +1209,13 @@ config SURFACE_3_BUTTON
  	---help---
  	  This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet.
  
@@ -29,10 +29,10 @@ index 0c8971f1774e..c3d68aeec587 100644
  	tristate "Intel P-Unit IPC Driver"
  	---help---
 diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
-index 725dedf5fbfe..705525ff99a7 100644
+index 18f5a4ba7244..19b56f2181eb 100644
 --- a/drivers/platform/x86/Makefile
 +++ b/drivers/platform/x86/Makefile
-@@ -86,6 +86,7 @@ obj-$(CONFIG_INTEL_PMC_IPC)	+= intel_pmc_ipc.o
+@@ -85,6 +85,7 @@ obj-$(CONFIG_INTEL_PMC_IPC)	+= intel_pmc_ipc.o
  obj-$(CONFIG_TOUCHSCREEN_DMI)	+= touchscreen_dmi.o
  obj-$(CONFIG_SURFACE_PRO3_BUTTON)	+= surfacepro3_button.o
  obj-$(CONFIG_SURFACE_3_BUTTON)	+= surface3_button.o
@@ -651,5 +651,5 @@ index 000000000000..e0af01a60302
 +MODULE_DESCRIPTION("mshw0011 driver");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.24.0
+2.24.1
 

+ 3 - 3
patches/5.3/0006-surface-lte.patch → patches/5.3/0005-surface-lte.patch

@@ -1,7 +1,7 @@
-From 0e6c9d5398a6d2254c6d595112b234e222637a8b Mon Sep 17 00:00:00 2001
+From 5aba1417751252a6dcdb18ff3ad311bf7611689c Mon Sep 17 00:00:00 2001
 From: qzed <qzed@users.noreply.github.com>
 Date: Tue, 17 Sep 2019 17:21:43 +0200
-Subject: [PATCH 06/10] surface-lte
+Subject: [PATCH 05/10] surface-lte
 
 ---
  drivers/usb/serial/qcserial.c | 1 +
@@ -20,5 +20,5 @@ index 613f91add03d..e1428222dd73 100644
  	/* Huawei devices */
  	{DEVICE_HWI(0x03f0, 0x581d)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
 -- 
-2.24.0
+2.24.1
 

+ 171 - 0
patches/5.3/0006-wifi.patch

@@ -0,0 +1,171 @@
+From 1d1f574d38351171cb963be29c2eaee4b5317895 Mon Sep 17 00:00:00 2001
+From: sebanc <22224731+sebanc@users.noreply.github.com>
+Date: Mon, 4 Nov 2019 09:30:57 +0100
+Subject: [PATCH 06/10] wifi
+
+---
+ drivers/net/wireless/marvell/mwifiex/pcie.c   | 75 ++++++++++---------
+ .../net/wireless/marvell/mwifiex/sta_cmd.c    | 15 +---
+ 2 files changed, 40 insertions(+), 50 deletions(-)
+
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
+index b54f73e3d508..f0925b3d5aaf 100644
+--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
+@@ -149,37 +149,39 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
+  */
+ static int mwifiex_pcie_suspend(struct device *dev)
+ {
+-	struct mwifiex_adapter *adapter;
+-	struct pcie_service_card *card;
+ 	struct pci_dev *pdev = to_pci_dev(dev);
++	struct pcie_service_card *card = pci_get_drvdata(pdev);
++	struct mwifiex_adapter *adapter;
++	struct mwifiex_private *priv;
++	const struct mwifiex_pcie_card_reg *reg;
++	u32 fw_status;
++	int ret;
+ 
+-	card = pci_get_drvdata(pdev);
+ 
+ 	/* Might still be loading firmware */
+ 	wait_for_completion(&card->fw_done);
+ 
+ 	adapter = card->adapter;
+-	if (!adapter) {
+-		dev_err(dev, "adapter is not valid\n");
++	if (!adapter || !adapter->priv_num)
+ 		return 0;
+-	}
+ 
+-	mwifiex_enable_wake(adapter);
++	reg = card->pcie.reg;
++	if (reg)
++		ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
++	else
++		fw_status = -1;
++
++	if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
++		mwifiex_deauthenticate_all(adapter);
+ 
+-	/* Enable the Host Sleep */
+-	if (!mwifiex_enable_hs(adapter)) {
+-		mwifiex_dbg(adapter, ERROR,
+-			    "cmd: failed to suspend\n");
+-		clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
+-		mwifiex_disable_wake(adapter);
+-		return -EFAULT;
+-	}
++		priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
+ 
+-	flush_workqueue(adapter->workqueue);
++		mwifiex_disable_auto_ds(priv);
++
++		mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
++	}
+ 
+-	/* Indicate device suspended */
+-	set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
+-	clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
++	mwifiex_remove_card(adapter);
+ 
+ 	return 0;
+ }
+@@ -194,30 +196,29 @@ static int mwifiex_pcie_suspend(struct device *dev)
+  */
+ static int mwifiex_pcie_resume(struct device *dev)
+ {
+-	struct mwifiex_adapter *adapter;
+-	struct pcie_service_card *card;
+ 	struct pci_dev *pdev = to_pci_dev(dev);
++	struct pcie_service_card *card = pci_get_drvdata(pdev);
++	int ret;
+ 
+-	card = pci_get_drvdata(pdev);
++	pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
++		 pdev->vendor, pdev->device, pdev->revision);
+ 
+-	if (!card->adapter) {
+-		dev_err(dev, "adapter structure is not valid\n");
+-		return 0;
+-	}
++	init_completion(&card->fw_done);
+ 
+-	adapter = card->adapter;
++	card->dev = pdev;
+ 
+-	if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
+-		mwifiex_dbg(adapter, WARN,
+-			    "Device already resumed\n");
+-		return 0;
++	/* device tree node parsing and platform specific configuration */
++	if (pdev->dev.of_node) {
++		ret = mwifiex_pcie_probe_of(&pdev->dev);
++		if (ret)
++			return ret;
+ 	}
+ 
+-	clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
+-
+-	mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
+-			  MWIFIEX_ASYNC_CMD);
+-	mwifiex_disable_wake(adapter);
++	if (mwifiex_add_card(card, &card->fw_done, &pcie_ops,
++			MWIFIEX_PCIE, &pdev->dev)) {
++		pr_err("%s failed\n", __func__);
++		return -1;
++	}
+ 
+ 	return 0;
+ }
+@@ -271,6 +272,8 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
+ 		return -1;
+ 	}
+ 
++	pdev->bus->self->bridge_d3 = false;
++
+ 	return 0;
+ }
+ 
+diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+index 4ed10cf82f9a..013db4386c39 100644
+--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
++++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+@@ -2265,14 +2265,13 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
+ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
+ {
+ 	struct mwifiex_adapter *adapter = priv->adapter;
+-	int ret;
+ 	struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
+-	struct mwifiex_ds_auto_ds auto_ds;
+ 	enum state_11d_t state_11d;
+ 	struct mwifiex_ds_11n_tx_cfg tx_cfg;
+ 	u8 sdio_sp_rx_aggr_enable;
+ 	u16 packet_aggr_enable;
+ 	int data;
++	int ret;
+ 
+ 	if (first_sta) {
+ 		if (priv->adapter->iface_type == MWIFIEX_PCIE) {
+@@ -2395,18 +2394,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
+ 	if (ret)
+ 		return -1;
+ 
+-	if (!disable_auto_ds && first_sta &&
+-	    priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
+-		/* Enable auto deep sleep */
+-		auto_ds.auto_ds = DEEP_SLEEP_ON;
+-		auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;
+-		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH,
+-				       EN_AUTO_PS, BITMAP_AUTO_DS,
+-				       &auto_ds, true);
+-		if (ret)
+-			return -1;
+-	}
+-
+ 	if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
+ 		/* Send cmd to FW to enable/disable 11D function */
+ 		state_11d = ENABLE_11D;
+-- 
+2.24.1
+

+ 3 - 3
patches/5.3/0008-legacy-i915.patch → patches/5.3/0007-legacy-i915.patch

@@ -1,7 +1,7 @@
-From 53a9de609c3ffeb174f9551c221d4a63d1d15542 Mon Sep 17 00:00:00 2001
+From 42e6a02bc692206b0e6800278e781fc03d988b89 Mon Sep 17 00:00:00 2001
 From: Dorian Stoll <dorian.stoll@tmsp.io>
 Date: Mon, 16 Sep 2019 04:10:51 +0200
-Subject: [PATCH 08/10] legacy-i915
+Subject: [PATCH 07/10] legacy-i915
 
 ---
  drivers/gpu/drm/Kconfig                       |     2 +-
@@ -247066,5 +247066,5 @@ index 000000000000..8ea1c927dbad
 +	I915_WRITE(MIPI_EOT_DISABLE(port), CLOCKSTOP);
 +}
 -- 
-2.24.0
+2.24.1
 

+ 0 - 267
patches/5.3/0007-wifi.patch

@@ -1,267 +0,0 @@
-From 2e405d90dc591416b6e1aebaeba84cb09e317f07 Mon Sep 17 00:00:00 2001
-From: qzed <qzed@users.noreply.github.com>
-Date: Wed, 18 Sep 2019 03:18:25 +0200
-Subject: [PATCH 07/10] wifi
-
----
- drivers/net/wireless/marvell/mwifiex/11n_aggr.c |  3 +--
- drivers/net/wireless/marvell/mwifiex/cfg80211.c |  5 ++++-
- drivers/net/wireless/marvell/mwifiex/cmdevt.c   | 10 ++++++----
- drivers/net/wireless/marvell/mwifiex/fw.h       |  1 +
- drivers/net/wireless/marvell/mwifiex/main.c     | 17 +++++++++++++----
- drivers/net/wireless/marvell/mwifiex/main.h     |  2 ++
- drivers/net/wireless/marvell/mwifiex/pcie.c     |  9 +++++++++
- drivers/net/wireless/marvell/mwifiex/sta_cmd.c  |  4 ++--
- .../net/wireless/marvell/mwifiex/sta_cmdresp.c  | 10 +++++++---
- drivers/net/wireless/marvell/mwifiex/usb.c      |  2 ++
- scripts/leaking_addresses.pl                    |  0
- 11 files changed, 47 insertions(+), 16 deletions(-)
- mode change 100755 => 100644 scripts/leaking_addresses.pl
-
-diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
-index 088612438530..4386e657dfdb 100644
---- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
-+++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
-@@ -198,8 +198,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
- 
- 	do {
- 		/* Check if AMSDU can accommodate this MSDU */
--		if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) >
--		    adapter->tx_buf_size)
-+		if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
- 			break;
- 
- 		skb_src = skb_dequeue(&pra_list->skb_head);
-diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
-index d89684168500..1545bae9d6cf 100644
---- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
-+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
-@@ -437,7 +437,10 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
- 		mwifiex_dbg(priv->adapter, INFO,
- 			    "info: ignore timeout value for IEEE Power Save\n");
- 
--	ps_mode = enabled;
-+	//ps_mode = enabled;
-+
-+	mwifiex_dbg(priv->adapter, INFO, "overriding ps_mode to false\n");
-+	ps_mode = 0;
- 
- 	return mwifiex_drv_set_power(priv, &ps_mode);
- }
-diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
-index e8788c35a453..82d25b3ca914 100644
---- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
-+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
-@@ -1004,6 +1004,7 @@ mwifiex_cmd_timeout_func(struct timer_list *t)
- 		if (cmd_node->wait_q_enabled) {
- 			adapter->cmd_wait_q.status = -ETIMEDOUT;
- 			mwifiex_cancel_pending_ioctl(adapter);
-+			adapter->cmd_sent = false;
- 		}
- 	}
- 	if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) {
-@@ -1011,11 +1012,11 @@ mwifiex_cmd_timeout_func(struct timer_list *t)
- 		return;
- 	}
- 
--	if (adapter->if_ops.device_dump)
--		adapter->if_ops.device_dump(adapter);
-+	//if (adapter->if_ops.device_dump)
-+	//	adapter->if_ops.device_dump(adapter);
- 
--	if (adapter->if_ops.card_reset)
--		adapter->if_ops.card_reset(adapter);
-+	//if (adapter->if_ops.card_reset)
-+	//	adapter->if_ops.card_reset(adapter);
- }
- 
- void
-@@ -1578,6 +1579,7 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
- 						    adapter->key_api_minor_ver);
- 					break;
- 				case FW_API_VER_ID:
-+				case FW_KEY_API_VER_ID:
- 					adapter->fw_api_ver =
- 							api_rev->major_ver;
- 					mwifiex_dbg(adapter, INFO,
-diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
-index 1fb76d2f5d3f..fb32379da99d 100644
---- a/drivers/net/wireless/marvell/mwifiex/fw.h
-+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
-@@ -1052,6 +1052,7 @@ struct host_cmd_ds_802_11_ps_mode_enh {
- enum API_VER_ID {
- 	KEY_API_VER_ID = 1,
- 	FW_API_VER_ID = 2,
-+	FW_KEY_API_VER_ID = 4,
- };
- 
- struct hw_spec_api_rev {
-diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
-index a9657ae6d782..ba99d84a31ef 100644
---- a/drivers/net/wireless/marvell/mwifiex/main.c
-+++ b/drivers/net/wireless/marvell/mwifiex/main.c
-@@ -163,6 +163,7 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
- 	spin_lock_irqsave(&adapter->main_proc_lock, flags);
- 	if (adapter->mwifiex_processing) {
- 		adapter->more_task_flag = true;
-+		adapter->more_rx_task_flag = true;
- 		spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
- 	} else {
- 		spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
-@@ -171,16 +172,18 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
- }
- EXPORT_SYMBOL_GPL(mwifiex_queue_main_work);
- 
--static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
-+void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
- {
- 	spin_lock_bh(&adapter->rx_proc_lock);
- 	if (adapter->rx_processing) {
-+		adapter->more_rx_task_flag = true;
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 	} else {
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 		queue_work(adapter->rx_workqueue, &adapter->rx_work);
- 	}
- }
-+EXPORT_SYMBOL_GPL(mwifiex_queue_rx_work);
- 
- static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- {
-@@ -189,6 +192,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- 
- 	spin_lock_bh(&adapter->rx_proc_lock);
- 	if (adapter->rx_processing || adapter->rx_locked) {
-+		adapter->more_rx_task_flag = true;
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 		goto exit_rx_proc;
- 	} else {
-@@ -196,6 +200,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 	}
- 
-+rx_process_start:
- 	/* Check for Rx data */
- 	while ((skb = skb_dequeue(&adapter->rx_data_q))) {
- 		atomic_dec(&adapter->rx_pending);
-@@ -217,6 +222,11 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- 		}
- 	}
- 	spin_lock_bh(&adapter->rx_proc_lock);
-+	if (adapter->more_rx_task_flag) {
-+		adapter->more_rx_task_flag = false;
-+		spin_unlock_bh(&adapter->rx_proc_lock);
-+		goto rx_process_start;
-+	}
- 	adapter->rx_processing = false;
- 	spin_unlock_bh(&adapter->rx_proc_lock);
- 
-@@ -280,11 +290,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
- 				mwifiex_process_hs_config(adapter);
- 			if (adapter->if_ops.process_int_status)
- 				adapter->if_ops.process_int_status(adapter);
-+			if (adapter->rx_work_enabled && adapter->data_received)
-+				mwifiex_queue_rx_work(adapter);
- 		}
- 
--		if (adapter->rx_work_enabled && adapter->data_received)
--			mwifiex_queue_rx_work(adapter);
--
- 		/* Need to wake up the card ? */
- 		if ((adapter->ps_state == PS_STATE_SLEEP) &&
- 		    (adapter->pm_wakeup_card_req &&
-diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
-index 095837fba300..5dca5c25c601 100644
---- a/drivers/net/wireless/marvell/mwifiex/main.h
-+++ b/drivers/net/wireless/marvell/mwifiex/main.h
-@@ -909,6 +909,7 @@ struct mwifiex_adapter {
- 	spinlock_t main_proc_lock;
- 	u32 mwifiex_processing;
- 	u8 more_task_flag;
-+	u8 more_rx_task_flag;
- 	u16 tx_buf_size;
- 	u16 curr_tx_buf_size;
- 	/* sdio single port rx aggregation capability */
-@@ -1695,6 +1696,7 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
- void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
- void mwifiex_fw_dump_event(struct mwifiex_private *priv);
- void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
-+void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter);
- int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
- 			      int cmd_type,
- 			      struct mwifiex_ds_wakeup_reason *wakeup_reason);
-diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
-index b54f73e3d508..32502f443b9a 100644
---- a/drivers/net/wireless/marvell/mwifiex/pcie.c
-+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
-@@ -1743,6 +1743,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
- 	}
- 
- 	rx_len = get_unaligned_le16(skb->data);
-+
-+	if (rx_len == 0) {
-+		mwifiex_dbg(adapter, ERROR,
-+				    "0 byte cmdrsp\n");
-+		mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
-+					   PCI_DMA_FROMDEVICE);
-+		return 0;
-+	}
-+
- 	skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len);
- 	skb_trim(skb, rx_len);
- 
-diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
-index 4ed10cf82f9a..485360e8534b 100644
---- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
-+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
-@@ -30,8 +30,8 @@ static bool drcs;
- module_param(drcs, bool, 0644);
- MODULE_PARM_DESC(drcs, "multi-channel operation:1, single-channel operation:0");
- 
--static bool disable_auto_ds;
--module_param(disable_auto_ds, bool, 0);
-+static bool disable_auto_ds = 1;
-+module_param(disable_auto_ds, bool, 0644);
- MODULE_PARM_DESC(disable_auto_ds,
- 		 "deepsleep enabled=0(default), deepsleep disabled=1");
- /*
-diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
-index 20c206da0631..0e58da83417c 100644
---- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
-+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
-@@ -47,9 +47,13 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
- 	struct mwifiex_adapter *adapter = priv->adapter;
- 	struct host_cmd_ds_802_11_ps_mode_enh *pm;
- 
--	mwifiex_dbg(adapter, ERROR,
--		    "CMD_RESP: cmd %#x error, result=%#x\n",
--		    resp->command, resp->result);
-+	if (resp->command == 271 && resp->result == 2) {
-+		// ignore this command as the firmware does not support it
-+	} else {
-+		mwifiex_dbg(adapter, ERROR,
-+			    "CMD_RESP: cmd %#x error, result=%#x\n",
-+			    resp->command, resp->result);
-+	}
- 
- 	if (adapter->curr_cmd->wait_q_enabled)
- 		adapter->cmd_wait_q.status = -1;
-diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
-index c2365eeb7016..0a219ba378dd 100644
---- a/drivers/net/wireless/marvell/mwifiex/usb.c
-+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
-@@ -144,6 +144,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
- 		skb_queue_tail(&adapter->rx_data_q, skb);
- 		adapter->data_received = true;
- 		atomic_inc(&adapter->rx_pending);
-+		if (adapter->rx_work_enabled)
-+			mwifiex_queue_rx_work(adapter);
- 		break;
- 	default:
- 		mwifiex_dbg(adapter, ERROR,
-diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
-old mode 100755
-new mode 100644
--- 
-2.24.0
-

+ 10 - 34
patches/5.3/0009-ipts.patch → patches/5.3/0008-ipts.patch

@@ -1,7 +1,7 @@
-From 415661df64a887487ef496afaf38ec7a36833d0d Mon Sep 17 00:00:00 2001
+From 49678a8400c73921f11b2a89b844f1baeba40739 Mon Sep 17 00:00:00 2001
 From: Maximilian Luz <luzmaximilian@gmail.com>
 Date: Wed, 18 Sep 2019 13:04:18 +0200
-Subject: [PATCH 09/10] ipts
+Subject: [PATCH 08/10] ipts
 
 ---
  drivers/gpu/drm/i915_legacy/Makefile          |    3 +
@@ -35,12 +35,12 @@ Subject: [PATCH 09/10] ipts
  drivers/misc/ipts/hid.c                       |  496 ++++++++
  drivers/misc/ipts/hid.h                       |   21 +
  drivers/misc/ipts/ipts.c                      |   62 +
- drivers/misc/ipts/ipts.h                      |  176 +++
+ drivers/misc/ipts/ipts.h                      |  172 +++
  drivers/misc/ipts/kernel.c                    | 1047 +++++++++++++++++
  drivers/misc/ipts/kernel.h                    |   17 +
  drivers/misc/ipts/mei-msgs.h                  |  894 ++++++++++++++
  drivers/misc/ipts/mei.c                       |  238 ++++
- drivers/misc/ipts/msg-handler.c               |  416 +++++++
+ drivers/misc/ipts/msg-handler.c               |  396 +++++++
  drivers/misc/ipts/msg-handler.h               |   28 +
  drivers/misc/ipts/params.c                    |   46 +
  drivers/misc/ipts/params.h                    |   26 +
@@ -54,7 +54,7 @@ Subject: [PATCH 09/10] ipts
  include/linux/ipts-companion.h                |   30 +
  include/linux/ipts-gfx.h                      |   86 ++
  include/linux/ipts.h                          |   20 +
- 50 files changed, 6806 insertions(+), 21 deletions(-)
+ 50 files changed, 6782 insertions(+), 21 deletions(-)
  create mode 100644 drivers/gpu/drm/i915_legacy/intel_ipts.c
  create mode 100644 drivers/gpu/drm/i915_legacy/intel_ipts.h
  create mode 100644 drivers/misc/ipts/Kconfig
@@ -2973,10 +2973,10 @@ index 000000000000..dfafabf8dd94
 +}
 diff --git a/drivers/misc/ipts/ipts.h b/drivers/misc/ipts/ipts.h
 new file mode 100644
-index 000000000000..a044f839e4d0
+index 000000000000..32eb3ffd68a3
 --- /dev/null
 +++ b/drivers/misc/ipts/ipts.h
-@@ -0,0 +1,176 @@
+@@ -0,0 +1,172 @@
 +/* SPDX-License-Identifier: GPL-2.0-or-later */
 +/*
 + *
@@ -3067,10 +3067,6 @@ index 000000000000..a044f839e4d0
 +	int gfx_status;
 +	bool display_status;
 +
-+	bool switch_sensor_mode;
-+	enum touch_sensor_mode new_sensor_mode;
-+
-+	int retry;
 +	bool restart;
 +};
 +
@@ -5375,10 +5371,10 @@ index 000000000000..03b5d747a728
 +MODULE_LICENSE("GPL");
 diff --git a/drivers/misc/ipts/msg-handler.c b/drivers/misc/ipts/msg-handler.c
 new file mode 100644
-index 000000000000..dc4b730b2254
+index 000000000000..b2b382ea4675
 --- /dev/null
 +++ b/drivers/misc/ipts/msg-handler.c
-@@ -0,0 +1,416 @@
+@@ -0,0 +1,396 @@
 +// SPDX-License-Identifier: GPL-2.0-or-later
 +/*
 + *
@@ -5552,14 +5548,6 @@ index 000000000000..dc4b730b2254
 +{
 +	ipts_dbg(ipts, "ipts restart\n");
 +	ipts_stop(ipts);
-+	ipts->retry++;
-+
-+	// Try wth HID mode
-+	if (ipts->retry == IPTS_MAX_RETRY &&
-+			ipts->sensor_mode == TOUCH_SENSOR_MODE_RAW_DATA)
-+		ipts->sensor_mode = TOUCH_SENSOR_MODE_HID;
-+	else if (ipts->retry > IPTS_MAX_RETRY)
-+		return -EPERM;
 +
 +	ipts_send_sensor_quiesce_io_cmd(ipts);
 +	ipts->restart = true;
@@ -5741,9 +5729,6 @@ index 000000000000..dc4b730b2254
 +			cmd_status = ipts_handle_cmd(ipts,
 +				TOUCH_SENSOR_HID_READY_FOR_DATA_CMD, NULL, 0);
 +
-+		// reset retry since we are getting touh data
-+		ipts->retry = 0;
-+
 +		break;
 +	}
 +	case TOUCH_SENSOR_QUIESCE_IO_RSP: {
@@ -5762,15 +5747,6 @@ index 000000000000..dc4b730b2254
 +			break;
 +		}
 +
-+		// support sysfs debug node for switch sensor mode
-+		if (ipts->switch_sensor_mode) {
-+			ipts_set_state(ipts, IPTS_STA_INIT);
-+			ipts->sensor_mode = ipts->new_sensor_mode;
-+			ipts->switch_sensor_mode = false;
-+
-+			ipts_send_sensor_clear_mem_window_cmd(ipts);
-+		}
-+
 +		break;
 +	}
 +	}
@@ -7428,5 +7404,5 @@ index 000000000000..bfa8e1375926
 +
 +#endif // IPTS_H
 -- 
-2.24.0
+2.24.1
 

+ 5 - 18
patches/5.3/0010-ioremap_uc.patch → patches/5.3/0009-ioremap_uc.patch

@@ -1,15 +1,14 @@
-From 441b6e5c8fbe40ec9858147a521a5bb192160d49 Mon Sep 17 00:00:00 2001
+From 9c0380701b988307a75832e0eb1c083291fddc7c Mon Sep 17 00:00:00 2001
 From: Tuowen Zhao <ztuowen@gmail.com>
-Date: Wed, 16 Oct 2019 15:06:27 -0600
-Subject: [PATCH 10/10] ioremap_uc
+Date: Wed, 16 Oct 2019 15:06:28 -0600
+Subject: [PATCH 09/10] ioremap_uc
 
 ---
  .../driver-api/driver-model/devres.rst        |  1 +
- arch/sparc/include/asm/io_64.h                |  1 +
  drivers/mfd/intel-lpss.c                      |  2 +-
  include/linux/io.h                            |  2 ++
  lib/devres.c                                  | 19 +++++++++++++++++++
- 5 files changed, 24 insertions(+), 1 deletion(-)
+ 4 files changed, 23 insertions(+), 1 deletion(-)
 
 diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
 index a100bef54952..92628fdc2f11 100644
@@ -23,18 +22,6 @@ index a100bef54952..92628fdc2f11 100644
    devm_ioremap_wc()
    devm_ioremap_resource() : checks resource, requests memory region, ioremaps
    devm_iounmap()
-diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
-index 688911051b44..f4afa301954a 100644
---- a/arch/sparc/include/asm/io_64.h
-+++ b/arch/sparc/include/asm/io_64.h
-@@ -407,6 +407,7 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
- }
- 
- #define ioremap_nocache(X,Y)		ioremap((X),(Y))
-+#define ioremap_uc(X,Y)			ioremap((X),(Y))
- #define ioremap_wc(X,Y)			ioremap((X),(Y))
- #define ioremap_wt(X,Y)			ioremap((X),(Y))
- 
 diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
 index 277f48f1cc1c..06106c9320bb 100644
 --- a/drivers/mfd/intel-lpss.c
@@ -106,5 +93,5 @@ index 6a0e9bd6524a..17624d35e82d 100644
   * devm_ioremap_nocache - Managed ioremap_nocache()
   * @dev: Generic device to remap IO address for
 -- 
-2.24.0
+2.24.1
 

+ 63 - 0
patches/5.3/0010-surface3-spi-dma.patch

@@ -0,0 +1,63 @@
+From 4aded6dfb23129b9bd03f7d37ff655912db5cfb0 Mon Sep 17 00:00:00 2001
+From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
+Date: Fri, 6 Dec 2019 23:10:30 +0900
+Subject: [PATCH 10/10] surface3-spi dma
+
+---
+ drivers/input/touchscreen/surface3_spi.c | 26 ++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
+index ce4828b1415a..63b0b8ddf090 100644
+--- a/drivers/input/touchscreen/surface3_spi.c
++++ b/drivers/input/touchscreen/surface3_spi.c
+@@ -25,6 +25,12 @@
+ #define SURFACE3_REPORT_TOUCH	0xd2
+ #define SURFACE3_REPORT_PEN	0x16
+ 
++bool use_dma = false;
++module_param(use_dma, bool, 0644);
++MODULE_PARM_DESC(use_dma,
++				"Disable DMA mode if you encounter touch input crash. "
++				"(default: false, disabled to avoid crash)");
++
+ struct surface3_ts_data {
+ 	struct spi_device *spi;
+ 	struct gpio_desc *gpiod_rst[2];
+@@ -326,6 +332,13 @@ static int surface3_spi_create_pen_input(struct surface3_ts_data *data)
+ 	return 0;
+ }
+ 
++static bool surface3_spi_can_dma(struct spi_controller *ctlr,
++				struct spi_device *spi,
++				struct spi_transfer *tfr)
++{
++	return use_dma;
++}
++
+ static int surface3_spi_probe(struct spi_device *spi)
+ {
+ 	struct surface3_ts_data *data;
+@@ -368,6 +381,19 @@ static int surface3_spi_probe(struct spi_device *spi)
+ 	if (error)
+ 		return error;
+ 
++	/*
++	 * Set up DMA
++	 *
++	 * TODO: Currently, touch input with DMA seems to be broken.
++	 * On 4.19 LTS, touch input will crash after suspend.
++	 * On recent stable kernel (at least after 5.1), touch input will crash after
++	 * the first touch. No problem with PIO on those kernels.
++	 * Maybe we need to configure DMA here.
++	 *
++	 * Link to issue: https://github.com/jakeday/linux-surface/issues/596
++	 */
++	spi->controller->can_dma = surface3_spi_can_dma;
++
+ 	return 0;
+ }
+ 
+-- 
+2.24.1
+

+ 4 - 17
patches/5.4/0001-ioremap_uc.patch

@@ -1,15 +1,14 @@
-From e595c41258f70ccc9d980683bd6a447f04153d86 Mon Sep 17 00:00:00 2001
+From 8b8b25e23cc3501b18674b8ed599ffef33bafa6e Mon Sep 17 00:00:00 2001
 From: Tuowen Zhao <ztuowen@gmail.com>
-Date: Wed, 16 Oct 2019 15:06:27 -0600
+Date: Wed, 16 Oct 2019 15:06:28 -0600
 Subject: [PATCH 1/7] ioremap_uc
 
 ---
  .../driver-api/driver-model/devres.rst        |  1 +
- arch/sparc/include/asm/io_64.h                |  1 +
  drivers/mfd/intel-lpss.c                      |  2 +-
  include/linux/io.h                            |  2 ++
  lib/devres.c                                  | 19 +++++++++++++++++++
- 5 files changed, 24 insertions(+), 1 deletion(-)
+ 4 files changed, 23 insertions(+), 1 deletion(-)
 
 diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
 index a100bef54952..92628fdc2f11 100644
@@ -23,18 +22,6 @@ index a100bef54952..92628fdc2f11 100644
    devm_ioremap_wc()
    devm_ioremap_resource() : checks resource, requests memory region, ioremaps
    devm_iounmap()
-diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
-index 688911051b44..f4afa301954a 100644
---- a/arch/sparc/include/asm/io_64.h
-+++ b/arch/sparc/include/asm/io_64.h
-@@ -407,6 +407,7 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
- }
- 
- #define ioremap_nocache(X,Y)		ioremap((X),(Y))
-+#define ioremap_uc(X,Y)			ioremap((X),(Y))
- #define ioremap_wc(X,Y)			ioremap((X),(Y))
- #define ioremap_wt(X,Y)			ioremap((X),(Y))
- 
 diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
 index bfe4ff337581..b0f0781a6b9c 100644
 --- a/drivers/mfd/intel-lpss.c
@@ -106,5 +93,5 @@ index 6a0e9bd6524a..17624d35e82d 100644
   * devm_ioremap_nocache - Managed ioremap_nocache()
   * @dev: Generic device to remap IO address for
 -- 
-2.24.0
+2.24.1
 

+ 2 - 2
patches/5.4/0002-hid.patch

@@ -1,4 +1,4 @@
-From 5b13ed4b0c6dccb70cce67a80cc6c83492b58e28 Mon Sep 17 00:00:00 2001
+From 4e3ea1440ba9d3b72d7aebdf54221d27dee36793 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= <blaz@mxxn.io>
 Date: Wed, 6 Nov 2019 19:43:26 +0900
 Subject: [PATCH 2/7] hid
@@ -23,5 +23,5 @@ index 2fa3587d974f..e0b241bd3070 100644
  
  static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 -- 
-2.24.0
+2.24.1
 

File diff suppressed because it is too large
+ 1253 - 121
patches/5.4/0003-surface-acpi.patch


+ 7 - 7
patches/5.4/0005-surface3-power.patch → patches/5.4/0004-surface3-power.patch

@@ -1,7 +1,7 @@
-From 1fe372a463e7db7bf57acbab2f9456797f6f5451 Mon Sep 17 00:00:00 2001
+From bd28b11662cc9fba2f92d69e3d132c5a50b3537a 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 5/7] surface3-power
+Subject: [PATCH 4/7] surface3-power
 
 ---
  drivers/platform/x86/Kconfig          |   7 +
@@ -11,10 +11,10 @@ Subject: [PATCH 5/7] surface3-power
  create mode 100644 drivers/platform/x86/surface3_power.c
 
 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 1cef3c858d24..b8f019db9a55 100644
+index 675ec12cbc0e..cf709b3dd0cd 100644
 --- a/drivers/platform/x86/Kconfig
 +++ b/drivers/platform/x86/Kconfig
-@@ -1219,6 +1219,13 @@ config SURFACE_3_BUTTON
+@@ -1210,6 +1210,13 @@ config SURFACE_3_BUTTON
  	---help---
  	  This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet.
  
@@ -29,10 +29,10 @@ index 1cef3c858d24..b8f019db9a55 100644
  	tristate "Intel P-Unit IPC Driver"
  	---help---
 diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
-index 725dedf5fbfe..705525ff99a7 100644
+index 18f5a4ba7244..19b56f2181eb 100644
 --- a/drivers/platform/x86/Makefile
 +++ b/drivers/platform/x86/Makefile
-@@ -86,6 +86,7 @@ obj-$(CONFIG_INTEL_PMC_IPC)	+= intel_pmc_ipc.o
+@@ -85,6 +85,7 @@ obj-$(CONFIG_INTEL_PMC_IPC)	+= intel_pmc_ipc.o
  obj-$(CONFIG_TOUCHSCREEN_DMI)	+= touchscreen_dmi.o
  obj-$(CONFIG_SURFACE_PRO3_BUTTON)	+= surfacepro3_button.o
  obj-$(CONFIG_SURFACE_3_BUTTON)	+= surface3_button.o
@@ -651,5 +651,5 @@ index 000000000000..e0af01a60302
 +MODULE_DESCRIPTION("mshw0011 driver");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.24.0
+2.24.1
 

+ 0 - 359
patches/5.4/0004-surfacebook2-dgpu.patch

@@ -1,359 +0,0 @@
-From 553685a989f06c01aef953dcd9f2ea8f7f8ebf7a Mon Sep 17 00:00:00 2001
-From: Maximilian Luz <luzmaximilian@gmail.com>
-Date: Tue, 2 Jul 2019 22:17:46 +0200
-Subject: [PATCH 4/7] surfacebook2-dgpu
-
----
- drivers/platform/x86/Kconfig                 |   9 +
- drivers/platform/x86/Makefile                |   1 +
- drivers/platform/x86/surfacebook2_dgpu_hps.c | 306 +++++++++++++++++++
- 3 files changed, 316 insertions(+)
- create mode 100644 drivers/platform/x86/surfacebook2_dgpu_hps.c
-
-diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
-index 675ec12cbc0e..1cef3c858d24 100644
---- a/drivers/platform/x86/Kconfig
-+++ b/drivers/platform/x86/Kconfig
-@@ -481,6 +481,15 @@ config SURFACE3_WMI
- 	  To compile this driver as a module, choose M here: the module will
- 	  be called surface3-wmi.
- 
-+config SURFACE_BOOK2_DGPU_HPS
-+	tristate "Surface Book 2 dGPU Hot-Plug System Driver"
-+	depends on ACPI
-+	---help---
-+	  This is an experimetnal driver to control the power-state of the
-+	  Surface Book 2 dGPU.
-+
-+	  If you have a Surface Book 2, say Y or M here.
-+
- config THINKPAD_ACPI
- 	tristate "ThinkPad ACPI Laptop Extras"
- 	depends on ACPI
-diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
-index 18f5a4ba7244..725dedf5fbfe 100644
---- a/drivers/platform/x86/Makefile
-+++ b/drivers/platform/x86/Makefile
-@@ -48,6 +48,7 @@ obj-$(CONFIG_ACPI_WMI)		+= wmi.o
- obj-$(CONFIG_MSI_WMI)		+= msi-wmi.o
- obj-$(CONFIG_PEAQ_WMI)		+= peaq-wmi.o
- obj-$(CONFIG_SURFACE3_WMI)	+= surface3-wmi.o
-+obj-$(CONFIG_SURFACE_BOOK2_DGPU_HPS)	+= surfacebook2_dgpu_hps.o
- obj-$(CONFIG_TOPSTAR_LAPTOP)	+= topstar-laptop.o
- obj-$(CONFIG_WMI_BMOF)		+= wmi-bmof.o
- obj-$(CONFIG_INTEL_WMI_THUNDERBOLT)	+= intel-wmi-thunderbolt.o
-diff --git a/drivers/platform/x86/surfacebook2_dgpu_hps.c b/drivers/platform/x86/surfacebook2_dgpu_hps.c
-new file mode 100644
-index 000000000000..7639fb0029d8
---- /dev/null
-+++ b/drivers/platform/x86/surfacebook2_dgpu_hps.c
-@@ -0,0 +1,306 @@
-+#include <linux/acpi.h>
-+#include <linux/gpio.h>
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/platform_device.h>
-+#include <linux/sysfs.h>
-+
-+#include <linux/uaccess.h>
-+
-+
-+#define SB2_SHPS_DSM_REVISION	1
-+#define SB2_SHPS_DSM_GPU_STATE	0x05
-+
-+static const guid_t SB2_SHPS_DSM_UUID =
-+	GUID_INIT(0x5515a847, 0xed55, 0x4b27, 0x83, 0x52, 0xcd,
-+	          0x32, 0x0e, 0x10, 0x36, 0x0a);
-+
-+#define SB2_PARAM_PERM		(S_IRUGO | S_IWUSR)
-+
-+
-+static const struct acpi_gpio_params gpio_base_presence_int = { 0, 0, false };
-+static const struct acpi_gpio_params gpio_base_presence     = { 1, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_power_int    = { 2, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_power        = { 3, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_presence_int = { 4, 0, false };
-+static const struct acpi_gpio_params gpio_dgpu_presence     = { 5, 0, false };
-+
-+static const struct acpi_gpio_mapping sb2_mshw0153_acpi_gpios[] = {
-+	{ "base_presence-int-gpio", &gpio_base_presence_int, 1 },
-+	{ "base_presence-gpio",     &gpio_base_presence,     1 },
-+	{ "dgpu_power-int-gpio",    &gpio_dgpu_power_int,    1 },
-+	{ "dgpu_power-gpio",        &gpio_dgpu_power,        1 },
-+	{ "dgpu_presence-int-gpio", &gpio_dgpu_presence_int, 1 },
-+	{ "dgpu_presence-gpio",     &gpio_dgpu_presence,     1 },
-+	{ },
-+};
-+
-+
-+enum sb2_dgpu_power {
-+	SB2_DGPU_POWER_OFF      = 0,
-+	SB2_DGPU_POWER_ON       = 1,
-+
-+	__SB2_DGPU_POWER__START = 0,
-+	__SB2_DGPU_POWER__END   = 1,
-+};
-+
-+enum sb2_param_dgpu_power {
-+	SB2_PARAM_DGPU_POWER_OFF      = SB2_DGPU_POWER_OFF,
-+	SB2_PARAM_DGPU_POWER_ON       = SB2_DGPU_POWER_ON,
-+	SB2_PARAM_DGPU_POWER_AS_IS    = 2,
-+
-+	__SB2_PARAM_DGPU_POWER__START = 0,
-+	__SB2_PARAM_DGPU_POWER__END   = 2,
-+};
-+
-+static const char* sb2_dgpu_power_str(enum sb2_dgpu_power power) {
-+	if (power == SB2_DGPU_POWER_OFF) {
-+		return "off";
-+	} else if (power == SB2_DGPU_POWER_ON) {
-+		return "on";
-+	} else {
-+		return "<invalid>";
-+	}
-+}
-+
-+
-+struct sb2_shps_driver_data {
-+	struct mutex dgpu_power_lock;
-+	enum sb2_dgpu_power dgpu_power;
-+};
-+
-+
-+static int __sb2_shps_dgpu_set_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
-+	union acpi_object *result;
-+	union acpi_object param;
-+
-+	param.type = ACPI_TYPE_INTEGER;
-+	param.integer.value = power == SB2_DGPU_POWER_ON;
-+
-+	result = acpi_evaluate_dsm_typed(handle, &SB2_SHPS_DSM_UUID, SB2_SHPS_DSM_REVISION,
-+	                                 SB2_SHPS_DSM_GPU_STATE, &param, ACPI_TYPE_BUFFER);
-+
-+	if (IS_ERR_OR_NULL(result)) {
-+		return result ? PTR_ERR(result) : -EFAULT;
-+	}
-+
-+	if (result->buffer.length != 1 || result->buffer.pointer[0] != 0) {
-+		return -EIO;
-+	}
-+
-+	drvdata->dgpu_power = power;
-+
-+	printk(KERN_INFO "sb2_shps: dGPU power state set to \'%s\'\n", sb2_dgpu_power_str(power));
-+
-+	ACPI_FREE(result);
-+	return 0;
-+}
-+
-+static int sb2_shps_dgpu_set_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	int status = 0;
-+
-+	if (power < __SB2_DGPU_POWER__START || power > __SB2_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	mutex_lock(&drvdata->dgpu_power_lock);
-+	if (power != drvdata->dgpu_power) {
-+		status = __sb2_shps_dgpu_set_power(pdev, power);
-+	}
-+	mutex_unlock(&drvdata->dgpu_power_lock);
-+
-+	return status;
-+}
-+
-+static int sb2_shps_dgpu_force_power(struct platform_device *pdev, enum sb2_dgpu_power power)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	int status;
-+
-+	if (power < __SB2_DGPU_POWER__START || power > __SB2_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	mutex_lock(&drvdata->dgpu_power_lock);
-+	status = __sb2_shps_dgpu_set_power(pdev, power);
-+	mutex_unlock(&drvdata->dgpu_power_lock);
-+
-+	return status;
-+}
-+
-+
-+static int param_dgpu_power_set(const char *val, const struct kernel_param *kp)
-+{
-+	int power = SB2_PARAM_DGPU_POWER_OFF;
-+	int status;
-+
-+	status = kstrtoint(val, 0, &power);
-+	if (status) {
-+		return status;
-+	}
-+
-+	if (power < __SB2_PARAM_DGPU_POWER__START || power > __SB2_PARAM_DGPU_POWER__END) {
-+		return -EINVAL;
-+	}
-+
-+	return param_set_int(val, kp);
-+}
-+
-+static const struct kernel_param_ops param_dgpu_power_ops = {
-+	.set = param_dgpu_power_set,
-+	.get = param_get_int,
-+};
-+
-+static int param_dgpu_power_init = SB2_PARAM_DGPU_POWER_OFF;
-+static int param_dgpu_power_exit = SB2_PARAM_DGPU_POWER_OFF;
-+
-+module_param_cb(dgpu_power_init, &param_dgpu_power_ops, &param_dgpu_power_init, SB2_PARAM_PERM);
-+module_param_cb(dgpu_power_exit, &param_dgpu_power_ops, &param_dgpu_power_exit, SB2_PARAM_PERM);
-+
-+MODULE_PARM_DESC(dgpu_power_init, "dGPU power state to be set on init (0: off / 1: on / 2: as-is)");
-+MODULE_PARM_DESC(dgpu_power_exit, "dGPU power state to be set on exit (0: off / 1: on / 2: as-is)");
-+
-+
-+static ssize_t dgpu_power_show(struct device *dev, struct device_attribute *attr, char *data)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+
-+	return sprintf(data, "%s\n", sb2_dgpu_power_str(drvdata->dgpu_power));
-+}
-+
-+static ssize_t dgpu_power_store(struct device *dev, struct device_attribute *attr,
-+                                const char *data, size_t count)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	bool power = false;
-+	int status;
-+
-+	status = kstrtobool(data, &power);
-+	if (status) {
-+		return status;
-+	}
-+
-+	if (power) {
-+		status = sb2_shps_dgpu_set_power(pdev, SB2_DGPU_POWER_ON);
-+	} else {
-+		status = sb2_shps_dgpu_set_power(pdev, SB2_DGPU_POWER_OFF);
-+	}
-+
-+	return status < 0 ? status : count;
-+}
-+
-+const static DEVICE_ATTR_RW(dgpu_power);
-+
-+
-+#ifdef CONFIG_PM
-+
-+static int sb2_shps_resume(struct device *dev)
-+{
-+	struct platform_device *pdev = container_of(dev, struct platform_device, dev);
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+
-+	return sb2_shps_dgpu_force_power(pdev, drvdata->dgpu_power);
-+}
-+
-+static SIMPLE_DEV_PM_OPS(sb2_shps_pm_ops, NULL, sb2_shps_resume);
-+
-+#endif
-+
-+
-+static int sb2_shps_probe(struct platform_device *pdev)
-+{
-+	struct sb2_shps_driver_data *drvdata;
-+	struct acpi_device *shps_dev = ACPI_COMPANION(&pdev->dev);
-+	int status = 0;
-+
-+	if (gpiod_count(&pdev->dev, NULL) < 0) {
-+		return -ENODEV;
-+	}
-+
-+	status = acpi_dev_add_driver_gpios(shps_dev, sb2_mshw0153_acpi_gpios);
-+	if (status) {
-+		return status;
-+	}
-+
-+	drvdata = kzalloc(sizeof(struct sb2_shps_driver_data), GFP_KERNEL);
-+	if (!drvdata) {
-+		status = -ENOMEM;
-+		goto err_alloc_drvdata;
-+	}
-+
-+	mutex_init(&drvdata->dgpu_power_lock);
-+	drvdata->dgpu_power = SB2_DGPU_POWER_OFF;
-+	platform_set_drvdata(pdev, drvdata);
-+
-+	if (param_dgpu_power_init != SB2_PARAM_DGPU_POWER_AS_IS) {
-+		status = sb2_shps_dgpu_force_power(pdev, param_dgpu_power_init);
-+		if (status) {
-+			goto err_set_power;
-+		}
-+	}
-+
-+	status = sysfs_create_file(&pdev->dev.kobj, &dev_attr_dgpu_power.attr);
-+	if (status) {
-+		goto err_sysfs;
-+	}
-+
-+	return 0;
-+
-+err_sysfs:
-+	sb2_shps_dgpu_force_power(pdev, SB2_DGPU_POWER_OFF);
-+err_set_power:
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+err_alloc_drvdata:
-+	acpi_dev_remove_driver_gpios(shps_dev);
-+	return status;
-+}
-+
-+static int sb2_shps_remove(struct platform_device *pdev)
-+{
-+	struct sb2_shps_driver_data *drvdata = platform_get_drvdata(pdev);
-+	struct acpi_device *shps_dev = ACPI_COMPANION(&pdev->dev);
-+
-+	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_dgpu_power.attr);
-+
-+	if (param_dgpu_power_exit != SB2_PARAM_DGPU_POWER_AS_IS) {
-+		sb2_shps_dgpu_set_power(pdev, param_dgpu_power_exit);
-+	}
-+	acpi_dev_remove_driver_gpios(shps_dev);
-+
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+
-+	return 0;
-+}
-+
-+
-+static const struct acpi_device_id sb2_shps_acpi_match[] = {
-+	{ "MSHW0153", 0 },
-+	{ },
-+};
-+MODULE_DEVICE_TABLE(acpi, sb2_shps_acpi_match);
-+
-+static struct platform_driver sb2_shps_driver = {
-+	.probe = sb2_shps_probe,
-+	.remove = sb2_shps_remove,
-+	.driver = {
-+		.name = "sb2_shps",
-+		.acpi_match_table = ACPI_PTR(sb2_shps_acpi_match),
-+#ifdef CONFIG_PM
-+		.pm = &sb2_shps_pm_ops,
-+#endif
-+	},
-+};
-+module_platform_driver(sb2_shps_driver);
-+
-+MODULE_AUTHOR("Maximilian Luz <luzmaximilian@gmail.com>");
-+MODULE_DESCRIPTION("Surface Book 2 Hot-Plug System Driver");
-+MODULE_LICENSE("GPL v2");
--- 
-2.24.0
-

+ 3 - 3
patches/5.4/0006-surface-lte.patch → patches/5.4/0005-surface-lte.patch

@@ -1,7 +1,7 @@
-From 686f6202a26afc35e9ee45e2106207f6a50d3bac Mon Sep 17 00:00:00 2001
+From 1ac8e97c8765f1e89ede2a981559b10571b5b5a2 Mon Sep 17 00:00:00 2001
 From: qzed <qzed@users.noreply.github.com>
 Date: Tue, 17 Sep 2019 17:21:43 +0200
-Subject: [PATCH 6/7] surface-lte
+Subject: [PATCH 5/7] surface-lte
 
 ---
  drivers/usb/serial/qcserial.c | 1 +
@@ -20,5 +20,5 @@ index 613f91add03d..e1428222dd73 100644
  	/* Huawei devices */
  	{DEVICE_HWI(0x03f0, 0x581d)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
 -- 
-2.24.0
+2.24.1
 

+ 168 - 0
patches/5.4/0006-wifi.patch

@@ -0,0 +1,168 @@
+From 2bd84c6967b2741d012844717f46f514b2122f4f Mon Sep 17 00:00:00 2001
+From: sebanc <22224731+sebanc@users.noreply.github.com>
+Date: Mon, 4 Nov 2019 09:30:57 +0100
+Subject: [PATCH 6/7] wifi
+
+---
+ drivers/net/wireless/marvell/mwifiex/pcie.c   | 74 ++++++++++---------
+ .../net/wireless/marvell/mwifiex/sta_cmd.c    | 15 +---
+ 2 files changed, 41 insertions(+), 48 deletions(-)
+
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
+index eff06d59e9df..eeda5de9173f 100644
+--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
+@@ -149,35 +149,38 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
+  */
+ static int mwifiex_pcie_suspend(struct device *dev)
+ {
++	struct pci_dev *pdev = to_pci_dev(dev);
++	struct pcie_service_card *card = pci_get_drvdata(pdev);
+ 	struct mwifiex_adapter *adapter;
+-	struct pcie_service_card *card = dev_get_drvdata(dev);
+-
++	struct mwifiex_private *priv;
++	const struct mwifiex_pcie_card_reg *reg;
++	u32 fw_status;
++	int ret;
+ 
+ 	/* Might still be loading firmware */
+ 	wait_for_completion(&card->fw_done);
+ 
+ 	adapter = card->adapter;
+-	if (!adapter) {
+-		dev_err(dev, "adapter is not valid\n");
++	if (!adapter || !adapter->priv_num)
+ 		return 0;
+-	}
+ 
+-	mwifiex_enable_wake(adapter);
++	reg = card->pcie.reg;
++	if (reg)
++		ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
++	else
++		fw_status = -1;
++
++	if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
++		mwifiex_deauthenticate_all(adapter);
+ 
+-	/* Enable the Host Sleep */
+-	if (!mwifiex_enable_hs(adapter)) {
+-		mwifiex_dbg(adapter, ERROR,
+-			    "cmd: failed to suspend\n");
+-		clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
+-		mwifiex_disable_wake(adapter);
+-		return -EFAULT;
+-	}
++		priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
+ 
+-	flush_workqueue(adapter->workqueue);
++		mwifiex_disable_auto_ds(priv);
+ 
+-	/* Indicate device suspended */
+-	set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
+-	clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
++		mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
++	}
++
++	mwifiex_remove_card(adapter);
+ 
+ 	return 0;
+ }
+@@ -192,28 +195,29 @@ static int mwifiex_pcie_suspend(struct device *dev)
+  */
+ static int mwifiex_pcie_resume(struct device *dev)
+ {
+-	struct mwifiex_adapter *adapter;
+-	struct pcie_service_card *card = dev_get_drvdata(dev);
++	struct pci_dev *pdev = to_pci_dev(dev);
++	struct pcie_service_card *card = pci_get_drvdata(pdev);
++	int ret;
+ 
++	pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
++		 pdev->vendor, pdev->device, pdev->revision);
+ 
+-	if (!card->adapter) {
+-		dev_err(dev, "adapter structure is not valid\n");
+-		return 0;
+-	}
++	init_completion(&card->fw_done);
+ 
+-	adapter = card->adapter;
++	card->dev = pdev;
+ 
+-	if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
+-		mwifiex_dbg(adapter, WARN,
+-			    "Device already resumed\n");
+-		return 0;
++	/* device tree node parsing and platform specific configuration */
++	if (pdev->dev.of_node) {
++		ret = mwifiex_pcie_probe_of(&pdev->dev);
++		if (ret)
++			return ret;
+ 	}
+ 
+-	clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
+-
+-	mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
+-			  MWIFIEX_ASYNC_CMD);
+-	mwifiex_disable_wake(adapter);
++	if (mwifiex_add_card(card, &card->fw_done, &pcie_ops,
++			MWIFIEX_PCIE, &pdev->dev)) {
++		pr_err("%s failed\n", __func__);
++		return -1;
++	}
+ 
+ 	return 0;
+ }
+@@ -267,6 +271,8 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
+ 		return -1;
+ 	}
+ 
++	pdev->bus->self->bridge_d3 = false;
++
+ 	return 0;
+ }
+ 
+diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+index 4ed10cf82f9a..013db4386c39 100644
+--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
++++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+@@ -2265,14 +2265,13 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
+ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
+ {
+ 	struct mwifiex_adapter *adapter = priv->adapter;
+-	int ret;
+ 	struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
+-	struct mwifiex_ds_auto_ds auto_ds;
+ 	enum state_11d_t state_11d;
+ 	struct mwifiex_ds_11n_tx_cfg tx_cfg;
+ 	u8 sdio_sp_rx_aggr_enable;
+ 	u16 packet_aggr_enable;
+ 	int data;
++	int ret;
+ 
+ 	if (first_sta) {
+ 		if (priv->adapter->iface_type == MWIFIEX_PCIE) {
+@@ -2395,18 +2394,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
+ 	if (ret)
+ 		return -1;
+ 
+-	if (!disable_auto_ds && first_sta &&
+-	    priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
+-		/* Enable auto deep sleep */
+-		auto_ds.auto_ds = DEEP_SLEEP_ON;
+-		auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;
+-		ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH,
+-				       EN_AUTO_PS, BITMAP_AUTO_DS,
+-				       &auto_ds, true);
+-		if (ret)
+-			return -1;
+-	}
+-
+ 	if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
+ 		/* Send cmd to FW to enable/disable 11D function */
+ 		state_11d = ENABLE_11D;
+-- 
+2.24.1
+

+ 63 - 0
patches/5.4/0007-surface3-spi-dma.patch

@@ -0,0 +1,63 @@
+From 995dc220a596617eaf5ccd543a9a9b2e3d1e7bf2 Mon Sep 17 00:00:00 2001
+From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
+Date: Fri, 6 Dec 2019 23:10:30 +0900
+Subject: [PATCH 7/7] surface3-spi dma
+
+---
+ drivers/input/touchscreen/surface3_spi.c | 26 ++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
+index ce4828b1415a..63b0b8ddf090 100644
+--- a/drivers/input/touchscreen/surface3_spi.c
++++ b/drivers/input/touchscreen/surface3_spi.c
+@@ -25,6 +25,12 @@
+ #define SURFACE3_REPORT_TOUCH	0xd2
+ #define SURFACE3_REPORT_PEN	0x16
+ 
++bool use_dma = false;
++module_param(use_dma, bool, 0644);
++MODULE_PARM_DESC(use_dma,
++				"Disable DMA mode if you encounter touch input crash. "
++				"(default: false, disabled to avoid crash)");
++
+ struct surface3_ts_data {
+ 	struct spi_device *spi;
+ 	struct gpio_desc *gpiod_rst[2];
+@@ -326,6 +332,13 @@ static int surface3_spi_create_pen_input(struct surface3_ts_data *data)
+ 	return 0;
+ }
+ 
++static bool surface3_spi_can_dma(struct spi_controller *ctlr,
++				struct spi_device *spi,
++				struct spi_transfer *tfr)
++{
++	return use_dma;
++}
++
+ static int surface3_spi_probe(struct spi_device *spi)
+ {
+ 	struct surface3_ts_data *data;
+@@ -368,6 +381,19 @@ static int surface3_spi_probe(struct spi_device *spi)
+ 	if (error)
+ 		return error;
+ 
++	/*
++	 * Set up DMA
++	 *
++	 * TODO: Currently, touch input with DMA seems to be broken.
++	 * On 4.19 LTS, touch input will crash after suspend.
++	 * On recent stable kernel (at least after 5.1), touch input will crash after
++	 * the first touch. No problem with PIO on those kernels.
++	 * Maybe we need to configure DMA here.
++	 *
++	 * Link to issue: https://github.com/jakeday/linux-surface/issues/596
++	 */
++	spi->controller->can_dma = surface3_spi_can_dma;
++
+ 	return 0;
+ }
+ 
+-- 
+2.24.1
+

+ 0 - 267
patches/5.4/0007-wifi.patch

@@ -1,267 +0,0 @@
-From 4336f2d8b36012ff7eac888dee18e9d35bbff90e Mon Sep 17 00:00:00 2001
-From: qzed <qzed@users.noreply.github.com>
-Date: Wed, 18 Sep 2019 03:18:25 +0200
-Subject: [PATCH 7/7] wifi
-
----
- drivers/net/wireless/marvell/mwifiex/11n_aggr.c |  3 +--
- drivers/net/wireless/marvell/mwifiex/cfg80211.c |  5 ++++-
- drivers/net/wireless/marvell/mwifiex/cmdevt.c   | 10 ++++++----
- drivers/net/wireless/marvell/mwifiex/fw.h       |  1 +
- drivers/net/wireless/marvell/mwifiex/main.c     | 17 +++++++++++++----
- drivers/net/wireless/marvell/mwifiex/main.h     |  2 ++
- drivers/net/wireless/marvell/mwifiex/pcie.c     |  9 +++++++++
- drivers/net/wireless/marvell/mwifiex/sta_cmd.c  |  4 ++--
- .../net/wireless/marvell/mwifiex/sta_cmdresp.c  | 10 +++++++---
- drivers/net/wireless/marvell/mwifiex/usb.c      |  2 ++
- scripts/leaking_addresses.pl                    |  0
- 11 files changed, 47 insertions(+), 16 deletions(-)
- mode change 100755 => 100644 scripts/leaking_addresses.pl
-
-diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
-index 088612438530..4386e657dfdb 100644
---- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
-+++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
-@@ -198,8 +198,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
- 
- 	do {
- 		/* Check if AMSDU can accommodate this MSDU */
--		if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) >
--		    adapter->tx_buf_size)
-+		if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
- 			break;
- 
- 		skb_src = skb_dequeue(&pra_list->skb_head);
-diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
-index d89684168500..1545bae9d6cf 100644
---- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
-+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
-@@ -437,7 +437,10 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
- 		mwifiex_dbg(priv->adapter, INFO,
- 			    "info: ignore timeout value for IEEE Power Save\n");
- 
--	ps_mode = enabled;
-+	//ps_mode = enabled;
-+
-+	mwifiex_dbg(priv->adapter, INFO, "overriding ps_mode to false\n");
-+	ps_mode = 0;
- 
- 	return mwifiex_drv_set_power(priv, &ps_mode);
- }
-diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
-index e8788c35a453..82d25b3ca914 100644
---- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
-+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
-@@ -1004,6 +1004,7 @@ mwifiex_cmd_timeout_func(struct timer_list *t)
- 		if (cmd_node->wait_q_enabled) {
- 			adapter->cmd_wait_q.status = -ETIMEDOUT;
- 			mwifiex_cancel_pending_ioctl(adapter);
-+			adapter->cmd_sent = false;
- 		}
- 	}
- 	if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) {
-@@ -1011,11 +1012,11 @@ mwifiex_cmd_timeout_func(struct timer_list *t)
- 		return;
- 	}
- 
--	if (adapter->if_ops.device_dump)
--		adapter->if_ops.device_dump(adapter);
-+	//if (adapter->if_ops.device_dump)
-+	//	adapter->if_ops.device_dump(adapter);
- 
--	if (adapter->if_ops.card_reset)
--		adapter->if_ops.card_reset(adapter);
-+	//if (adapter->if_ops.card_reset)
-+	//	adapter->if_ops.card_reset(adapter);
- }
- 
- void
-@@ -1578,6 +1579,7 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
- 						    adapter->key_api_minor_ver);
- 					break;
- 				case FW_API_VER_ID:
-+				case FW_KEY_API_VER_ID:
- 					adapter->fw_api_ver =
- 							api_rev->major_ver;
- 					mwifiex_dbg(adapter, INFO,
-diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
-index 1fb76d2f5d3f..fb32379da99d 100644
---- a/drivers/net/wireless/marvell/mwifiex/fw.h
-+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
-@@ -1052,6 +1052,7 @@ struct host_cmd_ds_802_11_ps_mode_enh {
- enum API_VER_ID {
- 	KEY_API_VER_ID = 1,
- 	FW_API_VER_ID = 2,
-+	FW_KEY_API_VER_ID = 4,
- };
- 
- struct hw_spec_api_rev {
-diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
-index a9657ae6d782..ba99d84a31ef 100644
---- a/drivers/net/wireless/marvell/mwifiex/main.c
-+++ b/drivers/net/wireless/marvell/mwifiex/main.c
-@@ -163,6 +163,7 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
- 	spin_lock_irqsave(&adapter->main_proc_lock, flags);
- 	if (adapter->mwifiex_processing) {
- 		adapter->more_task_flag = true;
-+		adapter->more_rx_task_flag = true;
- 		spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
- 	} else {
- 		spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
-@@ -171,16 +172,18 @@ void mwifiex_queue_main_work(struct mwifiex_adapter *adapter)
- }
- EXPORT_SYMBOL_GPL(mwifiex_queue_main_work);
- 
--static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
-+void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
- {
- 	spin_lock_bh(&adapter->rx_proc_lock);
- 	if (adapter->rx_processing) {
-+		adapter->more_rx_task_flag = true;
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 	} else {
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 		queue_work(adapter->rx_workqueue, &adapter->rx_work);
- 	}
- }
-+EXPORT_SYMBOL_GPL(mwifiex_queue_rx_work);
- 
- static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- {
-@@ -189,6 +192,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- 
- 	spin_lock_bh(&adapter->rx_proc_lock);
- 	if (adapter->rx_processing || adapter->rx_locked) {
-+		adapter->more_rx_task_flag = true;
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 		goto exit_rx_proc;
- 	} else {
-@@ -196,6 +200,7 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- 		spin_unlock_bh(&adapter->rx_proc_lock);
- 	}
- 
-+rx_process_start:
- 	/* Check for Rx data */
- 	while ((skb = skb_dequeue(&adapter->rx_data_q))) {
- 		atomic_dec(&adapter->rx_pending);
-@@ -217,6 +222,11 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter)
- 		}
- 	}
- 	spin_lock_bh(&adapter->rx_proc_lock);
-+	if (adapter->more_rx_task_flag) {
-+		adapter->more_rx_task_flag = false;
-+		spin_unlock_bh(&adapter->rx_proc_lock);
-+		goto rx_process_start;
-+	}
- 	adapter->rx_processing = false;
- 	spin_unlock_bh(&adapter->rx_proc_lock);
- 
-@@ -280,11 +290,10 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)
- 				mwifiex_process_hs_config(adapter);
- 			if (adapter->if_ops.process_int_status)
- 				adapter->if_ops.process_int_status(adapter);
-+			if (adapter->rx_work_enabled && adapter->data_received)
-+				mwifiex_queue_rx_work(adapter);
- 		}
- 
--		if (adapter->rx_work_enabled && adapter->data_received)
--			mwifiex_queue_rx_work(adapter);
--
- 		/* Need to wake up the card ? */
- 		if ((adapter->ps_state == PS_STATE_SLEEP) &&
- 		    (adapter->pm_wakeup_card_req &&
-diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
-index 095837fba300..5dca5c25c601 100644
---- a/drivers/net/wireless/marvell/mwifiex/main.h
-+++ b/drivers/net/wireless/marvell/mwifiex/main.h
-@@ -909,6 +909,7 @@ struct mwifiex_adapter {
- 	spinlock_t main_proc_lock;
- 	u32 mwifiex_processing;
- 	u8 more_task_flag;
-+	u8 more_rx_task_flag;
- 	u16 tx_buf_size;
- 	u16 curr_tx_buf_size;
- 	/* sdio single port rx aggregation capability */
-@@ -1695,6 +1696,7 @@ void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
- void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
- void mwifiex_fw_dump_event(struct mwifiex_private *priv);
- void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
-+void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter);
- int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
- 			      int cmd_type,
- 			      struct mwifiex_ds_wakeup_reason *wakeup_reason);
-diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
-index eff06d59e9df..76e76a6a7ab1 100644
---- a/drivers/net/wireless/marvell/mwifiex/pcie.c
-+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
-@@ -1739,6 +1739,15 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter)
- 	}
- 
- 	rx_len = get_unaligned_le16(skb->data);
-+
-+	if (rx_len == 0) {
-+		mwifiex_dbg(adapter, ERROR,
-+				    "0 byte cmdrsp\n");
-+		mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
-+					   PCI_DMA_FROMDEVICE);
-+		return 0;
-+	}
-+
- 	skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len);
- 	skb_trim(skb, rx_len);
- 
-diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
-index 4ed10cf82f9a..485360e8534b 100644
---- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
-+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
-@@ -30,8 +30,8 @@ static bool drcs;
- module_param(drcs, bool, 0644);
- MODULE_PARM_DESC(drcs, "multi-channel operation:1, single-channel operation:0");
- 
--static bool disable_auto_ds;
--module_param(disable_auto_ds, bool, 0);
-+static bool disable_auto_ds = 1;
-+module_param(disable_auto_ds, bool, 0644);
- MODULE_PARM_DESC(disable_auto_ds,
- 		 "deepsleep enabled=0(default), deepsleep disabled=1");
- /*
-diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
-index 20c206da0631..0e58da83417c 100644
---- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
-+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
-@@ -47,9 +47,13 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
- 	struct mwifiex_adapter *adapter = priv->adapter;
- 	struct host_cmd_ds_802_11_ps_mode_enh *pm;
- 
--	mwifiex_dbg(adapter, ERROR,
--		    "CMD_RESP: cmd %#x error, result=%#x\n",
--		    resp->command, resp->result);
-+	if (resp->command == 271 && resp->result == 2) {
-+		// ignore this command as the firmware does not support it
-+	} else {
-+		mwifiex_dbg(adapter, ERROR,
-+			    "CMD_RESP: cmd %#x error, result=%#x\n",
-+			    resp->command, resp->result);
-+	}
- 
- 	if (adapter->curr_cmd->wait_q_enabled)
- 		adapter->cmd_wait_q.status = -1;
-diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c
-index c2365eeb7016..0a219ba378dd 100644
---- a/drivers/net/wireless/marvell/mwifiex/usb.c
-+++ b/drivers/net/wireless/marvell/mwifiex/usb.c
-@@ -144,6 +144,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
- 		skb_queue_tail(&adapter->rx_data_q, skb);
- 		adapter->data_received = true;
- 		atomic_inc(&adapter->rx_pending);
-+		if (adapter->rx_work_enabled)
-+			mwifiex_queue_rx_work(adapter);
- 		break;
- 	default:
- 		mwifiex_dbg(adapter, ERROR,
-diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
-old mode 100755
-new mode 100644
--- 
-2.24.0
-

Some files were not shown because too many files changed in this diff