Skip to contentSkip to conversation

pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping

PATCH In review Bartosz Golaszewski 6 participants 8 messages Jan 6 – Jan 9

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

---
 drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +1 -1
index d9e3a8d5932a..ded7b218e2ec 100644
@@ -893,7 +893,7 @@ static const struct gpio_chip aml_gpio_template = {
 	.direction_input	= aml_gpio_direction_input,
 	.direction_output	= aml_gpio_direction_output,
 	.get_direction		= aml_gpio_get_direction,
-	.can_sleep		= false,
+	.can_sleep		= true,
 };
 
 static void init_bank_register_bit(struct aml_pinctrl *info,
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Bartosz Golaszewski

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

---
  drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +0 -0
index d9e3a8d5932a..ded7b218e2ec 100644

drivers/pinctrl/meson/pinctrl-amlogic-a4.c static const struct gpio_chip aml_gpio_template = { · line 899

Quoted 8 lines
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +1 -1
@@ -893,7 +893,7 @@ static const struct gpio_chip aml_gpio_template = {
  	.direction_input	= aml_gpio_direction_input,
  	.direction_output	= aml_gpio_direction_output,
  	.get_direction		= aml_gpio_get_direction,
-	.can_sleep		= false,
+	.can_sleep		= true,
  };
 
  static void init_bank_register_bit(struct aml_pinctrl *info,

Thanks,
Neil

maintainer
#2 lore raw

Hi Bartosz,
Could you explain the reproduction method for this problem ?

Quoted 27 lines · Neil Armstrong

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

---
   drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +1 -1
index d9e3a8d5932a..ded7b218e2ec 100644
@@ -893,7 +893,7 @@ static const struct gpio_chip aml_gpio_template = {
       .direction_input        = aml_gpio_direction_input,
       .direction_output       = aml_gpio_direction_output,
       .get_direction          = aml_gpio_get_direction,
-     .can_sleep              = false,
+     .can_sleep              = true,
   };
 
   static void init_bank_register_bit(struct aml_pinctrl *info,
#3 lore raw
Quoted 4 lines · Xianwei Zhao

Hi Bartosz,
Could you explain the reproduction method for this problem ?

Please don't top-post on the mailing list.

If you have a pin shared by multiple devices in device-tree, it will now go through a dedicated gpio-shared-proxy driver. It will use a locking mechanism depending on the can_sleep flag of the GPIO controller device - spinlock or mutex. If the flag is wrong - like is the case here - it may happen that we take a spinlock and then descend into pinctrl where a mutex is taken resulting in a lockdep splat.

Bart

reviewer Reviewed-by on v1 1/1
#4 lore raw
In reply to Bartosz Golaszewski
Quoted 11 lines · Bartosz Golaszewski

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

maintainer
#5 lore raw
In reply to Bartosz Golaszewski
Quoted 10 lines · Bartosz Golaszewski

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

Patch applied for fixes!

Yours,
Linus Walleij

maintainer
#6 lore raw
In reply to Bartosz Golaszewski
Quoted 4 lines · Bartosz Golaszewski

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

BTW it is a very *welcome* side-effect of the new shared GPIO rework that it just happens to find these old bugs, I'm very pleased with this :)

Yours,
Linus Walleij

#7 lore raw
Quoted 4 lines · Linus Walleij

On Tue, Jan 6, 2026 at 9:53 AM Bartosz Golaszewski <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines

The GPIO controller is configured as non-sleeping but it uses generic pinctrl helpers which use a mutex for synchronization. This will cause lockdep splats when used together with shared GPIOs going through the GPIO shared proxy driver.

BTW it is a very *welcome* side-effect of the new shared GPIO rework that it just happens to find these old bugs, I'm very pleased with this :)

Actually, I was surprised I was getting so many bug reports and then it turned out, there was a bug that caused a lot of false-positives to turn up when scanning the devicetree for shared pins. I just queued a fix for that so it should slow down now.

Bart