]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Mar 2021 13:16:04 +0000 (14:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Mar 2021 13:16:04 +0000 (14:16 +0100)
added patches:
gpio-pca953x-set-irq-type-when-handle-intel-galileo-gen-2.patch
gpiolib-acpi-add-acpi_gpio_quirk_absolute_number-quirk.patch

queue-5.10/gpio-pca953x-set-irq-type-when-handle-intel-galileo-gen-2.patch [new file with mode: 0644]
queue-5.10/gpiolib-acpi-add-acpi_gpio_quirk_absolute_number-quirk.patch [new file with mode: 0644]
queue-5.10/gpiolib-acpi-allow-to-find-gpioint-resource-by-name-and-index.patch
queue-5.10/series

diff --git a/queue-5.10/gpio-pca953x-set-irq-type-when-handle-intel-galileo-gen-2.patch b/queue-5.10/gpio-pca953x-set-irq-type-when-handle-intel-galileo-gen-2.patch
new file mode 100644 (file)
index 0000000..eb74f2e
--- /dev/null
@@ -0,0 +1,136 @@
+From eb441337c7147514ab45036cadf09c3a71e4ce31 Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Thu, 25 Feb 2021 18:33:20 +0200
+Subject: gpio: pca953x: Set IRQ type when handle Intel Galileo Gen 2
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+commit eb441337c7147514ab45036cadf09c3a71e4ce31 upstream.
+
+The commit 0ea683931adb ("gpio: dwapb: Convert driver to using the
+GPIO-lib-based IRQ-chip") indeliberately made a regression on how
+IRQ line from GPIO I²C expander is handled. I.e. it reveals that
+the quirk for Intel Galileo Gen 2 misses the part of setting IRQ type
+which previously was predefined by gpio-dwapb driver. Now, we have to
+reorganize the approach to call necessary parts, which can be done via
+ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk.
+
+Without this fix and with above mentioned change the kernel hangs
+on the first IRQ event with:
+
+    gpio gpiochip3: Persistence not supported for GPIO 1
+    irq 32, desc: 62f8fb50, depth: 0, count: 0, unhandled: 0
+    ->handle_irq():  41c7b0ab, handle_bad_irq+0x0/0x40
+    ->irq_data.chip(): e03f1e72, 0xc2539218
+    ->action(): 0ecc7e6f
+    ->action->handler(): 8a3db21e, irq_default_primary_handler+0x0/0x10
+       IRQ_NOPROBE set
+    unexpected IRQ trap at vector 20
+
+Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
+Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip")
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpio-pca953x.c |   78 ++++++++++++--------------------------------
+ 1 file changed, 23 insertions(+), 55 deletions(-)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -112,8 +112,29 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id);
+ #ifdef CONFIG_GPIO_PCA953X_IRQ
+ #include <linux/dmi.h>
+-#include <linux/gpio.h>
+-#include <linux/list.h>
++
++static const struct acpi_gpio_params pca953x_irq_gpios = { 0, 0, true };
++
++static const struct acpi_gpio_mapping pca953x_acpi_irq_gpios[] = {
++      { "irq-gpios", &pca953x_irq_gpios, 1, ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER },
++      { }
++};
++
++static int pca953x_acpi_get_irq(struct device *dev)
++{
++      int ret;
++
++      ret = devm_acpi_dev_add_driver_gpios(dev, pca953x_acpi_irq_gpios);
++      if (ret)
++              dev_warn(dev, "can't add GPIO ACPI mapping\n");
++
++      ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0);
++      if (ret < 0)
++              return ret;
++
++      dev_info(dev, "ACPI interrupt quirk (IRQ %d)\n", ret);
++      return ret;
++}
+ static const struct dmi_system_id pca953x_dmi_acpi_irq_info[] = {
+       {
+@@ -132,59 +153,6 @@ static const struct dmi_system_id pca953
+       },
+       {}
+ };
+-
+-#ifdef CONFIG_ACPI
+-static int pca953x_acpi_get_pin(struct acpi_resource *ares, void *data)
+-{
+-      struct acpi_resource_gpio *agpio;
+-      int *pin = data;
+-
+-      if (acpi_gpio_get_irq_resource(ares, &agpio))
+-              *pin = agpio->pin_table[0];
+-      return 1;
+-}
+-
+-static int pca953x_acpi_find_pin(struct device *dev)
+-{
+-      struct acpi_device *adev = ACPI_COMPANION(dev);
+-      int pin = -ENOENT, ret;
+-      LIST_HEAD(r);
+-
+-      ret = acpi_dev_get_resources(adev, &r, pca953x_acpi_get_pin, &pin);
+-      acpi_dev_free_resource_list(&r);
+-      if (ret < 0)
+-              return ret;
+-
+-      return pin;
+-}
+-#else
+-static inline int pca953x_acpi_find_pin(struct device *dev) { return -ENXIO; }
+-#endif
+-
+-static int pca953x_acpi_get_irq(struct device *dev)
+-{
+-      int pin, ret;
+-
+-      pin = pca953x_acpi_find_pin(dev);
+-      if (pin < 0)
+-              return pin;
+-
+-      dev_info(dev, "Applying ACPI interrupt quirk (GPIO %d)\n", pin);
+-
+-      if (!gpio_is_valid(pin))
+-              return -EINVAL;
+-
+-      ret = gpio_request(pin, "pca953x interrupt");
+-      if (ret)
+-              return ret;
+-
+-      ret = gpio_to_irq(pin);
+-
+-      /* When pin is used as an IRQ, no need to keep it requested */
+-      gpio_free(pin);
+-
+-      return ret;
+-}
+ #endif
+ static const struct acpi_device_id pca953x_acpi_ids[] = {
diff --git a/queue-5.10/gpiolib-acpi-add-acpi_gpio_quirk_absolute_number-quirk.patch b/queue-5.10/gpiolib-acpi-add-acpi_gpio_quirk_absolute_number-quirk.patch
new file mode 100644 (file)
index 0000000..1ea5294
--- /dev/null
@@ -0,0 +1,61 @@
+From 62d5247d239d4b48762192a251c647d7c997616a Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Thu, 25 Feb 2021 18:33:18 +0200
+Subject: gpiolib: acpi: Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+commit 62d5247d239d4b48762192a251c647d7c997616a upstream.
+
+On some systems the ACPI tables has wrong pin number and instead of
+having a relative one it provides an absolute one in the global GPIO
+number space.
+
+Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases.
+
+Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
+Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip")
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Acked-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpiolib-acpi.c   |    7 ++++++-
+ include/linux/gpio/consumer.h |    2 ++
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpio/gpiolib-acpi.c
++++ b/drivers/gpio/gpiolib-acpi.c
+@@ -649,6 +649,7 @@ static int acpi_populate_gpio_lookup(str
+       if (!lookup->desc) {
+               const struct acpi_resource_gpio *agpio = &ares->data.gpio;
+               bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT;
++              struct gpio_desc *desc;
+               int pin_index;
+               if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
+@@ -661,8 +662,12 @@ static int acpi_populate_gpio_lookup(str
+               if (pin_index >= agpio->pin_table_length)
+                       return 1;
+-              lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
++              if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
++                      desc = gpio_to_desc(agpio->pin_table[pin_index]);
++              else
++                      desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
+                                             agpio->pin_table[pin_index]);
++              lookup->desc = desc;
+               lookup->info.pin_config = agpio->pin_config;
+               lookup->info.gpioint = gpioint;
+--- a/include/linux/gpio/consumer.h
++++ b/include/linux/gpio/consumer.h
+@@ -674,6 +674,8 @@ struct acpi_gpio_mapping {
+  * get GpioIo type explicitly, this quirk may be used.
+  */
+ #define ACPI_GPIO_QUIRK_ONLY_GPIOIO           BIT(1)
++/* Use given pin as an absolute GPIO number in the system */
++#define ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER               BIT(2)
+       unsigned int quirks;
+ };
index 587fa41fa515df73e1a0bec71a5e1519746900bb..9ac60710c4c33d3aba9f73040fb01c963ee0c05e 100644 (file)
@@ -26,7 +26,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/drivers/gpio/gpiolib-acpi.c
 +++ b/drivers/gpio/gpiolib-acpi.c
-@@ -911,8 +911,9 @@ struct gpio_desc *acpi_node_get_gpiod(st
+@@ -916,8 +916,9 @@ struct gpio_desc *acpi_node_get_gpiod(st
  }
  
  /**
@@ -37,7 +37,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
   * @index: index of GpioInt resource (starting from %0)
   *
   * If the device has one or more GpioInt resources, this function can be
-@@ -922,9 +923,12 @@ struct gpio_desc *acpi_node_get_gpiod(st
+@@ -927,9 +928,12 @@ struct gpio_desc *acpi_node_get_gpiod(st
   * The function is idempotent, though each time it runs it will configure GPIO
   * pin direction according to the flags in GpioInt resource.
   *
@@ -51,7 +51,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  {
        int idx, i;
        unsigned int irq_flags;
-@@ -934,7 +938,7 @@ int acpi_dev_gpio_irq_get(struct acpi_de
+@@ -939,7 +943,7 @@ int acpi_dev_gpio_irq_get(struct acpi_de
                struct acpi_gpio_info info;
                struct gpio_desc *desc;
  
@@ -60,7 +60,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
                /* Ignore -EPROBE_DEFER, it only matters if idx matches */
                if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
-@@ -971,7 +975,7 @@ int acpi_dev_gpio_irq_get(struct acpi_de
+@@ -976,7 +980,7 @@ int acpi_dev_gpio_irq_get(struct acpi_de
        }
        return -ENOENT;
  }
index a293fd4e038266b3392fc6160803c39694b1b774..1c7d99d90d15a56abb88d435618cd337f046fab7 100644 (file)
@@ -8,8 +8,6 @@ net-fix-gro-aggregation-for-udp-encaps-with-zero-csum.patch
 net-check-if-protocol-extracted-by-virtio_net_hdr_set_proto-is-correct.patch
 net-avoid-infinite-loop-in-mpls_gso_segment-when-mpls_hlen-0.patch
 net-l2tp-reduce-log-level-of-messages-in-receive-path-add-counter-instead.patch
-gpiolib-acpi-allow-to-find-gpioint-resource-by-name-and-index.patch
-gpiolib-read-gpio-line-names-from-a-firmware-node.patch
 can-skb-can_skb_set_owner-fix-ref-counting-if-socket-was-closed-before-setting-skb-ownership.patch
 can-flexcan-assert-frz-bit-in-flexcan_chip_freeze.patch
 can-flexcan-enable-rx-fifo-after-frz-halt-valid.patch
@@ -29,7 +27,6 @@ libbpf-clear-map_info-before-each-bpf_obj_get_info_by_fd.patch
 ibmvnic-fix-possibly-uninitialized-old_num_tx_queues-variable-warning.patch
 ibmvnic-always-store-valid-mac-address.patch
 mt76-dma-do-not-report-truncated-frames-to-mac80211.patch
-gpio-fix-gpio-device-list-corruption.patch
 powerpc-603-fix-protection-of-user-pages-mapped-with-prot_none.patch
 mount-fix-mounting-of-detached-mounts-onto-targets-that-reside-on-shared-mounts.patch
 cifs-return-proper-error-code-in-statfs-2.patch
@@ -80,3 +77,8 @@ net-hns3-fix-query-vlan-mask-value-error-for-flow-director.patch
 net-hns3-fix-bug-when-calculating-the-tcam-table-info.patch
 s390-cio-return-efault-if-copy_to_user-fails.patch
 bnxt_en-reliably-allocate-irq-table-on-reset-to-avoid-crash.patch
+gpiolib-acpi-add-acpi_gpio_quirk_absolute_number-quirk.patch
+gpiolib-acpi-allow-to-find-gpioint-resource-by-name-and-index.patch
+gpiolib-read-gpio-line-names-from-a-firmware-node.patch
+gpio-pca953x-set-irq-type-when-handle-intel-galileo-gen-2.patch
+gpio-fix-gpio-device-list-corruption.patch