Message ID | 20231010121621.3009154-1-f.suligoi@asem.it (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | [v4,1/2] dt-bindings: backlight: Add MPS MP3309C | expand |
On Tue, Oct 10, 2023 at 02:16:21PM +0200, Flavio Suligoi wrote: > The Monolithic Power (MPS) MP3309C is a WLED step-up converter, featuring a > programmable switching frequency to optimize efficiency. > The brightness can be controlled either by I2C commands (called "analog" > mode) or by a PWM input signal (PWM mode). > This driver supports both modes. > > For device driver details, please refer to: > - drivers/video/backlight/mp3309c_bl.c > > The datasheet is available at: > - https://www.monolithicpower.com/en/mp3309c.html > > Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> > --- > > v4: > - remove not more used allOf keyword > - add brightness-levels and default-brightness properties > - remove max-brightness and default-brightness from required properties > - update example, adding brightness-levels and default-brightness properties > v3: > - add default value for mps,overvoltage-protection-microvolt property > - fix the example, changing from "mps,mp3309c-backlight" to "mps,mp3309c" in > compatible property > v2: > - remove useless properties (dimming-mode, pinctrl-names, pinctrl-0, > switch-on-delay-ms, switch-off-delay-ms, reset-gpios, reset-on-delay-ms, > reset-on-length-ms) > - add common.yaml# > - remove already included properties (default-brightness, max-brightness) > - substitute three boolean properties, used for the overvoltage-protection > values, with a single enum property > - remove some conditional definitions > - remove the 2nd example > v1: > - first version > > .../bindings/leds/backlight/mps,mp3309c.yaml | 82 +++++++++++++++++++ > 1 file changed, 82 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml > > diff --git a/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml b/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml > new file mode 100644 > index 000000000000..e2f9ae2b3fb4 > --- /dev/null > +++ b/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml > @@ -0,0 +1,82 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/leds/backlight/mps,mp3309c.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: MPS MP3309C backlight > + > +maintainers: > + - Flavio Suligoi <f.suligoi@asem.it> > + > +description: | > + The Monolithic Power (MPS) MP3309C is a WLED step-up converter, featuring a > + programmable switching frequency to optimize efficiency. > + It supports two different dimming modes: > + > + - analog mode, via I2C commands, as default mode (32 dimming levels) > + - PWM controlled mode (optional) > + > + The datasheet is available at: > + https://www.monolithicpower.com/en/mp3309c.html > + > +properties: > + compatible: > + const: mps,mp3309c > + > + reg: > + maxItems: 1 > + > + pwms: > + description: if present, the backlight is controlled in PWM mode. > + maxItems: 1 > + > + enable-gpios: > + description: GPIO used to enable the backlight in "analog-i2c" dimming mode. > + maxItems: 1 > + > + brightness-levels: > + description: > + Array of distinct brightness levels, in PWM dimming mode. > + Typically these are in the range from 0 to 255, but any range starting > + at 0 will do. > + The 0 value means a 0% duty cycle (darkest/off), while the last value in > + the array represents a 100% duty cycle (brightest). > + $ref: /schemas/types.yaml#/definitions/uint32-array This already has a type defined. Please add it to backlight/common.yaml and remove from led-backlight.yaml and pwm-backlight.yaml. You say 0-255 here, but your example is 0-10. One of those seems wrong. Anyways, don't define constraints in prose, use a schema: items: maximum: 10 (or 255?) > + > + default-brightness: > + description: > + The default brightness (index into the levels array). > + $ref: /schemas/types.yaml#/definitions/uint32 Already has a type. You need to reference backlight/common.yaml. > + > + mps,overvoltage-protection-microvolt: > + description: Overvoltage protection (13.5V, 24V or 35.5V). > + enum: [ 13500000, 24000000, 35500000 ] > + default: 35500000 > + > + mps,no-sync-mode: > + description: disable synchronous rectification mode > + type: boolean > + > +required: > + - compatible > + - reg > + > +unevaluatedProperties: false > + > +examples: > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + /* Backlight with PWM control */ > + backlight_pwm: backlight@17 { > + compatible = "mps,mp3309c"; > + reg = <0x17>; > + pwms = <&pwm1 0 3333333 0>; /* 300 Hz --> (1/f) * 1*10^9 */ > + brightness-levels = <0 1 2 3 4 5 6 7 8 9 10>; > + default-brightness = <8>; > + mps,overvoltage-protection-microvolt = <24000000>; > + }; > + }; > -- > 2.34.1 >
Hi Rob, ... > > .../bindings/leds/backlight/mps,mp3309c.yaml | 82 > > +++++++++++++++++++ > > 1 file changed, 82 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml > > > > diff --git > > a/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml > > b/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml > > new file mode 100644 > > index 000000000000..e2f9ae2b3fb4 > > --- /dev/null > > +++ > b/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yam > > +++ l > > @@ -0,0 +1,82 @@ > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/leds/backlight/mps,mp3309c.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: MPS MP3309C backlight > > + > > +maintainers: > > + - Flavio Suligoi <f.suligoi@asem.it> > > + > > +description: | > > + The Monolithic Power (MPS) MP3309C is a WLED step-up converter, > > +featuring a > > + programmable switching frequency to optimize efficiency. > > + It supports two different dimming modes: > > + > > + - analog mode, via I2C commands, as default mode (32 dimming > > + levels) > > + - PWM controlled mode (optional) > > + > > + The datasheet is available at: > > + https://www.monolithicpower.com/en/mp3309c.html > > + > > +properties: > > + compatible: > > + const: mps,mp3309c > > + > > + reg: > > + maxItems: 1 > > + > > + pwms: > > + description: if present, the backlight is controlled in PWM mode. > > + maxItems: 1 > > + > > + enable-gpios: > > + description: GPIO used to enable the backlight in "analog-i2c" dimming > mode. > > + maxItems: 1 > > + > > + brightness-levels: > > + description: > > + Array of distinct brightness levels, in PWM dimming mode. > > + Typically these are in the range from 0 to 255, but any range starting > > + at 0 will do. > > + The 0 value means a 0% duty cycle (darkest/off), while the last value in > > + the array represents a 100% duty cycle (brightest). > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > This already has a type defined. Please add it to backlight/common.yaml and > remove from led-backlight.yaml and pwm-backlight.yaml. Ok, I'll add common.yaml and I'll prepare two other separate patches for these. > > You say 0-255 here, but your example is 0-10. One of those seems wrong. > Anyways, don't define constraints in prose, use a schema: > > items: > maximum: 10 (or 255?) Ok, I'll add maximum, and I'll change the example, using 0..255 > > > + > > + default-brightness: > > + description: > > + The default brightness (index into the levels array). > > + $ref: /schemas/types.yaml#/definitions/uint32 > > Already has a type. You need to reference backlight/common.yaml. Ok > > > + > > + mps,overvoltage-protection-microvolt: > > + description: Overvoltage protection (13.5V, 24V or 35.5V). > > + enum: [ 13500000, 24000000, 35500000 ] > > + default: 35500000 > > + > > + mps,no-sync-mode: > > + description: disable synchronous rectification mode > > + type: boolean > > + > > +required: > > + - compatible > > + - reg > > + > > +unevaluatedProperties: false > > + > > +examples: > > + - | > > + i2c { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + /* Backlight with PWM control */ > > + backlight_pwm: backlight@17 { > > + compatible = "mps,mp3309c"; > > + reg = <0x17>; > > + pwms = <&pwm1 0 3333333 0>; /* 300 Hz --> (1/f) * 1*10^9 */ > > + brightness-levels = <0 1 2 3 4 5 6 7 8 9 10>; > > + default-brightness = <8>; > > + mps,overvoltage-protection-microvolt = <24000000>; > > + }; > > + }; > > -- > > 2.34.1 > > Thanks, Flavio
Hi Rob, just a question about led-backlight.yaml and pwm-backlight.yaml common properties. ... > > + > > + brightness-levels: > > + description: > > + Array of distinct brightness levels, in PWM dimming mode. > > + Typically these are in the range from 0 to 255, but any range starting > > + at 0 will do. > > + The 0 value means a 0% duty cycle (darkest/off), while the last value in > > + the array represents a 100% duty cycle (brightest). > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > This already has a type defined. Please add it to backlight/common.yaml and > remove from led-backlight.yaml and pwm-backlight.yaml. As well as the brightness-levels property, also the default-brightness-level is in common between led-backlight.yaml and pwm-backlight.yaml. What do you think about removing it from both led-backlight.yaml and pwm-backlight.yaml, and moving it into backlight/common.yaml? > > You say 0-255 here, but your example is 0-10. One of those seems wrong. > Anyways, don't define constraints in prose, use a schema: > > items: > maximum: 10 (or 255?) > > > + > > + default-brightness: > > + description: > > + The default brightness (index into the levels array). > > + $ref: /schemas/types.yaml#/definitions/uint32 > > Already has a type. You need to reference backlight/common.yaml. > > > + > > + mps,overvoltage-protection-microvolt: > > + description: Overvoltage protection (13.5V, 24V or 35.5V). > > + enum: [ 13500000, 24000000, 35500000 ] > > + default: 35500000 > > + > > + mps,no-sync-mode: > > + description: disable synchronous rectification mode > > + type: boolean > > + > > +required: > > + - compatible > > + - reg > > + > > +unevaluatedProperties: false > > + > > +examples: > > + - | > > + i2c { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + /* Backlight with PWM control */ > > + backlight_pwm: backlight@17 { > > + compatible = "mps,mp3309c"; > > + reg = <0x17>; > > + pwms = <&pwm1 0 3333333 0>; /* 300 Hz --> (1/f) * 1*10^9 */ > > + brightness-levels = <0 1 2 3 4 5 6 7 8 9 10>; > > + default-brightness = <8>; > > + mps,overvoltage-protection-microvolt = <24000000>; > > + }; > > + }; > > -- > > 2.34.1 > > Regards, Flavio
diff --git a/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml b/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml new file mode 100644 index 000000000000..e2f9ae2b3fb4 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/backlight/mps,mp3309c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MPS MP3309C backlight + +maintainers: + - Flavio Suligoi <f.suligoi@asem.it> + +description: | + The Monolithic Power (MPS) MP3309C is a WLED step-up converter, featuring a + programmable switching frequency to optimize efficiency. + It supports two different dimming modes: + + - analog mode, via I2C commands, as default mode (32 dimming levels) + - PWM controlled mode (optional) + + The datasheet is available at: + https://www.monolithicpower.com/en/mp3309c.html + +properties: + compatible: + const: mps,mp3309c + + reg: + maxItems: 1 + + pwms: + description: if present, the backlight is controlled in PWM mode. + maxItems: 1 + + enable-gpios: + description: GPIO used to enable the backlight in "analog-i2c" dimming mode. + maxItems: 1 + + brightness-levels: + description: + Array of distinct brightness levels, in PWM dimming mode. + Typically these are in the range from 0 to 255, but any range starting + at 0 will do. + The 0 value means a 0% duty cycle (darkest/off), while the last value in + the array represents a 100% duty cycle (brightest). + $ref: /schemas/types.yaml#/definitions/uint32-array + + default-brightness: + description: + The default brightness (index into the levels array). + $ref: /schemas/types.yaml#/definitions/uint32 + + mps,overvoltage-protection-microvolt: + description: Overvoltage protection (13.5V, 24V or 35.5V). + enum: [ 13500000, 24000000, 35500000 ] + default: 35500000 + + mps,no-sync-mode: + description: disable synchronous rectification mode + type: boolean + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + /* Backlight with PWM control */ + backlight_pwm: backlight@17 { + compatible = "mps,mp3309c"; + reg = <0x17>; + pwms = <&pwm1 0 3333333 0>; /* 300 Hz --> (1/f) * 1*10^9 */ + brightness-levels = <0 1 2 3 4 5 6 7 8 9 10>; + default-brightness = <8>; + mps,overvoltage-protection-microvolt = <24000000>; + }; + };
The Monolithic Power (MPS) MP3309C is a WLED step-up converter, featuring a programmable switching frequency to optimize efficiency. The brightness can be controlled either by I2C commands (called "analog" mode) or by a PWM input signal (PWM mode). This driver supports both modes. For device driver details, please refer to: - drivers/video/backlight/mp3309c_bl.c The datasheet is available at: - https://www.monolithicpower.com/en/mp3309c.html Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> --- v4: - remove not more used allOf keyword - add brightness-levels and default-brightness properties - remove max-brightness and default-brightness from required properties - update example, adding brightness-levels and default-brightness properties v3: - add default value for mps,overvoltage-protection-microvolt property - fix the example, changing from "mps,mp3309c-backlight" to "mps,mp3309c" in compatible property v2: - remove useless properties (dimming-mode, pinctrl-names, pinctrl-0, switch-on-delay-ms, switch-off-delay-ms, reset-gpios, reset-on-delay-ms, reset-on-length-ms) - add common.yaml# - remove already included properties (default-brightness, max-brightness) - substitute three boolean properties, used for the overvoltage-protection values, with a single enum property - remove some conditional definitions - remove the 2nd example v1: - first version .../bindings/leds/backlight/mps,mp3309c.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml