Skip to contentSkip to conversation

dt-bindings: leds: pca995x: Add binding document for PCA995X chips

PATCH Superseded Marek Vasut 3 participants 5 messages Jul 5, 2023 – Jul 13, 2023

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 dt-bindings: leds: pca995x: Add binding document for PCA995X chips

The PCA995x chips are I2C controlled LED drivers. Each chip has up to 16 outputs, each one with an individual 8-bit resolution PWM for brightness control. Add binding document.

---
Cc: Conor Dooley <[email protected]>
Cc: Isai Gaspar <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Fix the led@[0-9]+ match
V3: Unit addresses for leds@ are hex, add a-f into the glob

---
 .../devicetree/bindings/leds/nxp,pca995x.yaml | 81 +++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/nxp,pca995x.yaml
Documentation/devicetree/bindings/leds/nxp,pca995x.yaml new file +81 -0
new file mode 100644
index 0000000000000..654915c1f687f
@@ -0,0 +1,81 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/nxp,pca995x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP PCA995x LED controllers
+
+maintainers:
+  - Isai Gaspar <[email protected]>
+  - Marek Vasut <[email protected]>
+
+description:
+  The NXP PCA9952/PCA9955B are programmable LED controllers connected via I2C
+  that can drive 16 separate lines. Each of them can be individually switched
+  on and off, and brightness can be controlled via individual PWM.
+
+  Datasheets are available at
+  https://www.nxp.com/docs/en/data-sheet/PCA9952_PCA9955.pdf
+  https://www.nxp.com/docs/en/data-sheet/PCA9955B.pdf
+
+properties:
+  compatible:
+    enum:
+      - nxp,pca9952
+      - nxp,pca9955b
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^led@[0-9a-f]+$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 15
+
+    required:
+      - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@1 {
+            compatible = "nxp,pca9955b";
+            reg = <0x01>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            led@0 {
+                reg = <0x0>;
+                color = <LED_COLOR_ID_RED>;
+                function = LED_FUNCTION_POWER;
+            };
+
+            led@2 {
+                reg = <0x2>;
+                color = <LED_COLOR_ID_WHITE>;
+                function = LED_FUNCTION_STATUS;
+            };
+        };
+    };
+
+...
Signature · 1 line
2.40.1
#1 lore raw

PATCH v3 2/2 leds: pca995x: Add support for PCA995X chips

From: Isai Gaspar <[email protected]>

The PCA995x chips are I2C controlled LED drivers. Each chip has up to 16 outputs, each one with an individual 8-bit resolution PWM for brightness control.

---
Cc: Conor Dooley <[email protected]>
Cc: Isai Gaspar <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: - Fix pca995x_probe() type
- Fix device_get_match_data() cast
V3: - Drop of_match_ptr()

---
 drivers/leds/Kconfig        |   9 ++
 drivers/leds/Makefile       |   1 +
 drivers/leds/leds-pca995x.c | 198 ++++++++++++++++++++++++++++++++++++
 3 files changed, 208 insertions(+)
 create mode 100644 drivers/leds/leds-pca995x.c
drivers/leds/Kconfig +9 -0
index 6046dfeca16fc..b92208eccdea9 100644
@@ -521,6 +521,15 @@ config LEDS_PCA963X
 	  LED driver chip accessed via the I2C bus. Supported
 	  devices include PCA9633 and PCA9634
 
+config LEDS_PCA995X
+	tristate "LED Support for PCA995x I2C chips"
+	depends on LEDS_CLASS
+	depends on I2C
+	help
+	  This option enables support for LEDs connected to PCA995x
+	  LED driver chips accessed via the I2C bus. Supported
+	  devices include PCA9955BTW, PCA9952TW and PCA9955TW.
+
 config LEDS_WM831X_STATUS
 	tristate "LED support for status LEDs on WM831x PMICs"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index d71f1226540c2..d7348e8bc019a 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_LEDS_OT200)		+= leds-ot200.o
 obj-$(CONFIG_LEDS_PCA9532)		+= leds-pca9532.o
 obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
 obj-$(CONFIG_LEDS_PCA963X)		+= leds-pca963x.o
