Skip to content

Commit 44e1655

Browse files
committed
dt-bindings: backlight: Convert common backlight bindings to DT schema
Convert the common GPIO, LED, and PWM backlight bindings to DT schema format. Given there's only 2 common properties and the descriptions are slightly different, I opted to not create a common backlight schema. Cc: Lee Jones <[email protected]> Cc: Daniel Thompson <[email protected]> Cc: Jingoo Han <[email protected]> Cc: Sam Ravnborg <[email protected]> Acked-by: Sam Ravnborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 038fb87 commit 44e1655

File tree

6 files changed

+202
-105
lines changed

6 files changed

+202
-105
lines changed

Documentation/devicetree/bindings/leds/backlight/gpio-backlight.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/backlight/gpio-backlight.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: gpio-backlight bindings
8+
9+
maintainers:
10+
- Lee Jones <[email protected]>
11+
- Daniel Thompson <[email protected]>
12+
- Jingoo Han <[email protected]>
13+
14+
properties:
15+
compatible:
16+
const: gpio-backlight
17+
18+
gpios:
19+
description: The gpio that is used for enabling/disabling the backlight.
20+
maxItems: 1
21+
22+
default-on:
23+
description: enable the backlight at boot.
24+
type: boolean
25+
26+
required:
27+
- compatible
28+
- gpios
29+
30+
additionalProperties: false
31+
32+
examples:
33+
- |
34+
#include <dt-bindings/gpio/gpio.h>
35+
backlight {
36+
compatible = "gpio-backlight";
37+
gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;
38+
default-on;
39+
};
40+
41+
...

Documentation/devicetree/bindings/leds/backlight/led-backlight.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/backlight/led-backlight.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: led-backlight bindings
8+
9+
maintainers:
10+
- Lee Jones <[email protected]>
11+
- Daniel Thompson <[email protected]>
12+
- Jingoo Han <[email protected]>
13+
14+
description:
15+
This binding is used to describe a basic backlight device made of LEDs. It
16+
can also be used to describe a backlight device controlled by the output of
17+
a LED driver.
18+
19+
properties:
20+
compatible:
21+
const: led-backlight
22+
23+
leds:
24+
description: A list of LED nodes
25+
$ref: /schemas/types.yaml#/definitions/phandle-array
26+
27+
brightness-levels:
28+
description:
29+
Array of distinct brightness levels. The levels must be in the range
30+
accepted by the underlying LED devices. This is used to translate a
31+
backlight brightness level into a LED brightness level. If it is not
32+
provided, the identity mapping is used.
33+
$ref: /schemas/types.yaml#/definitions/uint32-array
34+
35+
default-brightness-level:
36+
description:
37+
The default brightness level (index into the array defined by the
38+
"brightness-levels" property).
39+
$ref: /schemas/types.yaml#/definitions/uint32
40+
41+
required:
42+
- compatible
43+
- leds
44+
45+
additionalProperties: false
46+
47+
examples:
48+
- |
49+
backlight {
50+
compatible = "led-backlight";
51+
52+
leds = <&led1>, <&led2>;
53+
brightness-levels = <0 4 8 16 32 64 128 255>;
54+
default-brightness-level = <6>;
55+
};
56+
57+
...

Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt

Lines changed: 0 additions & 61 deletions
This file was deleted.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/backlight/pwm-backlight.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: pwm-backlight bindings
8+
9+
maintainers:
10+
- Lee Jones <[email protected]>
11+
- Daniel Thompson <[email protected]>
12+
- Jingoo Han <[email protected]>
13+
14+
properties:
15+
compatible:
16+
const: pwm-backlight
17+
18+
pwms:
19+
maxItems: 1
20+
21+
pwm-names: true
22+
23+
power-supply:
24+
description: regulator for supply voltage
25+
26+
enable-gpios:
27+
description:
28+
Contains a single GPIO specifier for the GPIO which enables and disables
29+
the backlight.
30+
maxItems: 1
31+
32+
post-pwm-on-delay-ms:
33+
description:
34+
Delay in ms between setting an initial (non-zero) PWM and enabling the
35+
backlight using GPIO.
36+
37+
pwm-off-delay-ms:
38+
description:
39+
Delay in ms between disabling the backlight using GPIO and setting PWM
40+
value to 0.
41+
42+
brightness-levels:
43+
description:
44+
Array of distinct brightness levels. Typically these are in the range
45+
from 0 to 255, but any range starting at 0 will do. The actual brightness
46+
level (PWM duty cycle) will be interpolated from these values. 0 means a
47+
0% duty cycle (darkest/off), while the last value in the array represents
48+
a 100% duty cycle (brightest).
49+
$ref: /schemas/types.yaml#/definitions/uint32-array
50+
51+
default-brightness-level:
52+
description:
53+
The default brightness level (index into the array defined by the
54+
"brightness-levels" property).
55+
$ref: /schemas/types.yaml#/definitions/uint32
56+
57+
num-interpolated-steps:
58+
description:
59+
Number of interpolated steps between each value of brightness-levels
60+
table. This way a high resolution pwm duty cycle can be used without
61+
having to list out every possible value in the brightness-level array.
62+
$ref: /schemas/types.yaml#/definitions/uint32
63+
64+
dependencies:
65+
default-brightness-level: [brightness-levels]
66+
num-interpolated-steps: [brightness-levels]
67+
68+
required:
69+
- compatible
70+
- pwms
71+
- power-supply
72+
73+
additionalProperties: false
74+
75+
examples:
76+
- |
77+
backlight {
78+
compatible = "pwm-backlight";
79+
pwms = <&pwm 0 5000000>;
80+
81+
brightness-levels = <0 4 8 16 32 64 128 255>;
82+
default-brightness-level = <6>;
83+
84+
power-supply = <&vdd_bl_reg>;
85+
enable-gpios = <&gpio 58 0>;
86+
post-pwm-on-delay-ms = <10>;
87+
pwm-off-delay-ms = <10>;
88+
};
89+
90+
- |
91+
// Example using num-interpolation-steps:
92+
backlight {
93+
compatible = "pwm-backlight";
94+
pwms = <&pwm 0 5000000>;
95+
96+
brightness-levels = <0 2048 4096 8192 16384 65535>;
97+
num-interpolated-steps = <2048>;
98+
default-brightness-level = <4096>;
99+
100+
power-supply = <&vdd_bl_reg>;
101+
enable-gpios = <&gpio 58 0>;
102+
};
103+
104+
...

0 commit comments

Comments
 (0)