Skip to contentSkip to conversation

leds: add new LED driver for TI LP5812

PATCH Superseded Nam Tran 3 participants 6 messages Feb 20, 2025 – Feb 21, 2025

Subsystems (2)

v1 of 22 Superseded Latest is v22 →

lore
Share & tools
lore

Nam Tran

author
#0 lore raw

cover leds: add new LED driver for TI LP5812

From: Nam Tran <[email protected]>
To: Pavel Machek <[email protected]>, Lee Jones <[email protected]>
Cc: [email protected], [email protected]

This patch series adds support for the Texas Instruments LP5812 LED driver. Patch 1 adds the Device Tree (DT) bindings documentation.
Patch 2 introduces the core driver implementation.

The LP5812 is an I2C-controlled LED driver capable of driving up to 4 LEDs with independent brightness control and pattern programming. This driver provides support through the Linux LED framework and includes device tree bindings for proper integration.

This driver has been tested on Raspberry Pi 4 B using kernel version 6.1.13.

I kindly request feedback from the community to ensure that this driver adheres to the Linux LED subsystem standards.

Thank you for your consideration.

Best regards,
Nam

---

Changes in v1:
- Initial submission.

author
#1 lore raw

PATCH 1/2 dt-bindings: leds: Add LP5812 LED driver bindings

This documentation ensures proper integration of the LP5812 in Device Tree-based systems.

---
 .../devicetree/bindings/leds/leds-lp5812.yaml | 34 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++++
 2 files changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-lp5812.yaml
Documentation/devicetree/bindings/leds/leds-lp5812.yaml new file +34 -0
new file mode 100644
index 000000000000..1eb395230531
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+
+title: LED driver for LP5812 LED from Texas Instruments.
+
+maintainers:
+
+description: |
+  The LP5812 is an I2C LED Driver that can support LED matrix 4x3.
+
+properties:
+  compatible:
+    const: ti,lp5812
+
+  reg:
+    description: I2C slave address
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c1 {
+      lp5812@1b {
+        compatible = "ti,lp5812";
+        reg = <0x1b>;
+      };
+    };
+
+...
MAINTAINERS +6 -0
index 4e17764cb6ed..7efbd6f0c79e 100644
@@ -23489,6 +23489,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/leds/backlight/ti,lp8864.yaml
 F:	drivers/leds/leds-lp8864.c
 
+TEXAS INSTRUMENTS' LP5812 LED DRIVER
+M:	Nam Tran <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/leds/leds-lp5812.yaml
+
 TEXAS INSTRUMENTS' SYSTEM CONTROL INTERFACE (TISCI) PROTOCOL DRIVER
 M:	Nishanth Menon <[email protected]>
 M:	Tero Kristo <[email protected]>
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v1 1/2] dt-bindings: leds: Add LP5812 LED driver bindings

Quoted 2 lines · Nam Tran

This documentation ensures proper integration of the LP5812 in Device Tree-based systems.

Thank you for your patch. There is something to discuss/improve.

Describe the hardware, not that DT is DT.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Quoted 4 lines
---
 .../devicetree/bindings/leds/leds-lp5812.yaml | 34 +++++++++++++++++++

Filename based on compatible.

More review when you test it.

Best regards,
Krzysztof

author
#3 lore raw

PATCH 2/2 leds: add new LED driver for TI LP5812

In reply to Nam Tran

The chip can drive LED matrix 4x3.
This driver uses I2C to communicate with the chip.

---
 MAINTAINERS                       |    6 +
 drivers/leds/Kconfig              |   13 +
 drivers/leds/Makefile             |    2 +
 drivers/leds/leds-lp5812-common.c | 1097 ++++++++++++++
 drivers/leds/leds-lp5812-common.h |  323 ++++
 drivers/leds/leds-lp5812-regs.h   |   96 ++
 drivers/leds/leds-lp5812.c        | 2319 +++++++++++++++++++++++++++++
 7 files changed, 3856 insertions(+)
 create mode 100644 drivers/leds/leds-lp5812-common.c
 create mode 100644 drivers/leds/leds-lp5812-common.h
 create mode 100644 drivers/leds/leds-lp5812-regs.h
 create mode 100644 drivers/leds/leds-lp5812.c
MAINTAINERS +6 -0
index 7efbd6f0c79e..d357383c2ad3 100644
@@ -23494,6 +23494,12 @@ M:	Nam Tran <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/leds/leds-lp5812.yaml
+F:	drivers/leds/Kconfig
+F:	drivers/leds/Makefile
+F:	drivers/leds/leds-lp5812-common.c
+F:	drivers/leds/leds-lp5812-common.h
+F:	drivers/leds/leds-lp5812-regs.h
+F:	drivers/leds/leds-lp5812.c
 
 TEXAS INSTRUMENTS' SYSTEM CONTROL INTERFACE (TISCI) PROTOCOL DRIVER
 M:	Nishanth Menon <[email protected]>