+obj-$(CONFIG_LEDS_PCA995X)		+= leds-pca995x.o
 obj-$(CONFIG_LEDS_PM8058)		+= leds-pm8058.o
 obj-$(CONFIG_LEDS_POWERNV)		+= leds-powernv.o
 obj-$(CONFIG_LEDS_PWM)			+= leds-pwm.o
drivers/leds/leds-pca995x.c new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
2.40.1
maintainer
#2 lore raw

Re: [PATCH v3 2/2] leds: pca995x: Add support for PCA995X chips

Quoted 85 lines · Marek Vasut

From: Isai Gaspar <[email protected]>

The PCA995x chips are I2C controlled LED drivers. Each chip has up to 16 outputs, each one with an individual 8-bit resolution PWM for brightness control.

---
Cc: Conor Dooley <[email protected]>
Cc: Isai Gaspar <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: - Fix pca995x_probe() type
- Fix device_get_match_data() cast
V3: - Drop of_match_ptr()

---
 drivers/leds/Kconfig        |   9 ++
 drivers/leds/Makefile       |   1 +
 drivers/leds/leds-pca995x.c | 198 ++++++++++++++++++++++++++++++++++++
 3 files changed, 208 insertions(+)
 create mode 100644 drivers/leds/leds-pca995x.c
drivers/leds/Kconfig +9 -0
index 6046dfeca16fc..b92208eccdea9 100644
@@ -521,6 +521,15 @@ config LEDS_PCA963X
 	  LED driver chip accessed via the I2C bus. Supported
 	  devices include PCA9633 and PCA9634
 
+config LEDS_PCA995X
+	tristate "LED Support for PCA995x I2C chips"
+	depends on LEDS_CLASS
+	depends on I2C
+	help
+	  This option enables support for LEDs connected to PCA995x
+	  LED driver chips accessed via the I2C bus. Supported
+	  devices include PCA9955BTW, PCA9952TW and PCA9955TW.
+
 config LEDS_WM831X_STATUS
 	tristate "LED support for status LEDs on WM831x PMICs"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index d71f1226540c2..d7348e8bc019a 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_LEDS_OT200)		+= leds-ot200.o
 obj-$(CONFIG_LEDS_PCA9532)		+= leds-pca9532.o
 obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
 obj-$(CONFIG_LEDS_PCA963X)		+= leds-pca963x.o
+obj-$(CONFIG_LEDS_PCA995X)		+= leds-pca995x.o
 obj-$(CONFIG_LEDS_PM8058)		+= leds-pm8058.o
 obj-$(CONFIG_LEDS_POWERNV)		+= leds-powernv.o
 obj-$(CONFIG_LEDS_PWM)			+= leds-pwm.o
drivers/leds/leds-pca995x.c new file +18 -0
new file mode 100644
index 0000000000000..dde99f4a4c1c7
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * LED driver for PCA995x I2C LED drivers
+ *
+ * Copyright 2011 bct electronic GmbH
+ * Copyright 2013 Qtechnology/AS
+ * Copyright 2022 NXP
+ * Copyright 2023 Marek Vasut
+ */
+
+#include <linux/i2c.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
+#include <linux/regmap.h>
+
+/* Register definition */

drivers/leds/leds-pca995x.c line 28

Quoted 10 lines
drivers/leds/leds-pca995x.c new file +10 -0
+#define PCA995X_MODE1		0x00
+#define PCA995X_MODE2		0x01
+#define PCA995X_LEDOUT0		0x02
+#define PCA9955B_PWM0		0x08
+#define PCA9952_PWM0		0x0A
+#define PCA9952_IREFALL		0x43
+#define PCA9955B_IREFALL	0x45
+
+/* LED select registers determine the source that drives LED outputs */
+#define PCA995X_LED_OFF		0x0	/* LED driver off */

