5b0243472c1f4f1ba77bc44368e086648f303252
[openwrt/staging/wigyori.git] /
1 From 7ec32023e6ad31c242e2acc179fd35084fa9cea5 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 21 Jan 2022 14:22:01 +0000
4 Subject: [PATCH] dtoverlays: Add pwm backlight option to
5 vc4-kms-dpi-generic
6
7 Adds the option of a PWM controlled backlight on a generic
8 DPI display.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 ---
12 arch/arm/boot/dts/overlays/README | 17 +++++++
13 .../overlays/vc4-kms-dpi-generic-overlay.dts | 51 +++++++++++++++++++
14 2 files changed, 68 insertions(+)
15
16 --- a/arch/arm/boot/dts/overlays/README
17 +++ b/arch/arm/boot/dts/overlays/README
18 @@ -3644,6 +3644,23 @@ Params: clock-frequency Display
19 value. NB also overridden by rgbXXX overrides.
20 backlight-gpio Defines a GPIO to be used for backlight control
21 (default of none).
22 + backlight-pwm Defines a PWM channel to be used for backlight
23 + control (default of none). NB Disables audio
24 + headphone output as that also uses PWM.
25 + backlight-pwm-chan Choose channel on &pwm node for backlight
26 + control.
27 + (default 0).
28 + backlight-pwm-gpio GPIO pin to be used for the PWM backlight. See
29 + pwm-2chan for valid options.
30 + (default 18 - note this can only work with
31 + rgb666-padhi).
32 + backlight-pwm-func Pin function of GPIO used for the PWM
33 + backlight.
34 + See pwm-2chan for valid options.
35 + (default 2).
36 + backlight-def-brightness
37 + Set the default brightness. Normal range 1-16.
38 + (default 16).
39
40
41 Name: vc4-kms-dsi-7inch
42 --- a/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
43 +++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
44 @@ -80,6 +80,52 @@
45 };
46 };
47
48 + fragment@4 {
49 + target = <&panel>;
50 + __dormant__ {
51 + backlight = <&backlight_pwm>;
52 + };
53 + };
54 +
55 + fragment@5 {
56 + target-path = "/";
57 + __dormant__ {
58 + backlight_pwm: backlight_pwm {
59 + compatible = "pwm-backlight";
60 + brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
61 + default-brightness-level = <16>;
62 + pwms = <&pwm 0 200000>;
63 + };
64 + };
65 + };
66 +
67 + fragment@6 {
68 + target = <&pwm>;
69 + __dormant__ {
70 + pinctrl-names = "default";
71 + pinctrl-0 = <&pwm_pins>;
72 + assigned-clock-rates = <1000000>;
73 + status = "okay";
74 + };
75 + };
76 +
77 + fragment@7 {
78 + target = <&gpio>;
79 + __dormant__ {
80 + pwm_pins: pwm_pins {
81 + brcm,pins = <18>;
82 + brcm,function = <2>; /* Alt5 */
83 + };
84 + };
85 + };
86 +
87 + fragment@8 {
88 + target = <&audio>;
89 + __dormant__ {
90 + brcm,disable-headphones;
91 + };
92 + };
93 +
94 __overrides__ {
95 clock-frequency = <&timing>, "clock-frequency:0";
96 hactive = <&timing>, "hactive:0";
97 @@ -107,5 +153,10 @@
98 bus-format = <&panel>, "bus-format:0";
99 backlight-gpio = <0>, "+2+3",
100 <&backlight>, "gpios:4";
101 + backlight-pwm = <0>, "+4+5+6+7+8";
102 + backlight-pwm-chan = <&backlight_pwm>, "pwms:4";
103 + backlight-pwm-gpio = <&pwm_pins>, "brcm,pins:0";
104 + backlight-pwm-func = <&pwm_pins>, "brcm,function:0";
105 + backlight-def-brightness = <&backlight_pwm>, "default-brightness-level:0";
106 };
107 };