Skip to contentSkip to conversation

leds: leds-multi-gpio: Add multiple GPIOs LED driver

PATCH In review Hermes Zhang 3 participants 4 messages Mar 29, 2021 – Aug 18, 2021 LED

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 leds: leds-multi-gpio: Add multiple GPIOs LED driver

From: Hermes Zhang <[email protected]>

Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file.

---

Notes:
changes v3:
- Remove LEDS_SIMPLE menu
- Minro code style fix

changes v2:
- use max_brightness(2^gpio numbers) instead of LED_FULL
- malloc the priv in once
- move the code to simple folder

 drivers/leds/Kconfig                  |   3 +
 drivers/leds/Makefile                 |   3 +
 drivers/leds/simple/Kconfig           |  12 +++
 drivers/leds/simple/Makefile          |   3 +
 drivers/leds/simple/leds-multi-gpio.c | 144 ++++++++++++++++++++++++++
 5 files changed, 165 insertions(+)
 create mode 100644 drivers/leds/simple/Kconfig
 create mode 100644 drivers/leds/simple/Makefile
 create mode 100644 drivers/leds/simple/leds-multi-gpio.c
drivers/leds/Kconfig +3 -0
index b6742b4231bf..f95217b2fcf1 100644
@@ -937,4 +937,7 @@ source "drivers/leds/trigger/Kconfig"
 comment "LED Blink"
 source "drivers/leds/blink/Kconfig"
 
+comment "LED Simple"
+source "drivers/leds/simple/Kconfig"
+
 endif # NEW_LEDS
drivers/leds/Makefile +3 -0
index 2a698df9da57..22cba8dfd6a9 100644
@@ -111,3 +111,6 @@ obj-$(CONFIG_LEDS_TRIGGERS)		+= trigger/
 
 # LED Blink
 obj-$(CONFIG_LEDS_BLINK)                += blink/
+
+# LED Simple
+obj-$(CONFIG_LEDS_SIMPLE)		+= simple/
drivers/leds/simple/Kconfig new file +12 -0
new file mode 100644
index 000000000000..98540b6c8d7a
@@ -0,0 +1,12 @@
+config LEDS_MULTI_GPIO
+	tristate "LED Support for multiple GPIOs LED"
+	depends on LEDS_CLASS
+	depends on GPIOLIB
+	depends on OF
+	help
+	  This option enables support for a multiple GPIOs LED. Such LED is made
+	  of multiple GPIOs and could change the brightness by setting different
+	  states of the GPIOs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called leds-multi-gpio.
drivers/leds/simple/Makefile new file +3 -0
new file mode 100644
index 000000000000..2ba655fdc175
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_LEDS_MULTI_GPIO)	+= leds-multi-gpio.o
drivers/leds/simple/leds-multi-gpio.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
2.20.1
Acked-by on v3 1/1
#1 lore raw

Hi!

Quoted 7 lines

From: Hermes Zhang <[email protected]>

Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file.

Thank you, it looks simple and mostly ok.

But it really needs to go in with devicetree documentation changes, and they need to be acked by devicetree maintainers. If you have that, please send it in series.

Best regards,
Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek
#2 lore raw

Hi,

Quoted 19 lines

-----Original Message-----
From: Pavel Machek <[email protected]>
Sent: 2021年8月4日 23:52
To: Hermes Zhang <[email protected]>
Cc: Dan Murphy <[email protected]>; kernel <[email protected]>; Hermes Zhang <[email protected]>; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] leds: leds-multi-gpio: Add multiple GPIOs LED driver

Hi!

Quoted 7 lines

From: Hermes Zhang <[email protected]>

Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file.

Quoted 8 lines

Thank you, it looks simple and mostly ok.

But it really needs to go in with devicetree documentation changes, and they need to be acked by devicetree maintainers. If you have that, please send it in series.

Do you mean this one: https://lore.kernel.org/patchwork/patch/1402471/, it's already in series.

Best Regards,
Hermes

#3 lore raw

Hi!

Quoted 10 lines
Quoted 10 lines
Quoted 7 lines

From: Hermes Zhang <[email protected]>

Introduce a new multiple GPIOs LED driver. This LED will made of multiple GPIOs (up to 8) and will map different brightness to different GPIOs states which defined in dts file.

Thank you, it looks simple and mostly ok.

Quoted 8 lines
Quoted 6 lines

But it really needs to go in with devicetree documentation changes, and they need to be acked by devicetree maintainers. If you have that, please send it in series.

Do you mean this one: https://lore.kernel.org/patchwork/patch/1402471/, it's already in series.

I don't see Rob Herring's ack there.

Best regards,
Pavel

Signature · 1 line
http://www.livejournal.com/~pavelmachek