The define nomenclature is clear enough.

/> +#define PCA995X_LED_ON 0x1 /* LED driver on */

The define nomenclature is clear enough.

drivers/leds/leds-pca995x.c line 30

Quoted 1 line
drivers/leds/leds-pca995x.c new file +1 -0
+#define PCA995X_LED_PWM		0x2	/* Controlled through PWM */

PCA995X_LED_PWM_MODE

Then, the define nomenclature will be clear enough.

drivers/leds/leds-pca995x.c line 33

Quoted 3 lines
drivers/leds/leds-pca995x.c new file +3 -0
+#define PCA995X_LDRX_MASK	0x3	/* 2 bits per output state control */
+
+#define PCA995X_MODE_1_CFG	0x00	/* Auto-increment disabled. Normal mode */

Is this not the reset value?

drivers/leds/leds-pca995x.c line 34

Quoted 1 line
drivers/leds/leds-pca995x.c new file +1 -0
+#define PCA995X_IREFALL_CFG	0x7F	/* Half of max current gain multiplier */

PCA995X_IREFALL_FULL_CFG 0xFF
PCA995X_IREFALL_HALF_CFG (PCA995X_IREFALL_MAX_CFG / 2)

?

drivers/leds/leds-pca995x.c line 36

Quoted 1 line
drivers/leds/leds-pca995x.c new file +1 -0
+#define PCA995X_MAX_OUTPUTS	16	/* Supported outputs */

The define nomenclature is clear enough.

drivers/leds/leds-pca995x.c line 50

Quoted 13 lines
drivers/leds/leds-pca995x.c new file +13 -0
+#define ldev_to_led(c)	container_of(c, struct pca995x_led, ldev)
+
+struct pca995x_led {
+	unsigned int led_no;
+	struct led_classdev ldev;
+	struct pca995x_chip *chip;
+};
+
+struct pca995x_chip {
+	struct regmap *regmap;
+	struct pca995x_led leds[PCA995X_MAX_OUTPUTS];
+	int btype;
+};

It's weird to have 2 structs reference each other.

This should not be allowed:

pca995x_led->pca995x_chip->pca995x_led->pca995x_chip->pca995x_led->pca995x_chip

Some implementation of container_of() should do the trick.

drivers/leds/leds-pca995x.c line 60

Quoted 9 lines
drivers/leds/leds-pca995x.c new file +9 -0
+static int pca995x_brightness_set(struct led_classdev *led_cdev,
+				  enum led_brightness brightness)
+{
+	struct pca995x_led *led = ldev_to_led(led_cdev);
+	struct pca995x_chip *chip = led->chip;
+	u8 ledout_addr, pwmout_addr;
+	int shift, ret;
+
+	pwmout_addr = (chip->btype ? PCA9955B_PWM0 : PCA9952_PWM0) + led->led_no;

All this btype stuff is a little crazy and totally not scalable.

drivers/leds/leds-pca995x.c line 62

Quoted 2 lines
drivers/leds/leds-pca995x.c new file +2 -0
+	ledout_addr = PCA995X_LEDOUT0 + (led->led_no / 4);
+	shift = 2 * (led->led_no % 4);

Why 2 and 4? I suggest that they are defined.

drivers/leds/leds-pca995x.c line 65

Quoted 2 lines
drivers/leds/leds-pca995x.c new file +2 -0
+	switch (brightness) {
+	case LED_FULL:

https://elixir.bootlin.com/linux/latest/source/include/linux/leds.h#L32

drivers/leds/leds-pca995x.c line 72

Quoted 7 lines
drivers/leds/leds-pca995x.c new file +7 -0
+		return regmap_update_bits(chip->regmap, ledout_addr,
+					  PCA995X_LDRX_MASK << shift,
+					  PCA995X_LED_ON << shift);
+	case LED_OFF:
+		return regmap_update_bits(chip->regmap, ledout_addr,
+					  PCA995X_LDRX_MASK << shift, 0);
+	default:

Are there no invalid values here?

drivers/leds/leds-pca995x.c line 80

Quoted 8 lines
drivers/leds/leds-pca995x.c new file +8 -0
+		/* Adjust brightness as per user input by changing individual PWM */
+		ret = regmap_write(chip->regmap, pwmout_addr, brightness);
+		if (ret)
+			return ret;
+
+		/*
+		 * Change LDRx configuration to individual brightness via PWM.
+		 * Led will stop blinking if it's doing so

LED, it's an abbreviation.

Quoted 70 lines
drivers/leds/leds-pca995x.c new file +70 -0
+		 */
+		return regmap_update_bits(chip->regmap, ledout_addr,
+					  PCA995X_LDRX_MASK << shift,
+					  PCA995X_LED_PWM << shift);
+	}
+}
+
+static const struct regmap_config pca995x_regmap = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = 0x49,
+};
+
+static int pca995x_probe(struct i2c_client *client)
+{
+	struct fwnode_handle *led_fwnodes[PCA995X_MAX_OUTPUTS] = { 0 };
+	struct fwnode_handle *np, *child;
+	struct device *dev = &client->dev;
+	struct pca995x_chip *chip;
+	struct pca995x_led *led;
+	int i, btype, reg, ret;
+
+	btype = (unsigned long)device_get_match_data(&client->dev);
+
+	np = dev_fwnode(dev);
+	if (!np)
+		return -ENODEV;
+
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+	if (!chip)
+		return -ENOMEM;
+
+	chip->btype = btype;
+	chip->regmap = devm_regmap_init_i2c(client, &pca995x_regmap);
+	if (IS_ERR(chip->regmap))
+		return PTR_ERR(chip->regmap);
+
+	i2c_set_clientdata(client, chip);
+
+	fwnode_for_each_available_child_node(np, child) {
+		ret = fwnode_property_read_u32(child, "reg", &reg);
+		if (ret) {
+			fwnode_handle_put(child);
+			return ret;
+		}
+
+		if (reg < 0 || reg >= PCA995X_MAX_OUTPUTS || led_fwnodes[reg]) {
+			fwnode_handle_put(child);
+			return -EINVAL;
+		}
+
+		led = &chip->leds[reg];
+		led_fwnodes[reg] = child;
+		led->chip = chip;
+		led->led_no = reg;
+		led->ldev.brightness_set_blocking = pca995x_brightness_set;
+		led->ldev.max_brightness = 255;
+	}
+
+	for (i = 0; i < PCA995X_MAX_OUTPUTS; i++) {
+		struct led_init_data init_data = {};
+
+		if (!led_fwnodes[i])
+			continue;
+
+		init_data.fwnode = led_fwnodes[i];
+
+		ret = devm_led_classdev_register_ext(dev,
+						     &chip->leds[i].ldev,
+						     &init_data);

drivers/leds/leds-pca995x.c line 160

Quoted 10 lines
drivers/leds/leds-pca995x.c new file +10 -0
+		if (ret < 0) {
+			fwnode_handle_put(child);
+			return dev_err_probe(dev, ret,
+					     "Could not register LED %s\n",
+					     chip->leds[i].ldev.name);
+		}
+	}
+
+	/* Disable LED all-call address and set normal mode */
+	ret = regmap_write(chip->regmap, PCA995X_MODE1, PCA995X_MODE_1_CFG);

The formatting of "MODE1" and "MODE_1" is making me twitch!

Is this how they are referenced in the datasheet?

drivers/leds/leds-pca995x.c line 171

Quoted 11 lines
drivers/leds/leds-pca995x.c new file +11 -0
+	if (ret)
+		return ret;
+
+	/* IREF Output current value for all LEDn outputs */
+	return regmap_write(chip->regmap,
+			    btype ? PCA9955B_IREFALL : PCA9952_IREFALL,
+			    PCA995X_IREFALL_CFG);
+}
+
+static const struct i2c_device_id pca995x_id[] = {
+	{ "pca9952", .driver_data = (kernel_ulong_t)0 /* non-B chip */ },

Defines at least please.

Are you sure these are the only 2 types of chip this driver will support?

Quoted 6 lines
drivers/leds/leds-pca995x.c new file +6 -0
+	{ "pca9955b", .driver_data = (kernel_ulong_t)1 /* B-type chip */ },
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, pca995x_id);
+
+static const struct of_device_id pca995x_of_match[] = {

drivers/leds/leds-pca995x.c line 187

Quoted 10 lines
drivers/leds/leds-pca995x.c new file +10 -0
+	{ .compatible = "nxp,pca9952",  .data = (void *)0 /* non-B chip */ },
+	{ .compatible = "nxp,pca9955b", .data = (void *)1 /* B-type chip */ },
+	{},
+};
+MODULE_DEVICE_TABLE(i2c, pca995x_of_match);
+
+static struct i2c_driver pca995x_driver = {
+	.driver = {
+		.name = "leds-pca995x",
+		.owner = THIS_MODULE,

Does the core not do this for you?

drivers/leds/leds-pca995x.c line 193

Quoted 6 lines
drivers/leds/leds-pca995x.c new file +6 -0
+		.of_match_table = pca995x_of_match,
+	},
+	.probe = pca995x_probe,
+	.id_table = pca995x_id,
+};
+

Remove this line please.

Quoted 8 lines
drivers/leds/leds-pca995x.c new file +5 -0
+module_i2c_driver(pca995x_driver);
+
+MODULE_AUTHOR("Isai Gaspar <[email protected]>");
+MODULE_DESCRIPTION("PCA995x LED driver");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.40.1
Signature · 1 line
Lee Jones [李琼斯]
#3 lore raw

Re: [PATCH v3 2/2] leds: pca995x: Add support for PCA995X chips

On 7/13/23 16:07, Lee Jones wrote:

[...]

Quoted 5 lines

drivers/leds/leds-pca995x.c line 33

Quoted 3 lines
drivers/leds/leds-pca995x.c new file +3 -0
+#define PCA995X_LDRX_MASK	0x3	/* 2 bits per output state control */
+
+#define PCA995X_MODE_1_CFG	0x00	/* Auto-increment disabled. Normal mode */

Is this not the reset value?

The chip may not be power-cycled on reboot, so this register is not necessarily 0x0.

Quoted 27 lines
Quoted 1 line

+#define PCA995X_IREFALL_CFG 0x7F /* Half of max current gain multiplier */

PCA995X_IREFALL_FULL_CFG 0xFF
PCA995X_IREFALL_HALF_CFG (PCA995X_IREFALL_MAX_CFG / 2)

?

Quoted 1 line

+#define PCA995X_MAX_OUTPUTS 16 /* Supported outputs */

The define nomenclature is clear enough.

drivers/leds/leds-pca995x.c line 50

Quoted 13 lines
drivers/leds/leds-pca995x.c new file +13 -0
+#define ldev_to_led(c)	container_of(c, struct pca995x_led, ldev)
+
+struct pca995x_led {
+	unsigned int led_no;
+	struct led_classdev ldev;
+	struct pca995x_chip *chip;
+};
+
+struct pca995x_chip {
+	struct regmap *regmap;
+	struct pca995x_led leds[PCA995X_MAX_OUTPUTS];
+	int btype;
+};

It's weird to have 2 structs reference each other.

Quoted 5 lines

This should not be allowed:

pca995x_led->pca995x_chip->pca995x_led->pca995x_chip->pca995x_led->pca995x_chip

Some implementation of container_of() should do the trick.

container_of() wouldn't work here because struct pca995x_chip contains array of LEDs .

The structure layout is taken from:
8325642d2757e ("leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver")

Quoted 11 lines

drivers/leds/leds-pca995x.c line 60

