Patch "pinctrl: qcom: Move clearing pending IRQ to .irq_request_resources callback" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    pinctrl: qcom: Move clearing pending IRQ to .irq_request_resources callback

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pinctrl-qcom-move-clearing-pending-irq-to-.irq_reque.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 34a6f963a4a2b32d686e156b91f7fadfbf07e273
Author: Maulik Shah <mkshah@xxxxxxxxxxxxxx>
Date:   Thu Nov 5 13:08:04 2020 +0530

    pinctrl: qcom: Move clearing pending IRQ to .irq_request_resources callback
    
    [ Upstream commit 71266d9d39366c9b24b866d811b3facaf837f13f ]
    
    When GPIOs that are routed to PDC are used as output they can still latch
    the IRQ pending at GIC. As a result the spurious IRQ was handled when the
    client driver change the direction to input to starts using it as IRQ.
    
    Currently such erroneous latched IRQ are cleared with .irq_enable callback
    however if the driver continue to use GPIO as interrupt and invokes
    disable_irq() followed by enable_irq() then everytime during enable_irq()
    previously latched interrupt gets cleared.
    
    This can make edge IRQs not seen after enable_irq() if they had arrived
    after the driver has invoked disable_irq() and were pending at GIC.
    
    Move clearing erroneous IRQ to .irq_request_resources callback as this is
    the place where GPIO direction is changed as input and its locked as IRQ.
    
    While at this add a missing check to invoke msm_gpio_irq_clear_unmask()
    from .irq_enable callback only when GPIO is not routed to PDC.
    
    Fixes: e35a6ae0eb3a ("pinctrl/msm: Setup GPIO chip in hierarchy")
    Signed-off-by: Maulik Shah <mkshah@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/1604561884-10166-1-git-send-email-mkshah@xxxxxxxxxxxxxx
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 1df232266f63a..1554f0275067e 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -815,21 +815,14 @@ static void msm_gpio_irq_clear_unmask(struct irq_data *d, bool status_clear)
 
 static void msm_gpio_irq_enable(struct irq_data *d)
 {
-	/*
-	 * Clear the interrupt that may be pending before we enable
-	 * the line.
-	 * This is especially a problem with the GPIOs routed to the
-	 * PDC. These GPIOs are direct-connect interrupts to the GIC.
-	 * Disabling the interrupt line at the PDC does not prevent
-	 * the interrupt from being latched at the GIC. The state at
-	 * GIC needs to be cleared before enabling.
-	 */
-	if (d->parent_data) {
-		irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, 0);
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
+
+	if (d->parent_data)
 		irq_chip_enable_parent(d);
-	}
 
-	msm_gpio_irq_clear_unmask(d, true);
+	if (!test_bit(d->hwirq, pctrl->skip_wake_irqs))
+		msm_gpio_irq_clear_unmask(d, true);
 }
 
 static void msm_gpio_irq_disable(struct irq_data *d)
@@ -1104,6 +1097,19 @@ static int msm_gpio_irq_reqres(struct irq_data *d)
 		ret = -EINVAL;
 		goto out;
 	}
+
+	/*
+	 * Clear the interrupt that may be pending before we enable
+	 * the line.
+	 * This is especially a problem with the GPIOs routed to the
+	 * PDC. These GPIOs are direct-connect interrupts to the GIC.
+	 * Disabling the interrupt line at the PDC does not prevent
+	 * the interrupt from being latched at the GIC. The state at
+	 * GIC needs to be cleared before enabling.
+	 */
+	if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
+		irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, 0);
+
 	return 0;
 out:
 	module_put(gc->owner);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux