|
@@ -1,4 +1,4 @@
|
|
|
-From be77582b7b07355bfcc4cac4da80f2da43c4f097 Mon Sep 17 00:00:00 2001
|
|
|
+From c0287fbdf248c6aa637c71aa17c7a25554bc683a Mon Sep 17 00:00:00 2001
|
|
|
From: qzed <qzed@users.noreply.github.com>
|
|
|
Date: Mon, 26 Aug 2019 01:15:40 +0200
|
|
|
Subject: [PATCH] ACPI: Fix buffer/integer type mismatch
|
|
@@ -81,7 +81,7 @@ index b272c329d45d..cf547883a993 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 4331e6ee0f21ce7e51c03325d3693238203af948 Mon Sep 17 00:00:00 2001
|
|
|
+From 6fca03fe46be728664002d081f306b20ac50537d Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Tue, 24 Sep 2019 17:38:12 +0200
|
|
|
Subject: [PATCH] serdev: Add ACPI devices by ResourceSource field
|
|
@@ -269,7 +269,7 @@ index c66a04d24f1d..1b18d12d217f 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From fa8c370c44eaef3cd75200b51247a04c12b779d7 Mon Sep 17 00:00:00 2001
|
|
|
+From 44d22b18a786031006bb06155acdd3da9450c907 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Tue, 31 Jul 2018 07:50:37 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Differentiate between surprise and safe removal
|
|
@@ -468,7 +468,7 @@ index 5c58c22e0c08..18f83e554c73 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 5790c8b33cc4b0a19a5b1c2c065baf3ba3b1c5cf Mon Sep 17 00:00:00 2001
|
|
|
+From a72bf1f7000b012b6f876adc1f26d0e6d8ae5602 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Sun, 19 Aug 2018 16:29:00 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Drop unnecessary includes
|
|
@@ -607,7 +607,7 @@ index 18f83e554c73..c512b2ed85ed 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From b83555bde6d001be3bb9e09996684da2c2518f67 Mon Sep 17 00:00:00 2001
|
|
|
+From 7e56e7d001a7808839ba6fe38f7731054a75b5a1 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Sun, 19 Aug 2018 16:29:00 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Drop hotplug_slot_ops wrappers
|
|
@@ -820,7 +820,7 @@ index d4b7049cbc70..576362d0b1cd 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From b2639a0c1b7648269b338daf87ce4a149203fbe8 Mon Sep 17 00:00:00 2001
|
|
|
+From 5283b2bc9b1cfdbefcf761a27288cd4362054689 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Sat, 8 Sep 2018 09:59:01 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Tolerate Presence Detect hardwired to zero
|
|
@@ -1018,7 +1018,7 @@ index 576362d0b1cd..7f4173d6771a 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From f3bc2638976b69fbfc0f40f70b4211ff84e9c92d Mon Sep 17 00:00:00 2001
|
|
|
+From 591a23298a05a7c7493ec2a0416f067803f37758 Mon Sep 17 00:00:00 2001
|
|
|
From: Patrick Talbert <ptalbert@redhat.com>
|
|
|
Date: Wed, 5 Sep 2018 09:12:53 +0200
|
|
|
Subject: [PATCH] PCI/ASPM: Do not initialize link state when aspm_disabled is
|
|
@@ -1063,7 +1063,7 @@ index cb474338f39d..18aa830e79e4 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From a088c61501b4416c22057520accb8351a2e9ff6c Mon Sep 17 00:00:00 2001
|
|
|
+From abf218f97266461d64033060138826e7c5801251 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Sun, 19 Aug 2018 16:29:00 +0200
|
|
|
Subject: [PATCH] PCI: Simplify disconnected marking
|
|
@@ -1149,7 +1149,7 @@ index 2c3b5bd59b18..dee5a7507403 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 47fec40f2551fb4a56c32276642fa0eac3e0e8b8 Mon Sep 17 00:00:00 2001
|
|
|
+From 35f7a64d5411b13edccdc510280315536ad984d1 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Tue, 18 Sep 2018 21:46:17 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Unify controller and slot structs
|
|
@@ -2341,7 +2341,7 @@ index 8da87931bd45..b9c1396db6fe 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From a82359ba7d6698eeaf7ce9c50d0f57aa2d88350d Mon Sep 17 00:00:00 2001
|
|
|
+From ce21a78c2d2533f9572392e6238055663729e898 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Sat, 8 Sep 2018 09:59:01 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Rename controller struct members for clarity
|
|
@@ -2648,7 +2648,7 @@ index 4a17d71e15d3..e4d6ec960630 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 15686c23a0c8f9e876195fc50469bef486a6d5a0 Mon Sep 17 00:00:00 2001
|
|
|
+From 24d4ad1309949d2dd3ed503245e1940f64d8ce03 Mon Sep 17 00:00:00 2001
|
|
|
From: Lukas Wunner <lukas@wunner.de>
|
|
|
Date: Sat, 8 Sep 2018 09:59:01 +0200
|
|
|
Subject: [PATCH] PCI: pciehp: Reshuffle controller struct for clarity
|
|
@@ -2779,7 +2779,7 @@ index 2499489158cc..df82a0335515 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 8928c2cdfbf667c87ce75074627ee4f2de854d0c Mon Sep 17 00:00:00 2001
|
|
|
+From 26f4cb74e76953195269393fa42f34ec211f077a Mon Sep 17 00:00:00 2001
|
|
|
From: Keith Busch <keith.busch@intel.com>
|
|
|
Date: Thu, 20 Sep 2018 10:27:17 -0600
|
|
|
Subject: [PATCH] PCI: Make link active reporting detection generic
|
|
@@ -2976,7 +2976,7 @@ index ec6c48ecd7d5..74c8e9190fed 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 828f314baaea82376c69919db201d7a9468c7544 Mon Sep 17 00:00:00 2001
|
|
|
+From 8521cb5e0771b4f7a1858b5473d9463e280a1290 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:53:53 -0500
|
|
|
Subject: [PATCH] PCI: Do not skip power-managed bridges in pci_enable_wake()
|
|
@@ -3027,7 +3027,7 @@ index 99292b338401..2898b7c1ac4b 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 2f6cfa13e7a7d6413bea8b242e4838c632013c77 Mon Sep 17 00:00:00 2001
|
|
|
+From 1a7e191a554c4ac45f51ab24f71fba44cc3db3d5 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:38:19 -0500
|
|
|
Subject: [PATCH] PCI: pciehp: Disable hotplug interrupt during suspend
|
|
@@ -3141,7 +3141,7 @@ index 0693870a9e24..b5c7f5ef597a 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 6bb05aa2d4cdb7b8f72c0247ce047d27c2805a1c Mon Sep 17 00:00:00 2001
|
|
|
+From 2fab3a73aa17c0bd7c61c49e40276c9fcadb6a67 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:41:46 -0500
|
|
|
Subject: [PATCH] PCI: pciehp: Do not handle events if interrupts are masked
|
|
@@ -3183,7 +3183,7 @@ index b5c7f5ef597a..242b9f30210a 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 776d86cb203ee0b0aa77dbbb7ceb675fec976221 Mon Sep 17 00:00:00 2001
|
|
|
+From 2280d316dc6c07931a23953b50e207b48702c0bd Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:41:47 -0500
|
|
|
Subject: [PATCH] PCI/portdrv: Resume upon exit from system suspend if left
|
|
@@ -3236,7 +3236,7 @@ index 23a5a0c2c3fe..5badf8a1ce0a 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From a0b5807960f56c96f7ac90fd19c7937bf8c01c15 Mon Sep 17 00:00:00 2001
|
|
|
+From 8b7a2b01ef0ff71797f30cdfc5cf516a45cc5b80 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:41:48 -0500
|
|
|
Subject: [PATCH] PCI/portdrv: Add runtime PM hooks for port service drivers
|
|
@@ -3348,7 +3348,7 @@ index 5badf8a1ce0a..59d2567e2db2 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 611f6b8b569b4a7ed5721bbe1cf92343c09689ca Mon Sep 17 00:00:00 2001
|
|
|
+From 2ff989f95f1fcc1d04b9cb88f24860859680e184 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:41:49 -0500
|
|
|
Subject: [PATCH] PCI: pciehp: Implement runtime PM callbacks
|
|
@@ -3405,7 +3405,7 @@ index 8e6e4ce869fb..e5de25ebc4cf 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 17d21b61dd014649657455e08cd58b2eab669ae5 Mon Sep 17 00:00:00 2001
|
|
|
+From 6ded56d0a9cc634784d92c8316646b6dfb3b0855 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:57:05 -0500
|
|
|
Subject: [PATCH] ACPI / property: Allow multiple property compatible _DSD
|
|
@@ -3700,7 +3700,7 @@ index cd412817654f..4e2e30e340fe 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From e13a0cc908833740788dca823b99b0d7f4e57b44 Mon Sep 17 00:00:00 2001
|
|
|
+From dd9d941f47115a86182ef719d44cab491a7dc6ae Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 27 Sep 2018 16:57:14 -0500
|
|
|
Subject: [PATCH] PCI / ACPI: Whitelist D3 for more PCIe hotplug ports
|
|
@@ -3865,7 +3865,7 @@ index e9ede82ee2c2..0a5efc437bd1 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From b7c856bcec6d02044f1737ff3d7fbfeda431f6a5 Mon Sep 17 00:00:00 2001
|
|
|
+From c889fe03a79ed9eb837e3c3a94421e7c90f44827 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Mon, 7 Jan 2019 16:09:40 +0300
|
|
|
Subject: [PATCH] PCI: pciehp: Assign ctrl->slot_ctrl before writing it to
|
|
@@ -3919,7 +3919,7 @@ index 242b9f30210a..7074d4923811 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From b661fc6fc2c48a267e112a43dcd93a3c2a931f83 Mon Sep 17 00:00:00 2001
|
|
|
+From e9602252dc92abb532e67f5f9619593345fec693 Mon Sep 17 00:00:00 2001
|
|
|
From: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
Date: Thu, 31 Jan 2019 20:07:46 +0300
|
|
|
Subject: [PATCH] PCI: pciehp: Disable Data Link Layer State Changed event on
|
|
@@ -4008,7 +4008,7 @@ index 7074d4923811..a37ff79a6e9e 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 559532f683fcdfd1d94bd26d6e276d947b5e5c4c Mon Sep 17 00:00:00 2001
|
|
|
+From 6f78ee460a37322033317ab3c64ad953dc36a2d8 Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Thu, 29 Oct 2020 22:04:38 +0100
|
|
|
Subject: [PATCH] PCI: Allow D3cold for hot-plug ports on Surface Books
|
|
@@ -4034,7 +4034,6 @@ via ACPI, out-of-band interrupts, and the surface_hotplug driver
|
|
|
however, device removal/addition will only be detected on device resume.
|
|
|
|
|
|
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
-
|
|
|
Patchset: surface-sam
|
|
|
---
|
|
|
drivers/pci/pci.c | 31 +++++++++++++++++++++++++++++--
|
|
@@ -4094,91 +4093,69 @@ index b53a6772ee09..70af1713767f 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 53572f59250be10aaaf6dd82f773291c6df58108 Mon Sep 17 00:00:00 2001
|
|
|
+From 4675fefaed2fe4c65ed5b2f69ca8ed7d9c0b544b Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
-Date: Sat, 31 Oct 2020 19:48:06 +0100
|
|
|
-Subject: [PATCH] PCI: Update platform power state when updating PCI state
|
|
|
+Date: Mon, 9 Nov 2020 14:23:00 +0100
|
|
|
+Subject: [PATCH] PCI: Run platform power transition on initial D0 entry
|
|
|
|
|
|
On some devices and platforms, the initial platform power state is not
|
|
|
in sync with the power state of the PCI device.
|
|
|
|
|
|
-Specifically, on the Surface Book 2 and 3, some ACPI power regions that
|
|
|
-should be "on" for the D0 state (and others) are initialized as "off" in
|
|
|
-ACPI, whereas the PCI device is in D0. As the state is updated in
|
|
|
-pci_enable_device_flags() without ensuring that the platform state is
|
|
|
-also updated, the power resource will never be properly turned on.
|
|
|
-Instead, it lives in a sort of on-but-marked-as-off zombie-state, which
|
|
|
-confuses things down the line when attempting to transition the device
|
|
|
-into D3cold: As the resource is already marked as off, it won't be
|
|
|
-turned off and the device does not fully enter D3cold, causing increased
|
|
|
-power consumption during (runtime-)suspend.
|
|
|
+pci_enable_device_flags() updates the state of a PCI device by reading
|
|
|
+from the the PCI_PM_CTRL register. This may change the stored power
|
|
|
+state of the device without running the appropriate platform power
|
|
|
+transition.
|
|
|
|
|
|
-Ensuring that the platform power state is in sync with the PCI power
|
|
|
-state when updating the latter guarantees that all required ACPI power
|
|
|
-regions are powered on/off in accordance with the requirements
|
|
|
-(specified in the ACPI _PRn fields) for the current PCI power state.
|
|
|
+Due to the stored power-state being changed, the later call to
|
|
|
+pci_set_power_state(..., PCI_D0) in do_pci_enable_device() can evaluate
|
|
|
+to a no-op if the stored state has been changed to D0 via that. This
|
|
|
+will then prevent the appropriate platform power transition to be run,
|
|
|
+which can on some devices and platforms lead to platform and PCI power
|
|
|
+state being entirely different, i.e. out-of-sync. On ACPI platforms,
|
|
|
+this can lead to power resources not being turned on, even though they
|
|
|
+are marked as required for D0.
|
|
|
|
|
|
-Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
+Specifically, on the Microsoft Surface Book 2 and 3, some ACPI power
|
|
|
+regions that should be "on" for the D0 state (and others) are
|
|
|
+initialized as "off" in ACPI, whereas the PCI device is in D0. As the
|
|
|
+state is updated in pci_enable_device_flags() without ensuring that the
|
|
|
+platform state is also updated, the power resource will never be
|
|
|
+properly turned on. Instead, it lives in a sort of on-but-marked-as-off
|
|
|
+zombie-state, which confuses things down the line when attempting to
|
|
|
+transition the device into D3cold: As the resource is already marked as
|
|
|
+off, it won't be turned off and the device does not fully enter D3cold,
|
|
|
+causing increased power consumption during (runtime-)suspend.
|
|
|
|
|
|
+By replacing pci_set_power_state() in do_pci_enable_device() with
|
|
|
+pci_power_up(), we can force pci_platform_power_transition() to be
|
|
|
+called, which will then check if the platform power state needs updating
|
|
|
+and appropriate actions need to be taken.
|
|
|
+
|
|
|
+Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Patchset: surface-sam
|
|
|
---
|
|
|
- drivers/pci/pci.c | 30 ++++++++++++++++++++++++++++--
|
|
|
- 1 file changed, 28 insertions(+), 2 deletions(-)
|
|
|
+ drivers/pci/pci.c | 4 +---
|
|
|
+ 1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
|
|
|
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
|
|
|
-index 70af1713767f..da8254eeba77 100644
|
|
|
+index 70af1713767f..18caa27c774f 100644
|
|
|
--- a/drivers/pci/pci.c
|
|
|
+++ b/drivers/pci/pci.c
|
|
|
-@@ -1587,7 +1587,7 @@ static void pci_enable_bridge(struct pci_dev *dev)
|
|
|
- static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
|
|
|
- {
|
|
|
- struct pci_dev *bridge;
|
|
|
-- int err;
|
|
|
-+ int err = 0;
|
|
|
- int i, bars = 0;
|
|
|
+@@ -1520,9 +1520,7 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars)
|
|
|
+ u16 cmd;
|
|
|
+ u8 pin;
|
|
|
|
|
|
- /*
|
|
|
-@@ -1597,9 +1597,35 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
|
|
|
- * (e.g. if the device really is in D0 at enable time).
|
|
|
- */
|
|
|
- if (dev->pm_cap) {
|
|
|
-+ pci_power_t current_state;
|
|
|
- u16 pmcsr;
|
|
|
-+
|
|
|
- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
|
|
|
-- dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
|
|
|
-+ current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
|
|
|
-+
|
|
|
-+ /*
|
|
|
-+ * On some platforms, the initial power state may not be in
|
|
|
-+ * sync with the PCI power state. Specifically, on ACPI based
|
|
|
-+ * platforms, power-resources for the current state may not
|
|
|
-+ * have been properly enabled (or power-resources not required
|
|
|
-+ * for the current state disabled) yet. Thus, ensure that the
|
|
|
-+ * platform power state reflects the PCI state.
|
|
|
-+ *
|
|
|
-+ * Update platform state before actually setting current state
|
|
|
-+ * so that it can still be accessed in platform code, if
|
|
|
-+ * necessary.
|
|
|
-+ */
|
|
|
-+ if (platform_pci_power_manageable(dev))
|
|
|
-+ err = platform_pci_set_power_state(dev, current_state);
|
|
|
-+
|
|
|
-+ // always update current state
|
|
|
-+ dev->current_state = current_state;
|
|
|
-+
|
|
|
-+ if (err) {
|
|
|
-+ pci_err(dev, "failed to update platform power state: %d\n",
|
|
|
-+ err);
|
|
|
-+ return err;
|
|
|
-+ }
|
|
|
- }
|
|
|
+- err = pci_set_power_state(dev, PCI_D0);
|
|
|
+- if (err < 0 && err != -EIO)
|
|
|
+- return err;
|
|
|
++ pci_power_up(dev);
|
|
|
|
|
|
- if (atomic_inc_return(&dev->enable_cnt) > 1)
|
|
|
+ bridge = pci_upstream_bridge(dev);
|
|
|
+ if (bridge)
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 4589e6b130e1ee76e64094c06d7831fcfddfd386 Mon Sep 17 00:00:00 2001
|
|
|
+From c2807442e76fa5fd4fc7fa89f24f81603cd6b67e Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Sat, 31 Oct 2020 20:46:33 +0100
|
|
|
Subject: [PATCH] PCI: Add sysfs attribute for PCI device power state
|
|
@@ -4252,7 +4229,7 @@ index 1edf5a1836ea..ee1518650d55 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From a9676aa474e9a0a056251ee93e902f3368dafcd0 Mon Sep 17 00:00:00 2001
|
|
|
+From 80f85033c27b0dcadbf76db3462e17a02435fcf0 Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Mon, 17 Aug 2020 01:23:20 +0200
|
|
|
Subject: [PATCH] misc: surface_sam: Add file2alias support for Surface SAM
|
|
@@ -4354,7 +4331,7 @@ index 7f40b6aab689..76e3b1d7db45 100644
|
|
|
--
|
|
|
2.29.2
|
|
|
|
|
|
-From 7dd08a5b102a9e7b955ebe79acd7100a8c6ef14c Mon Sep 17 00:00:00 2001
|
|
|
+From 31b1c16f7f5513a4f51e277a697cf9ba584dcc90 Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Mon, 17 Aug 2020 01:44:30 +0200
|
|
|
Subject: [PATCH] misc: Add support for Surface System Aggregator Module
|
|
@@ -4394,12 +4371,12 @@ Patchset: surface-sam
|
|
|
.../clients/surface_acpi_notify.c | 884 ++++++
|
|
|
.../clients/surface_aggregator_cdev.c | 299 ++
|
|
|
.../clients/surface_aggregator_registry.c | 609 ++++
|
|
|
- .../clients/surface_battery.c | 1191 ++++++++
|
|
|
- .../surface_aggregator/clients/surface_dtx.c | 1275 ++++++++
|
|
|
- .../surface_aggregator/clients/surface_hid.c | 919 ++++++
|
|
|
+ .../clients/surface_battery.c | 1188 ++++++++
|
|
|
+ .../surface_aggregator/clients/surface_dtx.c | 1277 ++++++++
|
|
|
+ .../surface_aggregator/clients/surface_hid.c | 916 ++++++
|
|
|
.../clients/surface_hotplug.c | 269 ++
|
|
|
.../clients/surface_perfmode.c | 122 +
|
|
|
- drivers/misc/surface_aggregator/controller.c | 2553 +++++++++++++++++
|
|
|
+ drivers/misc/surface_aggregator/controller.c | 2555 +++++++++++++++++
|
|
|
drivers/misc/surface_aggregator/controller.h | 288 ++
|
|
|
drivers/misc/surface_aggregator/core.c | 842 ++++++
|
|
|
drivers/misc/surface_aggregator/ssh_msgb.h | 201 ++
|
|
@@ -4412,14 +4389,14 @@ Patchset: surface-sam
|
|
|
drivers/misc/surface_aggregator/trace.h | 625 ++++
|
|
|
include/linux/mod_devicetable.h | 5 +-
|
|
|
include/linux/surface_acpi_notify.h | 39 +
|
|
|
- include/linux/surface_aggregator/controller.h | 815 ++++++
|
|
|
+ include/linux/surface_aggregator/controller.h | 832 ++++++
|
|
|
include/linux/surface_aggregator/device.h | 430 +++
|
|
|
include/linux/surface_aggregator/serial_hub.h | 655 +++++
|
|
|
include/uapi/linux/surface_aggregator/cdev.h | 58 +
|
|
|
include/uapi/linux/surface_aggregator/dtx.h | 150 +
|
|
|
scripts/mod/devicetable-offsets.c | 3 +-
|
|
|
scripts/mod/file2alias.c | 10 +-
|
|
|
- 48 files changed, 18754 insertions(+), 7 deletions(-)
|
|
|
+ 48 files changed, 18769 insertions(+), 7 deletions(-)
|
|
|
create mode 100644 Documentation/driver-api/surface_aggregator/client-api.rst
|
|
|
create mode 100644 Documentation/driver-api/surface_aggregator/client.rst
|
|
|
create mode 100644 Documentation/driver-api/surface_aggregator/clients/cdev.rst
|
|
@@ -7148,7 +7125,7 @@ index 000000000000..7320922ba755
|
|
|
+obj-$(CONFIG_SURFACE_PERFMODE) += surface_perfmode.o
|
|
|
diff --git a/drivers/misc/surface_aggregator/clients/surface_acpi_notify.c b/drivers/misc/surface_aggregator/clients/surface_acpi_notify.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..9010f3aafd28
|
|
|
+index 000000000000..7a5b8f280036
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/clients/surface_acpi_notify.c
|
|
|
@@ -0,0 +1,884 @@
|
|
@@ -7740,8 +7717,8 @@ index 000000000000..9010f3aafd28
|
|
|
+ return san_rqst_fixup_suspended(d, &rqst, buffer);
|
|
|
+ }
|
|
|
+
|
|
|
-+ status = ssam_retry(ssam_request_sync_onstack, SAN_REQUEST_NUM_TRIES,
|
|
|
-+ d->ctrl, &rqst, &rsp, SAN_GSB_MAX_RQSX_PAYLOAD);
|
|
|
++ status = __ssam_retry(ssam_request_sync_onstack, SAN_REQUEST_NUM_TRIES,
|
|
|
++ d->ctrl, &rqst, &rsp, SAN_GSB_MAX_RQSX_PAYLOAD);
|
|
|
+
|
|
|
+ if (!status) {
|
|
|
+ gsb_rqsx_response_success(buffer, rsp.pointer, rsp.length);
|
|
@@ -8343,7 +8320,7 @@ index 000000000000..7ebd0977fb37
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
diff --git a/drivers/misc/surface_aggregator/clients/surface_aggregator_registry.c b/drivers/misc/surface_aggregator/clients/surface_aggregator_registry.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..282f4409535b
|
|
|
+index 000000000000..215308c79666
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/clients/surface_aggregator_registry.c
|
|
|
@@ -0,0 +1,609 @@
|
|
@@ -8631,7 +8608,7 @@ index 000000000000..282f4409535b
|
|
|
+ u8 opmode;
|
|
|
+ int status;
|
|
|
+
|
|
|
-+ status = ssam_bas_query_opmode(sdev->ctrl, &opmode);
|
|
|
++ status = ssam_retry(ssam_bas_query_opmode, sdev->ctrl, &opmode);
|
|
|
+ if (status < 0) {
|
|
|
+ dev_err(&sdev->dev, "failed to query base state: %d\n", status);
|
|
|
+ return status;
|
|
@@ -8958,10 +8935,10 @@ index 000000000000..282f4409535b
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
diff --git a/drivers/misc/surface_aggregator/clients/surface_battery.c b/drivers/misc/surface_aggregator/clients/surface_battery.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..540a5bd8957a
|
|
|
+index 000000000000..0a4e48754afc
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/clients/surface_battery.c
|
|
|
-@@ -0,0 +1,1191 @@
|
|
|
+@@ -0,0 +1,1188 @@
|
|
|
+// SPDX-License-Identifier: GPL-2.0+
|
|
|
+/*
|
|
|
+ * Surface battery and AC device driver.
|
|
@@ -8983,9 +8960,6 @@ index 000000000000..540a5bd8957a
|
|
|
+
|
|
|
+#include <linux/surface_aggregator/device.h>
|
|
|
+
|
|
|
-+#define SPWR_RETRY 3
|
|
|
-+#define spwr_retry(fn, args...) ssam_retry(fn, SPWR_RETRY, args)
|
|
|
-+
|
|
|
+#define SPWR_AC_BAT_UPDATE_DELAY msecs_to_jiffies(5000)
|
|
|
+
|
|
|
+
|
|
@@ -9210,7 +9184,7 @@ index 000000000000..540a5bd8957a
|
|
|
+
|
|
|
+static int spwr_battery_load_sta(struct spwr_battery_device *bat)
|
|
|
+{
|
|
|
-+ return spwr_retry(ssam_bat_get_sta, bat->sdev, &bat->sta);
|
|
|
++ return ssam_retry(ssam_bat_get_sta, bat->sdev, &bat->sta);
|
|
|
+}
|
|
|
+
|
|
|
+static int spwr_battery_load_bix(struct spwr_battery_device *bat)
|
|
@@ -9220,7 +9194,7 @@ index 000000000000..540a5bd8957a
|
|
|
+ if (!spwr_battery_present(bat))
|
|
|
+ return 0;
|
|
|
+
|
|
|
-+ status = spwr_retry(ssam_bat_get_bix, bat->sdev, &bat->bix);
|
|
|
++ status = ssam_retry(ssam_bat_get_bix, bat->sdev, &bat->bix);
|
|
|
+
|
|
|
+ // enforce NULL terminated strings in case anything goes wrong...
|
|
|
+ bat->bix.model[ARRAY_SIZE(bat->bix.model) - 1] = 0;
|
|
@@ -9236,7 +9210,7 @@ index 000000000000..540a5bd8957a
|
|
|
+ if (!spwr_battery_present(bat))
|
|
|
+ return 0;
|
|
|
+
|
|
|
-+ return spwr_retry(ssam_bat_get_bst, bat->sdev, &bat->bst);
|
|
|
++ return ssam_retry(ssam_bat_get_bst, bat->sdev, &bat->bst);
|
|
|
+}
|
|
|
+
|
|
|
+static int spwr_battery_set_alarm_unlocked(struct spwr_battery_device *bat,
|
|
@@ -9245,7 +9219,7 @@ index 000000000000..540a5bd8957a
|
|
|
+ __le32 value_le = cpu_to_le32(value);
|
|
|
+
|
|
|
+ bat->alarm = value;
|
|
|
-+ return spwr_retry(ssam_bat_set_btp, bat->sdev, &value_le);
|
|
|
++ return ssam_retry(ssam_bat_set_btp, bat->sdev, &value_le);
|
|
|
+}
|
|
|
+
|
|
|
+static int spwr_battery_set_alarm(struct spwr_battery_device *bat, u32 value)
|
|
@@ -9322,7 +9296,7 @@ index 000000000000..540a5bd8957a
|
|
|
+ int status;
|
|
|
+ u32 old = ac->state;
|
|
|
+
|
|
|
-+ status = spwr_retry(ssam_bat_get_psrc, ac->sdev, &ac->state);
|
|
|
++ status = ssam_retry(ssam_bat_get_psrc, ac->sdev, &ac->state);
|
|
|
+ if (status < 0)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -9850,7 +9824,7 @@ index 000000000000..540a5bd8957a
|
|
|
+ int status;
|
|
|
+
|
|
|
+ // make sure the device is there and functioning properly
|
|
|
-+ status = spwr_retry(ssam_bat_get_sta, ac->sdev, &sta);
|
|
|
++ status = ssam_retry(ssam_bat_get_sta, ac->sdev, &sta);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -9913,7 +9887,7 @@ index 000000000000..540a5bd8957a
|
|
|
+ int status;
|
|
|
+
|
|
|
+ // make sure the device is there and functioning properly
|
|
|
-+ status = spwr_retry(ssam_bat_get_sta, bat->sdev, &sta);
|
|
|
++ status = ssam_retry(ssam_bat_get_sta, bat->sdev, &sta);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -10155,10 +10129,10 @@ index 000000000000..540a5bd8957a
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
diff --git a/drivers/misc/surface_aggregator/clients/surface_dtx.c b/drivers/misc/surface_aggregator/clients/surface_dtx.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..6e2cef16f208
|
|
|
+index 000000000000..46e340229dc5
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/clients/surface_dtx.c
|
|
|
-@@ -0,0 +1,1275 @@
|
|
|
+@@ -0,0 +1,1277 @@
|
|
|
+// SPDX-License-Identifier: GPL-2.0+
|
|
|
+/*
|
|
|
+ * Surface Book (gen. 2 and later) detachment system (DTX) driver.
|
|
@@ -10445,7 +10419,7 @@ index 000000000000..6e2cef16f208
|
|
|
+ struct sdtx_base_info info;
|
|
|
+ int status;
|
|
|
+
|
|
|
-+ status = ssam_bas_get_base(ddev->ctrl, &raw);
|
|
|
++ status = ssam_retry(ssam_bas_get_base, ddev->ctrl, &raw);
|
|
|
+ if (status < 0)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -10463,7 +10437,7 @@ index 000000000000..6e2cef16f208
|
|
|
+ u8 mode;
|
|
|
+ int status;
|
|
|
+
|
|
|
-+ status = ssam_bas_get_device_mode(ddev->ctrl, &mode);
|
|
|
++ status = ssam_retry(ssam_bas_get_device_mode, ddev->ctrl, &mode);
|
|
|
+ if (status < 0)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -10475,7 +10449,7 @@ index 000000000000..6e2cef16f208
|
|
|
+ u8 latch;
|
|
|
+ int status;
|
|
|
+
|
|
|
-+ status = ssam_bas_get_latch_status(ddev->ctrl, &latch);
|
|
|
++ status = ssam_retry(ssam_bas_get_latch_status, ddev->ctrl, &latch);
|
|
|
+ if (status < 0)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -10497,22 +10471,22 @@ index 000000000000..6e2cef16f208
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ case SDTX_IOCTL_LATCH_LOCK:
|
|
|
-+ return ssam_bas_latch_lock(ddev->ctrl);
|
|
|
++ return ssam_retry(ssam_bas_latch_lock, ddev->ctrl);
|
|
|
+
|
|
|
+ case SDTX_IOCTL_LATCH_UNLOCK:
|
|
|
-+ return ssam_bas_latch_unlock(ddev->ctrl);
|
|
|
++ return ssam_retry(ssam_bas_latch_unlock, ddev->ctrl);
|
|
|
+
|
|
|
+ case SDTX_IOCTL_LATCH_REQUEST:
|
|
|
-+ return ssam_bas_latch_request(ddev->ctrl);
|
|
|
++ return ssam_retry(ssam_bas_latch_request, ddev->ctrl);
|
|
|
+
|
|
|
+ case SDTX_IOCTL_LATCH_CONFIRM:
|
|
|
-+ return ssam_bas_latch_confirm(ddev->ctrl);
|
|
|
++ return ssam_retry(ssam_bas_latch_confirm, ddev->ctrl);
|
|
|
+
|
|
|
+ case SDTX_IOCTL_LATCH_HEARTBEAT:
|
|
|
-+ return ssam_bas_latch_heartbeat(ddev->ctrl);
|
|
|
++ return ssam_retry(ssam_bas_latch_heartbeat, ddev->ctrl);
|
|
|
+
|
|
|
+ case SDTX_IOCTL_LATCH_CANCEL:
|
|
|
-+ return ssam_bas_latch_cancel(ddev->ctrl);
|
|
|
++ return ssam_retry(ssam_bas_latch_cancel, ddev->ctrl);
|
|
|
+
|
|
|
+ case SDTX_IOCTL_GET_BASE_INFO:
|
|
|
+ return sdtx_ioctl_get_base_info(ddev,
|
|
@@ -10893,14 +10867,14 @@ index 000000000000..6e2cef16f208
|
|
|
+ ddev = container_of(work, struct sdtx_device, mode_work.work);
|
|
|
+
|
|
|
+ // get operation mode
|
|
|
-+ status = ssam_bas_get_device_mode(ddev->ctrl, &mode);
|
|
|
++ status = ssam_retry(ssam_bas_get_device_mode, ddev->ctrl, &mode);
|
|
|
+ if (status) {
|
|
|
+ dev_err(ddev->dev, "failed to get device mode: %d\n", status);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // get base info
|
|
|
-+ status = ssam_bas_get_base(ddev->ctrl, &base);
|
|
|
++ status = ssam_retry(ssam_bas_get_base, ddev->ctrl, &base);
|
|
|
+ if (status) {
|
|
|
+ dev_err(ddev->dev, "failed to get base info: %d\n", status);
|
|
|
+ return;
|
|
@@ -11044,19 +11018,19 @@ index 000000000000..6e2cef16f208
|
|
|
+ */
|
|
|
+ smp_mb__after_atomic();
|
|
|
+
|
|
|
-+ status = ssam_bas_get_base(ddev->ctrl, &base);
|
|
|
++ status = ssam_retry(ssam_bas_get_base, ddev->ctrl, &base);
|
|
|
+ if (status) {
|
|
|
+ dev_err(ddev->dev, "failed to get base state: %d\n", status);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
-+ status = ssam_bas_get_device_mode(ddev->ctrl, &mode);
|
|
|
++ status = ssam_retry(ssam_bas_get_device_mode, ddev->ctrl, &mode);
|
|
|
+ if (status) {
|
|
|
+ dev_err(ddev->dev, "failed to get device mode: %d\n", status);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
-+ status = ssam_bas_get_latch_status(ddev->ctrl, &latch);
|
|
|
++ status = ssam_retry(ssam_bas_get_latch_status, ddev->ctrl, &latch);
|
|
|
+ if (status) {
|
|
|
+ dev_err(ddev->dev, "failed to get latch status: %d\n", status);
|
|
|
+ return;
|
|
@@ -11134,15 +11108,17 @@ index 000000000000..6e2cef16f208
|
|
|
+ * Note that we also need to do this before registring the event
|
|
|
+ * notifier, as that may access the state values.
|
|
|
+ */
|
|
|
-+ status = ssam_bas_get_base(ddev->ctrl, &ddev->state.base);
|
|
|
++ status = ssam_retry(ssam_bas_get_base, ddev->ctrl, &ddev->state.base);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
|
-+ status = ssam_bas_get_device_mode(ddev->ctrl, &ddev->state.device_mode);
|
|
|
++ status = ssam_retry(ssam_bas_get_device_mode, ddev->ctrl,
|
|
|
++ &ddev->state.device_mode);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
|
-+ status = ssam_bas_get_latch_status(ddev->ctrl, &ddev->state.latch_status);
|
|
|
++ status = ssam_retry(ssam_bas_get_latch_status, ddev->ctrl,
|
|
|
++ &ddev->state.latch_status);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -11436,10 +11412,10 @@ index 000000000000..6e2cef16f208
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
diff --git a/drivers/misc/surface_aggregator/clients/surface_hid.c b/drivers/misc/surface_aggregator/clients/surface_hid.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..8a9a389ac396
|
|
|
+index 000000000000..3fead99ee583
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/clients/surface_hid.c
|
|
|
-@@ -0,0 +1,919 @@
|
|
|
+@@ -0,0 +1,916 @@
|
|
|
+// SPDX-License-Identifier: GPL-2.0+
|
|
|
+/*
|
|
|
+ * Surface System Aggregator Module (SSAM) HID device driver.
|
|
@@ -11464,9 +11440,6 @@ index 000000000000..8a9a389ac396
|
|
|
+#include <linux/surface_aggregator/controller.h>
|
|
|
+#include <linux/surface_aggregator/device.h>
|
|
|
+
|
|
|
-+#define SHID_RETRY 3
|
|
|
-+#define shid_retry(fn, args...) ssam_retry(fn, SHID_RETRY, args)
|
|
|
-+
|
|
|
+
|
|
|
+enum surface_hid_descriptor_entry {
|
|
|
+ SURFACE_HID_DESC_HID = 0,
|
|
@@ -11582,7 +11555,7 @@ index 000000000000..8a9a389ac396
|
|
|
+
|
|
|
+ rsp.length = 0;
|
|
|
+
|
|
|
-+ status = shid_retry(ssam_request_sync_onstack, shid->ctrl,
|
|
|
++ status = ssam_retry(ssam_request_sync_onstack, shid->ctrl,
|
|
|
+ &rqst, &rsp, sizeof(*slice));
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
@@ -11634,7 +11607,7 @@ index 000000000000..8a9a389ac396
|
|
|
+
|
|
|
+ buf[0] = report_id;
|
|
|
+
|
|
|
-+ return shid_retry(ssam_request_sync, shid->ctrl, &rqst, NULL);
|
|
|
++ return ssam_retry(ssam_request_sync, shid->ctrl, &rqst, NULL);
|
|
|
+}
|
|
|
+
|
|
|
+static int ssam_hid_get_raw_report(struct surface_hid_device *shid,
|
|
@@ -11655,7 +11628,7 @@ index 000000000000..8a9a389ac396
|
|
|
+ rsp.length = 0;
|
|
|
+ rsp.pointer = buf;
|
|
|
+
|
|
|
-+ return shid_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
|
|
|
++ return ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
|
|
|
+ sizeof(report_id));
|
|
|
+}
|
|
|
+
|
|
@@ -11740,7 +11713,7 @@ index 000000000000..8a9a389ac396
|
|
|
+ rsp.length = 0;
|
|
|
+ rsp.pointer = buf;
|
|
|
+
|
|
|
-+ status = shid_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
|
|
|
++ status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
|
|
|
+ sizeof(entry));
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
@@ -11767,7 +11740,7 @@ index 000000000000..8a9a389ac396
|
|
|
+ rqst.length = sizeof(value_u8);
|
|
|
+ rqst.payload = &value_u8;
|
|
|
+
|
|
|
-+ return shid_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, NULL,
|
|
|
++ return ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, NULL,
|
|
|
+ sizeof(value_u8));
|
|
|
+}
|
|
|
+
|
|
@@ -11791,7 +11764,7 @@ index 000000000000..8a9a389ac396
|
|
|
+ rsp.length = 0;
|
|
|
+ rsp.pointer = buf;
|
|
|
+
|
|
|
-+ status = shid_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
|
|
|
++ status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
|
|
|
+ sizeof(payload));
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
@@ -12636,7 +12609,7 @@ index 000000000000..9afddfc6a358
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
diff --git a/drivers/misc/surface_aggregator/clients/surface_perfmode.c b/drivers/misc/surface_aggregator/clients/surface_perfmode.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..006601b3bea6
|
|
|
+index 000000000000..e13f4995b28b
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/clients/surface_perfmode.c
|
|
|
@@ -0,0 +1,122 @@
|
|
@@ -12692,7 +12665,7 @@ index 000000000000..006601b3bea6
|
|
|
+ if (mode < __SAM_PERF_MODE__MIN || mode > __SAM_PERF_MODE__MAX)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
-+ return __ssam_tmp_perf_mode_set(sdev, &mode_le);
|
|
|
++ return ssam_retry(__ssam_tmp_perf_mode_set, sdev, &mode_le);
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t perf_mode_show(struct device *dev, struct device_attribute *attr,
|
|
@@ -12702,7 +12675,7 @@ index 000000000000..006601b3bea6
|
|
|
+ struct ssam_perf_info info;
|
|
|
+ int status;
|
|
|
+
|
|
|
-+ status = ssam_tmp_perf_mode_get(sdev, &info);
|
|
|
++ status = ssam_retry(ssam_tmp_perf_mode_get, sdev, &info);
|
|
|
+ if (status) {
|
|
|
+ dev_err(dev, "failed to get current performance mode: %d\n",
|
|
|
+ status);
|
|
@@ -12764,10 +12737,10 @@ index 000000000000..006601b3bea6
|
|
|
+MODULE_LICENSE("GPL");
|
|
|
diff --git a/drivers/misc/surface_aggregator/controller.c b/drivers/misc/surface_aggregator/controller.c
|
|
|
new file mode 100644
|
|
|
-index 000000000000..27332aed13a5
|
|
|
+index 000000000000..5b0c65437b70
|
|
|
--- /dev/null
|
|
|
+++ b/drivers/misc/surface_aggregator/controller.c
|
|
|
-@@ -0,0 +1,2553 @@
|
|
|
+@@ -0,0 +1,2555 @@
|
|
|
+// SPDX-License-Identifier: GPL-2.0+
|
|
|
+/*
|
|
|
+ * Main SSAM/SSH controller structure and functionality.
|
|
@@ -14585,7 +14558,8 @@ index 000000000000..27332aed13a5
|
|
|
+ result.length = 0;
|
|
|
+ result.pointer = buf;
|
|
|
+
|
|
|
-+ status = ssam_request_sync_onstack(ctrl, &rqst, &result, sizeof(params));
|
|
|
++ status = ssam_retry(ssam_request_sync_onstack, ctrl, &rqst, &result,
|
|
|
++ sizeof(params));
|
|
|
+ if (status) {
|
|
|
+ ssam_err(ctrl, "failed to enable event source (tc: 0x%02x, "
|
|
|
+ "iid: 0x%02x, reg: 0x%02x)\n", id.target_category,
|
|
@@ -14653,7 +14627,8 @@ index 000000000000..27332aed13a5
|
|
|
+ result.length = 0;
|
|
|
+ result.pointer = buf;
|
|
|
+
|
|
|
-+ status = ssam_request_sync_onstack(ctrl, &rqst, &result, sizeof(params));
|
|
|
++ status = ssam_retry(ssam_request_sync_onstack, ctrl, &rqst, &result,
|
|
|
++ sizeof(params));
|
|
|
+ if (status) {
|
|
|
+ ssam_err(ctrl, "failed to disable event source (tc: 0x%02x, "
|
|
|
+ "iid: 0x%02x, reg: 0x%02x)\n", id.target_category,
|
|
@@ -14687,7 +14662,7 @@ index 000000000000..27332aed13a5
|
|
|
+ __le32 __version;
|
|
|
+ int status;
|
|
|
+
|
|
|
-+ status = ssam_ssh_get_firmware_version(ctrl, &__version);
|
|
|
++ status = ssam_retry(ssam_ssh_get_firmware_version, ctrl, &__version);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -14729,7 +14704,7 @@ index 000000000000..27332aed13a5
|
|
|
+
|
|
|
+ ssam_dbg(ctrl, "pm: notifying display off\n");
|
|
|
+
|
|
|
-+ status = ssam_ssh_notif_display_off(ctrl, &response);
|
|
|
++ status = ssam_retry(ssam_ssh_notif_display_off, ctrl, &response);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -14768,7 +14743,7 @@ index 000000000000..27332aed13a5
|
|
|
+
|
|
|
+ ssam_dbg(ctrl, "pm: notifying display on\n");
|
|
|
+
|
|
|
-+ status = ssam_ssh_notif_display_on(ctrl, &response);
|
|
|
++ status = ssam_retry(ssam_ssh_notif_display_on, ctrl, &response);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -14810,7 +14785,7 @@ index 000000000000..27332aed13a5
|
|
|
+
|
|
|
+ ssam_dbg(ctrl, "pm: notifying D0 exit\n");
|
|
|
+
|
|
|
-+ status = ssam_ssh_notif_d0_exit(ctrl, &response);
|
|
|
++ status = ssam_retry(ssam_ssh_notif_d0_exit, ctrl, &response);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -14852,7 +14827,7 @@ index 000000000000..27332aed13a5
|
|
|
+
|
|
|
+ ssam_dbg(ctrl, "pm: notifying D0 entry\n");
|
|
|
+
|
|
|
-+ status = ssam_ssh_notif_d0_entry(ctrl, &response);
|
|
|
++ status = ssam_retry(ssam_ssh_notif_d0_entry, ctrl, &response);
|
|
|
+ if (status)
|
|
|
+ return status;
|
|
|
+
|
|
@@ -21373,10 +21348,10 @@ index 000000000000..8e3e86c7d78c
|
|
|
+#endif /* _LINUX_SURFACE_ACPI_NOTIFY_H */
|
|
|
diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h
|
|
|
new file mode 100644
|
|
|
-index 000000000000..447cda590409
|
|
|
+index 000000000000..d128c68c04e0
|
|
|
--- /dev/null
|
|
|
+++ b/include/linux/surface_aggregator/controller.h
|
|
|
-@@ -0,0 +1,815 @@
|
|
|
+@@ -0,0 +1,832 @@
|
|
|
+/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
+/*
|
|
|
+ * Surface System Aggregator Module (SSAM) controller interface.
|
|
@@ -21625,7 +21600,7 @@ index 000000000000..447cda590409
|
|
|
+ })
|
|
|
+
|
|
|
+/**
|
|
|
-+ * ssam_retry - Retry request in case of I/O errors or timeouts.
|
|
|
++ * __ssam_retry - Retry request in case of I/O errors or timeouts.
|
|
|
+ * @request: The request function to execute. Must return an integer.
|
|
|
+ * @n: Number of tries.
|
|
|
+ * @args: Arguments for the request function.
|
|
@@ -21637,7 +21612,7 @@ index 000000000000..447cda590409
|
|
|
+ *
|
|
|
+ * Return: Returns the return value of the last execution of @request.
|
|
|
+ */
|
|
|
-+#define ssam_retry(request, n, args...) \
|
|
|
++#define __ssam_retry(request, n, args...) \
|
|
|
+ ({ \
|
|
|
+ int __i, __s = 0; \
|
|
|
+ \
|
|
@@ -21649,6 +21624,23 @@ index 000000000000..447cda590409
|
|
|
+ __s; \
|
|
|
+ })
|
|
|
+
|
|
|
++/**
|
|
|
++ * ssam_retry - Retry request in case of I/O errors or timeouts up to three
|
|
|
++ * times in total.
|
|
|
++ * @request: The request function to execute. Must return an integer.
|
|
|
++ * @args: Arguments for the request function.
|
|
|
++ *
|
|
|
++ * Executes the given request function, i.e. calls @request. In case the
|
|
|
++ * request returns %-EREMOTEIO (indicates I/O error) or -%ETIMEDOUT (request
|
|
|
++ * or underlying packet timed out), @request will be re-executed again, up to
|
|
|
++ * three times in total.
|
|
|
++ *
|
|
|
++ * See __ssam_retry() for a more generic macro for this purpose.
|
|
|
++ *
|
|
|
++ * Return: Returns the return value of the last execution of @request.
|
|
|
++ */
|
|
|
++#define ssam_retry(request, args...) \
|
|
|
++ __ssam_retry(request, 3, args)
|
|
|
+
|
|
|
+/**
|
|
|
+ * struct ssam_request_spec - Blue-print specification of SAM request.
|