backlight: add ktd3137 support
Subsystems (4)
v2 cover backlight: add ktd3137 support
This patch series adds support for Kinetic KTD3137 backlight IC. It supports linear brightness range from 0 to 2047.
While the chip supports PWM and MSB modes, they weren't included, since MSB mode supports only 8-bit brightness range, and PWM is not enabled on this board. I have checked other Xiaomi vendor kernels, and their configuration appear to be the same as on my board. I'm not aware if any device uses PWM mode with this chip.
This series was developed and tested on the Xiaomi Redmi Note 9 board.
---
Changes in v2:
- dt-bindings: drop vin-supply from required list (Daniel)
- Driver:
- Drop val variable in ktd3137_init() (Daniel)
- Replace KTD3137_DEFAULT_BRIGHTNESS with KTD3137_MAX_BRIGHTNESS (Daniel)
- Drop gpiod_set_value_cansleep() in ktd3137_remove() (Daniel)
- Link to v1: https://patch.msgid.link/[email protected]
---
Roman Vivchar (2):
dt-bindings: leds: backlight: add Kinetic KTD3137
backlight: add ktd3137 support
.../bindings/leds/backlight/kinetic,ktd3137.yaml | 63 +++++ MAINTAINERS | 6 + drivers/video/backlight/Kconfig | 11 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/ktd3137.c | 258 +++++++++++++++++++++ 5 files changed, 339 insertions(+)
---
base-commit: 5e6de6a2b522f659defacb1551d0465ba6ce13cf
change-id: 20261102-6768-ktd3137-4ec95068fb6a
Best regards,
Signature · 1 line
Roman Vivchar <[email protected]>
PATCH v2 1/2 dt-bindings: leds: backlight: add Kinetic KTD3137
Kinetic KTD3137 is an LED IC, used in various mobile devices for the display backlight. Add devicetree bindings documentation for this chip.
Datasheet: https://www.kinet-ic.com/uploads/KTD3137-04a.pdf
--- .../bindings/leds/backlight/kinetic,ktd3137.yaml | 63 ++++++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 68 insertions(+)
Documentation/devicetree/bindings/leds/backlight/kinetic,ktd3137.yaml new file +63 -0
@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/backlight/kinetic,ktd3137.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Kinetic Technologies KTD3137 LED Backlight + +maintainers: + - Roman Vivchar <[email protected]> + +description: + The Kinetic Technologies KTD3137 is an I2C LED backlight driver for medium + to large size LCD panels. + +allOf: + - $ref: common.yaml# + +properties: + compatible: + const: kinetic,ktd3137 + + reg: + maxItems: 1 + + default-brightness: + maximum: 2047 + default: 2047 + + enable-gpios: + maxItems: 1 + description: GPIO connected to the HWEN pin. + + led-max-microamp: + minimum: 5000 + maximum: 29800 + default: 20200 + + vin-supply: true + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + backlight@36 { + compatible = "kinetic,ktd3137"; + reg = <0x36>; + enable-gpios = <&pio 160 GPIO_ACTIVE_HIGH>; + led-max-microamp = <20200>; + default-brightness = <2047>; + vin-supply = <&vsys>; + }; + };
MAINTAINERS +5 -0
@@ -14618,6 +14618,11 @@ S: Maintained F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd2801.yaml F: drivers/video/backlight/ktd2801-backlight.c +KTD3137 BACKLIGHT DRIVER +M: Roman Vivchar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd3137.yaml + KTEST M: Steven Rostedt <[email protected]> M: John Hawley <[email protected]>
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH v2 1/2] dt-bindings: leds: backlight: add Kinetic KTD3137
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
From: Roman Vivchar <[email protected]>
Kinetic KTD3137 is an LED IC, used in various mobile devices for the display backlight. Add devicetree bindings documentation for this chip.
Datasheet: https://www.kinet-ic.com/uploads/KTD3137-04a.pdf
Signed-off-by Roman Vivchar <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v2 1/2] dt-bindings: leds: backlight: add Kinetic KTD3137
In reply to Roman VivcharDocumentation/devicetree/bindings/leds/backlight/kinetic,ktd3137.yaml line 43
Quoted 10 lines · Roman Vivchar
Documentation/devicetree/bindings/leds/backlight/kinetic,ktd3137.yaml new file +10
-0+ led-max-microamp: + minimum: 5000 + maximum: 29800 + default: 20200 + + vin-supply: true + +required: + - compatible + - reg
Supply is required, device cannot operate without power.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +unevaluatedProperties: false
Best regards,
Krzysztof
PATCH v2 2/2 backlight: add ktd3137 support
In reply to Roman VivcharAdd support for the KTD3137 display backlight IC. It's used in various Xiaomi phones, such as Xiaomi Redmi Note 9.
--- MAINTAINERS | 1 + drivers/video/backlight/Kconfig | 11 ++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/ktd3137.c | 258 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 271 insertions(+)
MAINTAINERS +1 -0
@@ -14622,6 +14622,7 @@ KTD3137 BACKLIGHT DRIVER M: Roman Vivchar <[email protected]> S: Maintained F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd3137.yaml +F: drivers/video/backlight/ktd3137.c KTEST M: Steven Rostedt <[email protected]>
drivers/video/backlight/Kconfig +11 -0
@@ -199,6 +199,17 @@ config BACKLIGHT_KTD2801 Say Y to enable the backlight driver for the Kinetic KTD2801 1-wire GPIO-controlled backlight found in Samsung Galaxy Core Prime VE LTE. +config BACKLIGHT_KTD3137 + tristate "Backlight Driver for Kinetic KTD3137" + depends on I2C + select REGMAP_I2C + help + Say Y to enable the backlight driver for the Kinetic KTD3137 + found in various Xiaomi smartphones. + + To compile this driver as a module, choose M here: the module + will be called ktd3137. + config BACKLIGHT_KTZ8866 tristate "Backlight Driver for Kinetic KTZ8866" depends on I2C
drivers/video/backlight/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o obj-$(CONFIG_BACKLIGHT_KTD2801) += ktd2801-backlight.o +obj-$(CONFIG_BACKLIGHT_KTD3137) += ktd3137.o obj-$(CONFIG_BACKLIGHT_KTZ8866) += ktz8866.o obj-$(CONFIG_BACKLIGHT_LM3509) += lm3509_bl.o obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
drivers/video/backlight/ktd3137.c new file +258 -0
258 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] backlight: ktd3137: use named initializer in ktd3137_ids --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] backlight: ktd3137: use named initializer in ktd3137_ids --
commit 8835810206d0f5ccda9a816dd64ce8c1128ef9b3
Author: Roman Vivchar <[email protected]>
backlight: add ktd3137 support
This commit adds an I2C backlight driver for the Kinetic KTD3137 display backlight IC.
Quoted 6 lines
drivers/video/backlight/ktd3137.c new file +0
-0@@ -0,0 +1,258 @@
[ ... ]
drivers/video/backlight/ktd3137.c line 237
Quoted 4 lines
drivers/video/backlight/ktd3137.c new file +4
-0+static const struct i2c_device_id ktd3137_ids[] = { + {"ktd3137" }, + { } +};
[Severity: Low]
This isn't a bug, but new struct i2c_device_id entries should use named initializers ({ .name = "ktd3137" }).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2