* [PATCH v4 1/3] dt-bindings: leds: ti,lp5860: Document I2C interface
2026-12-04 0:34 [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support Peter LaDow via B4 Relay
@ 2026-12-04 0:34 ` Peter LaDow via B4 Relay
2026-12-04 0:34 ` [PATCH v4 2/3] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init() Peter LaDow via B4 Relay
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Peter LaDow via B4 Relay @ 2026-12-04 0:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Steffen Trumtrar, Nam Tran
Cc: Peter LaDow, linux-leds, devicetree, linux-kernel
From: Peter LaDow <pladow@gmail.com>
Document the I2C 7-bit page-zero base address convention (0x40, 0x44,
0x48, or 0x4c) and add an I2C example node to the TI LP5860 binding.
Signed-off-by: Peter LaDow <pladow@gmail.com>
---
.../devicetree/bindings/leds/leds-lp5860.yaml | 45 ++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/Documentation/devicetree/bindings/leds/leds-lp5860.yaml b/Documentation/devicetree/bindings/leds/leds-lp5860.yaml
index 710fec3738ed..8a204c4717af 100644
--- a/Documentation/devicetree/bindings/leds/leds-lp5860.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-lp5860.yaml
@@ -26,6 +26,11 @@ properties:
reg:
maxItems: 1
+ description: |
+ For SPI, the chip select number.
+ For I2C, the 7-bit page-zero base address (0x40, 0x44, 0x48, or 0x4c)
+ selected by ADDR1 and ADDR0. The device consumes four consecutive 7-bit
+ addresses (base through base + 3) to access its 10-bit register space.
'#address-cells':
const: 1
@@ -89,6 +94,46 @@ examples:
led-controller@0 {
compatible = "ti,lp5860";
reg = <0x0>;
+ spi-max-frequency = <12000000>;
+ enable-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ multi-led@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x0>;
+ color = <LED_COLOR_ID_RGB>;
+
+ led@0 {
+ reg = <0x0>;
+ color = <LED_COLOR_ID_RED>;
+ };
+
+ led@1 {
+ reg = <0x1>;
+ color = <LED_COLOR_ID_GREEN>;
+ };
+
+ led@2 {
+ reg = <0x2>;
+ color = <LED_COLOR_ID_BLUE>;
+ };
+ };
+ };
+ };
+
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/leds/common.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ led-controller@40 {
+ compatible = "ti,lp5860";
+ reg = <0x40>;
enable-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v4 2/3] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init()
2026-12-04 0:34 [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support Peter LaDow via B4 Relay
2026-12-04 0:34 ` [PATCH v4 1/3] dt-bindings: leds: ti,lp5860: Document I2C interface Peter LaDow via B4 Relay
@ 2026-12-04 0:34 ` Peter LaDow via B4 Relay
2026-12-04 0:48 ` sashiko-bot
2026-12-04 0:34 ` [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support Peter LaDow via B4 Relay
2026-12-04 0:48 ` [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support sashiko-bot
3 siblings, 1 reply; 7+ messages in thread
From: Peter LaDow via B4 Relay @ 2026-12-04 0:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Steffen Trumtrar, Nam Tran
Cc: Peter LaDow, linux-leds, devicetree, linux-kernel
From: Peter LaDow <pladow@gmail.com>
Pass the initialized struct regmap pointer into lp5860_device_init() and
move child-node validation, struct lp5860 allocation, mutex setup, and
driver data assignment into the core initialization helper.
This avoids duplicating common probe boilerplate across bus front-ends in
preparation for adding I2C interface support.
Tested on ZynqMP (ZU3) via the I2C bus front-end; SPI changes were
compile-tested only.
Signed-off-by: Peter LaDow <pladow@gmail.com>
---
drivers/leds/rgb/leds-lp5860-core.c | 26 +++++++++++++++++++++++--
drivers/leds/rgb/leds-lp5860-spi.c | 39 ++++++++-----------------------------
drivers/leds/rgb/leds-lp5860.h | 2 +-
3 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
index e21d5f2302be..84eb4635dafb 100644
--- a/drivers/leds/rgb/leds-lp5860-core.c
+++ b/drivers/leds/rgb/leds-lp5860-core.c
@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of_platform.h>
+#include <linux/overflow.h>
#include <linux/property.h>
#include <linux/regmap.h>
@@ -188,11 +189,32 @@ static int lp5860_init_dt(struct lp5860 *lp)
return 0;
}
-int lp5860_device_init(struct device *dev)
+int lp5860_device_init(struct device *dev, struct regmap *regmap)
{
- struct lp5860 *lp = dev_get_drvdata(dev);
+ struct lp5860 *lp;
+ unsigned int multi_leds;
int ret;
+ multi_leds = device_get_child_node_count(dev);
+ if (!multi_leds)
+ return dev_err_probe(dev, -ENODEV, "LEDs are not defined in Device Tree!\n");
+
+ if (multi_leds > LP5860_MAX_LED)
+ return dev_err_probe(dev, -EINVAL, "Too many LEDs specified.\n");
+
+ lp = devm_kzalloc(dev, struct_size(lp, leds, multi_leds), GFP_KERNEL);
+ if (!lp)
+ return -ENOMEM;
+
+ lp->dev = dev;
+ lp->regmap = regmap;
+
+ ret = devm_mutex_init(dev, &lp->lock);
+ if (ret)
+ return ret;
+
+ dev_set_drvdata(dev, lp);
+
ret = lp5860_chip_enable(lp, LP5860_CHIP_ENABLE);
if (ret)
return ret;
diff --git a/drivers/leds/rgb/leds-lp5860-spi.c b/drivers/leds/rgb/leds-lp5860-spi.c
index 6bf6a625c28a..94b645556c32 100644
--- a/drivers/leds/rgb/leds-lp5860-spi.c
+++ b/drivers/leds/rgb/leds-lp5860-spi.c
@@ -7,9 +7,7 @@
#include <linux/init.h>
#include <linux/module.h>
-#include <linux/mutex.h>
#include <linux/of.h>
-#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
@@ -36,40 +34,19 @@ static const struct regmap_config lp5860_regmap_config = {
static int lp5860_probe(struct spi_device *spi)
{
struct device *dev = &spi->dev;
- struct lp5860 *lp5860;
- unsigned int multi_leds;
+ struct regmap *regmap;
int ret;
- multi_leds = device_get_child_node_count(dev);
- if (!multi_leds) {
- dev_err(dev, "LEDs are not defined in Device Tree!");
- return -ENODEV;
- }
-
- if (multi_leds > LP5860_MAX_LED) {
- dev_err(dev, "Too many LEDs specified.\n");
- return -EINVAL;
- }
-
- lp5860 = devm_kzalloc(dev, struct_size(lp5860, leds, multi_leds),
- GFP_KERNEL);
- if (!lp5860)
- return -ENOMEM;
-
- lp5860->regmap = devm_regmap_init_spi(spi, &lp5860_regmap_config);
- if (IS_ERR(lp5860->regmap))
- return dev_err_probe(&spi->dev, PTR_ERR(lp5860->regmap),
- "Failed to initialise Regmap.\n");
-
- lp5860->dev = dev;
-
- ret = devm_mutex_init(dev, &lp5860->lock);
+ ret = spi_setup(spi);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "Failed to setup SPI.\n");
- spi_set_drvdata(spi, lp5860);
+ regmap = devm_regmap_init_spi(spi, &lp5860_regmap_config);
+ if (IS_ERR(regmap))
+ return dev_err_probe(dev, PTR_ERR(regmap),
+ "Failed to initialize regmap.\n");
- return lp5860_device_init(dev);
+ return lp5860_device_init(dev, regmap);
}
static void lp5860_remove(struct spi_device *spi)
diff --git a/drivers/leds/rgb/leds-lp5860.h b/drivers/leds/rgb/leds-lp5860.h
index 940be0c6e8da..85f6a4d0f167 100644
--- a/drivers/leds/rgb/leds-lp5860.h
+++ b/drivers/leds/rgb/leds-lp5860.h
@@ -262,7 +262,7 @@ struct lp5860 {
DECLARE_FLEX_ARRAY(struct lp5860_led, leds);
};
-int lp5860_device_init(struct device *dev);
+int lp5860_device_init(struct device *dev, struct regmap *regmap);
void lp5860_device_remove(struct device *dev);
#endif /* _DRIVERS_LEDS_RGB_LP5860_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v4 2/3] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init()
2026-12-04 0:34 ` [PATCH v4 2/3] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init() Peter LaDow via B4 Relay
@ 2026-12-04 0:48 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-04 0:48 UTC (permalink / raw)
To: Peter LaDow; +Cc: linux-leds, devicetree, robh, conor+dt, lee
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] leds: lp5860: redundant undocumented spi_setup() call in
lp5860_probe()
--
commit 28b32b8370a90029a12f16f94635e9e60d510abd
Author: Peter LaDow <pladow@gmail.com>
leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init()
This commit moves child-node validation, struct lp5860 allocation, mutex
initialization, and driver data setup from the SPI probe function into
lp5860_device_init() in preparation for I2C support.
> diff --git a/drivers/leds/rgb/leds-lp5860-spi.c b/drivers/leds/rgb/leds-lp5860-spi.c
> index 6bf6a625c28af..94b645556c32d 100644
> --- a/drivers/leds/rgb/leds-lp5860-spi.c
> +++ b/drivers/leds/rgb/leds-lp5860-spi.c
[ ... ]
> @@ -36,40 +34,19 @@ static const struct regmap_config lp5860_regmap_config = {
> static int lp5860_probe(struct spi_device *spi)
> {
> struct device *dev = &spi->dev;
> - struct lp5860 *lp5860;
> - unsigned int multi_leds;
> + struct regmap *regmap;
> int ret;
>
[ ... ]
> - ret = devm_mutex_init(dev, &lp5860->lock);
> + ret = spi_setup(spi);
> if (ret)
> - return ret;
> + return dev_err_probe(dev, ret, "Failed to setup SPI.\n");
[Severity: Low]
Is this spi_setup() call needed in lp5860_probe()?
The SPI core already calls __spi_setup() in __spi_add_device() before
binding the driver, and lp5860_probe() does not modify spi->mode,
spi->bits_per_word, or spi->max_speed_hz. Calling spi_setup() again
just repeats controller setup on every probe.
The commit message also does not mention or justify this change. Unless
specific SPI parameters need to be configured here, can this call be
dropped?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-add-i2c-support-for-lp5860-v4-0-dd84962336b1@gmail.com?part=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support
2026-12-04 0:34 [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support Peter LaDow via B4 Relay
2026-12-04 0:34 ` [PATCH v4 1/3] dt-bindings: leds: ti,lp5860: Document I2C interface Peter LaDow via B4 Relay
2026-12-04 0:34 ` [PATCH v4 2/3] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init() Peter LaDow via B4 Relay
@ 2026-12-04 0:34 ` Peter LaDow via B4 Relay
2026-12-04 0:46 ` sashiko-bot
2026-12-04 0:48 ` [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support sashiko-bot
3 siblings, 1 reply; 7+ messages in thread
From: Peter LaDow via B4 Relay @ 2026-12-04 0:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Steffen Trumtrar, Nam Tran
Cc: Peter LaDow, linux-leds, devicetree, linux-kernel
From: Peter LaDow <pladow@gmail.com>
The Texas Instruments LP5860 RGB LED matrix driver supports both SPI and
I2C communication buses depending on the IFS pin state, but the
existing driver only implements the SPI bus interface.
Add an I2C bus front-end driver (leds-lp5860-i2c) that reserves the
four consecutive 7-bit I2C addresses used by the LP5860 to map its
10-bit register space across dummy I2C clients, initializes a custom
regmap, and delegates device setup to lp5860_device_init(). Update
Kconfig and Makefile so I2C and SPI support can be built independently
or together.
Tested on ZynqMP (ZU3) with an LP5860 connected over an AXI IIC at
base address 0x40 (A1=0, A0=0) at 400 kHz.
Signed-off-by: Peter LaDow <pladow@gmail.com>
---
drivers/leds/rgb/Kconfig | 12 ++++
drivers/leds/rgb/Makefile | 1 +
drivers/leds/rgb/leds-lp5860-core.c | 4 +-
drivers/leds/rgb/leds-lp5860-i2c.c | 121 ++++++++++++++++++++++++++++++++++++
4 files changed, 136 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/rgb/Kconfig b/drivers/leds/rgb/Kconfig
index c27d7ed516ac..ea86c27e3cd9 100644
--- a/drivers/leds/rgb/Kconfig
+++ b/drivers/leds/rgb/Kconfig
@@ -79,6 +79,18 @@ config LEDS_LP5860_SPI
To compile this driver as a module, choose M here: the
module will be called leds-lp5860-spi.
+config LEDS_LP5860_I2C
+ tristate "LED Support for TI LP5860 I2C LED driver chip"
+ depends on I2C
+ depends on OF
+ select LEDS_LP5860_CORE
+ help
+ If you say yes here you get support for the Texas Instruments
+ LP5860 LED driver for I2C bus connections.
+
+ To compile this driver as a module, choose M here: the
+ module will be called leds-lp5860-i2c.
+
config LEDS_NCP5623
tristate "LED support for NCP5623"
depends on I2C
diff --git a/drivers/leds/rgb/Makefile b/drivers/leds/rgb/Makefile
index a59c13396a22..0e35bf16d615 100644
--- a/drivers/leds/rgb/Makefile
+++ b/drivers/leds/rgb/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_LEDS_KTD202X) += leds-ktd202x.o
obj-$(CONFIG_LEDS_LP5812) += leds-lp5812.o
obj-$(CONFIG_LEDS_LP5860_CORE) += leds-lp5860-core.o
obj-$(CONFIG_LEDS_LP5860_SPI) += leds-lp5860-spi.o
+obj-$(CONFIG_LEDS_LP5860_I2C) += leds-lp5860-i2c.o
obj-$(CONFIG_LEDS_NCP5623) += leds-ncp5623.o
obj-$(CONFIG_LEDS_PWM_MULTICOLOR) += leds-pwm-multicolor.o
obj-$(CONFIG_LEDS_QCOM_LPG) += leds-qcom-lpg.o
diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
index 84eb4635dafb..132ada3ea4b9 100644
--- a/drivers/leds/rgb/leds-lp5860-core.c
+++ b/drivers/leds/rgb/leds-lp5860-core.c
@@ -25,7 +25,7 @@ static int lp5860_set_dot_onoff(struct lp5860_led *led, unsigned int dot, bool e
unsigned int offset = dot / LP5860_MAX_DOT_ONOFF_GROUP_NUM;
unsigned int mask = BIT(dot % LP5860_MAX_DOT_ONOFF_GROUP_NUM);
- if (dot > LP5860_MAX_LED)
+ if (dot >= LP5860_MAX_LED)
return -EINVAL;
return regmap_update_bits(led->chip->regmap,
@@ -115,7 +115,7 @@ static int lp5860_iterate_subleds(struct lp5860_led *led, struct led_init_data *
}
ret = fwnode_property_read_u32(led_node, "reg", &channel);
- if (ret < 0 || channel > LP5860_MAX_LED) {
+ if (ret < 0 || channel >= LP5860_MAX_LED) {
dev_err_probe(led->chip->dev, ret,
"%pfwP: 'reg' property is missing. Skipping.\n", led_node);
fwnode_handle_put(led_node);
diff --git a/drivers/leds/rgb/leds-lp5860-i2c.c b/drivers/leds/rgb/leds-lp5860-i2c.c
new file mode 100644
index 000000000000..adb61201cfb0
--- /dev/null
+++ b/drivers/leds/rgb/leds-lp5860-i2c.c
@@ -0,0 +1,121 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+
+#include "leds-lp5860.h"
+
+#define LP5860_I2C_NUM_PAGES 4
+#define LP5860_I2C_PAGE_SHIFT 8
+#define LP5860_I2C_PAGE_MASK 0x03
+#define LP5860_I2C_REG_MASK 0xff
+
+static int lp5860_i2c_reg_read(void *context, unsigned int reg, unsigned int *val)
+{
+ struct i2c_client **clients = context;
+ unsigned int page = reg >> LP5860_I2C_PAGE_SHIFT;
+ int ret;
+
+ if (page >= LP5860_I2C_NUM_PAGES)
+ return -EINVAL;
+
+ ret = i2c_smbus_read_byte_data(clients[page], reg & LP5860_I2C_REG_MASK);
+ if (ret < 0)
+ return ret;
+
+ *val = ret;
+ return 0;
+}
+
+static int lp5860_i2c_reg_write(void *context, unsigned int reg, unsigned int val)
+{
+ struct i2c_client **clients = context;
+ unsigned int page = reg >> LP5860_I2C_PAGE_SHIFT;
+
+ if (page >= LP5860_I2C_NUM_PAGES)
+ return -EINVAL;
+
+ return i2c_smbus_write_byte_data(clients[page], reg & LP5860_I2C_REG_MASK, val);
+}
+
+static const struct regmap_config lp5860_i2c_regmap_config = {
+ .name = "lp5860",
+ .reg_bits = 10,
+ .val_bits = 8,
+ .max_register = LP5860_MAX_REG,
+ .reg_read = lp5860_i2c_reg_read,
+ .reg_write = lp5860_i2c_reg_write,
+};
+
+static int lp5860_i2c_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct i2c_client **clients;
+ struct regmap *regmap;
+
+ if ((client->flags & I2C_CLIENT_TEN) || (client->addr & LP5860_I2C_PAGE_MASK))
+ return dev_err_probe(dev, -EINVAL,
+ "Invalid I2C address: must be a 7-bit page-zero base address.\n");
+
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+ return dev_err_probe(dev, -EOPNOTSUPP,
+ "SMBus byte-data transactions are not supported.\n");
+
+ clients = devm_kcalloc(dev, LP5860_I2C_NUM_PAGES, sizeof(*clients), GFP_KERNEL);
+ if (!clients)
+ return -ENOMEM;
+
+ /*
+ * The LP5860 encodes the upper two bits of its 10-bit register address
+ * in the two least-significant bits of the 7-bit I2C slave address.
+ * Reserve the three consecutive dummy addresses for register pages 1..3.
+ */
+ clients[0] = client;
+ for (unsigned int page = 1; page < LP5860_I2C_NUM_PAGES; page++) {
+ clients[page] = devm_i2c_new_dummy_device(dev, client->adapter,
+ client->addr | page);
+ if (IS_ERR(clients[page]))
+ return dev_err_probe(dev, PTR_ERR(clients[page]),
+ "Failed to reserve I2C register page %u.\n", page);
+ }
+
+ regmap = devm_regmap_init(dev, NULL, clients, &lp5860_i2c_regmap_config);
+ if (IS_ERR(regmap))
+ return dev_err_probe(dev, PTR_ERR(regmap),
+ "Failed to initialise Regmap.\n");
+
+ return lp5860_device_init(dev, regmap);
+}
+
+static void lp5860_i2c_remove(struct i2c_client *client)
+{
+ lp5860_device_remove(&client->dev);
+}
+
+static const struct of_device_id lp5860_i2c_of_match[] = {
+ { .compatible = "ti,lp5860" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, lp5860_i2c_of_match);
+
+static const struct i2c_device_id lp5860_i2c_ids[] = {
+ { .name = "lp5860" },
+ {}
+};
+MODULE_DEVICE_TABLE(i2c, lp5860_i2c_ids);
+
+static struct i2c_driver lp5860_i2c_driver = {
+ .driver = {
+ .name = "lp5860-i2c",
+ .of_match_table = lp5860_i2c_of_match,
+ },
+ .probe = lp5860_i2c_probe,
+ .remove = lp5860_i2c_remove,
+ .id_table = lp5860_i2c_ids,
+};
+module_i2c_driver(lp5860_i2c_driver);
+
+MODULE_DESCRIPTION("TI LP5860 RGB LED I2C driver");
+MODULE_LICENSE("GPL");
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support
2026-12-04 0:34 ` [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support Peter LaDow via B4 Relay
@ 2026-12-04 0:46 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-04 0:46 UTC (permalink / raw)
To: Peter LaDow; +Cc: linux-leds, devicetree, robh, conor+dt, lee
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] leds: lp5860: lp5860_iterate_subleds() returns 0 on
out-of-range channel
- [Low] leds: lp5860: undocumented core bounds-check fixes bundled in
I2C commit
--
commit c30d7cd0ea8cc80600add2467fdd412378cb0465
Author: Peter LaDow <pladow@gmail.com>
> leds: rgb: lp5860: Add I2C interface support
>
> The Texas Instruments LP5860 RGB LED matrix driver supports both SPI and
> I2C communication buses depending on the IFS pin state, but the
> existing driver only implements the SPI bus interface.
>
> Add an I2C bus front-end driver (leds-lp5860-i2c) that reserves the
> four consecutive 7-bit I2C addresses used by the LP5860 to map its
> 10-bit register space across dummy I2C clients, initializes a custom
> regmap, and delegates device setup to lp5860_device_init(). Update
> Kconfig and Makefile so I2C and SPI support can be built independently
> or together.
>
> Tested on ZynqMP (ZU3) with an LP5860 connected over an AXI IIC at
> base address 0x40 (A1=0, A0=0) at 400 kHz.
>
> Signed-off-by: Peter LaDow <pladow@gmail.com>
[Severity: Low]
Should the off-by-one bounds-check fixes in leds-lp5860-core.c be split into
a separate commit, or at least described in the commit message?
The commit message only describes the new I2C driver, while the diff also
fixes off-by-one checks in lp5860_set_dot_onoff() and lp5860_iterate_subleds()
from f0a66563aa2d ("leds: Add support for TI LP5860 LED driver chip").
Splitting them out lets the SPI driver take the fix with a Fixes: tag.
[ ... ]
> diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
> index 84eb4635dafba..132ada3ea4b9f 100644
> --- a/drivers/leds/rgb/leds-lp5860-core.c
> +++ b/drivers/leds/rgb/leds-lp5860-core.c
[ ... ]
> @@ -115,7 +115,7 @@ static int lp5860_iterate_subleds(struct lp5860_led *led, struct led_init_data *
> }
>
> ret = fwnode_property_read_u32(led_node, "reg", &channel);
> - if (ret < 0 || channel > LP5860_MAX_LED) {
> + if (ret < 0 || channel >= LP5860_MAX_LED) {
> dev_err_probe(led->chip->dev, ret,
> "%pfwP: 'reg' property is missing. Skipping.\n", led_node);
> fwnode_handle_put(led_node);
[Severity: Medium]
Does lp5860_iterate_subleds() return 0 when channel >= LP5860_MAX_LED?
When fwnode_property_read_u32() succeeds with an out-of-range reg value such
as 198, ret is 0. This branch logs error 0 via dev_err_probe() and returns
ret (0) instead of -EINVAL.
Because lp5860_init_dt() only skips the node on a non-zero return, it proceeds
to call lp5860_set_mc_brightness() with the remaining zero-initialized
subled_info entries (driving hardware channel 0) and registers a partially
initialized multicolor LED.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-add-i2c-support-for-lp5860-v4-0-dd84962336b1@gmail.com?part=3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support
2026-12-04 0:34 [PATCH v4 0/3] leds: rgb: lp5860: Add I2C support Peter LaDow via B4 Relay
` (2 preceding siblings ...)
2026-12-04 0:34 ` [PATCH v4 3/3] leds: rgb: lp5860: Add I2C interface support Peter LaDow via B4 Relay
@ 2026-12-04 0:48 ` sashiko-bot
3 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-04 0:48 UTC (permalink / raw)
To: Peter LaDow; +Cc: linux-leds, lee
Sashiko has finished reviewing this 3-patch series:
- Patch 1: no issues found.
- Patch 2 ("leds: rgb: lp5860: Consolidate common probe setup in..."): 1
potential issue (1 Low)
- Patch 3 ("leds: rgb: lp5860: Add I2C interface support"): 2 potential
issues (1 Medium, 1 Low)
Detailed reviews have been sent as separate replies to patches 2 and 3.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-add-i2c-support-for-lp5860-v4-0-dd84962336b1@gmail.com
^ permalink raw reply [flat|nested] 7+ messages in thread