All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Tom Rini <trini@konsulko.com>,
	Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Vignesh R <vigneshr@ti.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Arseniy Krasnov <avkrasnov@salutedevices.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Simon Glass <sjg@chromium.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Dmitry Dunaev <dunaev@tecon.ru>,
	Devarsh Thakkar <devarsht@ti.com>, Bin Meng <bmeng.cn@gmail.com>,
	Eugene Uriev <eugeneuriev@gmail.com>,
	Nikhil M Jain <n-jain1@ti.com>,
	Shiji Yang <yangshiji66@outlook.com>,
	Raymond Mao <raymond.mao@linaro.org>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Doug Zobel <douglas.zobel@climate.com>,
	William Zhang <william.zhang@broadcom.com>,
	Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,
	Igor Prusov <ivprusov@salutedevices.com>,
	Bruce Suen <bruce_suen@163.com>,
	Takahiro Kuwano <Takahiro.Kuwano@infineon.com>,
	Pratyush Yadav <p.yadav@ti.com>,
	Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>,
	Vaishnav Achath <vaishnav.a@ti.com>,
	AKASHI Takahiro <akashi.tkhro@gmail.com>,
	u-boot@lists.denx.de
Subject: [PATCH 2/7] led: status_led: add support for white LED colour
Date: Wed,  5 Jun 2024 21:21:34 +0200	[thread overview]
Message-ID: <20240605192146.19052-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com>

Add support for white LED colour present on many devices.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 cmd/legacy_led.c        |  6 ++++++
 common/board_f.c        |  2 ++
 drivers/led/Kconfig     | 14 ++++++++++++++
 drivers/misc/gpio_led.c | 12 ++++++++++++
 include/status_led.h    |  4 ++++
 5 files changed, 38 insertions(+)

diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c
index 5256255f052..40dbc05a651 100644
--- a/cmd/legacy_led.c
+++ b/cmd/legacy_led.c
@@ -57,6 +57,9 @@ static const led_tbl_t led_commands[] = {
 #endif
 #ifdef CONFIG_LED_STATUS_BLUE
 	{ "blue", CONFIG_LED_STATUS_BLUE, blue_led_off, blue_led_on, NULL },
+#endif
+#ifdef CONFIG_LED_STATUS_WHITE
+	{ "white", CONFIG_LED_STATUS_WHITE, white_led_off, white_led_on, NULL },
 #endif
 	{ NULL, 0, NULL, NULL, NULL }
 };
