Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Hardik Prakash <hardikprakash.official@gmail.com>,
	linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org
Cc: linus.walleij@linaro.org, wsa@kernel.org,
	andriy.shevchenko@intel.com, "Natikar,
	Basavaraj" <basavaraj.natikar@amd.com>
Subject: Re: [PATCH 1/2] pinctrl-amd: enable IRQ for WACF2200 touchscreen on Lenovo Yoga 7 14AGP11
Date: Wed, 13 May 2026 12:23:18 -0500	[thread overview]
Message-ID: <dcd84a44-d52b-4810-a1a8-5865f80db1ba@kernel.org> (raw)
In-Reply-To: <20260513061338.9348-2-hardikprakash.official@gmail.com>

++

On 5/13/26 01:13, Hardik Prakash wrote:
> On Lenovo Yoga 7 14AGP11 (83TD), the WACF2200 touchscreen controller
> is wired via I2C2 (AMDI0010:02) with its interrupt on GPIO pin 157
> (confirmed via ACPI _CRS GpioInt decode). After amd_gpio_irq_init()
> clears all GPIO interrupts at boot, pin 157 is never re-enabled,
> preventing the touchscreen from signalling the driver.
> 
> Windows keeps GPIO 157 INTERRUPT_ENABLE (bit 11) and INTERRUPT_MASK
> (bit 12) set after initialisation. Add a DMI quirk to restore these
> bits after amd_gpio_irq_init() on this hardware.
> 
> Signed-off-by: Hardik Prakash <hardikprakash.official@gmail.com>
> Assisted-by: Claude:claude-sonnet-4-6
> Assisted-by: GPT-Codex:gpt-5.2-codex
> ---
>   drivers/pinctrl/pinctrl-amd.c | 35 +++++++++++++++++++++++++++++++++++
>   1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
> index e3128b0045d22..64315b0edf2a6 100644
> --- a/drivers/pinctrl/pinctrl-amd.c
> +++ b/drivers/pinctrl/pinctrl-amd.c
> @@ -26,6 +26,7 @@
>   #include <linux/interrupt.h>
>   #include <linux/bitops.h>
>   #include <linux/pinctrl/pinconf.h>
> +#include <linux/dmi.h>
>   #include <linux/pinctrl/pinconf-generic.h>
>   #include <linux/pinctrl/pinmux.h>
>   #include <linux/string_choices.h>
> @@ -39,6 +40,39 @@
>   static struct amd_gpio *pinctrl_dev;
>   #endif
>   
> +static const struct dmi_system_id amd_gpio_quirk_yoga7_14agp11[] = {
> +	{
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "83TD"),
> +			DMI_MATCH(DMI_BOARD_NAME, "LNVNB161216"),
> +		},
> +	},
> +	{ }
> +};
> +
> +static void amd_gpio_apply_quirks(struct amd_gpio *gpio_dev)
> +{
> +	const unsigned int pin = 157; /* WACF2200 GpioInt per ACPI _CRS */
> +	unsigned long flags;
> +	u32 reg;
> +
> +	if (!dmi_check_system(amd_gpio_quirk_yoga7_14agp11))
> +		return;
> +	if (pin >= gpio_dev->gc.ngpio)
> +		return;
> +
> +	raw_spin_lock_irqsave(&gpio_dev->lock, flags);
> +	reg = readl(gpio_dev->base + pin * 4);
> +	reg |= BIT(INTERRUPT_ENABLE_OFF) | BIT(INTERRUPT_MASK_OFF);
> +	writel(reg, gpio_dev->base + pin * 4);
> +	raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
> +
> +	dev_info(&gpio_dev->pdev->dev,
> +		 "Enabled IRQ for GPIO %u (Yoga 7 14AGP11 touchscreen)\n",
> +		 pin);

I don't understand.  Our design is that the interrupt is disabled 
initially when driver loads (we don't trust state of the GPIO 
configuration pre-boot), and then when i2c-hid loads later it is 
re-enabled via amd_gpio_irq_enable().

Why isn't that flow working on this system?

> +}
> +
>   static int amd_gpio_get_direction(struct gpio_chip *gc, unsigned offset)
>   {
>   	unsigned long flags;
> @@ -1219,6 +1253,7 @@ static int amd_gpio_probe(struct platform_device *pdev)
>   
>   	/* Disable and mask interrupts */
>   	amd_gpio_irq_init(gpio_dev);
> +	amd_gpio_apply_quirks(gpio_dev);
>   
>   	girq = &gpio_dev->gc.irq;
>   	gpio_irq_chip_set_chip(girq, &amd_gpio_irqchip);


  parent reply	other threads:[~2026-05-13 17:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  6:13 [PATCH v2 0/2] Fix WACF2200 touchscreen on Lenovo Yoga 7 14AGP11 Hardik Prakash
2026-05-13  6:13 ` [PATCH 1/2] pinctrl-amd: enable IRQ for " Hardik Prakash
2026-05-13  7:36   ` Linus Walleij
2026-05-13 17:23   ` Mario Limonciello [this message]
2026-05-13  6:13 ` [PATCH 2/2] i2c: designware: fix probe ordering for AMD GPIO " Hardik Prakash
2026-05-13 17:12   ` Andy Shevchenko
2026-05-13 17:28     ` Mario Limonciello
2026-05-13 17:03 ` [PATCH v2 0/2] Fix WACF2200 touchscreen " Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2026-05-12  7:31 [PATCH " Hardik Prakash
2026-05-12  7:31 ` [PATCH 1/2] pinctrl-amd: enable IRQ for " Hardik Prakash
2026-05-12  8:47   ` Linus Walleij
2026-05-12 10:46   ` Andy Shevchenko
2026-05-13  7:33   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcd84a44-d52b-4810-a1a8-5865f80db1ba@kernel.org \
    --to=superm1@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=basavaraj.natikar@amd.com \
    --cc=hardikprakash.official@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox