ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
Subsystems (3)
cover ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
This series fixes the probing of leds-gpio on the Raspberry Pi 400. Also try to improve the error logging of leds-gpio.
Stefan Wahren (2):
leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts | 4 +--- drivers/leds/leds-gpio.c | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-)
--
2.34.1
PATCH 1/2 leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case devm_fwnode_gpiod_get() fails.
--- drivers/leds/leds-gpio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/leds/leds-gpio.c +2 -0
@@ -172,6 +172,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev) led.gpiod =devm_fwnode_gpiod_get (dev, child,NULL ,GPIOD_ASIS ,NULL );if (IS_ERR (led.gpiod)) { +dev_err (dev,"Failed to get gpio '%pfw': %ld\n" , + child,PTR_ERR (led.gpiod));fwnode_handle_put (child);return ERR_CAST (led.gpiod); }
--
2.34.1
PATCH 2/2 ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
In reply to Stefan WahrenThe LED ACT which is included from bcm2711-rpi-4-b doesn't exists on the Raspberry Pi 400. So the bcm2711-rpi-400.dts tries to use the delete-node directive in order to remove the complete node. Unfortunately the usage get broken in commit 1156e3a78bcc ("ARM: dts: bcm283x: Move ACT LED into separate dtsi") and now ACT and PWR LED using the same GPIO and this prevent probing of led-gpios on Raspberry Pi 400:
leds-gpio: probe of leds failed with error -16
So fix the delete-node directive.
--- arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts +1 -3
@@ -36,9 +36,7 @@ &led_pwr { gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; }; -&leds { - /delete-node/ led_act; -}; +/delete-node/ &led_act; &pm { /delete-property/ system-power-controller;
--
2.34.1
Re: [PATCH 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
In reply to Stefan WahrenQuoted 6 lines · Stefan Wahren
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails.
...
drivers/leds/leds-gpio.c static struct gpio_leds_priv *gpio_leds_create(struct device *dev) · line 176
Quoted 5 lines
drivers/leds/leds-gpio.c +2
-0led.gpiod =devm_fwnode_gpiod_get (dev, child,NULL ,GPIOD_ASIS ,NULL );if (IS_ERR (led.gpiod)) { +dev_err (dev,"Failed to get gpio '%pfw': %ld\n" , + child,PTR_ERR (led.gpiod));
Perhaps %pe ?
Quoted 3 lines
drivers/leds/leds-gpio.c +0
-0fwnode_handle_put (child);return ERR_CAST (led.gpiod); }
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Hi Andy,
Am 06.11.23 um 12:19 schrieb Andy Shevchenko:
Quoted 7 lines · Stefan Wahren
Quoted 6 lines
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails.
Quoted 8 lines
...
drivers/leds/leds-gpio.c static struct gpio_leds_priv *gpio_leds_create(struct device *dev) · line 176
Quoted 5 lines
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL,
GPIOD_ASIS,
NULL);
if (IS_ERR(led.gpiod)) {drivers/leds/leds-gpio.c +2
-0+dev_err (dev,"Failed to get gpio '%pfw': %ld\n" , + child,PTR_ERR (led.gpiod));Perhaps %pe ?
i notice that i need to use dev_err_probe because of EPROBE_DEFER anyway. So i will drop the second parameter in the next version.
Quoted 4 lines
Quoted 4 lines
fwnode_handle_put(child); return ERR_CAST(led.gpiod); }