v4.19: update patches

Update patches via linux-surface/kernel@fccd0a489e.

Updated patches:
    pick ea097eb Add secureboot pre-signing to the kernel
    pick b50d617 surface3-power
    pick 71ab90b surface3-spi
    pick f109cbf surface3-oemb
    pick c924fb6 surface-buttons
    f 1a44682d3bea Input: soc_button_array - fix Wdiscarded-qualifiers for kernels below 4.20
    pick 91a78cc surface-sam
    pick 263250b suspend
    pick 5ae0ab6 ipts
    f a5db77a8ad47 ipts: Simplify feedback implementation
    f 22c959edeaf2 ipts: Remove no_feedback quirk
    f 21a71ef429b4 ipts: Remove quirk implementation
    f f28c0f7b64aa ipts: companion: improve comment for hardware id on SP4
    pick df219c0 surface-lte
    pick 3484574 ioremap_uc
    pick 4f727ac wifi
    f f86788d75e54 Revert "BACKPORT: wireless/mwifiex: Fix S0ix / suspend"
    f 169bb34570af mwifiex: pcie: Use dev_get_drvdata
    f 6e9eefbca821 mwifiex_pcie: remove()/probe() card on suspend()/resume()
    f 3619cec06fdc mwifiex_pcie: disable parent bridge_d3
    f fda9d444d14d mwifiex: sta_cmd: do not enable auto_ds by default
    f 74ab58241354 mwifiex: sta_cmd: add comment for not enabling ps_mode by default

Note: almost all part of the ioremap_uc patch is now upstream. So, the
remaining unupstreamed patch is now only linux-surface/kernel@de067f5c12
("docs: driver-model: add devm_ioremap_uc")

Signed-off-by: Tsuchiya Yuto (kitakar5525) <kitakar@gmail.com>
This commit is contained in:
Tsuchiya Yuto (kitakar5525) 2020-05-16 18:11:38 +09:00
parent 93dd316b7b
commit c7caeec62c
10 changed files with 165 additions and 330 deletions

View file

@ -1,4 +1,4 @@
From b50d617e2eee9791180395ca60841f20442c5b95 Mon Sep 17 00:00:00 2001 From a2b33dd39478cc3c162c3e76a2a0bd888be6b019 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com> From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 28 Sep 2019 18:00:43 +0200 Date: Sat, 28 Sep 2019 18:00:43 +0200
Subject: [PATCH 01/10] surface3-power Subject: [PATCH 01/10] surface3-power
@ -651,5 +651,5 @@ index 000000000000..e0af01a60302
+MODULE_DESCRIPTION("mshw0011 driver"); +MODULE_DESCRIPTION("mshw0011 driver");
+MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL v2");
-- --
2.26.0 2.26.2

View file

@ -1,4 +1,4 @@
From 71ab90b1a4fde2bcf91d5cb7cb278c792c89f653 Mon Sep 17 00:00:00 2001 From 06e4d51c83a77d54ca5b1d402fb57554c51d3926 Mon Sep 17 00:00:00 2001
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com> From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
Date: Fri, 6 Dec 2019 23:10:30 +0900 Date: Fri, 6 Dec 2019 23:10:30 +0900
Subject: [PATCH 02/10] surface3-spi Subject: [PATCH 02/10] surface3-spi
@ -59,5 +59,5 @@ index 5db0f1c4ef38..8935ddbc2357 100644
} }
-- --
2.26.0 2.26.2

View file

@ -1,4 +1,4 @@
From f109cbf36e5acdf7829d19b642e4a23ef6476ce4 Mon Sep 17 00:00:00 2001 From c9fd73ef014ee91d0cda46c2c456ae579ba3b4e0 Mon Sep 17 00:00:00 2001
From: Chih-Wei Huang <cwhuang@linux.org.tw> From: Chih-Wei Huang <cwhuang@linux.org.tw>
Date: Tue, 18 Sep 2018 11:01:37 +0800 Date: Tue, 18 Sep 2018 11:01:37 +0800
Subject: [PATCH 03/10] surface3-oemb Subject: [PATCH 03/10] surface3-oemb
@ -67,5 +67,5 @@ index 91bb99b69601..8418938b32ad 100644
}; };
-- --
2.26.0 2.26.2

View file

@ -1,13 +1,13 @@
From c924fb68b7aa19fd8947991f128c56296e9b678d Mon Sep 17 00:00:00 2001 From 25c1108f70fde7cca28e5f851427108737443088 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com> From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 27 Jul 2019 17:51:37 +0200 Date: Sat, 27 Jul 2019 17:51:37 +0200
Subject: [PATCH 04/10] surface-buttons Subject: [PATCH 04/10] surface-buttons
--- ---
drivers/input/misc/Kconfig | 6 +- drivers/input/misc/Kconfig | 6 +-
drivers/input/misc/soc_button_array.c | 112 +++++++++++++++++++--- drivers/input/misc/soc_button_array.c | 114 +++++++++++++++++++---
drivers/platform/x86/surfacepro3_button.c | 47 +++++++++ drivers/platform/x86/surfacepro3_button.c | 47 +++++++++
3 files changed, 150 insertions(+), 15 deletions(-) 3 files changed, 151 insertions(+), 16 deletions(-)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index ca59a2be9bc5..ea69610370e8 100644 index ca59a2be9bc5..ea69610370e8 100644
@ -28,7 +28,7 @@ index ca59a2be9bc5..ea69610370e8 100644
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called soc_button_array. module will be called soc_button_array.
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 55cd6e0b409c..5983733d78dd 100644 index 55cd6e0b409c..c564ea99f47d 100644
--- a/drivers/input/misc/soc_button_array.c --- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c
@@ -29,6 +29,11 @@ struct soc_button_info { @@ -29,6 +29,11 @@ struct soc_button_info {
@ -100,15 +100,17 @@ index 55cd6e0b409c..5983733d78dd 100644
} }
error = gpiod_count(dev, NULL); error = gpiod_count(dev, NULL);
@@ -357,7 +377,7 @@ static int soc_button_probe(struct platform_device *pdev) @@ -357,8 +377,8 @@ static int soc_button_probe(struct platform_device *pdev)
if (!priv->children[0] && !priv->children[1]) if (!priv->children[0] && !priv->children[1])
return -ENODEV; return -ENODEV;
- if (!id->driver_data) - if (!id->driver_data)
- devm_kfree(dev, button_info);
+ if (!device_data || !device_data->button_info) + if (!device_data || !device_data->button_info)
devm_kfree(dev, button_info); + devm_kfree(dev, (void *)button_info);
return 0; return 0;
}
@@ -368,7 +388,7 @@ static int soc_button_probe(struct platform_device *pdev) @@ -368,7 +388,7 @@ static int soc_button_probe(struct platform_device *pdev)
* is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC * is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC
* Platforms" * Platforms"
@ -270,5 +272,5 @@ index 1b491690ce07..96627627060e 100644
if (!button) if (!button)
return -ENOMEM; return -ENOMEM;
-- --
2.26.0 2.26.2

