leds: add ktd20xx LED driver support
Subsystems (2)
v2 cover leds: add ktd20xx LED driver support
Introducing the KTD2061/58/59/60 RGB LED drivers. The difference in these are the address numbers on the I2C bus that the device listens to.
Due to the hardware limitation, we can only set 7 colors and the color black (LED off) for each LED independently and not the full RGB range.
v1: Inital send
v2: Remove variant 1 from source
Florian Eckert (2):
leds: ktd20xx: Extension of the KTD20xx family of LED drivers from
Kinetic
dt: bindings: KTD20xx: Introduce the ktd20xx family of RGB drivers
.../bindings/leds/leds-ktd20xx.yaml | 130 ++++ MAINTAINERS | 7 + drivers/leds/Kconfig | 13 + drivers/leds/Makefile | 1 + drivers/leds/leds-ktd20xx.c | 614 ++++++++++++++++++ 5 files changed, 765 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd20xx.yaml create mode 100644 drivers/leds/leds-ktd20xx.c
Signature · 1 line
2.20.1
PATCH v2 1/2 leds: ktd20xx: Extension of the KTD20xx family of LED drivers from Kinetic
Introducing the KTD2061/58/59/60 RGB LED drivers. The difference in these are the address numbers on the I2C bus that the device listens to.
All KT20xx units can drive up to 12 LEDs.
Due to the hardware limitation, we can only set 7 colors and the color black (LED off) for each LED independently and not the full RGB range. This is because the chip only has two color registers.
To control the LEDs independently, the chip has to be configured in a special way.
Color register 0 must be loaded with the current value 0mA, and color register 1 must be loaded with the value 'kinetic,led-current' from the device tree node. If the property is omitted, the register is loaded with the default value (0x28 = 5mA).
To select a color for an LED, a combination must be written to the color selection register of that LED. This range for selecting the value is 3 bits wide (RGB). A '0' in any of the bits uses color register '0' and a '1' uses color register '1'.
So we could choose the following combination for each LED:
R G B
0 0 0 = Black (off)
0 0 1 = Blue
0 1 0 = green
0 1 1 = Cyan
1 0 0 = Red
1 0 1 = Magenta
1 1 0 = Yellow
1 1 1 = White
--- MAINTAINERS | 6 + drivers/leds/Kconfig | 13 + drivers/leds/Makefile | 1 + drivers/leds/leds-ktd20xx.c | 614 ++++++++++++++++++++++++++++++++++++ 4 files changed, 634 insertions(+) create mode 100644 drivers/leds/leds-ktd20xx.c
MAINTAINERS +6 -0
@@ -10603,6 +10603,12 @@ S: Maintained F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd253.yaml F: drivers/video/backlight/ktd253-backlight.c +KTD20XX LED CONTROLLER DRIVER +M: Florian Eckert <[email protected]> +L: [email protected] +S: Maintained +F: drivers/leds/leds-ktd20xx.c + KTEST M: Steven Rostedt <[email protected]> M: John Hawley <[email protected]>
drivers/leds/Kconfig +13 -0
@@ -157,6 +157,19 @@ config LEDS_EL15203000 To compile this driver as a module, choose M here: the module will be called leds-el15203000. +config LEDS_KTD20XX + tristate "LED Support for KTD2061/58/59/60 LED driver chip" + depends on LEDS_CLASS && I2C + depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR + depends on OF + select REGMAP_I2C + help + If you say yes here you get support for the Kinetic + KTD2061, KTD2058, KTD2059 and KTD2060 LED driver. + + To compile this driver as a module, choose M here: the + module will be called leds-ktd20xx. + config LEDS_TURRIS_OMNIA tristate "LED support for CZ.NIC's Turris Omnia" depends on LEDS_CLASS_MULTICOLOR
drivers/leds/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_LEDS_IP30) += leds-ip30.o obj-$(CONFIG_LEDS_IPAQ_MICRO) += leds-ipaq-micro.o obj-$(CONFIG_LEDS_IS31FL319X) += leds-is31fl319x.o obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o +obj-${CONFIG_LEDS_KTD20XX} += leds-ktd20xx.o obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o obj-$(CONFIG_LEDS_LM3532) += leds-lm3532.o obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o
drivers/leds/leds-ktd20xx.c new file +614 -0
614 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v2 2/2 dt: bindings: KTD20xx: Introduce the ktd20xx family of RGB drivers
In reply to Florian EckertIntroduce the bindings for the Kinetic KTD2061/58/59/60RGB LED device driver. The KTD20xx can control RGB LEDs individually. Because of the hardware limitations, only 7 colors and the color black (off) can be set.
--- .../bindings/leds/leds-ktd20xx.yaml | 130 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd20xx.yaml
Documentation/devicetree/bindings/leds/leds-ktd20xx.yaml new file +130 -0
@@ -0,0 +1,130 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/leds-ktd20xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: LED driver for KTD20xx RGB LED from Kinetic. + +maintainers: + - Florian Eckert <[email protected]> + +description: | + The KTD20XX is multi-channel, I2C LED driver. Into can control up to 12 + LEDs per device. The RGB value can be set for each LED. Due to hardware + limitations, the full RGB range cannot be used. Only 7 colors and the + color black can be set (black means off). + R G B + 0 0 0 = Black (off) + 0 0 1 = Blue + 0 1 0 = Green + 0 1 1 = Cyan + 1 0 0 = Red + 1 0 1 = Magenta + 1 1 0 = Yellow + 1 1 1 = White + +properties: + compatible: + enum: + - kinetic,ktd20xx + + reg: + maxItems: 1 + description: + I2C slave address + ktd2061/58/59/60 0x68 0x69 0x6A 0x6B + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + 'kinetic,led-current': + $ref: /schemas/types.yaml#/definitions/uint8 + description: + This value is a current setting for all LEDs connected to this device. + If this value is not set then the default value off 0x28 (5mA) is set. + This means all LEDs get 5mA. The max value is 24mA. We have the following + mapping in 125uA steps. We can set a maximum of 24mA. + 0000 0000 (0x00) = 0uA + 0000 0001 (0x01) = 125uA + .... .... + 0010 1000 (0x28) = 5mA + .... .... + 1100 0000 (0xC0) = 24mA + 1100 0001 (0xC1) = 24mA + .... .... + 1111 1111 (0xFF) = 24mA + minimum: 0 + maximum: 255 + +patternProperties: + '^multi-led@[0-9a-f]$': + type: object + allOf: + - $ref: leds-class-multicolor.yaml# + description: + This node represents one of the Multicolor LED. No subnodes need to + be added for subchannels since this controller only supports 1bit + RGB values. We could display seven different colors and the color + black which means off. + + properties: + reg: + minimum: 0 + maximum: 11 + description: + This property identifies wired connection of the LED to this device. + 0x00 LEDA1 + 0x01 LEDA2 + 0x02 LEDA3 + 0x03 LEDA4 + 0x04 LEDB1 + 0x05 LEDB2 + 0x06 LEDB3 + 0x07 LEDB4 + 0x08 LEDC1 + 0x09 LEDC2 + 0x0A LEDC3 + 0x0B LEDC4 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/leds/common.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + led-controller@14 { + compatible = "kinetic,ktd20xx"; + reg = <0x68>; + #address-cells = <1>; + #size-cells = <0>; + kinetic,led-current = <0x28>; // Current for all LEDs is 5mA + + multi-led@0 { + reg = <0x0>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_CHARGING; + linux,default-trigger = "default-on"; + }; + + multi-led@2 { + reg = <0x2>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_STANDBY; + linux,default-trigger = "default-on"; + }; + }; + }; + +...
MAINTAINERS +1 -0
@@ -10607,6 +10607,7 @@ KTD20XX LED CONTROLLER DRIVER M: Florian Eckert <[email protected]> L: [email protected] S: Maintained +F: Documentation/devicetree/bindings/leds/leds-ktd20xx.yaml F: drivers/leds/leds-ktd20xx.c KTEST
Signature · 1 line
2.20.1
Re: [PATCH v2 2/2] dt: bindings: KTD20xx: Introduce the ktd20xx family of RGB drivers
Quoted 11 lines · Florian Eckert
Introduce the bindings for the Kinetic KTD2061/58/59/60RGB LED device driver. The KTD20xx can control RGB LEDs individually. Because of the hardware limitations, only 7 colors and the color black (off) can be set.
Signed-off-by Florian Eckert <[email protected]>--- .../bindings/leds/leds-ktd20xx.yaml | 130 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-ktd20xx.yaml