Skip to content

Commit

Permalink
leds: lp55xx: initialise output direction from dts
Browse files Browse the repository at this point in the history
Commit a5d3d1a ("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: a5d3d1a ("leds: lp55xx: Initialize enable GPIO direction to output")
Fixes: 92a8156 ("leds: lp55xx: Add multicolor framework support to lp55xx")
Fixes: ac219bf ("leds: lp55xx: Convert to use GPIO descriptors")
Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
  • Loading branch information
Merlijn Wajer authored and Pavel Machek committed Jan 12, 2022
1 parent e9af026 commit 9e87a8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/leds/leds-lp55xx-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 9e87a8d

Please sign in to comment.