View file

@ -1,4 +1,4 @@
From 91a78cc8ef8f5b822dc5e0367d11321e64251667 Mon Sep 17 00:00:00 2001 From 09f283be44830292c64b4af888e3ddc9fff46c11 Mon Sep 17 00:00:00 2001
From: qzed <qzed@users.noreply.github.com> From: qzed <qzed@users.noreply.github.com>
Date: Mon, 26 Aug 2019 01:15:40 +0200 Date: Mon, 26 Aug 2019 01:15:40 +0200
Subject: [PATCH 05/10] surface-sam Subject: [PATCH 05/10] surface-sam
@ -7548,5 +7548,5 @@ index c66a04d24f1d..6b48fdfb2005 100644
if (!ctrl->serdev) if (!ctrl->serdev)
return -ENODEV; return -ENODEV;
-- --
2.26.0 2.26.2

View file

@ -1,4 +1,4 @@
From 263250b920776cdc295f6317c028191db6623f53 Mon Sep 17 00:00:00 2001 From 9fbb880aaed6b854547a6019cdfd2e78013f8fbb Mon Sep 17 00:00:00 2001
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com> From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
Date: Sat, 28 Sep 2019 17:48:21 +0200 Date: Sat, 28 Sep 2019 17:48:21 +0200
Subject: [PATCH 06/10] suspend Subject: [PATCH 06/10] suspend
@ -12,7 +12,7 @@ Subject: [PATCH 06/10] suspend
5 files changed, 162 insertions(+), 6 deletions(-) 5 files changed, 162 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a8132e8d72bb..acb0d5bb3a8d 100644 index d5359c7c811a..04e1568b145a 100644
--- a/drivers/nvme/host/core.c --- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c
@@ -1055,15 +1055,15 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl, @@ -1055,15 +1055,15 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl,
@ -59,7 +59,7 @@ index a8132e8d72bb..acb0d5bb3a8d 100644
int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
{ {
u32 q_count = (*count - 1) | ((*count - 1) << 16); u32 q_count = (*count - 1) | ((*count - 1) << 16);
@@ -3590,6 +3608,18 @@ static void nvme_free_ctrl(struct device *dev) @@ -3601,6 +3619,18 @@ static void nvme_free_ctrl(struct device *dev)
nvme_put_subsystem(subsys); nvme_put_subsystem(subsys);
} }
@ -266,10 +266,10 @@ index 3c68a5b35ec1..0cc7bea4eb70 100644
.err_handler = &nvme_err_handler, .err_handler = &nvme_err_handler,
}; };
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 1117b25fbe0b..5d7d30f72ea8 100644 index db2efa219028..0d1ef41abea0 100644
--- a/drivers/pci/pcie/aspm.c --- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c
@@ -1176,6 +1176,26 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp) @@ -1180,6 +1180,26 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp)
module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy, module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy,
NULL, 0644); NULL, 0644);
@ -312,5 +312,5 @@ index b1f297f4b7b0..94ab2fc800d3 100644
#ifdef CONFIG_PCIEAER #ifdef CONFIG_PCIEAER
-- --
2.26.0 2.26.2

View file

