mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM
@ 2026-11-15  2:55 Igor Velkov
  2026-11-16 15:33 ` Bartosz Golaszewski
  2026-11-17 13:35 ` Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Igor Velkov @ 2026-11-15  2:55 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Shawn Guo, Neil Armstrong, linux-gpio,
	linux-amlogic, regressions

Since f918e3804498 ("arm64: enable HAVE_SHARED_GPIOS for all ARM64
platforms"), two of the three fixed regulators sharing GPIOH_8
(GPIO_OPEN_DRAIN) on ODROID-HC4 fail on every boot:

  reg-fixed-voltage regulator-p12v-0: setup of GPIO (default) failed: -1
  reg-fixed-voltage regulator-p12v-0: error -EPERM: can't get GPIO

The first user (vcc_5v) sets the line to output high in
gpiod_configure_flags(). Its enable then goes through
gpio_set_open_drain_value_commit(), which emulates high by calling
direction_input on the proxy, and the proxy switches the shared line to
input. The next users hit "Shared GPIO's direction already set to input,
refusing to change" in gpio_shared_proxy_direction_output(). Stack from
trace_trigger=gpio_direction.stacktrace:

  gpiod_direction_input <- gpio_shared_proxy_direction_input
  <- gpio_set_open_drain_value_commit <- gpiod_set_value_cansleep
  <- _regulator_do_enable <- set_machine_constraints <- regulator_register

Armbian v7.4-rc2 (its patches don't touch gpiolib or these nodes); same
with the five shared-proxy fixes from the v7.4-rc3 pull. The winner
depends on probe order: without the fixes vcc_5v lost in 2 of 4 boots,
leaving the SD card unpowered and no rootfs.

#regzbot introduced: f918e3804498

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM
  2026-11-15  2:55 [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM Igor Velkov
@ 2026-11-16 15:33 ` Bartosz Golaszewski
  2026-11-17 13:35 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-11-16 15:33 UTC (permalink / raw)
  To: Igor Velkov
  Cc: Linus Walleij, Shawn Guo, Neil Armstrong, linux-gpio,
	linux-amlogic, regressions

On Sun, Nov 15, 2026 at 04:55:00AM +0200, Igor Velkov wrote:
> Since f918e3804498 ("arm64: enable HAVE_SHARED_GPIOS for all ARM64
> platforms"), two of the three fixed regulators sharing GPIOH_8
> (GPIO_OPEN_DRAIN) on ODROID-HC4 fail on every boot:
> 
>   reg-fixed-voltage regulator-p12v-0: setup of GPIO (default) failed: -1
>   reg-fixed-voltage regulator-p12v-0: error -EPERM: can't get GPIO
> 
> The first user (vcc_5v) sets the line to output high in
> gpiod_configure_flags(). Its enable then goes through
> gpio_set_open_drain_value_commit(), which emulates high by calling
> direction_input on the proxy, and the proxy switches the shared line to
> input. The next users hit "Shared GPIO's direction already set to input,
> refusing to change" in gpio_shared_proxy_direction_output(). Stack from
> trace_trigger=gpio_direction.stacktrace:
> 
>   gpiod_direction_input <- gpio_shared_proxy_direction_input
>   <- gpio_set_open_drain_value_commit <- gpiod_set_value_cansleep
>   <- _regulator_do_enable <- set_machine_constraints <- regulator_register
> 
> Armbian v7.4-rc2 (its patches don't touch gpiolib or these nodes); same
> with the five shared-proxy fixes from the v7.4-rc3 pull. The winner
> depends on probe order: without the fixes vcc_5v lost in 2 of 4 boots,
> leaving the SD card unpowered and no rootfs.
>

Thanks for the report, I'll send a fix proposal for you to test
tomorrow.

Bartosz

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM
  2026-11-15  2:55 [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM Igor Velkov
  2026-11-16 15:33 ` Bartosz Golaszewski
@ 2026-11-17 13:35 ` Bartosz Golaszewski
  2026-11-17 18:15   ` Igor Velkov
  1 sibling, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-11-17 13:35 UTC (permalink / raw)
  To: Igor Velkov
  Cc: Linus Walleij, Shawn Guo, Neil Armstrong, linux-gpio,
	linux-amlogic, regressions

On Sun, Nov 15, 2026 at 04:55:00AM +0200, Igor Velkov wrote:
> Since f918e3804498 ("arm64: enable HAVE_SHARED_GPIOS for all ARM64
> platforms"), two of the three fixed regulators sharing GPIOH_8
> (GPIO_OPEN_DRAIN) on ODROID-HC4 fail on every boot:
> 
>   reg-fixed-voltage regulator-p12v-0: setup of GPIO (default) failed: -1
>   reg-fixed-voltage regulator-p12v-0: error -EPERM: can't get GPIO
> 
> The first user (vcc_5v) sets the line to output high in
> gpiod_configure_flags(). Its enable then goes through
> gpio_set_open_drain_value_commit(), which emulates high by calling
> direction_input on the proxy, and the proxy switches the shared line to
> input. The next users hit "Shared GPIO's direction already set to input,
> refusing to change" in gpio_shared_proxy_direction_output(). Stack from
> trace_trigger=gpio_direction.stacktrace:
> 
>   gpiod_direction_input <- gpio_shared_proxy_direction_input
>   <- gpio_set_open_drain_value_commit <- gpiod_set_value_cansleep
>   <- _regulator_do_enable <- set_machine_constraints <- regulator_register
> 
> Armbian v7.4-rc2 (its patches don't touch gpiolib or these nodes); same
> with the five shared-proxy fixes from the v7.4-rc3 pull. The winner
> depends on probe order: without the fixes vcc_5v lost in 2 of 4 boots,
> leaving the SD card unpowered and no rootfs.
>

I was wondering why does the second user even arrive in
gpio_shared_proxy_direction_output() at all when it should take the
emulation path. I think the issue is with the proxy driver not
propagating the -ENOTSUPP error code in set_config(). While I did author
that code, I have no idea why I did it and if I even had any reason at
all. Could you try the following diff?

diff --git a/drivers/gpio/gpio-shared-proxy.c b/drivers/gpio/gpio-shared-proxy.c
index cb593192076f..8197ebb5f9a2 100644
--- a/drivers/gpio/gpio-shared-proxy.c
+++ b/drivers/gpio/gpio-shared-proxy.c
@@ -186,7 +186,7 @@ static int gpio_shared_proxy_set_config(struct gpio_chip *gc,
 	}

 	ret = gpiod_set_config(desc, cfg);
-	if (ret && ret != -ENOTSUPP)
+	if (ret)
 		return ret;

 	shared_desc->cfg = cfg;

With it, both users should take the simulation route.

Thanks,
Bartosz

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM
  2026-11-17 13:35 ` Bartosz Golaszewski
@ 2026-11-17 18:15   ` Igor Velkov
  0 siblings, 0 replies; 4+ messages in thread
From: Igor Velkov @ 2026-11-17 18:15 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Shawn Guo, Neil Armstrong, linux-gpio,
	linux-amlogic, regressions

On Tue, Nov 17, 2026 at 02:35:03PM +0100, Bartosz Golaszewski wrote:
> I think the issue is with the proxy driver not
> propagating the -ENOTSUPP error code in set_config().
[...]
> Could you try the following diff?

Thanks, that fixes it. With the diff on v7.4-rc3, 4 of 4 cold boots:
no -EPERM, vcc_5v and both p12v regulators probe as open-drain
outputs, and both SATA disks come up. Stock rc3 on the same board
failed both p12v regulators on the boot before.

Tested-by: Igor Velkov <iav@iav.lv>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15  2:55 [REGRESSION] gpio: shared-proxy: open-drain regulators on ODROID-HC4 fail with -EPERM Igor Velkov
2026-11-16 15:33 ` Bartosz Golaszewski
2026-11-17 13:35 ` Bartosz Golaszewski
2026-11-17 18:15   ` Igor Velkov

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®