gpio fixes for v6.2-rc5
- fix a potential race condition and always set GPIOs used as interrupt source to input in gpio-mxc - fix a GPIO ACPI-related issue with system suspend on Clevo NL5xRU -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmPLFecACgkQEacuoBRx 13JVhRAAtaM45L65GHsiio06G3DOJthvvEXPvxN+bOgsLVrl+XE8jlEZrPkjjkwM jPDPpd5HLXXDxApOK2vVEXlSXS/4DuPMo7FyTInz/H2oTMXK3WubMTUM2iddgnQr fKjRTkhaeB+dQlrQ/6ZgT08cw+Bf3r0M+A0Mo8h63xzldxNssS3pHd1s3fxiebzG pLSlZzfBhLcXOGn74BttTTEKHLvA03CnEV/Kn1VcljLhGvudfdKzm58ncwONclea v8y3wNj9GdcUhBSnpRxISURW2K8g3SkRVPUjefqsy9xqXMBogsp2cxUjoP/6wsj0 yphDc9ArbdDJSaX7pewtzXmM1BsWAj7NqkOCFzl7Rg5VP7gcfj1Gdc3USSD721ID 4C8VfvakrS3QcfoZvynYB8RKGZuWaM/PibZAgCMq9fErGVPvs5YjFOID3bsVYaIw pbL6PQSsnZN1XLqPDFHGyVcBjvYR2JVWs5nuZPn3c4DhmAWgha3A51vq6vu/nUSx jTeBI/G0fXrc+Ohge6G8nnzKCddZTMT1niUaTO8H9n6aWYw0fGZfasEsWvJnAJxD uQ9MIQhtzM3mKCGWbx1d9l2gSj7/otrUSCG5Zx9OOuCGvq9WpEOwDDyQCoLLAb3X 7UsJT/hy1fPLhJgk5Byy/JW3DoqkNv+BbTeyiqgvnX/ClHhFj6Y= =x2Ca -----END PGP SIGNATURE----- Merge tag 'gpio-fixes-for-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fixes from Bartosz Golaszewski: - fix a potential race condition and always set GPIOs used as interrupt source to input in gpio-mxc - fix a GPIO ACPI-related issue with system suspend on Clevo NL5xRU * tag 'gpio-fixes-for-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpiolib: acpi: Add a ignore wakeup quirk for Clevo NL5xRU gpiolib: acpi: Allow ignoring wake capability on pins that aren't in _AEI gpio: mxc: Always set GPIOs used as interrupt source to INPUT mode gpio: mxc: Protect GPIO irqchip RMW with bgpio spinlock
This commit is contained in:
commit
f883675bf6
@ -18,6 +18,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/of.h>
|
||||
@ -159,6 +160,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type)
|
||||
{
|
||||
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
|
||||
struct mxc_gpio_port *port = gc->private;
|
||||
unsigned long flags;
|
||||
u32 bit, val;
|
||||
u32 gpio_idx = d->hwirq;
|
||||
int edge;
|
||||
@ -197,6 +199,8 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
raw_spin_lock_irqsave(&port->gc.bgpio_lock, flags);
|
||||
|
||||
if (GPIO_EDGE_SEL >= 0) {
|
||||
val = readl(port->base + GPIO_EDGE_SEL);
|
||||
if (edge == GPIO_INT_BOTH_EDGES)
|
||||
@ -217,15 +221,20 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type)
|
||||
writel(1 << gpio_idx, port->base + GPIO_ISR);
|
||||
port->pad_type[gpio_idx] = type;
|
||||
|
||||
return 0;
|
||||
raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
|
||||
|
||||
return port->gc.direction_input(&port->gc, gpio_idx);
|
||||
}
|
||||
|
||||
static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
|
||||
{
|
||||
void __iomem *reg = port->base;
|
||||
unsigned long flags;
|
||||
u32 bit, val;
|
||||
int edge;
|
||||
|
||||
raw_spin_lock_irqsave(&port->gc.bgpio_lock, flags);
|
||||
|
||||
reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */
|
||||
bit = gpio & 0xf;
|
||||
val = readl(reg);
|
||||
@ -243,6 +252,8 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
|
||||
return;
|
||||
}
|
||||
writel(val | (edge << (bit << 1)), reg);
|
||||
|
||||
raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
|
||||
}
|
||||
|
||||
/* handle 32 interrupts in one status register */
|
||||
|
@ -385,7 +385,7 @@ err:
|
||||
}
|
||||
|
||||
static bool acpi_gpio_irq_is_wake(struct device *parent,
|
||||
struct acpi_resource_gpio *agpio)
|
||||
const struct acpi_resource_gpio *agpio)
|
||||
{
|
||||
unsigned int pin = agpio->pin_table[0];
|
||||
|
||||
@ -778,7 +778,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
|
||||
lookup->info.pin_config = agpio->pin_config;
|
||||
lookup->info.debounce = agpio->debounce_timeout;
|
||||
lookup->info.gpioint = gpioint;
|
||||
lookup->info.wake_capable = agpio->wake_capable == ACPI_WAKE_CAPABLE;
|
||||
lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio);
|
||||
|
||||
/*
|
||||
* Polarity and triggering are only specified for GpioInt
|
||||
@ -1623,6 +1623,19 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = {
|
||||
.ignore_interrupt = "AMDI0030:00@18",
|
||||
},
|
||||
},
|
||||
{
|
||||
/*
|
||||
* Spurious wakeups from TP_ATTN# pin
|
||||
* Found in BIOS 1.7.8
|
||||
* https://gitlab.freedesktop.org/drm/amd/-/issues/1722#note_1720627
|
||||
*/
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"),
|
||||
},
|
||||
.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
|
||||
.ignore_wake = "ELAN0415:00@9",
|
||||
},
|
||||
},
|
||||
{} /* Terminating entry */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user