From: Mario Limonciello <mario.limonciello@amd.com>
To: Natikar Basavaraj <Basavaraj.Natikar@amd.com>,
S-k Shyam-sundar <Shyam-sundar.S-k@amd.com>,
<linus.walleij@linaro.org>
Cc: <andriy.shevchenko@linux.intel.com>, <npliashechnikov@gmail.com>,
<nmschulte@gmail.com>, <friedrich.vock@gmx.de>,
<dridri85@gmail.com>, "Hans de Goede" <hdegoede@redhat.com>,
open list <linux-kernel@vger.kernel.org>,
"open list" <linux-gpio@vger.kernel.org>,
Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v2 2/4] pinctrl: amd: Use amd_pinconf_set() for all config options
Date: Wed, 5 Jul 2023 08:30:03 -0500 [thread overview]
Message-ID: <20230705133005.577-3-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230705133005.577-1-mario.limonciello@amd.com>
On ASUS TUF A16 it is reported that the ITE5570 ACPI device connected to
GPIO 7 is causing an interrupt storm. This issue doesn't happen on
Windows.
Comparing the GPIO register configuration between Windows and Linux
bit 20 has been configured as a pull up on Windows, but not on Linux.
Checking GPIO declaration from the firmware it is clear it *should* have
been a pull up on Linux as well.
```
GpioInt (Level, ActiveLow, Exclusive, PullUp, 0x0000,
"\\_SB.GPIO", 0x00, ResourceConsumer, ,)
{ // Pin list
0x0007
}
```
On Linux amd_gpio_set_config() is currently only used for programming
the debounce. Actually the GPIO core calls it with all the arguments
that are supported by a GPIO, pinctrl-amd just responds `-ENOTSUPP`.
To solve this issue expand amd_gpio_set_config() to support the other
arguments amd_pinconf_set() supports, namely `PIN_CONFIG_BIAS_PULL_DOWN`,
`PIN_CONFIG_BIAS_PULL_UP`, and `PIN_CONFIG_DRIVE_STRENGTH`.
Reported-by: Nik P <npliashechnikov@gmail.com>
Reported-by: Nathan Schulte <nmschulte@gmail.com>
Reported-by: Friedrich Vock <friedrich.vock@gmx.de>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217336
Reported-by: dridri85@gmail.com
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217493
Link: https://lore.kernel.org/linux-input/20230530154058.17594-1-friedrich.vock@gmx.de/
Fixes: 2956b5d94a76 ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
* Adjust commit message alignment
* Move earlier in the series
---
drivers/pinctrl/pinctrl-amd.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 02d9f9f245707..eeaf80fdc13a2 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -188,18 +188,6 @@ static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset,
return ret;
}
-static int amd_gpio_set_config(struct gpio_chip *gc, unsigned offset,
- unsigned long config)
-{
- u32 debounce;
-
- if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
- return -ENOTSUPP;
-
- debounce = pinconf_to_config_argument(config);
- return amd_gpio_set_debounce(gc, offset, debounce);
-}
-
#ifdef CONFIG_DEBUG_FS
static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
{
@@ -782,7 +770,7 @@ static int amd_pinconf_get(struct pinctrl_dev *pctldev,
}
static int amd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
- unsigned long *configs, unsigned num_configs)
+ unsigned long *configs, unsigned int num_configs)
{
int i;
u32 arg;
@@ -872,6 +860,20 @@ static int amd_pinconf_group_set(struct pinctrl_dev *pctldev,
return 0;
}
+static int amd_gpio_set_config(struct gpio_chip *gc, unsigned int pin,
+ unsigned long config)
+{
+ struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
+
+ if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
+ u32 debounce = pinconf_to_config_argument(config);
+
+ return amd_gpio_set_debounce(gc, pin, debounce);
+ }
+
+ return amd_pinconf_set(gpio_dev->pctrl, pin, &config, 1);
+}
+
static const struct pinconf_ops amd_pinconf_ops = {
.pin_config_get = amd_pinconf_get,
.pin_config_set = amd_pinconf_set,
--
2.34.1
next prev parent reply other threads:[~2023-07-05 13:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 13:30 [PATCH v2 0/4] Fix for interrupt storm on ASUS TUF A16 Mario Limonciello
2023-07-05 13:30 ` [PATCH v2 1/4] pinctrl: amd: Only use special debounce behavior for GPIO 0 Mario Limonciello
2023-07-05 13:30 ` Mario Limonciello [this message]
2023-07-06 9:16 ` [PATCH v2 2/4] pinctrl: amd: Use amd_pinconf_set() for all config options Andy Shevchenko
2023-07-06 14:30 ` Limonciello, Mario
2023-07-05 13:30 ` [PATCH v2 3/4] pinctrl: amd: Drop pull up select configuration Mario Limonciello
2023-07-05 13:30 ` [PATCH v2 4/4] pinctrl: amd: Unify debounce handling into amd_pinconf_set() Mario Limonciello
2023-07-07 13:50 ` [PATCH v2 0/4] Fix for interrupt storm on ASUS TUF A16 Linus Walleij
2023-07-07 14:09 ` Limonciello, Mario
2023-07-10 17:49 ` Jan Visser
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=20230705133005.577-3-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dridri85@gmail.com \
--cc=friedrich.vock@gmx.de \
--cc=hdegoede@redhat.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nmschulte@gmail.com \
--cc=npliashechnikov@gmail.com \
/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
all inboxes | Powered by JetHome®