drivers/leds/Kconfig +13 -0
index 2b27d043921c..e43dbd5a4d8c 100644
@@ -483,6 +483,19 @@ config LEDS_LP5569
 	  Driver provides direct control via LED class and interface for
 	  programming the engines.
 
+config LEDS_LP5812
+	bool "Enable LP5812 support LED matrix 4x3"
+	depends on LEDS_CLASS && I2C
+	depends on LEDS_CLASS_MULTICOLOR
+	help
+	  If you say Y here you get support for TI LP5812 LED driver.
+
+	  The LP5812 is an I2C-based RGB LED driver that supports a 4x3 LED matrix.
+	  It provides independent brightness control and color mixing for each LED.
+	  This driver integrates with the Linux LED framework and LED multicolor class.
+
+	  If unsure, say N.
+
 config LEDS_LP8501
 	tristate "LED Support for TI LP8501 LED driver chip"
 	depends on LEDS_CLASS && I2C
drivers/leds/Makefile +2 -0
index 6ad52e219ec6..2b95463c9ba7 100644
@@ -54,6 +54,8 @@ obj-$(CONFIG_LEDS_LP5523)		+= leds-lp5523.o
 obj-$(CONFIG_LEDS_LP5562)		+= leds-lp5562.o
 obj-$(CONFIG_LEDS_LP5569)		+= leds-lp5569.o
 obj-$(CONFIG_LEDS_LP55XX_COMMON)	+= leds-lp55xx-common.o
+obj-$(CONFIG_LEDS_LP5812) 		+= leds-lp5812.o
+leds-lp5812-objs				:= leds-lp5812.o leds-lp5812-common.o
 obj-$(CONFIG_LEDS_LP8501)		+= leds-lp8501.o
 obj-$(CONFIG_LEDS_LP8788)		+= leds-lp8788.o
 obj-$(CONFIG_LEDS_LP8860)		+= leds-lp8860.o
drivers/leds/leds-lp5812-common.c new file +1097 -0

1,097 lines not on this page · raw message

drivers/leds/leds-lp5812-common.h new file +323 -0

323 lines not on this page · raw message

drivers/leds/leds-lp5812-regs.h new file +96 -0

96 lines not on this page · raw message

drivers/leds/leds-lp5812.c new file +2319 -0

1,445 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.25.1

Part of the diff is not shown here. View the raw message.

#4 lore raw
Quoted 2 lines · Nam Tran

The chip can drive LED matrix 4x3.
This driver uses I2C to communicate with the chip.

Why none of the 10 existing drivers fit for your device?

Best regards,
Krzysztof

#5 lore raw
In reply to Nam Tran
kernel test robot noticed the following build warnings:

Hi Nam,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-leds/for-leds-next]
[also build test WARNING on linus/master v6.14-rc3 next-20250221] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nam-Tran/dt-bindings-leds-Add-LP5812-LED-driver-bindings/20250221-021848
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
patch link:    https://lore.kernel.org/r/20250220181541.2341-3-trannamatk%40gmail.com
patch subject: [PATCH v1 2/2] leds: add new LED driver for TI LP5812
reproduce: (https://download.01.org/0day-ci/archive/20250221/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

versioncheck warnings: (new ones prefixed by >>)
INFO PATH=/opt/cross/rustc-1.78.0-bindgen-0.65.1/cargo/bin:/opt/cross/clang-19/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/timeout -k 100 3h /usr/bin/make KCFLAGS= -Wtautological-compare -Wno-error=return-type -Wreturn-type -Wcast-function-type -funsigned-char -Wundef -fstrict-flex-arrays=3 -Wformat-overflow -Wformat-truncation -Wenum-conversion W=1 --keep-going LLVM=1 -j32 ARCH=x86_64 versioncheck find ./* \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o \
-name '*.[hcS]' -type f -print | sort \
| xargs perl -w ./scripts/checkversion.pl

>> ./drivers/leds/leds-lp5812.c: 10 linux/version.h not needed.

./samples/bpf/spintest.bpf.c: 8 linux/version.h not needed. ./tools/lib/bpf/bpf_helpers.h: 424: need linux/version.h ./tools/testing/selftests/bpf/progs/dev_cgroup.c: 9 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/netcnt_prog.c: 3 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_map_lock.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_send_signal_kern.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_spin_lock.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_tcp_estats.c: 37 linux/version.h not needed. ./tools/testing/selftests/wireguard/qemu/init.c: 27 linux/version.h not needed.

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki