Skip to contentSkip to conversation

leds: add new LED driver for TI LP5812

PATCH Superseded Nam Tran 4 participants 12 messages Apr 5, 2025 – Apr 10, 2025

Subsystems (5)

v4 of 22 Superseded Latest is v22 →

lore
Share & tools
lore

Nam Tran

author maintainer
#0 lore raw

v4 cover leds: add new LED driver for TI LP5812

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.
Patch 3 adds documentation of sysfs ABI interfaces.
Patch 4 adds Driver documentation in reStructuredText format. Patch 5 adds the LP5812 device tree node for Raspberry Pi 4B.

Changes in v4:
- Merge leds-lp5812-common.c into leds-lp5812.c
- Implemented the core of aeu_pwm[1-4]_{store, show}()
- Used kstrdup() instead of kmalloc() for allocating characters array
- Add sysfs ABI documentation
- Updated device tree binding documentation

Best regards,
Nam

author maintainer
#1 lore raw

PATCH v4 1/5 dt-bindings: leds: add TI/National Semiconductor LP5812 LED Driver

The LP5812 is a 4×3 RGB LED driver with an autonomous animation engine and time-cross-multiplexing (TCM) support for up to 12 LEDs. It supports both analog (256 levels) and PWM (8-bit) dimming, including exponential PWM for smooth brightness control.

---
 .../devicetree/bindings/leds/ti,lp5812.yaml   | 122 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 128 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/ti,lp5812.yaml
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +122 -0
new file mode 100644
index 000000000000..e492386ff127
@@ -0,0 +1,122 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/ti,lp5812.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI/National Semiconductor LP5812 LED Driver
+
+maintainers:
+  - Nam Tran <[email protected]>
+
+description: |
+  The LP5812 is an I2C LED Driver that can support LED matrix 4x3.
+  For more product information please see the link below:
+  https://www.ti.com/product/LP5812#tech-docs
+
+properties:
+  compatible:
+    const: ti,lp5812
+
+  reg:
+    maxItems: 1
+    description:
+      I2C slave address
+      lp5812/12- 0x1b
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^led@[0-9a-b]$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 0xb
+
+      chan-name:
+        $ref: /schemas/types.yaml#/definitions/string
+        description: LED channel name
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@1b {
+            compatible = "ti,lp5812";
+            reg = <0x1b>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                    reg = <0x0>;
+                    chan-name = "a0";
+            };
+            led@1 {
+                    reg = <0x1>;
+                    chan-name = "a1";
+            };
+            led@2 {
+                    reg = <0x2>;
+                    chan-name = "a2";
+            };
+            led@3 {
+                    reg = <0x3>;
+                    chan-name = "b0";
+            };
+            led@4 {
+                    reg = <0x4>;
+                    chan-name = "b1";
+            };
+            led@5 {
+                    reg = <0x5>;
+                    chan-name = "b2";
+            };
+            led@6 {
+                    reg = <0x6>;
+                    chan-name = "c0";
+            };
+            led@7 {
+                    reg = <0x7>;
+                    chan-name = "c1";
+            };
+            led@8 {
+                    reg = <0x8>;
+                    chan-name = "c2";
+            };
+            led@9 {
+                    reg = <0x9>;
+                    chan-name = "d0";
+            };
+            led@a {
+                    reg = <0xa>;
+                    chan-name = "d1";
+            };
+            led@b {
+                    reg = <0xb>;
+                    chan-name = "d2";
+            };
+        };
+    };
+
+...
MAINTAINERS +6 -0
index 3b5fa8436987..afbc481d0311 100644
@@ -23531,6 +23531,12 @@ S:	Supported
 F:	Documentation/devicetree/bindings/iio/dac/ti,dac7612.yaml
 F:	drivers/iio/dac/ti-dac7612.c
 
+TEXAS INSTRUMENTS' LP5812 LED DRIVER
+M:	Nam Tran <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/leds/ti,lp5812.yaml
+
 TEXAS INSTRUMENTS' LB8864 LED BACKLIGHT DRIVER
 M:	Alexander Sverdlin <[email protected]>
 L:	[email protected]

base-commit: 2df0c02dab829dd89360d98a8a1abaa026ef5798

Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v4 1/5] dt-bindings: leds: add TI/National Semiconductor LP5812 LED Driver

Documentation/devicetree/bindings/leds/ti,lp5812.yaml line 25

Quoted 9 lines · Nam Tran
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +9 -0
+properties:
+  compatible:
+    const: ti,lp5812
+
+  reg:
+    maxItems: 1
+    description:
+      I2C slave address
+      lp5812/12- 0x1b

Drop description, redundant.

Quoted 11 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +11 -0
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^led@[0-9a-b]$":
+    type: object
+    $ref: common.yaml#

Documentation/devicetree/bindings/leds/ti,lp5812.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +10 -0
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 0xb
+
+      chan-name:
+        $ref: /schemas/types.yaml#/definitions/string
+        description: LED channel name

Isn't this existing label property? Or node name? You don't need this and instead whatever currently LED subsystem is expecting (label got discouraged so maybe there is something else now).

There is no multi-led support in the device? Datasheet this can work as matrix and as direct drive of 4 LEDs, so binding looks incomplete. Not sure what you exactly miss here - check other recent devices with similar features.

Quoted 17 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +17 -0
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;

Documentation/devicetree/bindings/leds/ti,lp5812.yaml line 73

Quoted 10 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +10 -0
+
+        led-controller@1b {
+            compatible = "ti,lp5812";
+            reg = <0x1b>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                    reg = <0x0>;
+                    chan-name = "a0";

Mixed up indentation.

Best regards,
Krzysztof

author maintainer
#3 lore raw

Re: [PATCH v4 1/5] dt-bindings: leds: add TI/National Semiconductor LP5812 LED Driver

Quoted 12 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/leds/ti,lp5812.yaml line 25

Quoted 9 lines · Nam Tran
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +9 -0
+properties:
+  compatible:
+    const: ti,lp5812
+
+  reg:
+    maxItems: 1
+    description:
+      I2C slave address
+      lp5812/12- 0x1b

Drop description, redundant.

I will drop it.

Quoted 17 lines
Quoted 17 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +17 -0
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^led@[0-9a-b]$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 0xb
Quoted 8 lines

Documentation/devicetree/bindings/leds/ti,lp5812.yaml line 46

Quoted 4 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +4 -0
+
+      chan-name:
+        $ref: /schemas/types.yaml#/definitions/string
+        description: LED channel name

Isn't this existing label property? Or node name? You don't need this and instead whatever currently LED subsystem is expecting (label got discouraged so maybe there is something else now).

It isn't common led and multi-led. LP5812 is new 4x3 matrix leds on mainline. Therefore, it isn't same as existing led driver common.

Quoted 4 lines

There is no multi-led support in the device? Datasheet this can work as matrix and as direct drive of 4 LEDs, so binding looks incomplete. Not sure what you exactly miss here - check other recent devices with similar features.

My device doesn't support multi-led. Leds are controlled by the control register index directly. I will list more D0 - D3 leds. However, the maximum of leds are 12 LEDS.
It depends on the operation mode that the end user selects.

Quoted 21 lines
Quoted 21 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +21 -0
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@1b {
+            compatible = "ti,lp5812";
+            reg = <0x1b>;
Quoted 8 lines

Documentation/devicetree/bindings/leds/ti,lp5812.yaml line 73

Quoted 6 lines
Documentation/devicetree/bindings/leds/ti,lp5812.yaml new file +6 -0
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                    reg = <0x0>;
+                    chan-name = "a0";

Mixed up indentation.

I will fix the indentation.

Thanks for your detailed review.
Appreciate your time and feedback!

Best regards,
Nam Tran

author maintainer
#4 lore raw

PATCH v4 2/5 leds: add TI/National Semiconductor LP5812 LED Driver

In reply to Nam Tran

The LP5812 is a 4×3 matrix RGB LED driver
with an autonomous animation engine
and time-cross-multiplexing (TCM) support for up to 12 LEDs. Each LED can be configured through the related registers to realize vivid and fancy lighting effects.

---
 MAINTAINERS                |    4 +
 drivers/leds/Kconfig       |   16 +
 drivers/leds/Makefile      |    1 +
 drivers/leds/leds-lp5812.c | 2821 ++++++++++++++++++++++++++++++++++++
 drivers/leds/leds-lp5812.h |  350 +++++
 5 files changed, 3192 insertions(+)
 create mode 100644 drivers/leds/leds-lp5812.c
 create mode 100644 drivers/leds/leds-lp5812.h
MAINTAINERS +4 -0
index afbc481d0311..3fcc7192e01a 100644
@@ -23536,6 +23536,10 @@ M:	Nam Tran <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/leds/ti,lp5812.yaml
+F:	drivers/leds/Kconfig
+F:	drivers/leds/Makefile
+F:	drivers/leds/leds-lp5812.c
+F:	drivers/leds/leds-lp5812.h
 
 TEXAS INSTRUMENTS' LB8864 LED BACKLIGHT DRIVER
 M:	Alexander Sverdlin <[email protected]>
drivers/leds/Kconfig +16 -0
index 2b27d043921c..fa3acc9fa4da 100644
@@ -483,6 +483,22 @@ config LEDS_LP5569
 	  Driver provides direct control via LED class and interface for
 	  programming the engines.
 
+config LEDS_LP5812
+	tristate "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.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called leds-lp5812.
+
+	  If unsure, say N.
+
 config LEDS_LP8501
 	tristate "LED Support for TI LP8501 LED driver chip"
 	depends on LEDS_CLASS && I2C
drivers/leds/Makefile +1 -0
index 6ad52e219ec6..944278f1673e 100644
@@ -54,6 +54,7 @@ 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
 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.c new file +2821 -0

2,821 lines not on this page · raw message

drivers/leds/leds-lp5812.h new file +350 -0

140 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.

#5 lore raw

Re: [PATCH v4 2/5] leds: add TI/National Semiconductor LP5812 LED Driver

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 robh/for-next v6.14]
[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-TI-National-Semiconductor-LP5812-LED-Driver/20250406-023621
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next
patch link:    https://lore.kernel.org/r/20250405183246.198568-3-trannamatk%40gmail.com
patch subject: [PATCH v4 2/5] leds: add TI/National Semiconductor LP5812 LED Driver
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20250407/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250407/[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]/

All warnings (new ones prefixed by >>):

>> drivers/leds/leds-lp5812.c:544:13: warning: 'lp5812_dump_regs' defined but not used [-Wunused-function]
     544 | static void lp5812_dump_regs(struct lp5812_chip *chip, u16 from_reg, u16 to_reg)
         |             ^~~~~~~~~~~~~~~~
>> drivers/leds/leds-lp5812.c:364:12: warning: 'lp5812_update_bit' defined but not used [-Wunused-function]
     364 | static int lp5812_update_bit(struct lp5812_chip *chip, u16 reg, u8 mask, u8 val)
         |            ^~~~~~~~~~~~~~~~~

vim +/lp5812_dump_regs +544 drivers/leds/leds-lp5812.c

363

 > 364	static int lp5812_update_bit(struct lp5812_chip *chip, u16 reg, u8 mask, u8 val)
   365	{
   366		int ret;
   367		u8 tmp;
   368	
   369		ret = lp5812_read(chip, reg, &tmp);
   370		if (ret)
   371			return ret;
   372	
   373		tmp &= ~mask;
   374		tmp |= val & mask;
   375	
   376		return lp5812_write(chip, reg, tmp);
   377	}
   378	
   379	static int lp5812_read_tsd_config_status(struct lp5812_chip *chip, u8 *reg_val)
   380	{
   381		int ret = 0;
   382	
   383		if (!reg_val)
   384			return -1;
   385	
   386		ret = lp5812_read(chip, chip->regs->tsd_config_status_reg, reg_val);
   387	
   388		return ret;
   389	}
   390	
   391	static int lp5812_update_regs_config(struct lp5812_chip *chip)
   392	{
   393		int ret;
   394		u8 reg_val; /* save register value */
   395	
   396		/* Send update command to update config setting */
   397		ret = lp5812_write(chip, chip->regs->update_cmd_reg, UPDATE_CMD_VAL);
   398		if (ret)
   399			return ret;
   400		/* check if the configuration is proper */
   401		ret = lp5812_read_tsd_config_status(chip, &reg_val);
   402		if (ret == 0)
   403			return (int)(reg_val & 0x01);
   404	
   405		return ret;
   406	}
   407	
   408	static int lp5812_read_lod_status(struct lp5812_chip *chip, int led_number, u8 *val)
   409	{
   410		int ret = 0;
   411		u16 reg = 0;
   412		u8 reg_val = 0;
   413	
   414		if (!val)
   415			return -1;
   416	
   417		if (led_number < 0x8)
   418			reg = LOD_STAT_1_REG;
   419		else
   420			reg = LOD_STAT_2_REG;
   421	
   422		ret = lp5812_read(chip, reg, &reg_val);
   423		if (ret)
   424			return ret;
   425	
   426		*val = (reg_val & (1 << (led_number % 8))) ? 1 : 0;
   427	
   428		return ret;
   429	}
   430	
   431	static int lp5812_read_lsd_status(struct lp5812_chip *chip, int led_number, u8 *val)
   432	{
   433		int ret = 0;
   434		u16 reg = 0;
   435		u8 reg_val = 0;
   436	
   437		if (!val)
   438			return -1;
   439	
   440		if (led_number < 0x8)
   441			reg = LSD_STAT_1_REG;
   442		else
   443			reg = LSD_STAT_2_REG;
   444	
   445		ret = lp5812_read(chip, reg, &reg_val);
   446		if (ret)
   447			return ret;
   448	
   449		*val = (reg_val & (1 << (led_number % 8))) ? 1 : 0;
   450	
   451		return ret;
   452	}
   453	
   454	static int lp5812_read_auto_pwm_value(struct lp5812_chip *chip, int led_number,
   455			u8 *val)
   456	{
   457		int ret = 0;
   458		u16 reg = 0;
   459		u8 reg_val = 0;
   460	
   461		reg = AUTO_PWM_BASE_ADDR + led_number;
   462	
   463		ret = lp5812_read(chip, reg, &reg_val);
   464		if (ret)
   465			return ret;
   466	
   467		*val = reg_val;
   468	
   469		return ret;
   470	}
   471	
   472	static int lp5812_read_aep_status(struct lp5812_chip *chip, int led_number, u8 *val)
   473	{
   474		int ret = 0;
   475		u16 reg;
   476		u8 reg_val;
   477	
   478		switch (led_number / 2) {
   479		case 0:
   480			reg = AEP_STATUS_0_REG; // LED_0 and LED_1
   481			break;
   482		case 1:
   483			reg = AEP_STATUS_1_REG; // LED_2 and LED_3
   484			break;
   485		case 2:
   486			reg = AEP_STATUS_2_REG; // LED_A0 and LED_A1
   487			break;
   488		case 3:
   489			reg = AEP_STATUS_3_REG; // LED_A2 and LED_B0
   490			break;
   491		case 4:
   492			reg = AEP_STATUS_4_REG; // LED_B1 and LED_B2
   493			break;
   494		case 5:
   495			reg = AEP_STATUS_5_REG; // LED_C0 and LED_C1
   496			break;
   497		case 6:
   498			reg = AEP_STATUS_6_REG; // LED_C2 and LED_D0
   499			break;
   500		case 7:
   501			reg = AEP_STATUS_7_REG; // LED_D1 and LED_D2
   502			break;
   503		default:
   504			return -EINVAL;
   505		}
   506	
   507		ret = lp5812_read(chip, reg, &reg_val);
   508		if (ret)
   509			return ret;
   510	
   511		*val = (led_number % 2) ? ((reg_val >> 3) & 0x07) : (reg_val & 0x07);
   512	
   513		return ret;
   514	}
   515	
   516	static int lp5812_enable_disable(struct lp5812_chip *chip, int enable)
   517	{
   518		return lp5812_write(chip, chip->regs->enable_reg, (u8)enable);
   519	}
   520	
   521	static int lp5812_reset(struct lp5812_chip *chip)
   522	{
   523		return lp5812_write(chip, chip->regs->reset_reg, RESET_REG_VAL);
   524	}
   525	
   526	static int lp5812_fault_clear(struct lp5812_chip *chip, u8 value)
   527	{
   528		u8 reg_val;
   529	
   530		if (value == 0)
   531			reg_val = LOD_CLEAR_VAL;
   532		else if (value == 1)
   533			reg_val = LSD_CLEAR_VAL;
   534		else if (value == 2)
   535			reg_val = TSD_CLEAR_VAL;
   536		else if (value == 3)
   537			reg_val = FAULT_CLEAR_ALL;
   538		else
   539			return -EINVAL;
   540	
   541		return lp5812_write(chip, chip->regs->fault_clear_reg, reg_val);
   542	}
   543	
 > 544	static void lp5812_dump_regs(struct lp5812_chip *chip, u16 from_reg, u16 to_reg)

545 {
546 u16 reg_addr;
547 u8 reg_val;
548
549 for (reg_addr = from_reg; reg_addr <= to_reg; reg_addr++)
550 lp5812_read(chip, reg_addr, &reg_val);
551 }
552

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#6 lore raw

PATCH v4 3/5 docs: ABI: Document LP5812 LED sysfs interfaces

In reply to Nam Tran

The LP5812 is a 4 × 3 matrix RGB LED driver
with autonomous animation engine control.

The driver provides interfaces to configure
LED modes manual/autonomous, set PWM/DC values,
and manage autonomous animation engines.

---
 .../ABI/testing/sysfs-bus-i2c-devices-lp5812  | 150 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 151 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +150 -0
new file mode 100644
index 000000000000..e745f0f936c5
@@ -0,0 +1,150 @@
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_enable
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Enables or disables the LP5812 device. (RW)
+        0 - Disable
+        1 - Enable
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/dev_config
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Configures drive mode and scan order. (RW)
+        Some valid values: tcmscan:4:0:1:2:3 (default), tcmscan:3:0:1:2, mixscan:2:2:0:3, mixscan:3:0:1:2:3
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_command
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Issues device-level commands. (WO)
+        Valid values: "update", "start", "stop", "pause", "continue"
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_reset
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Triggers a software reset of the device. (WO)
+        1 - resets device
+        0 - does not reset device
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/fault_clear
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Clears fault status. (WO)
+        1 - clears fault status
+        0 - does not clear fault status
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/tsd_config_status
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Report the current thermal shutdown config status. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/enable
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Enables or disables the specified LED channel. (RW)
+        1 - Enable
+        0 - Disable
+
+What:		/sys/bus/i2c/devices/.../led_<id>/mode
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Selects LED operation mode. (RW)
+        Valid values: "manual", "autonomous"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/manual_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level in manual mode. (RW)
+        Valid values: 0 - 255
+
+What:		/sys/bus/i2c/devices/.../led_<id>/manual_pwm
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        PWM duty cycle in manual mode. (RW)
+        Valid values: 0 - 255
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level used in autonomous mode. (RW)
+        Valid values: 0 - 255
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level used in autonomous mode. (RW)
+        Valid values: 0 - 255
+
+What:		/sys/bus/i2c/devices/.../led_<id>/pwm_dimming_scale
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        PWM dimming scale type. (RW)
+        Valid values: "linear", "exponential"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/pwm_phase_align
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Configures PWM phase alignment. (RW)
+        Valid values: "forward", "middle", "backward"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_animation
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Controls AEU configuration and playback. (RW)
+        Format: (aeu number):(start pause time):(stop pause time):(playback time)
+        with aeu number 1, 2, 3; playback time 0 - 15
+
+What:		/sys/bus/i2c/devices/.../led_<id>/aep_status
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Shows current animation pattern status, value from 0 to 7. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/auto_pwm_val
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Shows the pwm value in autonomous mode when pause the animation, value from 0 to 255. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/lod_lsd
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        0 0 mean no lod and lsd fault detected, 1 1 mean lod and lsd fault detected (RO)
+
+
+
+
+
+
MAINTAINERS +1 -0
index 3fcc7192e01a..903070e18d05 100644
@@ -23535,6 +23535,7 @@ TEXAS INSTRUMENTS' LP5812 LED DRIVER
 M:	Nam Tran <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812
 F:	Documentation/devicetree/bindings/leds/ti,lp5812.yaml
 F:	drivers/leds/Kconfig
 F:	drivers/leds/Makefile
Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH v4 3/5] docs: ABI: Document LP5812 LED sysfs interfaces

Quoted 20 lines · Nam Tran

The LP5812 is a 4 × 3 matrix RGB LED driver
with autonomous animation engine control.

The driver provides interfaces to configure
LED modes manual/autonomous, set PWM/DC values,
and manage autonomous animation engines.

---
 .../ABI/testing/sysfs-bus-i2c-devices-lp5812  | 150 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 151 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +0 -0
new file mode 100644
index 000000000000..e745f0f936c5

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 1

Quoted 1 line
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +1 -0
@@ -0,0 +1,150 @@
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_enable

I do not see reason for such ABI. If you want to disable, just unbind it.

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 2

Quoted 1 line
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +1 -0
+Date:		April 2025

Not possible...

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 3

Quoted 1 line
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +1 -0
+KernelVersion:	6.14

You cannot go to the past. 6.14 was released. This will be v6.16 or later.

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 10

Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +7 -0
+Contact:	Nam Tran <[email protected]>
+Description:
+        Enables or disables the LP5812 device. (RW)
+        0 - Disable
+        1 - Enable
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/dev_config

Looks like wrong path here and everywhere else. I think other name it as led driver, e.g. Documentation/ABI/testing/sysfs-class-led-driver-lm3533

Quoted 13 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +13 -0
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Configures drive mode and scan order. (RW)
+        Some valid values: tcmscan:4:0:1:2:3 (default), tcmscan:3:0:1:2, mixscan:2:2:0:3, mixscan:3:0:1:2:3
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_command
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Issues device-level commands. (WO)

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 33

Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +10 -0
+        Valid values: "update", "start", "stop", "pause", "continue"
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_reset
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Triggers a software reset of the device. (WO)
+        1 - resets device
+        0 - does not reset device

I do not see kernel exposing it for other devices, drop.

Quoted 15 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +15 -0
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/fault_clear
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Clears fault status. (WO)
+        1 - clears fault status
+        0 - does not clear fault status
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/tsd_config_status
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 58

Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +10 -0
+        Report the current thermal shutdown config status. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/enable
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Enables or disables the specified LED channel. (RW)
+        1 - Enable
+        0 - Disable

No, you already have standard ABI for this. I also already told you that you cannot duplicate existing kernel interface.

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +6 -0
+
+What:		/sys/bus/i2c/devices/.../led_<id>/mode
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 74

Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +10 -0
+        Selects LED operation mode. (RW)
+        Valid values: "manual", "autonomous"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/manual_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level in manual mode. (RW)
+        Valid values: 0 - 255

NAK, duplicating existing brightness.

Quoted 13 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +13 -0
+
+What:		/sys/bus/i2c/devices/.../led_<id>/manual_pwm
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        PWM duty cycle in manual mode. (RW)
+        Valid values: 0 - 255
+> +What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 98

Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +10 -0
+        DC current level used in autonomous mode. (RW)
+        Valid values: 0 - 255
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level used in autonomous mode. (RW)
+        Valid values: 0 - 255

Also duplicating brigthness.

Quoted 42 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +42 -0
+
+What:		/sys/bus/i2c/devices/.../led_<id>/pwm_dimming_scale
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        PWM dimming scale type. (RW)
+        Valid values: "linear", "exponential"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/pwm_phase_align
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Configures PWM phase alignment. (RW)
+        Valid values: "forward", "middle", "backward"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_animation
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Controls AEU configuration and playback. (RW)
+        Format: (aeu number):(start pause time):(stop pause time):(playback time)
+        with aeu number 1, 2, 3; playback time 0 - 15
+
+What:		/sys/bus/i2c/devices/.../led_<id>/aep_status
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Shows current animation pattern status, value from 0 to 7. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/auto_pwm_val
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Shows the pwm value in autonomous mode when pause the animation, value from 0 to 255. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/lod_lsd
+Date:		April 2025

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 150

Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +10 -0
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        0 0 mean no lod and lsd fault detected, 1 1 mean lod and lsd fault detected (RO)
+
+
+
+
+
+

Why so many blank lines? Drop

Best regards,
Krzysztof

author maintainer
#8 lore raw

Re: [PATCH v4 3/5] docs: ABI: Document LP5812 LED sysfs interfaces

Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Nam Tran

The LP5812 is a 4 × 3 matrix RGB LED driver
with autonomous animation engine control.

The driver provides interfaces to configure
LED modes manual/autonomous, set PWM/DC values,
and manage autonomous animation engines.

---
 .../ABI/testing/sysfs-bus-i2c-devices-lp5812  | 150 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 151 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812
Quoted 9 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 1

Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +1 -0
new file mode 100644
index 000000000000..e745f0f936c5
@@ -0,0 +1,150 @@
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_enable

I do not see reason for such ABI. If you want to disable, just unbind it.

I think the name is confusing, it is Chip_EN register. It is used to "enable the internal circuits". The hardware supports low power consumption.
When we write 0 to the bit, it will save all configurations and go to save power mode. When we write 1, it will restore. Therefore, I support the end user in controlling this register.

Quoted 3 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 2

Quoted 1 line
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +1 -0
+Date:		April 2025

Not possible...

Sorry, I understand now. Should I use the current date or the date when the patch is accepted?

Quoted 3 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 3

Quoted 1 line
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +1 -0
+KernelVersion:	6.14

You cannot go to the past. 6.14 was released. This will be v6.16 or later.

It is my mistake. I will update the KernelVersion to v6.16 or later accordingly.

Quoted 11 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 10

Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +7 -0
+Contact:	Nam Tran <[email protected]>
+Description:
+        Enables or disables the LP5812 device. (RW)
+        0 - Disable
+        1 - Enable
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/dev_config

Looks like wrong path here and everywhere else. I think other name it as led driver, e.g. Documentation/ABI/testing/sysfs-class-led-driver-lm3533

The LP5812 driver is basically an I2C driver.
It doesn't work as current common or multi-LEDs supported by the Kernel framework. However, the LP5812 driver still supports LED functions.

Quoted 17 lines
Quoted 17 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +17 -0
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Configures drive mode and scan order. (RW)
+        Some valid values: tcmscan:4:0:1:2:3 (default), tcmscan:3:0:1:2, mixscan:2:2:0:3, mixscan:3:0:1:2:3
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_command
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Issues device-level commands. (WO)
+        Valid values: "update", "start", "stop", "pause", "continue"
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/device_reset
+Date:		April 2025
Quoted 8 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 33

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +6 -0
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Triggers a software reset of the device. (WO)
+        1 - resets device
+        0 - does not reset device

I do not see kernel exposing it for other devices, drop.

This is sw_reset register of hardware. It is used to request the hardware reset. I think I will change the name to "sw_reset" to make it clearly.

Quoted 20 lines
Quoted 20 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +20 -0
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/fault_clear
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Clears fault status. (WO)
+        1 - clears fault status
+        0 - does not clear fault status
+
+What:		/sys/bus/i2c/devices/.../lp5812_chip_setup/tsd_config_status
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Report the current thermal shutdown config status. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/enable
+Date:		April 2025
+KernelVersion:	6.14
Quoted 8 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 58

Quoted 5 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +5 -0
+Contact:	Nam Tran <[email protected]>
+Description:
+        Enables or disables the specified LED channel. (RW)
+        1 - Enable
+        0 - Disable

No, you already have standard ABI for this. I also already told you that you cannot duplicate existing kernel interface.

According to function of led and register, I will change it to "activate" interface.

Quoted 10 lines
Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +10 -0
+
+What:		/sys/bus/i2c/devices/.../led_<id>/mode
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Selects LED operation mode. (RW)
+        Valid values: "manual", "autonomous"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/manual_dc
Quoted 8 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 74

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +6 -0
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level in manual mode. (RW)
+        Valid values: 0 - 255

NAK, duplicating existing brightness.

There are some brighness mode in this hardware. manual_dc is a interface to to control dc current in manual mode.

Quoted 17 lines
Quoted 17 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +17 -0
+
+What:		/sys/bus/i2c/devices/.../led_<id>/manual_pwm
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        PWM duty cycle in manual mode. (RW)
+        Valid values: 0 - 255
+> +What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_dc
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level used in autonomous mode. (RW)
+        Valid values: 0 - 255
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_dc
Quoted 8 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 90

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +6 -0
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        DC current level used in autonomous mode. (RW)
+        Valid values: 0 - 255

Also duplicating brigthness.

It is not brightness only. It is another registers.
It is used for autonomous_dc that mean the led will blink with several brighness levels automotically.

Quoted 46 lines
Quoted 46 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +46 -0
+
+What:		/sys/bus/i2c/devices/.../led_<id>/pwm_dimming_scale
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        PWM dimming scale type. (RW)
+        Valid values: "linear", "exponential"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/pwm_phase_align
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Configures PWM phase alignment. (RW)
+        Valid values: "forward", "middle", "backward"
+
+What:		/sys/bus/i2c/devices/.../led_<id>/autonomous_animation
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Controls AEU configuration and playback. (RW)
+        Format: (aeu number):(start pause time):(stop pause time):(playback time)
+        with aeu number 1, 2, 3; playback time 0 - 15
+
+What:		/sys/bus/i2c/devices/.../led_<id>/aep_status
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Shows current animation pattern status, value from 0 to 7. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/auto_pwm_val
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        Shows the pwm value in autonomous mode when pause the animation, value from 0 to 255. (RO)
+
+What:		/sys/bus/i2c/devices/.../led_<id>/lod_lsd
+Date:		April 2025
+KernelVersion:	6.14
+Contact:	Nam Tran <[email protected]>
+Description:
+        0 0 mean no lod and lsd fault detected, 1 1 mean lod and lsd fault detected (RO)
Quoted 8 lines

Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 line 50

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812 new file +6 -0
+
+
+
+
+
+

Why so many blank lines? Drop

It's my mistake. I will remove the blank lines.

Thanks for your detailed review.
Appreciate your time and feedback!

Best regards,
Nam Tran

author maintainer
#9 lore raw

PATCH v4 4/5 docs: leds: Document TI LP5812 LED driver

In reply to Nam Tran

The driver provides sysfs interfaces to control and configure the LP5812 device and its LED channels.

The documetation describes the chip's capabilities, sysfs interface, and usage examples.

---
 Documentation/leds/leds-lp5812.rst | 79 ++++++++++++++++++++++++++++++
 MAINTAINERS                        |  1 +
 2 files changed, 80 insertions(+)
 create mode 100644 Documentation/leds/leds-lp5812.rst
Documentation/leds/leds-lp5812.rst new file +79 -0
new file mode 100644
index 000000000000..dcdf67ef6d74
@@ -0,0 +1,79 @@
+========================
+Kernel driver for lp5812
+========================
+
+* TI/National Semiconductor LP5812 LED Driver
+* Datasheet: https://www.ti.com/product/LP5812#tech-docs
+
+Authors: Jared Zhou <[email protected]>
+
+Description
+===========
+
+The LP5812 is a 4x3 maxtrix LED driver with support for both manual and
+autonomous animation control. It provides features such as:
+
+- PWM dimming and DC current control
+- Slope time configuration
+- Autonomous Engine Unit (AEU) for LED animation playback
+- Flexible scan and drive mode configuration
+
+This driver provides sysfs interfaces to control and configure the LP5812
+device and its LED channels.
+
+Sysfs Interface
+===============
+
+LP5812 device exposes a chip-level sysfs group:
+  /sys/bus/i2c/devices/<i2c-dev-addr>/lp5812_chip_setup/
+
+The following attributes are available at chip level:
+  - device_enable: Enable/disable the device (RW)
+  - dev_config: Configure drive mode and scan order (RW)
+  - device_command: Issue device-wide commands (WO)
+  - device_reset: Reset the device (WO)
+  - fault_clear: Clear any device faults (WO)
+  - tsd_config_status: Read thermal shutdown config status (RO)
+
+Each LED channel is exposed as:
+  /sys/bus/i2c/devices/<i2c-dev-addr>/led_<id>/
+
+Each LED exposes the following attributes:
+  - enable: Enable or disable the LED (RW)
+  - mode: manual or autonomous mode (RW)
+  - manual_dc: DC current value (0–255) (RW)
+  - manual_pwm: PWM duty cycle (0–255) (RW)
+  - autonomous_dc: DC current in autonomous mode (RW)
+  - pwm_dimming_scale: linear or exponential (RW)
+  - pwm_phase_align: PWM alignment mode (RW)
+  - autonomous_animation: Config autonomous animation mode with aeu number, start pause time, stop pause time, playback time (RW)
+  - aep_status: autonomous engine pattern status (RO)
+  - auto_pwm_val: pwm value in autonomous mode when pause the animation (RO)
+  - lod_lsd: lod and lsd fault detected status (RO)
+
+Example Usage
+=============
+
+To control led_A0 in manual mode::
+    echo 1 > /sys/bus/i2c/drivers/lp5812/xxxx/lp5812_chip_setup/device_enable
+    echo 1 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/enable
+    echo manual > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/mode
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/manual_dc
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/manual_pwm
+
+To control led_A0 in autonomous mode::
+    echo 1 > /sys/bus/i2c/drivers/lp5812/xxxx/lp5812_chip_setup/device_enable
+    echo 1 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/enable
+    echo autonomous > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/mode
+    echo 1:10:10:15 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/autonomous_animation
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/pwm1
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/pwm2
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/pwm3
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/pwm4
+    echo 100 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/pwm5
+    echo 5 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/slope_time_t1
+    echo 5 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/slope_time_t2
+    echo 5 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/slope_time_t3
+    echo 5 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/slope_time_t4
+    echo 1 > /sys/bus/i2c/drivers/lp5812/xxxx/led_A0/AEU1/playback_time
+    echo start > /sys/bus/i2c/drivers/lp5812/xxxx/lp5812_chip_setup/device_command
MAINTAINERS +1 -0
index 903070e18d05..2bc897eb5600 100644
@@ -23537,6 +23537,7 @@ L:	[email protected]
 S:	Maintained
 F:	Documentation/ABI/testing/sysfs-bus-i2c-devices-lp5812
 F:	Documentation/devicetree/bindings/leds/ti,lp5812.yaml
+F:	Documentation/leds/leds-lp5812.rst
 F:	drivers/leds/Kconfig
 F:	drivers/leds/Makefile
 F:	drivers/leds/leds-lp5812.c
Signature · 1 line
2.25.1
author maintainer
#10 lore raw

PATCH v4 5/5 arm64: dts: Add LP5812 LED node for Raspberry Pi 4 Model B

In reply to Nam Tran

Add the LP5812 LED driver node to the Device Tree for Raspberry Pi 4 B. This enables the LED connected to the LP5812 to be controlled via I2C.

---
 .../arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +60 -0
index 353bb50ce542..511d358f7692 100644
@@ -152,6 +152,66 @@ &hdmi1 {
 	status = "okay";
 };
 
+&i2c1 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led-controller@1b {
+				compatible = "ti,lp5812";
+				reg = <0x1b>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				led@0 {
+						reg = <0x0>;
+						chan-name = "a0";
+				};
+				led@1 {
+						reg = <0x1>;
+						chan-name = "a1";
+				};
+				led@2 {
+						reg = <0x2>;
+						chan-name = "a2";
+				};
+				led@3 {
+						reg = <0x3>;
+						chan-name = "b0";
+				};
+				led@4 {
+						reg = <0x4>;
+						chan-name = "b1";
+				};
+				led@5 {
+						reg = <0x5>;
+						chan-name = "b2";
+				};
+				led@6 {
+						reg = <0x6>;
+						chan-name = "c0";
+				};
+				led@7 {
+						reg = <0x7>;
+						chan-name = "c1";
+				};
+				led@8 {
+						reg = <0x8>;
+						chan-name = "c2";
+				};
+				led@9 {
+						reg = <0x9>;
+						chan-name = "d0";
+				};
+				led@a {
+						reg = <0xa>;
+						chan-name = "d1";
+				};
+				led@b {
+						reg = <0xb>;
+						chan-name = "d2";
+				};
+		};
+};
+
 &led_act {
 	gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
 };
Signature · 1 line
2.25.1
#11 lore raw
In reply to Nam Tran
Quoted 14 lines · Nam Tran

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.
Patch 3 adds documentation of sysfs ABI interfaces.
Patch 4 adds Driver documentation in reStructuredText format. Patch 5 adds the LP5812 device tree node for Raspberry Pi 4B.

Changes in v4:
- Merge leds-lp5812-common.c into leds-lp5812.c
- Implemented the core of aeu_pwm[1-4]_{store, show}()
- Used kstrdup() instead of kmalloc() for allocating characters array
- Add sysfs ABI documentation
- Updated device tree binding documentation

Quoted 4 lines

Best regards,
Nam

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: tags/v6.14-1107-g406fad7698f5 (exact match)

If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm/boot/dts/broadcom/' for [email protected]:

arch/arm/boot/dts/broadcom/bcm2836-rpi-2-b.dtb: /soc/i2s@7e203000: failed to match any schema with compatible: ['brcm,bcm2835-i2s']