Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900
@ 2021-12-12 22:40 Merlijn Wajer
  2021-12-12 22:40 ` [PATCH 2/2] leds: lp55xx: initialise output direction from dts Merlijn Wajer
  2021-12-15 20:32 ` [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Pavel Machek
  0 siblings, 2 replies; 5+ messages in thread
From: Merlijn Wajer @ 2021-12-12 22:40 UTC (permalink / raw)
  To: merlijn
  Cc: Ivaylo Dimitrov, Dev Null, Tony Lindgren, Sebastian Reichel,
	linux-kernel, linux-leds, linux-omap, Dan Murphy, devicetree,
	Doug Zobel, Jacek Anaszewski, Linus Walleij, Pavel Machek,
	Rob Herring, Sicelo A . Mhlongo, Benoît Cousson

The RGB status LED and keyboard backlight LEDs were broken on the Nokia N900
since the conversion to gpiod descriptors and additionally later on with the
addition of multi color support. There was at least one attempt merged to fix
the lp5523 driver since the gpiod conversion, but it doesn't honour the device
tree, which in the case of the Nokia N900 means that the fix doesn't work.

In this series are two patches fix the problems:

* One addresses the gpiod change in the device tree as well as the multi
  color support in the device tree;
* The other patch fixes the previous attempt at fixing the driver to honour
  the device tree;

Please let me know if anything seems off, and I'll be glad to make any
recommended changes, thanks!

Merlijn Wajer (1):
  leds: lp55xx: initialise output direction from dts

Sicelo A. Mhlongo (1):
  ARM: dts: omap3-n900: Fix lp5523 for multi color

 arch/arm/boot/dts/omap3-n900.dts  | 50 ++++++++++++++++++++++++-------
 drivers/leds/leds-lp55xx-common.c |  4 ++-
 2 files changed, 43 insertions(+), 11 deletions(-)

-- 
2.32.0


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

* [PATCH 2/2] leds: lp55xx: initialise output direction from dts
  2021-12-12 22:40 [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Merlijn Wajer
@ 2021-12-12 22:40 ` Merlijn Wajer
  2021-12-12 23:59   ` Linus Walleij
  2021-12-15 20:32 ` [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Pavel Machek
  1 sibling, 1 reply; 5+ messages in thread
From: Merlijn Wajer @ 2021-12-12 22:40 UTC (permalink / raw)
  To: merlijn
  Cc: Ivaylo Dimitrov, Dev Null, Tony Lindgren, Sebastian Reichel,
	Pavel Machek, Doug Zobel, Jacek Anaszewski, Dan Murphy,
	Linus Walleij, linux-leds, linux-kernel

Commit a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to
output") attempts to fix this, but the fix did not work since at least
for the Nokia N900 the value needs to be set to HIGH, per the device
tree. So rather than hardcoding the value to a potentially invalid value
for some devices, let's set direction in lp55xx_init_device.

Fixes: a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output")
Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx")
Fixes: ac219bf3c9bd ("leds: lp55xx: Convert to use GPIO descriptors")
Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
---
 drivers/leds/leds-lp55xx-common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index d1657c46ee2f..9fdfc1b9a1a0 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -439,6 +439,8 @@ int lp55xx_init_device(struct lp55xx_chip *chip)
 		return -EINVAL;
 
 	if (pdata->enable_gpiod) {
+		gpiod_direction_output(pdata->enable_gpiod, 0);
+
 		gpiod_set_consumer_name(pdata->enable_gpiod, "LP55xx enable");
 		gpiod_set_value(pdata->enable_gpiod, 0);
 		usleep_range(1000, 2000); /* Keep enable down at least 1ms */
@@ -694,7 +696,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
 	of_property_read_u8(np, "clock-mode", &pdata->clock_mode);
 
 	pdata->enable_gpiod = devm_gpiod_get_optional(dev, "enable",
-						      GPIOD_OUT_LOW);
+						      GPIOD_ASIS);
 	if (IS_ERR(pdata->enable_gpiod))
 		return ERR_CAST(pdata->enable_gpiod);
 
-- 
2.32.0


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

* Re: [PATCH 2/2] leds: lp55xx: initialise output direction from dts
  2021-12-12 22:40 ` [PATCH 2/2] leds: lp55xx: initialise output direction from dts Merlijn Wajer
@ 2021-12-12 23:59   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2021-12-12 23:59 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: Ivaylo Dimitrov, Dev Null, Tony Lindgren, Sebastian Reichel,
	Pavel Machek, Doug Zobel, Jacek Anaszewski, Dan Murphy,
	linux-leds, linux-kernel

On Sun, Dec 12, 2021 at 11:34 PM Merlijn Wajer <merlijn@wizzup.org> wrote:

> Commit a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to
> output") attempts to fix this, but the fix did not work since at least
> for the Nokia N900 the value needs to be set to HIGH, per the device
> tree. So rather than hardcoding the value to a potentially invalid value
> for some devices, let's set direction in lp55xx_init_device.
>
> Fixes: a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output")
> Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx")
> Fixes: ac219bf3c9bd ("leds: lp55xx: Convert to use GPIO descriptors")
> Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks for fixing my mistakes!

Yours,
Linus Walleij

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

* Re: [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900
  2021-12-12 22:40 [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Merlijn Wajer
  2021-12-12 22:40 ` [PATCH 2/2] leds: lp55xx: initialise output direction from dts Merlijn Wajer
@ 2021-12-15 20:32 ` Pavel Machek
  2021-12-16 11:51   ` Merlijn Wajer
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2021-12-15 20:32 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: Ivaylo Dimitrov, Dev Null, Tony Lindgren, Sebastian Reichel,
	linux-kernel, linux-leds, linux-omap, Dan Murphy, devicetree,
	Doug Zobel, Jacek Anaszewski, Linus Walleij, Rob Herring,
	Sicelo A . Mhlongo, Benoît Cousson

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

Hi!

> The RGB status LED and keyboard backlight LEDs were broken on the Nokia N900
> since the conversion to gpiod descriptors and additionally later on with the
> addition of multi color support. There was at least one attempt merged to fix
> the lp5523 driver since the gpiod conversion, but it doesn't honour the device
> tree, which in the case of the Nokia N900 means that the fix doesn't work.
> 
> In this series are two patches fix the problems:
> 
> * One addresses the gpiod change in the device tree as well as the multi
>   color support in the device tree;
> * The other patch fixes the previous attempt at fixing the driver to honour
>   the device tree;
> 
> Please let me know if anything seems off, and I'll be glad to make any
> recommended changes, thanks!

Thank you, I took the series. But if it changes the names in
/sys/class/leds, we want to do something else.

Best regards,
									Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900
  2021-12-15 20:32 ` [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Pavel Machek
@ 2021-12-16 11:51   ` Merlijn Wajer
  0 siblings, 0 replies; 5+ messages in thread
From: Merlijn Wajer @ 2021-12-16 11:51 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Ivaylo Dimitrov, Dev Null, Tony Lindgren, Sebastian Reichel,
	linux-kernel, linux-leds, linux-omap, Dan Murphy, devicetree,
	Doug Zobel, Jacek Anaszewski, Linus Walleij, Rob Herring,
	Sicelo A . Mhlongo, Benoît Cousson

Hi Pavel,

On 15/12/2021 21:32, Pavel Machek wrote:
> Hi!
> 
>> The RGB status LED and keyboard backlight LEDs were broken on the Nokia N900
>> since the conversion to gpiod descriptors and additionally later on with the
>> addition of multi color support. There was at least one attempt merged to fix
>> the lp5523 driver since the gpiod conversion, but it doesn't honour the device
>> tree, which in the case of the Nokia N900 means that the fix doesn't work.
>>
>> In this series are two patches fix the problems:
>>
>> * One addresses the gpiod change in the device tree as well as the multi
>>   color support in the device tree;
>> * The other patch fixes the previous attempt at fixing the driver to honour
>>   the device tree;
>>
>> Please let me know if anything seems off, and I'll be glad to make any
>> recommended changes, thanks!
> 
> Thank you, I took the series. But if it changes the names in
> /sys/class/leds, we want to do something else.

Thanks -- just for the record (I already replied to the other email) -
the names do not change based on my testing.

Regards,
Merlijn

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

end of thread, other threads:[~2021-12-16 11:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-12 22:40 [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Merlijn Wajer
2021-12-12 22:40 ` [PATCH 2/2] leds: lp55xx: initialise output direction from dts Merlijn Wajer
2021-12-12 23:59   ` Linus Walleij
2021-12-15 20:32 ` [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Pavel Machek
2021-12-16 11:51   ` Merlijn Wajer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox