gpio: dwapb: Unify ACPI enumeration checks in get_irq() and configure_irqs()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 4 Aug 2021 16:00:16 +0000 (19:00 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 11 Aug 2021 12:56:43 +0000 (15:56 +0300)
Shared IRQ is only enabled for ACPI enumeration, there is no need
to have a special flag for that, since we simple can test if device
has been enumerated by ACPI. This unifies the checks in dwapb_get_irq()
and dwapb_configure_irqs().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
drivers/gpio/gpio-dwapb.c
drivers/mfd/intel_quark_i2c_gpio.c
include/linux/platform_data/gpio-dwapb.h

index 3eb13d6..4c7153c 100644 (file)
@@ -436,21 +436,17 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
        pirq->irqchip.irq_set_wake = dwapb_irq_set_wake;
 #endif
 
-       if (!pp->irq_shared) {
-               girq->num_parents = pirq->nr_irqs;
-               girq->parents = pirq->irq;
-               girq->parent_handler_data = gpio;
-               girq->parent_handler = dwapb_irq_handler;
-       } else {
-               /* This will let us handle the parent IRQ in the driver */
+       /*
+        * Intel ACPI-based platforms mostly have the DesignWare APB GPIO
+        * IRQ lane shared between several devices. In that case the parental
+        * IRQ has to be handled in the shared way so to be properly delivered
+        * to all the connected devices.
+        */
+       if (has_acpi_companion(gpio->dev)) {
                girq->num_parents = 0;
                girq->parents = NULL;
                girq->parent_handler = NULL;
 
-               /*
-                * Request a shared IRQ since where MFD would have devices
-                * using the same irq pin
-                */
                err = devm_request_irq(gpio->dev, pp->irq[0],
                                       dwapb_irq_handler_mfd,
                                       IRQF_SHARED, DWAPB_DRIVER_NAME, gpio);
@@ -458,6 +454,11 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
                        dev_err(gpio->dev, "error requesting IRQ\n");
                        goto err_kfree_pirq;
                }
+       } else {
+               girq->num_parents = pirq->nr_irqs;
+               girq->parents = pirq->irq;
+               girq->parent_handler_data = gpio;
+               girq->parent_handler = dwapb_irq_handler;
        }
 
        girq->chip = &pirq->irqchip;
@@ -581,7 +582,6 @@ static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
                        pp->ngpio = DWAPB_MAX_GPIOS;
                }
 
-               pp->irq_shared  = false;
                pp->gpio_base   = -1;
 
                /*
index 01935ae..a43993e 100644 (file)
@@ -227,7 +227,6 @@ static int intel_quark_gpio_setup(struct pci_dev *pdev)
        pdata->properties->ngpio        = INTEL_QUARK_MFD_NGPIO;
        pdata->properties->gpio_base    = INTEL_QUARK_MFD_GPIO_BASE;
        pdata->properties->irq[0]       = pci_irq_vector(pdev, 0);
-       pdata->properties->irq_shared   = true;
 
        cell->platform_data = pdata;
        cell->pdata_size = sizeof(*pdata);
index 0aa5c67..535e5ed 100644 (file)
@@ -14,7 +14,6 @@ struct dwapb_port_property {
        unsigned int    ngpio;
        unsigned int    gpio_base;
        int             irq[DWAPB_MAX_GPIOS];
-       bool            irq_shared;
 };
 
 struct dwapb_platform_data {