]> git.sur5r.net Git - u-boot/blobdiff - drivers/led/led-uclass.c
spi: xilinx_spi: Added support to read JEDEC-id twice at the boot time
[u-boot] / drivers / led / led-uclass.c
index ca4f98c0b35dcfb7fe14d3319bdd4cea56fb8589..2f4d69eedddc07fc9ff0c6a277a6558352b3c9db 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2015 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -32,16 +31,38 @@ int led_get_by_label(const char *label, struct udevice **devp)
        return -ENODEV;
 }
 
-int led_set_on(struct udevice *dev, int on)
+int led_set_state(struct udevice *dev, enum led_state_t state)
 {
        struct led_ops *ops = led_get_ops(dev);
 
-       if (!ops->set_on)
+       if (!ops->set_state)
                return -ENOSYS;
 
-       return ops->set_on(dev, on);
+       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);
+}
+
+#ifdef CONFIG_LED_BLINK
+int led_set_period(struct udevice *dev, int period_ms)
+{
+       struct led_ops *ops = led_get_ops(dev);
+
+       if (!ops->set_period)
+               return -ENOSYS;
+
+       return ops->set_period(dev, period_ms);
+}
+#endif
+
 UCLASS_DRIVER(led) = {
        .id             = UCLASS_LED,
        .name           = "led",