Message ID | 20240308215617.1729664-1-paroga@paroga.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/2] dt-bindings: backlight: Add Texas Instruments LM3509 | expand |
On 08/03/2024 22:50, Patrick Gansterer wrote: > 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 <paroga@paroga.com> Thank you for your patch. There is something to discuss/improve. > + 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 > + > +required: required: goes after all properties. > + - compatible > + - reg > + > +patternProperties: > + "^led@[01]$": > + type: object > + description: Properties for a string of connected LEDs. Are you sure this is a string of LEDs? How does a string/tape work with a backlight, I mean physically? How could it look like? > + > + 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: > + maxItems: 1 It's a string, not string-array, so maxItems are not needed, just ":true". > + > + led-sources: > + allOf: > + - minItems: 1 > + maxItems: 2 > + items: > + minimum: 0 > + maximum: 1 > + > + default-brightness: > + minimum: 0 > + maximum: 31 Not a required property? Then "default:". > + > + max-brightness: > + minimum: 0 > + maximum: 31 Some of your examples miss it, so there is some kind of default. Add it. > + > + required: > + - reg > + > + unevaluatedProperties: false > + > +unevaluatedProperties: false You rewrote everything, so my previous comment obviously does not make sense in such case. This must be additionalProperties: false. Look at other bindings or example-schema how it is done (to repeat myself). > + > +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 { Best regards, Krzysztof
On 09/03/2024 12:53, Krzysztof Kozlowski wrote: >> + - compatible >> + - reg >> + >> +patternProperties: >> + "^led@[01]$": >> + type: object >> + description: Properties for a string of connected LEDs. > > Are you sure this is a string of LEDs? How does a string/tape work with > a backlight, I mean physically? How could it look like? I just took most of the descriptions/names from lm3630a-backlight.yaml. I understand it in this context as multiple serial connected LEDs (as shown in the circuit diagram in the datasheet), so that each of them gets the same current when connected to the output of the chip. Maybe a more general question: Is there any easy accessible information about which code is the best used as example/reference? I tried to align my code very close to the LM3630, but you gave me a bunch of comments on that ;-). And would you like see patches cleaning up some of the code with bad/outdated style? - Patrick
On 09/03/2024 13:09, Patrick Gansterer wrote: > On 09/03/2024 12:53, Krzysztof Kozlowski wrote: >>> + - compatible >>> + - reg >>> + >>> +patternProperties: >>> + "^led@[01]$": >>> + type: object >>> + description: Properties for a string of connected LEDs. >> >> Are you sure this is a string of LEDs? How does a string/tape work with >> a backlight, I mean physically? How could it look like? > > I just took most of the descriptions/names from lm3630a-backlight.yaml. > I understand it in this context as multiple serial connected LEDs (as > shown in the circuit diagram in the datasheet), so that each of them > gets the same current when connected to the output of the chip. > lm3630 might have copied it as well. LED strings are true in case of... well, LED strings, but I just wonder if such setup is applicable for backlight. Anyway, if you think it is, I don't mind. > Maybe a more general question: Is there any easy accessible information > about which code is the best used as example/reference? I tried to align > my code very close to the LM3630, but you gave me a bunch of comments on > that ;-). And would you like see patches cleaning up some of the code > with bad/outdated style? There is no such reference, except example-schema. Usually newest bindings, which passed review, are the best source. Best regards, Krzysztof
Hi, On Sat, Mar 09, 2024 at 01:22:28PM +0100, Krzysztof Kozlowski wrote: > LED strings are true in case of... well, LED strings, but I just > wonder if such setup is applicable for backlight. Anyway, if you > think it is, I don't mind. LED strings are being used as backlight. Either from the edge, like shown here: https://en.wikipedia.org/wiki/File:IPod_Touch_2G_Backlight.JPG or like this: https://de.wikipedia.org/wiki/Datei:DiodyTV.jpg Greetings, -- Sebastian
On 09/03/2024 19:49, Sebastian Reichel wrote: > Hi, > > On Sat, Mar 09, 2024 at 01:22:28PM +0100, Krzysztof Kozlowski wrote: >> LED strings are true in case of... well, LED strings, but I just >> wonder if such setup is applicable for backlight. Anyway, if you >> think it is, I don't mind. > > LED strings are being used as backlight. Either from the edge, like > shown here: > > https://en.wikipedia.org/wiki/File:IPod_Touch_2G_Backlight.JPG > > or like this: > > https://de.wikipedia.org/wiki/Datei:DiodyTV.jpg Indeed, thanks for sharing! Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml b/Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml new file mode 100644 index 000000000000..84ffd12d2f8e --- /dev/null +++ b/Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml @@ -0,0 +1,138 @@ +# 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 <paroga@paroga.com> + +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 + +required: + - compatible + - reg + +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: + maxItems: 1 + + led-sources: + allOf: + - minItems: 1 + maxItems: 2 + items: + minimum: 0 + maximum: 1 + + default-brightness: + minimum: 0 + maximum: 31 + + max-brightness: + minimum: 0 + maximum: 31 + + required: + - reg + + unevaluatedProperties: false + +unevaluatedProperties: 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>; + }; + }; + };
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 <paroga@paroga.com> --- Changes in v2: Add device tree nodes for each output Addressed multiple smaller review comments v1: https://lore.kernel.org/all/20240302212757.1871164-1-paroga@paroga.com/ .../bindings/leds/backlight/ti,lm3509.yaml | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/backlight/ti,lm3509.yaml