mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Hubert Feurstein <h.feurstein@gmail.com>
To: barebox@lists.infradead.org
Cc: Hubert Feurstein <h.feurstein@gmail.com>
Subject: [PATCH 4/4] led: parse panic-indicator from device-tree
Date: Tue, 10 Dec 2019 18:13:04 +0100	[thread overview]
Message-ID: <20191210171305.24276-4-h.feurstein@gmail.com> (raw)
In-Reply-To: <20191210171305.24276-1-h.feurstein@gmail.com>

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 Documentation/devicetree/bindings/leds/common.rst |  3 +++
 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 5a592d67d..911a55f4f 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 4bf19abcc..e727148a2 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);
-- 
2.24.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-12-10 17:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 17:13 [PATCH 1/4] led: unify led trigger tables Hubert Feurstein
2019-12-10 17:13 ` [PATCH 2/4] led: add documentation for net-tx and net-rx triggers Hubert Feurstein
2019-12-10 17:13 ` [PATCH 3/4] led: check for 'barebox, default-trigger' when 'linux, default-trigger' is not found Hubert Feurstein
2019-12-10 17:13 ` Hubert Feurstein [this message]
2019-12-11  8:39 ` [PATCH 1/4] led: unify led trigger tables Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210171305.24276-4-h.feurstein@gmail.com \
    --to=h.feurstein@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox