backlight: Add new lm3509 backlight driver
Subsystems (4)
v5 cover backlight: Add new lm3509 backlight driver
This is a general driver for LM3509 backlight chip of TI. LM3509 is High Efficiency Boost for White LEDs and/or OLED Displays with Dual Current Sinks. This driver supports OLED/White LED select, brightness control and sub/main control.
The datasheet can be found at http://www.ti.com/product/lm3509.
---
Changes in v5:
Renamed lm3509_bl_led_pdata to lm3509_bl_led_data
Set backlight_properties.scale to BACKLIGHT_SCALE_NON_LINEAR Add dev_err_probe() for first write to a register
Use dev_err_probe() instead of dev_err()
v4: https://lore.kernel.org/all/[email protected]/
Changes in v4:
Use backlight_*() to access backlight_device
Do not set backlight_properties.power
v3: https://lore.kernel.org/all/[email protected]/
Changes in v3:
Improved device tree bindings documentation
v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
Add device tree nodes for each output
Addressed multiple smaller review comments
v1: https://lore.kernel.org/all/[email protected]/
Patrick Gansterer (2):
dt-bindings: backlight: Add Texas Instruments LM3509
backlight: Add new lm3509 backlight driver
.../bindings/leds/backlight/ti,lm3509.yaml | 139 +++++++ drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/lm3509_bl.c | 340 ++++++++++++++++++ 4 files changed, 487 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml create mode 100644 drivers/video/backlight/lm3509_bl.c
Signature · 1 line
2.44.0
PATCH v5 1/2 dt-bindings: backlight: Add Texas Instruments LM3509
Add Device Tree bindings for Texas Instruments LM3509 - a High Efficiency Boost for White LED's and/or OLED Displays
--- .../bindings/leds/backlight/ti,lm3509.yaml | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file +139 -0
@@ -0,0 +1,139 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/backlight/ti,lm3509.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI LM3509 High Efficiency Boost for White LED's and/or OLED Displays + +maintainers: + - Patrick Gansterer <[email protected]> + +description: + The LM3509 current mode boost converter offers two separate outputs. + https://www.ti.com/product/LM3509 + +properties: + compatible: + const: ti,lm3509 + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reset-gpios: + maxItems: 1 + + ti,brightness-rate-of-change-us: + description: Brightness Rate of Change in microseconds. + enum: [51, 13000, 26000, 52000] + + ti,oled-mode: + description: Enable OLED mode. + type: boolean + +patternProperties: + "^led@[01]$": + type: object + description: Properties for a string of connected LEDs. + + allOf: + - $ref: common.yaml# + + properties: + reg: + description: + The control register that is used to program the two current sinks. + The LM3509 has two registers (BMAIN and BSUB) and are represented + as 0 or 1 in this property. The two current sinks can be controlled + independently with both registers, or register BMAIN can be + configured to control both sinks with the led-sources property. + minimum: 0 + maximum: 1 + + label: true + + led-sources: + allOf: + - minItems: 1 + maxItems: 2 + items: + minimum: 0 + maximum: 1 + + default-brightness: + minimum: 0 + maximum: 31 + default: 18 + + max-brightness: + minimum: 0 + maximum: 31 + default: 31 + + required: + - reg + + additionalProperties: false + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + backlight@36 { + compatible = "ti,lm3509"; + reg = <0x36>; + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + + ti,oled-mode; + ti,brightness-rate-of-change-us = <52000>; + + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + led-sources = <0 1>; + label = "lcd-backlight"; + default-brightness = <12>; + max-brightness = <31>; + }; + }; + }; + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + backlight@36 { + compatible = "ti,lm3509"; + reg = <0x36>; + + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + default-brightness = <12>; + }; + + led@1 { + reg = <1>; + default-brightness = <15>; + }; + }; + };
Signature · 1 line
2.44.0
Rob Herring
maintainerRe: [PATCH v5 1/2] dt-bindings: backlight: Add Texas Instruments LM3509
Quoted 52 lines · Patrick Gansterer
Add Device Tree bindings for Texas Instruments LM3509 - a High Efficiency Boost for White LED's and/or OLED Displays
Signed-off-by Patrick Gansterer <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Daniel Thompson <[email protected]>--- .../bindings/leds/backlight/ti,lm3509.yaml | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yamlDocumentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file +35
-0@@ -0,0 +1,139 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/backlight/ti,lm3509.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TI LM3509 High Efficiency Boost for White LED's and/or OLED Displays + +maintainers: + - Patrick Gansterer <[email protected]> + +description: + The LM3509 current mode boost converter offers two separate outputs. + https://www.ti.com/product/LM3509 + +properties: + compatible: + const: ti,lm3509 + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reset-gpios: + maxItems: 1 + + ti,brightness-rate-of-change-us: + description: Brightness Rate of Change in microseconds. + enum: [51, 13000, 26000, 52000] +
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file +10
-0+ ti,oled-mode: + description: Enable OLED mode. + type: boolean + +patternProperties: + "^led@[01]$": + type: object + description: Properties for a string of connected LEDs. + + allOf:
You don't need allOf here.
Quoted 7 lines
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file +7
-0+ - $ref: common.yaml# + + properties: + reg: + description: + The control register that is used to program the two current sinks. + The LM3509 has two registers (BMAIN and BSUB) and are represented
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml line 62
Quoted 10 lines
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file +10
-0+ as 0 or 1 in this property. The two current sinks can be controlled + independently with both registers, or register BMAIN can be + configured to control both sinks with the led-sources property. + minimum: 0 + maximum: 1 + + label: true + + led-sources: + allOf:
Or here.
Quoted 5 lines
Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file +5
-0+ - minItems: 1 + maxItems: 2 + items: + minimum: 0 + maximum: 1
PATCH v5 2/2 backlight: Add new lm3509 backlight driver
In reply to Patrick GanstererThis is a general driver for LM3509 backlight chip of TI. LM3509 is High Efficiency Boost for White LEDs and/or OLED Displays with Dual Current Sinks. This driver supports OLED/White LED select, brightness control and sub/main control.
The datasheet can be found at http://www.ti.com/product/lm3509.
--- drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/lm3509_bl.c | 340 ++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+) create mode 100644 drivers/video/backlight/lm3509_bl.c
drivers/video/backlight/Kconfig +7 -0
@@ -373,6 +373,13 @@ config BACKLIGHT_AAT2870 If you have a AnalogicTech AAT2870 say Y to enable the backlight driver. +config BACKLIGHT_LM3509 + tristate "Backlight Driver for LM3509" + depends on I2C + select REGMAP_I2C + help + This supports TI LM3509 Backlight Driver + config BACKLIGHT_LM3630A tristate "Backlight Driver for LM3630A" depends on I2C && PWM
drivers/video/backlight/Makefile +1 -0
@@ -36,6 +36,7 @@ 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_KTZ8866) += ktz8866.o +obj-$(CONFIG_BACKLIGHT_LM3509) += lm3509_bl.o obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
drivers/video/backlight/lm3509_bl.c new file +340 -0
340 lines not on this page · raw message
Signature · 1 line
2.44.0
Quoted 7 lines · Patrick Gansterer
This is a general driver for LM3509 backlight chip of TI. LM3509 is High Efficiency Boost for White LEDs and/or OLED Displays with Dual Current Sinks. This driver supports OLED/White LED select, brightness control and sub/main control.
The datasheet can be found at http://www.ti.com/product/lm3509.Signed-off-by Patrick Gansterer <[email protected]>
Daniel.