@@ -180,6 +183,9 @@ U_BOOT_CMD(
 #endif
 #ifdef CONFIG_LED_STATUS_BLUE
 	"blue|"
+#endif
+#ifdef CONFIG_LED_STATUS_WHITE
+	"white|"
 #endif
 	"all] [on|off|toggle|blink] [blink-freq in ms]",
 	"[led_name] [on|off|toggle|blink] sets or clears led(s)"
diff --git a/common/board_f.c b/common/board_f.c
index 039d6d712d0..54e2009339e 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -72,6 +72,8 @@ __weak void yellow_led_on(void) {}
 __weak void yellow_led_off(void) {}
 __weak void blue_led_on(void) {}
 __weak void blue_led_off(void) {}
+__weak void white_led_on(void) {}
+__weak void white_led_off(void) {}
 
 /*
  * Why is gd allocated a register? Prior to reloc it might be better to
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
index 9837960198d..6c4f02d71f2 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -415,6 +415,20 @@ config LED_STATUS_GREEN
 
 endif # LED_STATUS_GREEN_ENABLE
 
+config LED_STATUS_WHITE_ENABLE
+	bool "Enable white LED"
+	help
+	  Enable white status LED.
+
+if LED_STATUS_WHITE_ENABLE
+
+config LED_STATUS_WHITE
+	int "White LED identification"
+	help
+	  Valid enabled LED device number (0-5).
+
+endif # LED_STATUS_WHITE_ENABLE
+
 config LED_STATUS_CMD
 	bool "Enable status LED commands"
 
diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
index 0f3682e1465..de84c206b6b 100644
--- a/drivers/misc/gpio_led.c
+++ b/drivers/misc/gpio_led.c
@@ -112,3 +112,15 @@ void blue_led_off(void)
 	__led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_OFF);
 }
 #endif
+
+#ifdef CONFIG_LED_STATUS_WHITE
+void white_led_on(void)
+{
+	__led_set(GPIO_BIT(CONFIG_LED_STATUS_WHITE), CONFIG_LED_STATUS_ON);
+}
+
+void white_led_off(void)
+{
+	__led_set(GPIO_BIT(CONFIG_LED_STATUS_WHITE), CONFIG_LED_STATUS_OFF);
+}
+#endif
diff --git a/include/status_led.h b/include/status_led.h
index 6707ab1d29d..5ce4522b029 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -87,6 +87,8 @@ void yellow_led_on(void);
 void yellow_led_off(void);
 void blue_led_on(void);
 void blue_led_off(void);
+void white_led_on(void);
+void white_led_off(void);
 #else
 	.extern LED_init
 	.extern red_led_on
@@ -97,6 +99,8 @@ void blue_led_off(void);
 	.extern green_led_off
 	.extern blue_led_on
 	.extern blue_led_off
+	.extern white_led_on
+	.extern white_led_off
 #endif
 
 #endif	/* _STATUS_LED_H_	*/
-- 
2.43.0


  parent reply	other threads:[~2024-06-05 19:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 19:21 [PATCH 0/7] misc: introduce STATUS LED activity function Christian Marangi
2024-06-05 19:21 ` [PATCH 1/7] misc: gpio_led: fix broken coloured LED status functions Christian Marangi
2024-06-05 19:21 ` Christian Marangi [this message]
2024-06-05 19:21 ` [PATCH 3/7] led: status_led: add function to toggle a status LED Christian Marangi
2024-06-05 19:21 ` [PATCH 4/7] led: status_led: add new activity LED config and functions Christian Marangi
2024-06-06  8:56   ` neil.armstrong
2024-06-05 19:21 ` [PATCH 5/7] tftp: implement support for LED status activity Christian Marangi
2024-06-06  8:22   ` Peter Robinson
2024-06-06  8:44     ` Christian Marangi
2024-06-05 19:21 ` [PATCH 6/7] mtd: " Christian Marangi
2024-06-05 19:21 ` [PATCH 7/7] ubi: " Christian Marangi
2024-06-05 20:23 ` [PATCH 0/7] misc: introduce STATUS LED activity function Tom Rini
2024-06-05 20:33   ` Christian Marangi
2024-06-06  9:12 ` Quentin Schulz
2024-06-06  9:52   ` Christian Marangi
2024-06-06 10:55     ` Quentin Schulz
2024-06-06 11:52       ` Christian Marangi
2024-06-06 13:32         ` Quentin Schulz
2024-06-06 14:48           ` Christian Marangi

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=20240605192146.19052-3-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=Takahiro.Kuwano@infineon.com \
    --cc=akashi.tkhro@gmail.com \
    --cc=avkrasnov@salutedevices.com \
    --cc=bmeng.cn@gmail.com \
    --cc=bruce_suen@163.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=devarsht@ti.com \
    --cc=douglas.zobel@climate.com \
    --cc=dunaev@tecon.ru \
    --cc=eugeneuriev@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=ivprusov@salutedevices.com \
    --cc=jagan@amarulasolutions.com \
    --cc=joe.hershberger@ni.com \
    --cc=michael@amarulasolutions.com \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=miquel.raynal@bootlin.com \
    --cc=n-jain1@ti.com \
    --cc=p.yadav@ti.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=raymond.mao@linaro.org \
    --cc=rfried.dev@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vaishnav.a@ti.com \
    --cc=venkatesh.abbarapu@amd.com \
    --cc=vigneshr@ti.com \
    --cc=william.zhang@broadcom.com \
    --cc=xypron.glpk@gmx.de \
    --cc=yangshiji66@outlook.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.