gpio: aspeed: fix the GPIO number passed to pinctrl_gpio_set_config()
Subsystems (2)
PATCH 1/1 gpio: aspeed: fix the GPIO number passed to pinctrl_gpio_set_config()
From: Bartosz Golaszewski <[email protected]>
pinctrl_gpio_set_config() expects the GPIO number from the global GPIO numberspace, not the controller-relative offset, which needs to be added to the chip base.
--- drivers/gpio/gpio-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-aspeed.c +1 -1
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,else if (param ==PIN_CONFIG_BIAS_DISABLE || param ==PIN_CONFIG_BIAS_PULL_DOWN || param ==PIN_CONFIG_DRIVE_STRENGTH ) -return pinctrl_gpio_set_config (offset, config); +return pinctrl_gpio_set_config (chip->base + offset, config);else if (param ==PIN_CONFIG_DRIVE_OPEN_DRAIN || param ==PIN_CONFIG_DRIVE_OPEN_SOURCE )/* Return -ENOTSUPP to trigger emulation, as per datasheet */
Signature · 1 line
2.39.2
Quoted 5 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
pinctrl_gpio_set_config()expects the GPIO number from the global GPIO numberspace, not the controller-relative offset, which needs to be added to the chip base.
Right, because it has no clue what chip this offset is related to.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
pinctrl_gpio_set_config()expects the GPIO number from the global GPIO numberspace, not the controller-relative offset, which needs to be added to the chip base.Fixes 5ae4cb94b313 ("gpio: aspeed: Add debounce support")Signed-off-by Bartosz Golaszewski <[email protected]>
Thanks!
Quoted 17 lines
--- drivers/gpio/gpio-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-aspeed.c +1
-1@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,else if (param ==PIN_CONFIG_BIAS_DISABLE || param ==PIN_CONFIG_BIAS_PULL_DOWN || param ==PIN_CONFIG_DRIVE_STRENGTH ) -return pinctrl_gpio_set_config (offset, config); +return pinctrl_gpio_set_config (chip->base + offset, config);else if (param ==PIN_CONFIG_DRIVE_OPEN_DRAIN || param ==PIN_CONFIG_DRIVE_OPEN_SOURCE )/* Return -ENOTSUPP to trigger emulation, as per datasheet */
Quoted 27 lines · On Tue, Oct 3, 2023 at 9:39?AM Bartosz Golaszewski <[email protected]> wrote:
From: Bartosz Golaszewski <[email protected]>
pinctrl_gpio_set_config()expects the GPIO number from the global GPIO numberspace, not the controller-relative offset, which needs to be added to the chip base.Fixes 5ae4cb94b313 ("gpio: aspeed: Add debounce support")Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/gpio/gpio-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-aspeed.c +1
-2@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,else if (param ==PIN_CONFIG_BIAS_DISABLE || param ==PIN_CONFIG_BIAS_PULL_DOWN || param ==PIN_CONFIG_DRIVE_STRENGTH ) -return pinctrl_gpio_set_config (offset, config); +return pinctrl_gpio_set_config (chip->base + offset, config);else if (param ==PIN_CONFIG_DRIVE_OPEN_DRAIN || param ==PIN_CONFIG_DRIVE_OPEN_SOURCE )/* Return -ENOTSUPP to trigger emulation, as per datasheet */ --
Quoted 2 lines
2.39.2
Queued for fixes.
Bart