arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone
authorIcenowy Zheng <icenowy@aosc.io>
Thu, 2 Jul 2020 08:14:31 +0000 (10:14 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Fri, 3 Jul 2020 12:13:44 +0000 (14:13 +0200)
PinePhone uses PWM backlight and a XBD599 LCD panel over DSI for
display.

Backlight levels curve was optimized by Martijn Braam using a
lux meter.

Add its device nodes.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Martijn Braam <martijn@brixit.nl>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200702081432.1727696-2-megous@megous.com
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi

index 06a775c..3e99a87 100644 (file)
@@ -9,3 +9,22 @@
        model = "Pine64 PinePhone Braveheart (1.1)";
        compatible = "pine64,pinephone-1.1", "allwinner,sun50i-a64";
 };
+
+&backlight {
+       power-supply = <&reg_ldo_io0>;
+       /*
+        * PWM backlight circuit on this PinePhone revision was changed since
+        * 1.0, and the lowest PWM duty cycle that doesn't lead to backlight
+        * being off is around 20%. Duty cycle for the lowest brightness level
+        * also varries quite a bit between individual boards, so the lowest
+        * value here was chosen as a safe default.
+        */
+       brightness-levels = <
+               774  793  814  842
+               882  935  1003 1088
+               1192 1316 1462 1633
+               1830 2054 2309 2596
+               2916 3271 3664 4096>;
+       num-interpolated-steps = <50>;
+       default-brightness-level = <400>;
+};
index cefda14..a89425a 100644 (file)
                serial0 = &uart0;
        };
 
+       backlight: backlight {
+               compatible = "pwm-backlight";
+               pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
+               enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
+               /* Backlight configuration differs per PinePhone revision. */
+       };
+
        chosen {
                stdout-path = "serial0:115200n8";
        };
        status = "okay";
 };
 
+&de {
+       status = "okay";
+};
+
+&dphy {
+       status = "okay";
+};
+
+&dsi {
+       vcc-dsi-supply = <&reg_dldo1>;
+       status = "okay";
+
+       panel@0 {
+               compatible = "xingbangda,xbd599";
+               reg = <0>;
+               reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */
+               iovcc-supply = <&reg_dldo2>;
+               vcc-supply = <&reg_ldo_io0>;
+               backlight = <&backlight>;
+       };
+};
+
 &ehci0 {
        status = "okay";
 };
         */
 };
 
+&r_pwm {
+       status = "okay";
+};
+
 &r_rsb {
        status = "okay";