This is a note to let you know that I've just added the patch titled pinctrl: amd: Use amd_pinconf_set() for all config options to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pinctrl-amd-use-amd_pinconf_set-for-all-config-options.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 635a750d958e158e17af0f524bedc484b27fbb93 Mon Sep 17 00:00:00 2001 From: Mario Limonciello <mario.limonciello@xxxxxxx> Date: Wed, 5 Jul 2023 08:30:03 -0500 Subject: pinctrl: amd: Use amd_pinconf_set() for all config options From: Mario Limonciello <mario.limonciello@xxxxxxx> commit 635a750d958e158e17af0f524bedc484b27fbb93 upstream. 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@xxxxxxxxx> Reported-by: Nathan Schulte <nmschulte@xxxxxxxxx> Reported-by: Friedrich Vock <friedrich.vock@xxxxxx> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217336 Reported-by: dridri85@xxxxxxxxx Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217493 Link: https://lore.kernel.org/linux-input/20230530154058.17594-1-friedrich.vock@xxxxxx/ Tested-by: Jan Visser <starquake@xxxxxxxxxxxxxxxxxxx> Fixes: 2956b5d94a76 ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips") Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230705133005.577-3-mario.limonciello@xxxxxxx Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/pinctrl/pinctrl-amd.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -188,18 +188,6 @@ static int amd_gpio_set_debounce(struct 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 pinctr } 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 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, Patches currently in stable-queue which might be from mario.limonciello@xxxxxxx are queue-6.1/pinctrl-amd-detect-internal-gpio0-debounce-handling.patch queue-6.1/pinctrl-amd-only-use-special-debounce-behavior-for-gpio-0.patch queue-6.1/pinctrl-amd-adjust-debugfs-output.patch queue-6.1/pinctrl-amd-revert-pinctrl-amd-disable-and-mask-interrupts-on-probe.patch queue-6.1/pinctrl-amd-detect-and-mask-spurious-interrupts.patch queue-6.1/pinctrl-amd-drop-pull-up-select-configuration.patch queue-6.1/pinctrl-amd-fix-mistake-in-handling-clearing-pins-at-startup.patch queue-6.1/pinctrl-amd-add-z-state-wake-control-bits.patch queue-6.1/drm-amdgpu-sdma4-set-align-mask-to-255.patch queue-6.1/pinctrl-amd-use-amd_pinconf_set-for-all-config-options.patch queue-6.1/pinctrl-amd-unify-debounce-handling-into-amd_pinconf_set.patch queue-6.1/drm-client-send-hotplug-event-after-registering-a-client.patch queue-6.1/pinctrl-amd-add-fields-for-interrupt-status-and-wake-status.patch