Skip to content

Commit

Permalink
dm: led: auto probe() LEDs with "default-state"
Browse files Browse the repository at this point in the history
To avoid board specificy LED activation code, automatically
activate gpio-leds with "default-state" property during bind().

Signed-off-by: Patrick Bruenn <[email protected]>
  • Loading branch information
pbruenn authored and trini committed May 8, 2018
1 parent d90f0d4 commit bc882f5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/led/led_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <led.h>
#include <asm/gpio.h>
#include <dm/lists.h>
#include <dm/uclass-internal.h>

struct led_gpio_priv {
struct gpio_desc gpio;
Expand Down Expand Up @@ -117,6 +118,14 @@ static int led_gpio_bind(struct udevice *parent)
return ret;
uc_plat = dev_get_uclass_platdata(dev);
uc_plat->label = label;

if (ofnode_read_bool(node, "default-state")) {
struct udevice *devp;

ret = uclass_get_device_tail(dev, 0, &devp);
if (ret)
return ret;
}
}

return 0;
Expand Down

0 comments on commit bc882f5

Please sign in to comment.