openwrt/target/linux/bcm27xx/patches-5.15/950-0665-dtoverlays-Add-pwm-backlight-option-to-vc4-kms-dpi-g.patch

108 lines
3.4 KiB
Diff
Raw Normal View History

From 7ec32023e6ad31c242e2acc179fd35084fa9cea5 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 21 Jan 2022 14:22:01 +0000
Subject: [PATCH] dtoverlays: Add pwm backlight option to
vc4-kms-dpi-generic
Adds the option of a PWM controlled backlight on a generic
DPI display.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
arch/arm/boot/dts/overlays/README | 17 +++++++
.../overlays/vc4-kms-dpi-generic-overlay.dts | 51 +++++++++++++++++++
2 files changed, 68 insertions(+)
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -3644,6 +3644,23 @@ Params: clock-frequency Display
value. NB also overridden by rgbXXX overrides.
backlight-gpio Defines a GPIO to be used for backlight control
(default of none).
+ backlight-pwm Defines a PWM channel to be used for backlight
+ control (default of none). NB Disables audio
+ headphone output as that also uses PWM.
+ backlight-pwm-chan Choose channel on &pwm node for backlight
+ control.
+ (default 0).
+ backlight-pwm-gpio GPIO pin to be used for the PWM backlight. See
+ pwm-2chan for valid options.
+ (default 18 - note this can only work with
+ rgb666-padhi).
+ backlight-pwm-func Pin function of GPIO used for the PWM
+ backlight.
+ See pwm-2chan for valid options.
+ (default 2).
+ backlight-def-brightness
+ Set the default brightness. Normal range 1-16.
+ (default 16).
Name: vc4-kms-dsi-7inch
--- a/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
+++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
@@ -80,6 +80,52 @@
};
};
+ fragment@4 {
+ target = <&panel>;
+ __dormant__ {
+ backlight = <&backlight_pwm>;
+ };
+ };
+
+ fragment@5 {
+ target-path = "/";
+ __dormant__ {
+ backlight_pwm: backlight_pwm {
+ compatible = "pwm-backlight";
+ brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
+ default-brightness-level = <16>;
+ pwms = <&pwm 0 200000>;
+ };
+ };
+ };
+
+ fragment@6 {
+ target = <&pwm>;
+ __dormant__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm_pins>;
+ assigned-clock-rates = <1000000>;
+ status = "okay";
+ };
+ };
+
+ fragment@7 {
+ target = <&gpio>;
+ __dormant__ {
+ pwm_pins: pwm_pins {
+ brcm,pins = <18>;
+ brcm,function = <2>; /* Alt5 */
+ };
+ };
+ };
+
+ fragment@8 {
+ target = <&audio>;
+ __dormant__ {
+ brcm,disable-headphones;
+ };
+ };
+
__overrides__ {
clock-frequency = <&timing>, "clock-frequency:0";
hactive = <&timing>, "hactive:0";
@@ -107,5 +153,10 @@
bus-format = <&panel>, "bus-format:0";
backlight-gpio = <0>, "+2+3",
<&backlight>, "gpios:4";
+ backlight-pwm = <0>, "+4+5+6+7+8";
+ backlight-pwm-chan = <&backlight_pwm>, "pwms:4";
+ backlight-pwm-gpio = <&pwm_pins>, "brcm,pins:0";
+ backlight-pwm-func = <&pwm_pins>, "brcm,function:0";
+ backlight-def-brightness = <&backlight_pwm>, "default-brightness-level:0";
};
};