Re: [PATCH v3 4/5] arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone

2020-05-29 Thread Pavel Machek
Hi!

> 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.

If it was possible to preserve lux values for individual settings in
the comment somewhere... that would be nice :-).

One day, it would be nice to have brightness settings in lux, so I
could easily set matching levels on multiple devices, for example...

Best regards,

Pavel

> +
> + {
> + power-supply = <_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>;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 4/5] arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone

2020-05-15 Thread Ondrej Jirman
From: Icenowy Zheng 

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 
Signed-off-by: Martijn Braam 
Signed-off-by: Ondrej Jirman 
---
 .../allwinner/sun50i-a64-pinephone-1.1.dts| 19 ++
 .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 35 +++
 2 files changed, 54 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
index 06a775c41664..3e99a87e9ce5 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
@@ -9,3 +9,22 @@ / {
model = "Pine64 PinePhone Braveheart (1.1)";
compatible = "pine64,pinephone-1.1", "allwinner,sun50i-a64";
 };
+
+ {
+   power-supply = <_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>;
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index cefda145c3c9..e60b57f8ac14 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -16,6 +16,13 @@ aliases {
serial0 = 
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = <_pwm 0 5 PWM_POLARITY_INVERTED>;
+   enable-gpios = < 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
+   /* Backlight configuration differs per PinePhone revision. */
+   };
+
chosen {
stdout-path = "serial0:115200n8";
};
@@ -84,6 +91,30 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dldo1>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "okay";
+
+   panel@0 {
+   compatible = "xingbangda,xbd599", "sitronix,st7703";
+   reg = <0>;
+   reset-gpios = < 3 23 GPIO_ACTIVE_LOW>; /* PD23 */
+   iovcc-supply = <_dldo2>;
+   vcc-supply = <_ldo_io0>;
+   backlight = <>;
+   };
+};
+
  {
status = "okay";
 };
@@ -188,6 +219,10 @@ _pio {
 */
 };
 
+_pwm {
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
-- 
2.26.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel