From e343a7f6991c2a80a1fc064fd56fb5649afd077a Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 21 Jun 2025 16:01:27 +0800 Subject: [PATCH 333/334] AOSCOS: gpio: loongson-64bit: Add LS7A GPIO interrupt support On IPASON NL38-N11 laptops, the touchpad device (a HID multitouch device connected via I2C) uses GPIO 50 to send interrupts. Unfortunately, gpio-loongson-64bit does not support interrupt for LS7A yet, causing the touchpad fail to be probed with: i2c_hid_acpi i2c-PNP0C50:00: HID over i2c has not been provided an Int IRQ Add the offset of the GPIO_INT_EN controlling register to loongson_gpio_ls7a_data to support the interrupt. And, in LS7A the GPIO 4 ... 56 share the same interrupt pin, we need to take this fact into account when calling platform_get_irq or we'd fail with "IRQ index 50 not found." Signed-off-by: Xi Ruoyao --- drivers/gpio/gpio-loongson-64bit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpio/gpio-loongson-64bit.c b/drivers/gpio/gpio-loongson-64bit.c index 7b0738fd4a24f..e9ea3f313416a 100644 --- a/drivers/gpio/gpio-loongson-64bit.c +++ b/drivers/gpio/gpio-loongson-64bit.c @@ -27,6 +27,7 @@ struct loongson_gpio_chip_data { unsigned int out_offset; unsigned int in_offset; unsigned int inten_offset; + bool is_ls7a; }; struct loongson_gpio_chip { @@ -131,6 +132,9 @@ static int loongson_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) writeb(1, lgpio->reg_base + lgpio->chip_data->inten_offset + offset); } + if (lgpio->chip_data->is_ls7a) + offset = MIN(offset, 4); + return platform_get_irq(pdev, offset); } @@ -256,6 +260,8 @@ static const struct loongson_gpio_chip_data loongson_gpio_ls7a_data = { .conf_offset = 0x800, .in_offset = 0xa00, .out_offset = 0x900, + .inten_offset = 0xb00, + .is_ls7a = true, }; /* LS7A2000 chipset GPIO */ -- 2.50.0