aboutsummaryrefslogtreecommitdiff
path: root/include/led.h
diff options
context:
space:
mode:
authorMarek Vasut2022-04-04 01:23:27 +0200
committerTom Rini2022-04-14 15:39:15 -0400
commit72675b063b6ede269a8edee29575ade02c21b58d (patch)
tree44f0c4364eccfb6d6d3faf572de8712784a64b83 /include/led.h
parent2d1deaf88edc1182372794c79f43c6aa6c163d8e (diff)
led: Configure LED default-state on boot
In case the DT LED subnode contains "default-state" property set to either "on" or "off", probe the LED driver and configure the LED state automatically. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Philippe Reynes <philippe.reynes@softathome.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> [trini: Update the relevant test now that we have support] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'include/led.h')
-rw-r--r--include/led.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/include/led.h b/include/led.h
index 8eeb5a7c6d3..43acca85719 100644
--- a/include/led.h
+++ b/include/led.h
@@ -9,13 +9,26 @@
struct udevice;
+enum led_state_t {
+ LEDST_OFF = 0,
+ LEDST_ON = 1,
+ LEDST_TOGGLE,
+#ifdef CONFIG_LED_BLINK
+ LEDST_BLINK,
+#endif
+
+ LEDST_COUNT,
+};
+
/**
* struct led_uc_plat - Platform data the uclass stores about each device
*
* @label: LED label
+ * @default_state: LED default state
*/
struct led_uc_plat {
const char *label;
+ enum led_state_t default_state;
};
/**
@@ -27,17 +40,6 @@ struct led_uc_priv {
int period_ms;
};
-enum led_state_t {
- LEDST_OFF = 0,
- LEDST_ON = 1,
- LEDST_TOGGLE,
-#ifdef CONFIG_LED_BLINK
- LEDST_BLINK,
-#endif
-
- LEDST_COUNT,
-};
-
struct led_ops {
/**
* set_state() - set the state of an LED