gpio: fixes for v5.17-rc6
- fix an bug generating spurious interrupts in gpio-rockchip - fix a race condition in gpiod_to_irq() called by GPIO consumers -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmIZPoIACgkQEacuoBRx 13JG/g/+Jrh8vM7JCL9JMU7OQKi+MEXIsCpEZrE/ABm77NyxkgQtCDsSiRXu8Snb IX/kwZoWvmOHxwf6qCbr9mfsoyg5dP+LXZIaxOt9I1UY+7aQsAZoROutB7ErAqSC OsiyvoL344YxZJ5JcOrs2bxCe707WAC84dB4cKOwf3ez8pBVTf6LqiEZJRiSjKaj eQ5R6hD5DHOSTYuSAFVfEF+t1vGPdmlzH5Jcfg+x0bohVJHPk+jWf4Xq1CoCFB43 /N5aJY17ESmbCWX4/FcKutILORmVLdnksTrI2dciE2zmFLxBwipFX/pKuoy3CY/Y 6TNUiDUkNPdFIg5wnA0VdRXFfC8DAZ7oE8cactERBDXaQWhRv7gk7hOVEpU1CIdB xpeIEGsUi8uPhnT/y5fVME4Za+IvwPmEDJNfb8ovLp7lQfsPAt43S3Kx8EH7nqgB fOhLav7a9N6HtsPDbfDEmt1PpOg62xo60rEsdQ3w7cZjDZPE/HFEhyrsfZuiUeqU fD1NBDmKx2ucI2hOBGFstN//A+WkZXWL4tz524pB7QvcdLcLin6AALQ7ACbRNLIk 6JZPAwAQG8eOpMbWXLGby3OWuA9H+Eq/3qAvchgAGU2N0MPuxeclwuM+leVDf7Al auN7Jm/7gyjrmp31v4sDkpwVD83FilnYwfTaNA7AdtkIrLcfMI8= =+4o/ -----END PGP SIGNATURE----- Merge tag 'gpio-fixes-for-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fixes from Bartosz Golaszewski: - fix an bug generating spurious interrupts in gpio-rockchip - fix a race condition in gpiod_to_irq() called by GPIO consumers * tag 'gpio-fixes-for-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: Return EPROBE_DEFER if gc->to_irq is NULL gpio: rockchip: Reset int_bothedge when changing trigger
This commit is contained in:
commit
115ccd2278
|
@ -410,10 +410,8 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
|
|||
level = rockchip_gpio_readl(bank, bank->gpio_regs->int_type);
|
||||
polarity = rockchip_gpio_readl(bank, bank->gpio_regs->int_polarity);
|
||||
|
||||
switch (type) {
|
||||
case IRQ_TYPE_EDGE_BOTH:
|
||||
if (type == IRQ_TYPE_EDGE_BOTH) {
|
||||
if (bank->gpio_type == GPIO_TYPE_V2) {
|
||||
bank->toggle_edge_mode &= ~mask;
|
||||
rockchip_gpio_writel_bit(bank, d->hwirq, 1,
|
||||
bank->gpio_regs->int_bothedge);
|
||||
goto out;
|
||||
|
@ -431,24 +429,27 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
|
|||
else
|
||||
polarity |= mask;
|
||||
}
|
||||
break;
|
||||
case IRQ_TYPE_EDGE_RISING:
|
||||
} else {
|
||||
if (bank->gpio_type == GPIO_TYPE_V2) {
|
||||
rockchip_gpio_writel_bit(bank, d->hwirq, 0,
|
||||
bank->gpio_regs->int_bothedge);
|
||||
} else {
|
||||
bank->toggle_edge_mode &= ~mask;
|
||||
}
|
||||
switch (type) {
|
||||
case IRQ_TYPE_EDGE_RISING:
|
||||
level |= mask;
|
||||
polarity |= mask;
|
||||
break;
|
||||
case IRQ_TYPE_EDGE_FALLING:
|
||||
bank->toggle_edge_mode &= ~mask;
|
||||
level |= mask;
|
||||
polarity &= ~mask;
|
||||
break;
|
||||
case IRQ_TYPE_LEVEL_HIGH:
|
||||
bank->toggle_edge_mode &= ~mask;
|
||||
level &= ~mask;
|
||||
polarity |= mask;
|
||||
break;
|
||||
case IRQ_TYPE_LEVEL_LOW:
|
||||
bank->toggle_edge_mode &= ~mask;
|
||||
level &= ~mask;
|
||||
polarity &= ~mask;
|
||||
break;
|
||||
|
@ -456,6 +457,7 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
|
|||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
rockchip_gpio_writel(bank, level, bank->gpio_regs->int_type);
|
||||
rockchip_gpio_writel(bank, polarity, bank->gpio_regs->int_polarity);
|
||||
|
|
|
@ -3147,6 +3147,16 @@ int gpiod_to_irq(const struct gpio_desc *desc)
|
|||
|
||||
return retirq;
|
||||
}
|
||||
#ifdef CONFIG_GPIOLIB_IRQCHIP
|
||||
if (gc->irq.chip) {
|
||||
/*
|
||||
* Avoid race condition with other code, which tries to lookup
|
||||
* an IRQ before the irqchip has been properly registered,
|
||||
* i.e. while gpiochip is still being brought up.
|
||||
*/
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
#endif
|
||||
return -ENXIO;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpiod_to_irq);
|
||||
|
|
Loading…
Reference in New Issue