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
7 Adds the option of a PWM controlled backlight on a generic
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 arch/arm/boot/dts/overlays/README | 17 +++++++
13 .../overlays/vc4-kms-dpi-generic-overlay.dts | 51 +++++++++++++++++++
14 2 files changed, 68 insertions(+)
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
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
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
32 + backlight-pwm-func Pin function of GPIO used for the PWM
34 + See pwm-2chan for valid options.
36 + backlight-def-brightness
37 + Set the default brightness. Normal range 1-16.
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
51 + backlight = <&backlight_pwm>;
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>;
70 + pinctrl-names = "default";
71 + pinctrl-0 = <&pwm_pins>;
72 + assigned-clock-rates = <1000000>;
80 + pwm_pins: pwm_pins {
82 + brcm,function = <2>; /* Alt5 */
90 + brcm,disable-headphones;
95 clock-frequency = <&timing>, "clock-frequency:0";
96 hactive = <&timing>, "hactive:0";
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";