aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass2017-04-10 11:34:54 -0600
committerSimon Glass2017-04-14 19:38:57 -0600
commitddae9fcddc48d1e624c941148d0df5a4fc7d7d5c (patch)
tree59af471a5420bfd9ac4936bac0e3bccb37d72e4c /include
parent56e19871dc2a05aa5508ea51af35df59bbdb6cf5 (diff)
dm: led: Adjust the LED uclass
At present this is very simple, supporting only on and off. We want to also support toggling and blinking. As a first step, change the name of the main method and use an enum to indicate the state. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/led.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/include/led.h b/include/led.h
index a856b3d9ff7..8af87ea8ea8 100644
--- a/include/led.h
+++ b/include/led.h
@@ -17,15 +17,22 @@ struct led_uc_plat {
const char *label;
};
+enum led_state_t {
+ LEDST_OFF = 0,
+ LEDST_ON = 1,
+
+ LEDST_COUNT,
+};
+
struct led_ops {
/**
- * set_on() - set the state of an LED
+ * set_state() - set the state of an LED
*
* @dev: LED device to change
- * @on: 1 to turn the LED on, 0 to turn it off
+ * @state: LED state to set
* @return 0 if OK, -ve on error
*/
- int (*set_on)(struct udevice *dev, int on);
+ int (*set_state)(struct udevice *dev, enum led_state_t state);
};
#define led_get_ops(dev) ((struct led_ops *)(dev)->driver->ops)
@@ -40,12 +47,12 @@ struct led_ops {
int led_get_by_label(const char *label, struct udevice **devp);
/**
- * led_set_on() - set the state of an LED
+ * led_set_state() - set the state of an LED
*
* @dev: LED device to change
- * @on: 1 to turn the LED on, 0 to turn it off
+ * @state: LED state to set
* @return 0 if OK, -ve on error
*/
-int led_set_on(struct udevice *dev, int on);
+int led_set_state(struct udevice *dev, enum led_state_t state);
#endif