diff options
author | Hubert Feurstein <h.feurstein@gmail.com> | 2019-12-10 18:13:04 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-12-11 09:38:05 +0100 |
commit | 1e000e8e92182d21c2e9e59f73f022422843b646 (patch) | |
tree | 70704bff87e9449d67a18fcc475e240506d8492b | |
parent | 48e549a865b1b5020c1f2eecb51d0d5fdee35dd1 (diff) | |
download | barebox-1e000e8e92182d21c2e9e59f73f022422843b646.tar.gz barebox-1e000e8e92182d21c2e9e59f73f022422843b646.tar.xz |
led: parse panic-indicator from device-tree
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | Documentation/devicetree/bindings/leds/common.rst | 3 | ||||
-rw-r--r-- | drivers/led/core.c | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/leds/common.rst b/Documentation/devicetree/bindings/leds/common.rst index 5a592d67d0..911a55f4f6 100644 --- a/Documentation/devicetree/bindings/leds/common.rst +++ b/Documentation/devicetree/bindings/leds/common.rst @@ -12,3 +12,6 @@ Common leds properties * ``label``: The label for this LED. If omitted, the label is taken from the node name (excluding the unit address). + +* ``panic-indicator`` - This property specifies that the LED should be used as a + panic indicator. diff --git a/drivers/led/core.c b/drivers/led/core.c index 4bf19abcc9..e727148a24 100644 --- a/drivers/led/core.c +++ b/drivers/led/core.c @@ -286,11 +286,16 @@ enum led_trigger trigger_by_name(const char *name) void led_of_parse_trigger(struct led *led, struct device_node *np) { - enum led_trigger trg; + enum led_trigger trg = LED_TRIGGER_MAX; const char *trigger; - trigger = of_get_property(np, "linux,default-trigger", NULL); - trg = trigger_by_name(trigger); + if (of_property_read_bool(np, "panic-indicator")) + trg = LED_TRIGGER_PANIC; + + if (trg == LED_TRIGGER_MAX) { + trigger = of_get_property(np, "linux,default-trigger", NULL); + trg = trigger_by_name(trigger); + } if (trg == LED_TRIGGER_MAX) { trigger = of_get_property(np, "barebox,default-trigger", NULL); |