Quoted 9 lines
drivers/leds/leds-pca995x.c new file +9 -0
+static int pca995x_brightness_set(struct led_classdev *led_cdev,
+				  enum led_brightness brightness)
+{
+	struct pca995x_led *led = ldev_to_led(led_cdev);
+	struct pca995x_chip *chip = led->chip;
+	u8 ledout_addr, pwmout_addr;
+	int shift, ret;
+
+	pwmout_addr = (chip->btype ? PCA9955B_PWM0 : PCA9952_PWM0) + led->led_no;

All this btype stuff is a little crazy and totally not scalable.

That's right, but until NXP changes the register layout again, this should be sufficient to support the entire 995x line up.

Quoted 9 lines

drivers/leds/leds-pca995x.c line 62

Quoted 2 lines
drivers/leds/leds-pca995x.c new file +2 -0
+	ledout_addr = PCA995X_LEDOUT0 + (led->led_no / 4);
+	shift = 2 * (led->led_no % 4);

Why 2 and 4? I suggest that they are defined.

drivers/leds/leds-pca995x.c line 65

Quoted 2 lines
drivers/leds/leds-pca995x.c new file +2 -0
+	switch (brightness) {
+	case LED_FULL:

https://elixir.bootlin.com/linux/latest/source/include/linux/leds.h#L32

LED_HALF is just PWM (default) mode, set to half duty cycle .

Quoted 9 lines

drivers/leds/leds-pca995x.c line 72

Quoted 7 lines
drivers/leds/leds-pca995x.c new file +7 -0
+		return regmap_update_bits(chip->regmap, ledout_addr,
+					  PCA995X_LDRX_MASK << shift,
+					  PCA995X_LED_ON << shift);
+	case LED_OFF:
+		return regmap_update_bits(chip->regmap, ledout_addr,
+					  PCA995X_LDRX_MASK << shift, 0);
+	default:

Are there no invalid values here?

Not to my knowledge, this should be 0..255 clamped by ldev.max_brightness further down.

Quoted 6 lines

drivers/leds/leds-pca995x.c line 160

Quoted 2 lines
drivers/leds/leds-pca995x.c new file +2 -0
+	/* Disable LED all-call address and set normal mode */
+	ret = regmap_write(chip->regmap, PCA995X_MODE1, PCA995X_MODE_1_CFG);

The formatting of "MODE1" and "MODE_1" is making me twitch!

Is this how they are referenced in the datasheet?

It's called MODE1 in datasheet, fixed.

Quoted 14 lines

drivers/leds/leds-pca995x.c line 171

Quoted 11 lines
drivers/leds/leds-pca995x.c new file +11 -0
+	if (ret)
+		return ret;
+
+	/* IREF Output current value for all LEDn outputs */
+	return regmap_write(chip->regmap,
+			    btype ? PCA9955B_IREFALL : PCA9952_IREFALL,
+			    PCA995X_IREFALL_CFG);
+}
+
+static const struct i2c_device_id pca995x_id[] = {
+	{ "pca9952", .driver_data = (kernel_ulong_t)0 /* non-B chip */ },

Defines at least please.

Quoted 2 lines

Are you sure these are the only 2 types of chip this driver will support?

No, I cannot predict the future or how NXP will or won't change the register layout of it. When it cames, we can deal with that.

[...]

The rest is addressed in V4.

maintainer Reviewed-by on v3 1/2
#4 lore raw
In reply to Marek Vasut
Quoted 18 lines · Marek Vasut

The PCA995x chips are I2C controlled LED drivers. Each chip has up to 16 outputs, each one with an individual 8-bit resolution PWM for brightness control. Add binding document.

---
Cc: Conor Dooley <[email protected]>
Cc: Isai Gaspar <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Fix the led@[0-9]+ match
V3: Unit addresses for leds@ are hex, add a-f into the glob

Quoted 5 lines
---
 .../devicetree/bindings/leds/nxp,pca995x.yaml | 81 +++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/nxp,pca995x.yaml