Skip to content

Commit 635a750

Browse files
superm1linusw
authored andcommitted
pinctrl: amd: Use amd_pinconf_set() for all config options
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/ Tested-by: Jan Visser <starquake@linuxeverywhere.org> Fixes: 2956b5d ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230705133005.577-3-mario.limonciello@amd.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 0d5ace1 commit 635a750

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

drivers/pinctrl/pinctrl-amd.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,6 @@ static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset,
189189
return ret;
190190
}
191191

192-
static int amd_gpio_set_config(struct gpio_chip *gc, unsigned offset,
193-
unsigned long config)
194-
{
195-
u32 debounce;
196-
197-
if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
198-
return -ENOTSUPP;
199-
200-
debounce = pinconf_to_config_argument(config);
201-
return amd_gpio_set_debounce(gc, offset, debounce);
202-
}
203-
204192
#ifdef CONFIG_DEBUG_FS
205193
static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
206194
{
@@ -782,7 +770,7 @@ static int amd_pinconf_get(struct pinctrl_dev *pctldev,
782770
}
783771

784772
static int amd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
785-
unsigned long *configs, unsigned num_configs)
773+
unsigned long *configs, unsigned int num_configs)
786774
{
787775
int i;
788776
u32 arg;
@@ -872,6 +860,20 @@ static int amd_pinconf_group_set(struct pinctrl_dev *pctldev,
872860
return 0;
873861
}
874862

863+
static int amd_gpio_set_config(struct gpio_chip *gc, unsigned int pin,
864+
unsigned long config)
865+
{
866+
struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
867+
868+
if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
869+
u32 debounce = pinconf_to_config_argument(config);
870+
871+
return amd_gpio_set_debounce(gc, pin, debounce);
872+
}
873+
874+
return amd_pinconf_set(gpio_dev->pctrl, pin, &config, 1);
875+
}
876+
875877
static const struct pinconf_ops amd_pinconf_ops = {
876878
.pin_config_get = amd_pinconf_get,
877879
.pin_config_set = amd_pinconf_set,

0 commit comments

Comments
 (0)