summaryrefslogtreecommitdiff
path: root/drivers/led
diff options
context:
space:
mode:
authorPatrick Bruenn <p.bruenn@beckhoff.com>2018-04-11 11:16:28 +0200
committerTom Rini <trini@konsulko.com>2018-05-08 09:07:33 -0400
commitbc882f5d5c7b4d6ed5e927bf838863af43c786e7 (patch)
tree1ee253d888a739f08f6dd494a3152ea7036066c2 /drivers/led
parentd90f0d4cae5c9349a412e3f924bf25e20e35ddfa (diff)
downloadu-boot-socfpga-bc882f5d5c7b4d6ed5e927bf838863af43c786e7.tar.gz
dm: led: auto probe() LEDs with "default-state"
To avoid board specificy LED activation code, automatically activate gpio-leds with "default-state" property during bind(). Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
Diffstat (limited to 'drivers/led')
-rw-r--r--drivers/led/led_gpio.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
index 533587dc47..a36942b934 100644
--- a/drivers/led/led_gpio.c
+++ b/drivers/led/led_gpio.c
@@ -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;
@@ -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;