@ -1,4 +1,4 @@
From 5ae0ab65b746c3298aadabadd1ad5bbbac75de94 Mon Sep 17 00:00:00 2001 From ec6ee78e1b8700139edd50e62e3815d12e5a889e Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com> From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 28 Sep 2019 17:58:17 +0200 Date: Sat, 28 Sep 2019 17:58:17 +0200
Subject: [PATCH 07/10] ipts Subject: [PATCH 07/10] ipts
@ -24,15 +24,15 @@ Subject: [PATCH 07/10] ipts
drivers/misc/Makefile | 1 + drivers/misc/Makefile | 1 +
drivers/misc/ipts/Kconfig | 12 + drivers/misc/ipts/Kconfig | 12 +
drivers/misc/ipts/Makefile | 19 + drivers/misc/ipts/Makefile | 19 +
drivers/misc/ipts/companion.c | 230 ++++ drivers/misc/ipts/companion.c | 211 ++++
drivers/misc/ipts/companion.h | 26 + drivers/misc/ipts/companion.h | 25 +
drivers/misc/ipts/companion/Kconfig | 8 + drivers/misc/ipts/companion/Kconfig | 8 +
drivers/misc/ipts/companion/Makefile | 2 + drivers/misc/ipts/companion/Makefile | 2 +
drivers/misc/ipts/companion/ipts-surface.c | 224 ++++ drivers/misc/ipts/companion/ipts-surface.c | 157 +++
drivers/misc/ipts/dbgfs.c | 277 +++++ drivers/misc/ipts/dbgfs.c | 277 +++++
drivers/misc/ipts/gfx.c | 180 ++++ drivers/misc/ipts/gfx.c | 180 ++++
drivers/misc/ipts/gfx.h | 25 + drivers/misc/ipts/gfx.h | 25 +
drivers/misc/ipts/hid.c | 502 +++++++++ drivers/misc/ipts/hid.c | 469 +++++++++
drivers/misc/ipts/hid.h | 21 + drivers/misc/ipts/hid.h | 21 +
drivers/misc/ipts/ipts.c | 62 ++ drivers/misc/ipts/ipts.c | 62 ++
drivers/misc/ipts/ipts.h | 172 +++ drivers/misc/ipts/ipts.h | 172 +++
@ -40,10 +40,10 @@ Subject: [PATCH 07/10] ipts
drivers/misc/ipts/kernel.h | 17 + drivers/misc/ipts/kernel.h | 17 +
drivers/misc/ipts/mei-msgs.h | 901 ++++++++++++++++ drivers/misc/ipts/mei-msgs.h | 901 ++++++++++++++++
drivers/misc/ipts/mei.c | 238 +++++ drivers/misc/ipts/mei.c | 238 +++++
drivers/misc/ipts/msg-handler.c | 396 +++++++ drivers/misc/ipts/msg-handler.c | 405 +++++++
drivers/misc/ipts/msg-handler.h | 28 + drivers/misc/ipts/msg-handler.h | 28 +
drivers/misc/ipts/params.c | 46 + drivers/misc/ipts/params.c | 42 +
drivers/misc/ipts/params.h | 26 + drivers/misc/ipts/params.h | 25 +
drivers/misc/ipts/resource.c | 291 ++++++ drivers/misc/ipts/resource.c | 291 ++++++
drivers/misc/ipts/resource.h | 26 + drivers/misc/ipts/resource.h | 26 +
drivers/misc/ipts/sensor-regs.h | 834 +++++++++++++++ drivers/misc/ipts/sensor-regs.h | 834 +++++++++++++++
@ -51,10 +51,10 @@ Subject: [PATCH 07/10] ipts
drivers/misc/mei/hw-me-regs.h | 1 + drivers/misc/mei/hw-me-regs.h | 1 +
drivers/misc/mei/pci-me.c | 1 + drivers/misc/mei/pci-me.c | 1 +
include/linux/ipts-binary.h | 140 +++ include/linux/ipts-binary.h | 140 +++
include/linux/ipts-companion.h | 30 + include/linux/ipts-companion.h | 29 +
include/linux/ipts-gfx.h | 86 ++ include/linux/ipts-gfx.h | 86 ++
include/linux/ipts.h | 20 + include/linux/ipts.h | 19 +
50 files changed, 6802 insertions(+), 22 deletions(-) 50 files changed, 6684 insertions(+), 22 deletions(-)
create mode 100644 drivers/gpu/drm/i915/intel_ipts.c create mode 100644 drivers/gpu/drm/i915/intel_ipts.c
create mode 100644 drivers/gpu/drm/i915/intel_ipts.h create mode 100644 drivers/gpu/drm/i915/intel_ipts.h
create mode 100644 drivers/misc/ipts/Kconfig create mode 100644 drivers/misc/ipts/Kconfig
@ -1359,10 +1359,10 @@ index 000000000000..bb3982f48afc
+obj-y += companion/ +obj-y += companion/
diff --git a/drivers/misc/ipts/companion.c b/drivers/misc/ipts/companion.c diff --git a/drivers/misc/ipts/companion.c b/drivers/misc/ipts/companion.c
new file mode 100644 new file mode 100644
index 000000000000..c8199d8be5d6 index 000000000000..8f66b852f137
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/companion.c +++ b/drivers/misc/ipts/companion.c
@@ -0,0 +1,230 @@ @@ -0,0 +1,211 @@
+// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later
+/* +/*
+ * + *
@ -1574,31 +1574,12 @@ index 000000000000..c8199d8be5d6
+ return ret; + return ret;
+ +
+} +}
+
+unsigned int ipts_get_quirks(void)
+{
+ unsigned int ret;
+
+ // Make sure that access to the companion is synchronized
+ mutex_lock(&ipts_companion_lock);
+
+ // If the companion is ignored, or doesn't exist, assume that
+ // the device doesn't have any quirks
+ if (ipts_modparams.ignore_companion || ipts_companion == NULL)
+ ret = IPTS_QUIRK_NONE;
+ else
+ ret = ipts_companion->get_quirks(ipts_companion);
+
+ mutex_unlock(&ipts_companion_lock);
+
+ return ret;
+}
diff --git a/drivers/misc/ipts/companion.h b/drivers/misc/ipts/companion.h diff --git a/drivers/misc/ipts/companion.h b/drivers/misc/ipts/companion.h
new file mode 100644 new file mode 100644
index 000000000000..bb3368b41a38 index 000000000000..7a1e4b388c40
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/companion.h +++ b/drivers/misc/ipts/companion.h
@@ -0,0 +1,26 @@ @@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* +/*
+ * + *
@ -1616,7 +1597,6 @@ index 000000000000..bb3368b41a38
+#include "ipts.h" +#include "ipts.h"
+ +
+bool ipts_companion_available(void); +bool ipts_companion_available(void);
+unsigned int ipts_get_quirks(void);
+ +
+int ipts_request_firmware(const struct firmware **fw, const char *name, +int ipts_request_firmware(const struct firmware **fw, const char *name,
+ struct device *device); + struct device *device);
@ -1649,10 +1629,10 @@ index 000000000000..b37f2f59937a
+obj-$(CONFIG_INTEL_IPTS_SURFACE)+= ipts-surface.o +obj-$(CONFIG_INTEL_IPTS_SURFACE)+= ipts-surface.o
diff --git a/drivers/misc/ipts/companion/ipts-surface.c b/drivers/misc/ipts/companion/ipts-surface.c diff --git a/drivers/misc/ipts/companion/ipts-surface.c b/drivers/misc/ipts/companion/ipts-surface.c
new file mode 100644 new file mode 100644
index 000000000000..1a151538b898 index 000000000000..a717dfcdfeba
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/companion/ipts-surface.c +++ b/drivers/misc/ipts/companion/ipts-surface.c
@@ -0,0 +1,224 @@ @@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later
+/* +/*
+ * + *
@ -1681,53 +1661,6 @@ index 000000000000..1a151538b898
+ MODULE_FIRMWARE("intel/ipts/" X "/vendor_desc.bin"); \ + MODULE_FIRMWARE("intel/ipts/" X "/vendor_desc.bin"); \
+ MODULE_FIRMWARE("intel/ipts/" X "/vendor_kernel.bin") + MODULE_FIRMWARE("intel/ipts/" X "/vendor_kernel.bin")
+ +
+struct ipts_surface_data {
+ const char *hid;
+ unsigned int quirks;
+};
+
+// Surface Book 1 / Surface Studio
+static const struct ipts_surface_data ipts_surface_mshw0076 = {
+ .hid = "MSHW0076",
+ .quirks = IPTS_QUIRK_NO_FEEDBACK,
+};
+
+// Surface Pro 4
+static const struct ipts_surface_data ipts_surface_mshw0078 = {
+ .hid = "MSHW0078",
+ .quirks = IPTS_QUIRK_NO_FEEDBACK,
+};
+
+// Surface Laptop 1 / 2
+static const struct ipts_surface_data ipts_surface_mshw0079 = {
+ .hid = "MSHW0079",
+ .quirks = IPTS_QUIRK_NONE,
+};
+
+// Surface Pro 5 / 6
+static const struct ipts_surface_data ipts_surface_mshw0101 = {
+ .hid = "MSHW0101",
+ .quirks = IPTS_QUIRK_NONE,
+};
+
+// Surface Book 2 15"
+static const struct ipts_surface_data ipts_surface_mshw0102 = {
+ .hid = "MSHW0102",
+ .quirks = IPTS_QUIRK_NONE,
+};
+
+// Unknown, but firmware exists
+static const struct ipts_surface_data ipts_surface_mshw0103 = {
+ .hid = "MSHW0103",
+ .quirks = IPTS_QUIRK_NONE,
+};
+
+// Surface Book 2 13"
+static const struct ipts_surface_data ipts_surface_mshw0137 = {
+ .hid = "MSHW0137",
+ .quirks = IPTS_QUIRK_NONE,
+};
+
+/* +/*
+ * Checkpatch complains about the following lines because it sees them as + * Checkpatch complains about the following lines because it sees them as
+ * header files mixed with .c files. However, forward declaration is perfectly + * header files mixed with .c files. However, forward declaration is perfectly
@ -1774,7 +1707,6 @@ index 000000000000..1a151538b898
+static struct ipts_companion ipts_surface_companion = { +static struct ipts_companion ipts_surface_companion = {
+ .firmware_request = &ipts_surface_request_firmware, + .firmware_request = &ipts_surface_request_firmware,
+ .firmware_config = ipts_surface_fw_config, + .firmware_config = ipts_surface_fw_config,
+ .get_quirks = &ipts_surface_get_quirks,
+ .name = "ipts_surface", + .name = "ipts_surface",
+}; +};
+ +
@ -1783,44 +1715,26 @@ index 000000000000..1a151538b898
+ struct device *device) + struct device *device)
+{ +{
+ char fw_path[MAX_IOCL_FILE_PATH_LEN]; + char fw_path[MAX_IOCL_FILE_PATH_LEN];
+ struct ipts_surface_data *data;
+ +
+ if (companion == NULL || companion->data == NULL) + if (companion == NULL || companion->data == NULL)
+ return -ENOENT; + return -ENOENT;
+ +
+ data = (struct ipts_surface_data *)companion->data;
+
+ snprintf(fw_path, MAX_IOCL_FILE_PATH_LEN, IPTS_SURFACE_FW_PATH_FMT, + snprintf(fw_path, MAX_IOCL_FILE_PATH_LEN, IPTS_SURFACE_FW_PATH_FMT,
+ data->hid, name); + (const char *)companion->data, name);
+ return request_firmware(fw, fw_path, device); + return request_firmware(fw, fw_path, device);
+} +}
+ +
+unsigned int ipts_surface_get_quirks(struct ipts_companion *companion)
+{
+ struct ipts_surface_data *data;
+
+ // In case something went wrong, assume that the
+ // device doesn't have any quirks
+ if (companion == NULL || companion->data == NULL)
+ return IPTS_QUIRK_NONE;
+
+ data = (struct ipts_surface_data *)companion->data;
+
+ return data->quirks;
+}
+
+static int ipts_surface_probe(struct platform_device *pdev) +static int ipts_surface_probe(struct platform_device *pdev)
+{ +{
+ int r; + int r;
+ const struct ipts_surface_data *data = + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
+ acpi_device_get_match_data(&pdev->dev);
+ +
+ if (!data) { + if (!adev) {
+ dev_err(&pdev->dev, "Unable to find ACPI info for device\n"); + dev_err(&pdev->dev, "Unable to find ACPI info for device\n");
+ return -ENODEV; + return -ENODEV;
+ } + }
+ +
+ ipts_surface_companion.data = (void *)data; + ipts_surface_companion.data = (void *)acpi_device_hid(adev);
+ +
+ r = ipts_add_companion(&ipts_surface_companion); + r = ipts_add_companion(&ipts_surface_companion);
+ if (r) { + if (r) {
@ -1844,13 +1758,13 @@ index 000000000000..1a151538b898
+} +}
+ +
+static const struct acpi_device_id ipts_surface_acpi_match[] = { +static const struct acpi_device_id ipts_surface_acpi_match[] = {
+ { "MSHW0076", (unsigned long)&ipts_surface_mshw0076 }, + { "MSHW0076", 0 }, // Surface Book 1 / Surface Studio
+ { "MSHW0078", (unsigned long)&ipts_surface_mshw0078 }, + { "MSHW0078", 0 }, // some Surface Pro 4
+ { "MSHW0079", (unsigned long)&ipts_surface_mshw0079 }, + { "MSHW0079", 0 }, // Surface Laptop 1 / 2
+ { "MSHW0101", (unsigned long)&ipts_surface_mshw0101 }, + { "MSHW0101", 0 }, // Surface Book 2 15"
+ { "MSHW0102", (unsigned long)&ipts_surface_mshw0102 }, + { "MSHW0102", 0 }, // Surface Pro 5 / 6
+ { "MSHW0103", (unsigned long)&ipts_surface_mshw0103 }, + { "MSHW0103", 0 }, // some Surface Pro 4
+ { "MSHW0137", (unsigned long)&ipts_surface_mshw0137 }, + { "MSHW0137", 0 }, // Surface Book 2
+ { }, + { },
+}; +};
+MODULE_DEVICE_TABLE(acpi, ipts_surface_acpi_match); +MODULE_DEVICE_TABLE(acpi, ipts_surface_acpi_match);
@ -1875,7 +1789,6 @@ index 000000000000..1a151538b898
+IPTS_SURFACE_FIRMWARE("MSHW0101"); +IPTS_SURFACE_FIRMWARE("MSHW0101");
+IPTS_SURFACE_FIRMWARE("MSHW0102"); +IPTS_SURFACE_FIRMWARE("MSHW0102");
+IPTS_SURFACE_FIRMWARE("MSHW0103"); +IPTS_SURFACE_FIRMWARE("MSHW0103");
+
+IPTS_SURFACE_FIRMWARE("MSHW0137"); +IPTS_SURFACE_FIRMWARE("MSHW0137");
diff --git a/drivers/misc/ipts/dbgfs.c b/drivers/misc/ipts/dbgfs.c diff --git a/drivers/misc/ipts/dbgfs.c b/drivers/misc/ipts/dbgfs.c
new file mode 100644 new file mode 100644
@ -2379,10 +2292,10 @@ index 000000000000..2880e122e9f9
+#endif // _IPTS_GFX_H_ +#endif // _IPTS_GFX_H_
diff --git a/drivers/misc/ipts/hid.c b/drivers/misc/ipts/hid.c diff --git a/drivers/misc/ipts/hid.c b/drivers/misc/ipts/hid.c
new file mode 100644 new file mode 100644
index 000000000000..1a487b633fdd index 000000000000..1b7ad2a774a8
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/hid.c +++ b/drivers/misc/ipts/hid.c
@@ -0,0 +1,502 @@ @@ -0,0 +1,469 @@
+// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later
+/* +/*
+ * + *
@ -2741,10 +2654,11 @@ index 000000000000..1a487b633fdd
+static int handle_outputs(struct ipts_info *ipts, int parallel_idx) +static int handle_outputs(struct ipts_info *ipts, int parallel_idx)
+{ +{
+ struct kernel_output_buffer_header *out_buf_hdr; + struct kernel_output_buffer_header *out_buf_hdr;
+ struct ipts_buffer_info *output_buf, *fb_buf = NULL; + struct ipts_buffer_info *output_buf;
+ u8 *input_report, *payload; + u8 *input_report, *payload;
+ u32 tr_id; + u8 tr_id;
+ int i, payload_size, ret = 0, header_size; + int i, payload_size, header_size;
+ bool send_feedback = false;
+ +
+ header_size = sizeof(struct kernel_output_buffer_header); + header_size = sizeof(struct kernel_output_buffer_header);
+ output_buf = ipts_get_output_buffers_by_parallel_id(ipts, + output_buf = ipts_get_output_buffers_by_parallel_id(ipts,
@ -2757,6 +2671,9 @@ index 000000000000..1a487b633fdd
+ if (out_buf_hdr->length < header_size) + if (out_buf_hdr->length < header_size)
+ continue; + continue;
+ +
+ tr_id = *(u8 *)&out_buf_hdr->hid_private_data.transaction_id;
+ send_feedback = true;
+
+ payload_size = out_buf_hdr->length - header_size; + payload_size = out_buf_hdr->length - header_size;
+ payload = out_buf_hdr->data; + payload = out_buf_hdr->data;
+ +
@ -2779,12 +2696,7 @@ index 000000000000..1a487b633fdd
+ break; + break;
+ } + }
+ case OUTPUT_BUFFER_PAYLOAD_FEEDBACK_BUFFER: { + case OUTPUT_BUFFER_PAYLOAD_FEEDBACK_BUFFER: {
+ // send feedback data for raw data mode + // Ignored
+ fb_buf = ipts_get_feedback_buffer(ipts, parallel_idx);
+ tr_id = out_buf_hdr->hid_private_data.transaction_id;
+
+ memcpy(fb_buf->addr, payload, payload_size);
+
+ break; + break;
+ } + }
+ case OUTPUT_BUFFER_PAYLOAD_ERROR: { + case OUTPUT_BUFFER_PAYLOAD_ERROR: {
@ -2814,42 +2726,10 @@ index 000000000000..1a487b633fdd
+ } + }
+ } + }
+ +
+ /*
+ * XXX: Calling the "ipts_send_feedback" function repeatedly seems to
+ * be what is causing touch to crash (found by sebanc, see the link
+ * below for the comment) on some models, especially on Surface Pro 4
+ * and Surface Book 1.
+ * The most desirable fix could be done by raising IPTS GuC priority.
+ * Until we find a better solution, use this workaround.
+ *
+ * The decision which devices have no_feedback enabled by default is
+ * made by the companion driver. If no companion driver was loaded,
+ * no_feedback is disabled and the default behaviour is used.
+ *
+ * Link to the comment where sebanc found this workaround:
+ * https://github.com/jakeday/linux-surface/issues/374#issuecomment-508234110
+ * (Touch and pen issue persists · Issue #374 · jakeday/linux-surface)
+ *
+ * Link to the usage from kitakar5525 who made this change:
+ * https://github.com/jakeday/linux-surface/issues/374#issuecomment-517289171
+ * (Touch and pen issue persists · Issue #374 · jakeday/linux-surface)
+ */
+ if (fb_buf) {
+ // A negative value means "decide by dmi table"
+ if (ipts_modparams.no_feedback < 0) {
+ if (ipts_get_quirks() & IPTS_QUIRK_NO_FEEDBACK)
+ ipts_modparams.no_feedback = true;
+ else
+ ipts_modparams.no_feedback = false;
+ }
+ +
+ if (ipts_modparams.no_feedback)
+ return 0;
+ +
+ ret = ipts_send_feedback(ipts, parallel_idx, tr_id); + if (send_feedback)
+ if (ret) + return ipts_send_feedback(ipts, parallel_idx, tr_id);
+ return ret;
+ }
+ +
+ return 0; + return 0;
+} +}
@ -5387,10 +5267,10 @@ index 000000000000..03b5d747a728
+MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL");
diff --git a/drivers/misc/ipts/msg-handler.c b/drivers/misc/ipts/msg-handler.c diff --git a/drivers/misc/ipts/msg-handler.c b/drivers/misc/ipts/msg-handler.c
new file mode 100644 new file mode 100644
index 000000000000..b2b382ea4675 index 000000000000..9431b1dfc6e0
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/msg-handler.c +++ b/drivers/misc/ipts/msg-handler.c
@@ -0,0 +1,396 @@ @@ -0,0 +1,405 @@
+// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later
+/* +/*
+ * + *
@ -5435,16 +5315,24 @@ index 000000000000..b2b382ea4675
+int ipts_send_feedback(struct ipts_info *ipts, int buffer_idx, +int ipts_send_feedback(struct ipts_info *ipts, int buffer_idx,
+ u32 transaction_id) + u32 transaction_id)
+{ +{
+ int cmd_len = sizeof(struct touch_sensor_feedback_ready_cmd_data); + struct ipts_buffer_info feedback_buffer;
+ struct touch_sensor_feedback_ready_cmd_data fb_ready_cmd; + struct touch_feedback_hdr *feedback;
+ struct touch_sensor_feedback_ready_cmd_data cmd;
+ +
+ memset(&fb_ready_cmd, 0, cmd_len); + feedback_buffer = ipts->resource.feedback_buffer[buffer_idx];
+ feedback = (struct touch_feedback_hdr *)feedback_buffer.addr;
+ +
+ fb_ready_cmd.feedback_index = buffer_idx; + memset(feedback, 0, sizeof(struct touch_feedback_hdr));
+ fb_ready_cmd.transaction_id = transaction_id; + memset(&cmd, 0, sizeof(struct touch_sensor_feedback_ready_cmd_data));
+
+ feedback->feedback_cmd_type = TOUCH_FEEDBACK_CMD_TYPE_NONE;
+ feedback->buffer_id = transaction_id;
+
+ cmd.feedback_index = buffer_idx;
+ cmd.transaction_id = transaction_id;
+ +
+ return ipts_handle_cmd(ipts, TOUCH_SENSOR_FEEDBACK_READY_CMD, + return ipts_handle_cmd(ipts, TOUCH_SENSOR_FEEDBACK_READY_CMD,
+ &fb_ready_cmd, cmd_len); + &cmd, sizeof(struct touch_sensor_feedback_ready_cmd_data));
+} +}
+ +
+int ipts_send_sensor_quiesce_io_cmd(struct ipts_info *ipts) +int ipts_send_sensor_quiesce_io_cmd(struct ipts_info *ipts)
@ -5732,6 +5620,7 @@ index 000000000000..b2b382ea4675
+ } + }
+ case TOUCH_SENSOR_FEEDBACK_READY_RSP: { + case TOUCH_SENSOR_FEEDBACK_READY_RSP: {
+ if (rsp_status != TOUCH_STATUS_COMPAT_CHECK_FAIL && + if (rsp_status != TOUCH_STATUS_COMPAT_CHECK_FAIL &&
+ rsp_status != TOUCH_STATUS_INVALID_PARAMS &&
+ rsp_status != 0) { + rsp_status != 0) {
+ rsp_failed(ipts, cmd, rsp_status); + rsp_failed(ipts, cmd, rsp_status);
+ break; + break;
@ -5823,10 +5712,10 @@ index 000000000000..eca4238adf4b
+#endif /* _IPTS_MSG_HANDLER_H */ +#endif /* _IPTS_MSG_HANDLER_H */
diff --git a/drivers/misc/ipts/params.c b/drivers/misc/ipts/params.c diff --git a/drivers/misc/ipts/params.c b/drivers/misc/ipts/params.c
new file mode 100644 new file mode 100644
index 000000000000..93b19cbf4786 index 000000000000..3ea76ca8342a
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/params.c +++ b/drivers/misc/ipts/params.c
@@ -0,0 +1,46 @@ @@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0-or-later
+/* +/*
+ * + *
@ -5847,7 +5736,6 @@ index 000000000000..93b19cbf4786
+ .ignore_fw_fallback = false, + .ignore_fw_fallback = false,
+ .ignore_config_fallback = false, + .ignore_config_fallback = false,
+ .ignore_companion = false, + .ignore_companion = false,
+ .no_feedback = -1,
+ +
+ .debug = false, + .debug = false,
+ .debug_thread = false, + .debug_thread = false,
@ -5862,9 +5750,6 @@ index 000000000000..93b19cbf4786
+IPTS_PARAM(ignore_companion, bool, 0400, +IPTS_PARAM(ignore_companion, bool, 0400,
+ "Don't use a companion driver to load firmware. (default: false)" + "Don't use a companion driver to load firmware. (default: false)"
+); +);
+IPTS_PARAM(no_feedback, int, 0644,
+ "Disable sending feedback to ME (can prevent crashes on Skylake). (-1=auto [default], 0=false, 1=true)"
+);
+ +
+IPTS_PARAM(debug, bool, 0400, +IPTS_PARAM(debug, bool, 0400,
+ "Enable IPTS debugging output. (default: false)" + "Enable IPTS debugging output. (default: false)"
@ -5875,10 +5760,10 @@ index 000000000000..93b19cbf4786
+ +
diff --git a/drivers/misc/ipts/params.h b/drivers/misc/ipts/params.h diff --git a/drivers/misc/ipts/params.h b/drivers/misc/ipts/params.h
new file mode 100644 new file mode 100644
index 000000000000..4d9d2bca5ede index 000000000000..c20546bacb08
--- /dev/null --- /dev/null
+++ b/drivers/misc/ipts/params.h +++ b/drivers/misc/ipts/params.h
@@ -0,0 +1,26 @@ @@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* +/*
+ * + *
@ -5896,7 +5781,6 @@ index 000000000000..4d9d2bca5ede
+ bool ignore_fw_fallback; + bool ignore_fw_fallback;
+ bool ignore_config_fallback; + bool ignore_config_fallback;
+ bool ignore_companion; + bool ignore_companion;
+ int no_feedback;
+ +
+ bool debug; + bool debug;
+ bool debug_thread; + bool debug_thread;
@ -7103,7 +6987,7 @@ index 000000000000..ef73d28db47c
+ +
+#endif // _IPTS_STATE_H_ +#endif // _IPTS_STATE_H_
diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
index d80372d21c14..6e14bde0a819 100644 index 2ac1dc5104b7..5daa857a4938 100644
--- a/drivers/misc/mei/hw-me-regs.h --- a/drivers/misc/mei/hw-me-regs.h
+++ b/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h
@@ -119,6 +119,7 @@ @@ -119,6 +119,7 @@
@ -7115,7 +6999,7 @@ index d80372d21c14..6e14bde0a819 100644
#define MEI_DEV_ID_SPT_H_2 0xA13B /* Sunrise Point H 2 */ #define MEI_DEV_ID_SPT_H_2 0xA13B /* Sunrise Point H 2 */
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 3498c10b8263..4442c6366f0d 100644 index b4bf12f27caf..34f4338fa641 100644
--- a/drivers/misc/mei/pci-me.c --- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c
@@ -86,6 +86,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { @@ -86,6 +86,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
@ -7274,10 +7158,10 @@ index 000000000000..98b54d74ff88
+#endif // IPTS_BINARY_H +#endif // IPTS_BINARY_H
diff --git a/include/linux/ipts-companion.h b/include/linux/ipts-companion.h diff --git a/include/linux/ipts-companion.h b/include/linux/ipts-companion.h
new file mode 100644 new file mode 100644
index 000000000000..1f606a5fb5f2 index 000000000000..de31f5e0b186
--- /dev/null --- /dev/null
+++ b/include/linux/ipts-companion.h +++ b/include/linux/ipts-companion.h
@@ -0,0 +1,30 @@ @@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* +/*
+ * + *
@ -7294,7 +7178,6 @@ index 000000000000..1f606a5fb5f2
+#include <linux/ipts-binary.h> +#include <linux/ipts-binary.h>
+ +
+struct ipts_companion { +struct ipts_companion {
+ unsigned int (*get_quirks)(struct ipts_companion *companion);
+ int (*firmware_request)(struct ipts_companion *companion, + int (*firmware_request)(struct ipts_companion *companion,
+ const struct firmware **fw, + const struct firmware **fw,
+ const char *name, struct device *device); + const char *name, struct device *device);
@ -7402,10 +7285,10 @@ index 000000000000..cb9d98fe96e4
+#endif // IPTS_GFX_H +#endif // IPTS_GFX_H
diff --git a/include/linux/ipts.h b/include/linux/ipts.h diff --git a/include/linux/ipts.h b/include/linux/ipts.h
new file mode 100644 new file mode 100644
index 000000000000..bfa8e1375926 index 000000000000..f229a3436851
--- /dev/null --- /dev/null
+++ b/include/linux/ipts.h +++ b/include/linux/ipts.h
@@ -0,0 +1,20 @@ @@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* +/*
+ * + *
@ -7423,9 +7306,8 @@ index 000000000000..bfa8e1375926
+#define MAX_IOCL_FILE_PATH_LEN 256 +#define MAX_IOCL_FILE_PATH_LEN 256
+ +
+#define IPTS_QUIRK_NONE 0 +#define IPTS_QUIRK_NONE 0
+#define IPTS_QUIRK_NO_FEEDBACK BIT(0)
+ +
+#endif // IPTS_H +#endif // IPTS_H
-- --
2.26.0 2.26.2

View file

@ -1,4 +1,4 @@
From df219c06e6a1785faa283682974c41ba61bfce69 Mon Sep 17 00:00:00 2001 From 4141869e43f1bf06fd3dfa96b506148373171f10 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com> From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 28 Sep 2019 18:02:03 +0200 Date: Sat, 28 Sep 2019 18:02:03 +0200
Subject: [PATCH 08/10] surface-lte Subject: [PATCH 08/10] surface-lte
@ -8,10 +8,10 @@ Subject: [PATCH 08/10] surface-lte
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 613f91add03d..e1428222dd73 100644 index ce0401d3137f..b0c190cd46c9 100644
--- a/drivers/usb/serial/qcserial.c --- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c
@@ -177,6 +177,7 @@ static const struct usb_device_id id_table[] = { @@ -178,6 +178,7 @@ static const struct usb_device_id id_table[] = {
{DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */ {DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */
{DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */ {DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */
{DEVICE_SWI(0x413c, 0x81d2)}, /* Dell Wireless 5818 */ {DEVICE_SWI(0x413c, 0x81d2)}, /* Dell Wireless 5818 */
@ -20,5 +20,5 @@ index 613f91add03d..e1428222dd73 100644
/* Huawei devices */ /* Huawei devices */
{DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */ {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
-- --
2.26.0 2.26.2

View file

@ -1,14 +1,11 @@
From 34845744043e4e3c3f2bc0a4202c93c5e27bc14d Mon Sep 17 00:00:00 2001 From 6d8ed96cfeb08b584fd429eb603e0d5d00e476a6 Mon Sep 17 00:00:00 2001
From: Tuowen Zhao <ztuowen@gmail.com> From: Tuowen Zhao <ztuowen@gmail.com>
Date: Wed, 16 Oct 2019 15:06:28 -0600 Date: Wed, 16 Oct 2019 15:06:28 -0600
Subject: [PATCH 09/10] ioremap_uc Subject: [PATCH 09/10] ioremap_uc
--- ---
Documentation/driver-model/devres.txt | 1 + Documentation/driver-model/devres.txt | 1 +
drivers/mfd/intel-lpss.c | 2 +- 1 file changed, 1 insertion(+)
include/linux/io.h | 2 ++
lib/devres.c | 19 +++++++++++++++++++
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index 43681ca0837f..7b1ee4190208 100644 index 43681ca0837f..7b1ee4190208 100644
@ -22,76 +19,6 @@ index 43681ca0837f..7b1ee4190208 100644
devm_ioremap_wc() devm_ioremap_wc()
devm_ioremap_resource() : checks resource, requests memory region, ioremaps devm_ioremap_resource() : checks resource, requests memory region, ioremaps
devm_iounmap() devm_iounmap()
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 95e217e6b6d7..7577afd42842 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -397,7 +397,7 @@ int intel_lpss_probe(struct device *dev,
if (!lpss)
return -ENOMEM;
- lpss->priv = devm_ioremap(dev, info->mem->start + LPSS_PRIV_OFFSET,
+ lpss->priv = devm_ioremap_uc(dev, info->mem->start + LPSS_PRIV_OFFSET,
LPSS_PRIV_SIZE);
if (!lpss->priv)
return -ENOMEM;
diff --git a/include/linux/io.h b/include/linux/io.h
index 32e30e8fb9db..da39ff89df65 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -75,6 +75,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
resource_size_t size);
+void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
+ resource_size_t size);
void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
resource_size_t size);
void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
diff --git a/lib/devres.c b/lib/devres.c
index aa0f5308ac6b..75ea32d9b661 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -9,6 +9,7 @@
enum devm_ioremap_type {
DEVM_IOREMAP = 0,
DEVM_IOREMAP_NC,
+ DEVM_IOREMAP_UC,
DEVM_IOREMAP_WC,
};
@@ -39,6 +40,9 @@ static void __iomem *__devm_ioremap(struct device *dev, resource_size_t offset,
case DEVM_IOREMAP_NC:
addr = ioremap_nocache(offset, size);
break;
+ case DEVM_IOREMAP_UC:
+ addr = ioremap_uc(offset, size);
+ break;
case DEVM_IOREMAP_WC:
addr = ioremap_wc(offset, size);
break;
@@ -68,6 +72,21 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
}
EXPORT_SYMBOL(devm_ioremap);
+/**
+ * devm_ioremap_uc - Managed ioremap_uc()
+ * @dev: Generic device to remap IO address for
+ * @offset: Resource address to map
+ * @size: Size of map
+ *
+ * Managed ioremap_uc(). Map is automatically unmapped on driver detach.
+ */
+void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
+ resource_size_t size)
+{
+ return __devm_ioremap(dev, offset, size, DEVM_IOREMAP_UC);
+}
+EXPORT_SYMBOL_GPL(devm_ioremap_uc);
+
/**
* devm_ioremap_nocache - Managed ioremap_nocache()
* @dev: Generic device to remap IO address for
-- --
2.26.0 2.26.2

View file

@ -1,13 +1,13 @@
From 4f727acf39a87273cada07975102cb3e7d452057 Mon Sep 17 00:00:00 2001 From 9bb4c5b00ce73302b1321f7b51bfbe7bcf7386fb Mon Sep 17 00:00:00 2001
From: sebanc <22224731+sebanc@users.noreply.github.com> From: sebanc <22224731+sebanc@users.noreply.github.com>
Date: Mon, 4 Nov 2019 09:30:57 +0100 Date: Mon, 4 Nov 2019 09:30:57 +0100
Subject: [PATCH 10/10] wifi Subject: [PATCH 10/10] wifi
--- ---
.../net/wireless/marvell/mwifiex/cfg80211.c | 26 +++++++ .../net/wireless/marvell/mwifiex/cfg80211.c | 26 ++++++
drivers/net/wireless/marvell/mwifiex/pcie.c | 75 ++++++++++--------- drivers/net/wireless/marvell/mwifiex/pcie.c | 86 +++++++++++--------
.../net/wireless/marvell/mwifiex/sta_cmd.c | 26 +------ .../net/wireless/marvell/mwifiex/sta_cmd.c | 31 ++-----
3 files changed, 66 insertions(+), 61 deletions(-) 3 files changed, 83 insertions(+), 60 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 7b74ef71bef1..d8e65b733cb3 100644 index 7b74ef71bef1..d8e65b733cb3 100644
@ -54,16 +54,25 @@ index 7b74ef71bef1..d8e65b733cb3 100644
} }
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 991b9cc18000..4549359ee19b 100644 index 991b9cc18000..2464f536192c 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/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) @@ -146,40 +146,45 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
*
* If already not suspended, this function allocates and sends a host
* sleep activate request to the firmware and turns off the traffic.
+ *
+ * XXX: ignoring all the above comment and just removes the card to
+ * fix S0ix and "AP scanning (sometimes) not working after suspend".
+ * Required code is extracted from mwifiex_pcie_remove().
*/ */
static int mwifiex_pcie_suspend(struct device *dev) static int mwifiex_pcie_suspend(struct device *dev)
{ {
- struct mwifiex_adapter *adapter; - struct mwifiex_adapter *adapter;
- struct pcie_service_card *card; - struct pcie_service_card *card;
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
-
- card = pci_get_drvdata(pdev);
+ struct pcie_service_card *card = pci_get_drvdata(pdev); + struct pcie_service_card *card = pci_get_drvdata(pdev);
+ struct mwifiex_adapter *adapter; + struct mwifiex_adapter *adapter;
+ struct mwifiex_private *priv; + struct mwifiex_private *priv;
@ -71,8 +80,6 @@ index 991b9cc18000..4549359ee19b 100644
+ u32 fw_status; + u32 fw_status;
+ int ret; + int ret;
- card = pci_get_drvdata(pdev);
/* Might still be loading firmware */ /* Might still be loading firmware */
wait_for_completion(&card->fw_done); wait_for_completion(&card->fw_done);
@ -89,9 +96,6 @@ index 991b9cc18000..4549359ee19b 100644
+ ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status); + ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
+ else + else
+ fw_status = -1; + fw_status = -1;
+
+ if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
+ mwifiex_deauthenticate_all(adapter);
- /* Enable the Host Sleep */ - /* Enable the Host Sleep */
- if (!mwifiex_enable_hs(adapter)) { - if (!mwifiex_enable_hs(adapter)) {
@ -101,22 +105,31 @@ index 991b9cc18000..4549359ee19b 100644
- mwifiex_disable_wake(adapter); - mwifiex_disable_wake(adapter);
- return -EFAULT; - return -EFAULT;
- } - }
+ priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
+ mwifiex_deauthenticate_all(adapter);
- flush_workqueue(adapter->workqueue); - flush_workqueue(adapter->workqueue);
+ mwifiex_disable_auto_ds(priv); + priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
+
+ mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
+ }
- /* Indicate device suspended */ - /* Indicate device suspended */
- set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); - set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
- clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags); - clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
+ mwifiex_disable_auto_ds(priv);
+
+ mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
+ }
+
+ mwifiex_remove_card(adapter); + mwifiex_remove_card(adapter);
return 0; return 0;
} }
@@ -194,30 +196,29 @@ static int mwifiex_pcie_suspend(struct device *dev) @@ -191,33 +196,35 @@ static int mwifiex_pcie_suspend(struct device *dev)
*
* If already not resumed, this function turns on the traffic and
* sends a host sleep cancel request to the firmware.
+ *
+ * XXX: ignoring all the above comment and probes the card that was
+ * removed on suspend. Required code is extracted from mwifiex_pcie_probe().
*/ */
static int mwifiex_pcie_resume(struct device *dev) static int mwifiex_pcie_resume(struct device *dev)
{ {
@ -163,36 +176,41 @@ index 991b9cc18000..4549359ee19b 100644
return 0; return 0;
} }
@@ -271,6 +272,8 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, @@ -233,8 +240,13 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
return -1; const struct pci_device_id *ent)
} {
struct pcie_service_card *card;
+ struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
int ret;
+ pdev->bus->self->bridge_d3 = false; + /* disable bridge_d3 to fix driver crashing after suspend on gen4+
+ * Surface devices */
+ parent_pdev->bridge_d3 = false;
+ +
return 0; pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
} pdev->vendor, pdev->device, pdev->revision);
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index 4ed10cf82f9a..977b57c0908f 100644 index 4ed10cf82f9a..410bef3d6a6e 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/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, @@ -2254,7 +2254,6 @@ 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) * - Function init (for first interface only)
{ * - Read MAC address (for first interface only)
* - Reconfigure Tx buffer size (for first interface only)
- * - Enable auto deep sleep (for first interface only)
* - Get Tx rate
* - Get Tx power
* - Set IBSS coalescing status
@@ -2267,7 +2266,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
- int ret; int ret;
struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl; struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
- struct mwifiex_ds_auto_ds auto_ds; - struct mwifiex_ds_auto_ds auto_ds;
enum state_11d_t state_11d; enum state_11d_t state_11d;
struct mwifiex_ds_11n_tx_cfg tx_cfg; struct mwifiex_ds_11n_tx_cfg tx_cfg;
u8 sdio_sp_rx_aggr_enable; u8 sdio_sp_rx_aggr_enable;
u16 packet_aggr_enable; @@ -2339,16 +2337,10 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
int data;
+ int ret;
if (first_sta) {
if (priv->adapter->iface_type == MWIFIEX_PCIE) {
@@ -2339,17 +2338,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
if (ret) if (ret)
return -1; return -1;
@ -206,11 +224,14 @@ index 4ed10cf82f9a..977b57c0908f 100644
- if (ret) - if (ret)
- return -1; - return -1;
- } - }
- + /* Not enabling ps_mode (IEEE power_save) by default. Enabling
+ * this causes connection instability, especially on 5GHz APs
+ * and eventually causes "firmware wakeup failed". Therefore,
+ * the relevant code was removed from here. */
if (drcs) { if (drcs) {
adapter->drcs_enabled = true; adapter->drcs_enabled = true;
if (ISSUPP_DRCS_ENABLED(adapter->fw_cap_info)) @@ -2395,17 +2387,10 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
@@ -2395,18 +2383,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
if (ret) if (ret)
return -1; return -1;
@ -225,10 +246,13 @@ index 4ed10cf82f9a..977b57c0908f 100644
- if (ret) - if (ret)
- return -1; - return -1;
- } - }
- + /* Not enabling auto deep sleep (auto_ds) by default. Enabling
+ * this reportedly causes "suspend/resume fails when not connected
+ * to an Access Point." Therefore, the relevant code was removed
+ * from here. */
if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
/* Send cmd to FW to enable/disable 11D function */ /* Send cmd to FW to enable/disable 11D function */
state_11d = ENABLE_11D;
-- --
2.26.0 2.26.2