summaryrefslogtreecommitdiff
path: root/drivers/led/led-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-04-10 17:34:55 (GMT)
committerSimon Glass <sjg@chromium.org>2017-04-15 01:38:57 (GMT)
commit8f4b612333ee0381eedf767c1c005a830886df27 (patch)
treec687de5e960d0bb4c1de07f1b322119e46859349 /drivers/led/led-uclass.c
parentddae9fcddc48d1e624c941148d0df5a4fc7d7d5c (diff)
downloadu-boot-fsl-qoriq-8f4b612333ee0381eedf767c1c005a830886df27.tar.xz
dm: led: Add support for getting the state of an LED
It is useful to be able to read the LED as well as write it. Add this to the uclass and update the GPIO driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
Diffstat (limited to 'drivers/led/led-uclass.c')
-rw-r--r--drivers/led/led-uclass.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index b303469..ea5fbab 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -42,6 +42,16 @@ int led_set_state(struct udevice *dev, enum led_state_t state)
return ops->set_state(dev, state);
}
+enum led_state_t led_get_state(struct udevice *dev)
+{
+ struct led_ops *ops = led_get_ops(dev);
+
+ if (!ops->get_state)
+ return -ENOSYS;
+
+ return ops->get_state(dev);
+}
+
UCLASS_DRIVER(led) = {
.id = UCLASS_LED,
.name = "led",