Skip to contentSkip to conversation

leds: Add IS32FL3207 controller support

PATCH Superseded Ahmad Byagowi 2 participants 5 messages Aug 20

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover leds: Add IS32FL3207 controller support

Add a binding and LED-class driver for the Lumissil IS32FL3207 18-channel constant-current LED controller. The driver supports individual and multicolor LEDs, per-output current limits, an optional supply, and an optional SDB GPIO.

This is the LED prerequisite split out of the Time Card v5 series following the netdev maintainer's guidance. The dependent ptp_ocp board profiles will be resent to net-next after the LED and I2C prerequisites land.

Changes since v5:
- Send the binding and driver as a standalone LED series.
- Raise the minimum led-max-microamp value to 149 uA, the lowest nonzero setting representable at the maximum permitted full-scale current.
- Rebase onto the LED for-leds-next branch.

Krzysztof's Reviewed-by from v3 is not carried because the binding changed materially after that review. It now supports groups beginning at outputs 16 and 17, documents the RISET/current-limit relationship, and enforces the controller's minimum representable current.

Validation:
- dt-doc-validate
- dt-check-style --mode=strict
- targeted dt_binding_check
- x86-64 and arm64 defconfig/allmodconfig W=1 object builds

v5: https://lore.kernel.org/r/[email protected]/

Ahmad Byagowi (2):
dt-bindings: leds: Add IS32FL3207 controller
leds: is32fl3207: Add controller driver

 .../bindings/leds/issi,is32fl3207.yaml        | 285 +++++++
 MAINTAINERS                                   |   7 +
 drivers/leds/rgb/Kconfig                      |  11 +
 drivers/leds/rgb/Makefile                     |   1 +
 drivers/leds/rgb/leds-is32fl3207.c            | 736 ++++++++++++++++++
 5 files changed, 1040 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml
 create mode 100644 drivers/leds/rgb/leds-is32fl3207.c

base-commit: f8cca63a0a4f3475199d9ab7f86782bdfeb0744d

Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw

PATCH v6 1/2 dt-bindings: leds: Add IS32FL3207 controller

The IS32FL3207 is an 18-channel constant-current LED controller with per-output PWM and current scaling.

Describe I2C addressing, power and shutdown controls, RISET, and individual or multicolor output groupings. Require board current limits for each output and document their relationship to the RISET-derived full scale.

Allow dash-suffixed multicolor group names when a group begins at channel 16 or 17, which cannot be represented by the common schema unit-address form.

---
 .../bindings/leds/issi,is32fl3207.yaml        | 285 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 291 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +285 -0
new file mode 100644
index 0000000000000..32eaf14ca7cf3
@@ -0,0 +1,285 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/issi,is32fl3207.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lumissil IS32FL3207 18-channel LED controller
+
+maintainers:
+  - Ahmad Byagowi <[email protected]>
+
+description: |
+  The IS32FL3207 is an I2C LED controller with 18 individually controlled
+  constant-current outputs. Each output has 8-bit current scaling. PWM
+  brightness control uses the controller's default 8-bit, 62 kHz mode.
+  Outputs may be exposed as individual LEDs or grouped as multicolor LEDs.
+
+  The data sheet is available at:
+    https://www.lumissil.com/assets/pdf/core/IS32FL3207_DS.pdf
+
+properties:
+  compatible:
+    const: issi,is32fl3207
+
+  reg:
+    enum: [0x34, 0x35, 0x36, 0x37]
+
+  vcc-supply:
+    description: Regulator providing power to the VCC pin.
+
+  enable-gpios:
+    maxItems: 1
+    description: GPIO connected to SDB, asserted to enable the controller.
+
+  issi,riset-ohms:
+    minimum: 2000
+    maximum: 76500000
+    description: |
+      Resistance in ohms of the external RISET resistor. The resistor sets the
+      full-scale output current according to IOUT(MAX) = 76.5 / RISET amperes.
+      Each LED's led-max-microamp value selects a board-safe peak current no
+      greater than this full scale, using the per-output scaling register.
+
+  "#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: 17
+        description: |
+          Zero-based LED output number. Values 0 through 17 correspond to
+          OUT1 through OUT18.
+
+      led-max-microamp:
+        minimum: 149
+        maximum: 38250
+        description: |
+          Board-safe peak current for this output. The value must not exceed
+          the full-scale current derived from issi,riset-ohms. The minimum is
+          the smallest nonzero current representable at the maximum permitted
+          full-scale current.
+
+      color:
+        oneOf:
+          - minimum: 0
+            maximum: 7
+          - minimum: 10
+            maximum: 14
+
+      max-brightness:
+        minimum: 1
+        maximum: 255
+
+      default-state:
+        description:
+          The driver performs a software reset and clears the PWM state during
+          initialization, so an existing state cannot be preserved.
+        enum: ["on", "off"]
+
+      default-brightness:
+        maximum: 255
+        description: |
+          Brightness used when default-state is "on". This value must not
+          exceed max-brightness when max-brightness is specified.
+
+    anyOf:
+      - required:
+          - function
+      - required:
+          - color
+
+    required:
+      - reg
+      - led-max-microamp
+
+  "^multi-led(@[0-9a-f]|-[0-9]+)?$":
+    type: object
+    $ref: leds-class-multicolor.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 15
+        description: |
+          Optional zero-based lowest-numbered output used by a group named
+          multi-led@N. Values 0 through 15 correspond to OUT1 through OUT16.
+          For a multi-led-N group without reg, the driver derives the lowest
+          output from its component nodes. This form permits groups beginning
+          at channels 16 or 17 while following the common multicolor node-name
+          schema.
+
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+      max-brightness:
+        minimum: 1
+        maximum: 255
+
+      default-state:
+        description:
+          The driver performs a software reset and clears the PWM state during
+          initialization, so an existing state cannot be preserved.
+        enum: ["on", "off"]
+
+      default-brightness:
+        maximum: 255
+        description: |
+          Brightness used when default-state is "on". This value must not
+          exceed max-brightness when max-brightness is specified.
+
+    patternProperties:
+      "^led@[0-9a-f]+$":
+        type: object
+        $ref: common.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          reg:
+            minimum: 0
+            maximum: 17
+            description: |
+              Zero-based LED output number. Values 0 through 17 correspond to
+              OUT1 through OUT18.
+
+          led-max-microamp:
+            minimum: 149
+            maximum: 38250
+            description: |
+              Board-safe peak current for this output. The value must not
+              exceed the full-scale current derived from issi,riset-ohms. The
+              minimum is the smallest nonzero current representable at the
+              maximum permitted full-scale current.
+
+          color:
+            oneOf:
+              - minimum: 0
+                maximum: 7
+              - minimum: 10
+                maximum: 14
+
+          max-brightness: false
+
+          default-state: false
+
+          default-brightness: false
+
+          retain-state-shutdown: false
+
+        required:
+          - reg
+          - color
+          - led-max-microamp
+
+    anyOf:
+      - required: [led@0]
+      - required: [led@1]
+      - required: [led@2]
+      - required: [led@3]
+      - required: [led@4]
+      - required: [led@5]
+      - required: [led@6]
+      - required: [led@7]
+      - required: [led@8]
+      - required: [led@9]
+      - required: [led@a]
+      - required: [led@b]
+      - required: [led@c]
+      - required: [led@d]
+      - required: [led@e]
+      - required: [led@f]
+      - required: [led@10]
+      - required: [led@11]
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+
+required:
+  - compatible
+  - reg
+  - issi,riset-ohms
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        led-controller@34 {
+            compatible = "issi,is32fl3207";
+            reg = <0x34>;
+            #address-cells = <1>;
+            enable-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
+            #size-cells = <0>;
+            vcc-supply = <&led_3v3>;
+            issi,riset-ohms = <4700>;
+
+            multi-led@0 {
+                reg = <0>;
+                #address-cells = <1>;
+                color = <LED_COLOR_ID_RGB>;
+                function = LED_FUNCTION_STATUS;
+                #size-cells = <0>;
+
+                led@0 {
+                    reg = <0>;
+                    color = <LED_COLOR_ID_RED>;
+                    led-max-microamp = <8100>;
+                };
+
+                led@1 {
+                    reg = <1>;
+                    color = <LED_COLOR_ID_GREEN>;
+                    led-max-microamp = <8100>;
+                };
+
+                led@2 {
+                    reg = <2>;
+                    color = <LED_COLOR_ID_BLUE>;
+                    led-max-microamp = <8100>;
+                };
+            };
+
+            multi-led-1 {
+                #address-cells = <1>;
+                color = <LED_COLOR_ID_MULTI>;
+                function = LED_FUNCTION_INDICATOR;
+                #size-cells = <0>;
+
+                led@10 {
+                    reg = <16>;
+                    color = <LED_COLOR_ID_AMBER>;
+                    led-max-microamp = <8100>;
+                };
+
+                led@11 {
+                    reg = <17>;
+                    color = <LED_COLOR_ID_WHITE>;
+                    led-max-microamp = <8100>;
+                };
+            };
+        };
+    };
+...
MAINTAINERS +6 -0
index 747ef98f21e85..dbb2fc536c065 100644
@@ -13817,6 +13817,12 @@ S:	Maintained
 F:	Documentation/filesystems/isofs.rst
 F:	fs/isofs/
 
+ISSI IS32FL3207 LED DRIVER
+M:	Ahmad Byagowi <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml
+
 IT87 HARDWARE MONITORING DRIVER
 M:	Jean Delvare <[email protected]>
 L:	[email protected]
Signature · 1 line
2.50.1 (Apple Git-155)
#2 lore raw

Re: [PATCH v6 1/2] dt-bindings: leds: Add IS32FL3207 controller

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `minimum: 149` constraint on `led-max-microamp` incorrectly rejects valid, lower-current…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The minimum: 149 constraint on led-max-microamp incorrectly rejects valid, lower-current configurations. --

--- Patch [1]: [PATCH v6 1/2] dt-bindings: leds: Add IS32FL3207 controller --- commit 4fc20b49cd66c5af5de8db1465fd9c2b64f3c2ad
Author: Ahmad Byagowi <[email protected]>

dt-bindings: leds: Add IS32FL3207 controller

The IS32FL3207 is an 18-channel constant-current LED controller with per-output PWM and current scaling.

Quoted 13 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +7 -0
new file mode 100644
index 0000000000000..32eaf14ca7cf3
@@ -0,0 +1,285 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/issi,is32fl3207.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lumissil IS32FL3207 18-channel LED controller

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +7 -0
+patternProperties:
+  "^led@[0-9a-f]+$":
+    type: object
+    $ref: common.yaml#
+    unevaluatedProperties: false
+
+    properties:

Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml line 66

Quoted 10 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +10 -0
+      reg:
+        minimum: 0
+        maximum: 17
+        description: |
+          Zero-based LED output number. Values 0 through 17 correspond to
+          OUT1 through OUT18.
+
+      led-max-microamp:
+        minimum: 149
+        maximum: 38250

[Severity: Medium]
Does this minimum constraint inadvertently reject valid lower-current limits for single LEDs?

When a board designer uses a larger issi,riset-ohms (e.g., 100 kOhm) to achieve a lower full-scale current, they may need to limit a specific LED to a peak current well below 149 uA (e.g., 50 uA).

Since the hardware can represent much smaller currents with a large RISET, could this prevent developers from enforcing valid safety limits below 149 uA, forcing them to over-specify the limit?

Quoted 5 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +5 -0
+        description: |
+          Board-safe peak current for this output. The value must not exceed
+          the full-scale current derived from issi,riset-ohms. The minimum is
+          the smallest nonzero current representable at the maximum permitted
+          full-scale current.

[ ... ]

Quoted 4 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +4 -0
+  "^multi-led(@[0-9a-f]|-[0-9]+)?$":
+    type: object
+    $ref: leds-class-multicolor.yaml#
+    unevaluatedProperties: false

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +7 -0
+    patternProperties:
+      "^led@[0-9a-f]+$":
+        type: object
+        $ref: common.yaml#
+        unevaluatedProperties: false
+
+        properties:

Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml line 66

Quoted 10 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +10 -0
+          reg:
+            minimum: 0
+            maximum: 17
+            description: |
+              Zero-based LED output number. Values 0 through 17 correspond to
+              OUT1 through OUT18.
+
+          led-max-microamp:
+            minimum: 149
+            maximum: 38250

[Severity: Medium]
Does this also incorrectly restrict nested LEDs inside multi-led groups from having valid maximum current limits below 149 uA?

Quoted 5 lines
Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml new file +5 -0
+            description: |
+              Board-safe peak current for this output. The value must not
+              exceed the full-scale current derived from issi,riset-ohms. The
+              minimum is the smallest nonzero current representable at the
+              maximum permitted full-scale current.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v6 2/2 leds: is32fl3207: Add controller driver

In reply to Ahmad Byagowi

Add an I2C driver for the Lumissil IS32FL3207 18-channel LED controller.

Expose individual and multicolor LEDs through the LED class. Use the default 8-bit, 62 kHz PWM mode, derive output current from RISET, and enforce each output current limit with the scaling registers. Serialize multicolor calculation, scaling, PWM, and controller-wide update operations.

Clear retained scaling while SDB holds the outputs disabled. Release SDB and briefly enable normal operation to issue the required software reset, then keep the controller in software shutdown while registering every LED. Enable outputs only after all limits and initial brightness values are programmed.

Handle an optional supply and enable GPIO. Serialize shutdown against pending brightness updates and honor retained shutdown state.

---
 MAINTAINERS                        |   1 +
 drivers/leds/rgb/Kconfig           |  11 +
 drivers/leds/rgb/Makefile          |   1 +
 drivers/leds/rgb/leds-is32fl3207.c | 736 +++++++++++++++++++++++++++++
 4 files changed, 749 insertions(+)
 create mode 100644 drivers/leds/rgb/leds-is32fl3207.c
MAINTAINERS +1 -0
index dbb2fc536c065..79bb970b025db 100644
@@ -13822,6 +13822,7 @@ M:	Ahmad Byagowi <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/leds/issi,is32fl3207.yaml
+F:	drivers/leds/rgb/leds-is32fl3207.c
 
 IT87 HARDWARE MONITORING DRIVER
 M:	Jean Delvare <[email protected]>
drivers/leds/rgb/Kconfig +11 -0
index 6e9ab5f60714b..c896be1318dcc 100644
@@ -14,6 +14,17 @@ config LEDS_GROUP_MULTICOLOR
 	  To compile this driver as a module, choose M here: the module
 	  will be called leds-group-multicolor.
 
+config LEDS_IS32FL3207
+	tristate "LED support for ISSI IS32FL3207"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  Say Y here to include support for the Lumissil IS32FL3207
+	  18-channel I2C LED controller.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called leds-is32fl3207.
+
 config LEDS_KTD202X
 	tristate "LED support for KTD202x Chips"
 	depends on I2C
drivers/leds/rgb/Makefile +1 -0
index cc0f2df662869..228923e8bb119 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_LEDS_GROUP_MULTICOLOR)	+= leds-group-multicolor.o
+obj-$(CONFIG_LEDS_IS32FL3207)		+= leds-is32fl3207.o
 obj-$(CONFIG_LEDS_KTD202X)		+= leds-ktd202x.o
 obj-$(CONFIG_LEDS_LP5812)		+= leds-lp5812.o
 obj-$(CONFIG_LEDS_LP5860_CORE)		+= leds-lp5860-core.o
drivers/leds/rgb/leds-is32fl3207.c new file +736 -0

736 lines not on this page · raw message

Signature · 1 line
2.50.1 (Apple Git-155)
#4 lore raw

Re: [PATCH v6 2/2] leds: is32fl3207: Add controller driver

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 14 lines

Add an I2C driver for the Lumissil IS32FL3207 18-channel LED controller.

Expose individual and multicolor LEDs through the LED class. Use the default 8-bit, 62 kHz PWM mode, derive output current from RISET, and enforce each output current limit with the scaling registers. Serialize multicolor calculation, scaling, PWM, and controller-wide update operations.

Clear retained scaling while SDB holds the outputs disabled. Release SDB and briefly enable normal operation to issue the required software reset, then keep the controller in software shutdown while registering every LED. Enable outputs only after all limits and initial brightness values are programmed.

Quoted 4 lines

Handle an optional supply and enable GPIO. Serialize shutdown against pending brightness updates and honor retained shutdown state.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2