diff mbox series

[v2,5/5] arm64: allwinner: dts: a64: add LCD-related device nodes for PinePhone

Message ID 20200316133503.144650-6-icenowy@aosc.io (mailing list archive)
State New, archived
Headers show
Series Add support for PinePhone LCD panel | expand

Commit Message

Icenowy Zheng March 16, 2020, 1:35 p.m. UTC
PinePhone uses PWM backlight and a XBD599 LCD panel over DSI for
display.

Add its device nodes.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
No changes in v2.

 .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Icenowy Zheng March 19, 2020, 2:51 p.m. UTC | #1
在 2020-03-16星期一的 21:35 +0800,Icenowy Zheng写道:
> PinePhone uses PWM backlight and a XBD599 LCD panel over DSI for
> display.
> 
> Add its device nodes.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> No changes in v2.
> 
>  .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 37
> +++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> index cefda145c3c9..96d9150423e0 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -16,6 +16,15 @@ aliases {
>  		serial0 = &uart0;
>  	};
>  
> +	backlight: backlight {
> +		compatible = "pwm-backlight";
> +		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
> +		brightness-levels = <0 16 18 20 22 24 26 29 32 35 38 42
> 46 51 56 62 68 75 83 91 100>;

Should I drop the 0 here and replace it with 14?

I have heard community complaining about setting 0 to brightness make
the screen black.

(I think in this situation bl_power or blank the DSI panel can still
totally shut down the backlight).

> +		default-brightness-level = <15>;
> +		enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
> +		power-supply = <&reg_ldo_io0>;
> +	};
> +
>  	chosen {
>  		stdout-path = "serial0:115200n8";
>  	};
> @@ -84,6 +93,30 @@ &dai {
>  	status = "okay";
>  };
>  
> +&de {
> +	status = "okay";
> +};
> +
> +&dphy {
> +	status = "okay";
> +};
> +
> +&dsi {
> +	vcc-dsi-supply = <&reg_dldo1>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	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";
>  };
> @@ -188,6 +221,10 @@ &r_pio {
>  	 */
>  };
>  
> +&r_pwm {
> +	status = "okay";
> +};
> +
>  &r_rsb {
>  	status = "okay";
>  
> -- 
> 2.24.1
>
Ondřej Jirman March 19, 2020, 4:10 p.m. UTC | #2
On Thu, Mar 19, 2020 at 10:51:36PM +0800, Icenowy Zheng wrote:
> 在 2020-03-16星期一的 21:35 +0800,Icenowy Zheng写道:
> > PinePhone uses PWM backlight and a XBD599 LCD panel over DSI for
> > display.
> > 
> > Add its device nodes.
> > 
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > ---
> > No changes in v2.
> > 
> >  .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 37
> > +++++++++++++++++++
> >  1 file changed, 37 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > index cefda145c3c9..96d9150423e0 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> > @@ -16,6 +16,15 @@ aliases {
> >  		serial0 = &uart0;
> >  	};
> >  
> > +	backlight: backlight {
> > +		compatible = "pwm-backlight";
> > +		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
> > +		brightness-levels = <0 16 18 20 22 24 26 29 32 35 38 42
> > 46 51 56 62 68 75 83 91 100>;
> 
> Should I drop the 0 here and replace it with 14?

Almost all boards in arm/boot/dts start at 0.

> I have heard community complaining about setting 0 to brightness make
> the screen black.

Level 0 (first value in the list) is special, and turns off the backlight:

123         if (brightness > 0) {
124                 pwm_get_state(pb->pwm, &state);
125                 state.duty_cycle = compute_duty_cycle(pb, brightness);
126                 pwm_apply_state(pb->pwm, &state);
127                 pwm_backlight_power_on(pb);
128         } else {
129                 pwm_backlight_power_off(pb);
130         }

	o.

> (I think in this situation bl_power or blank the DSI panel can still
> totally shut down the backlight).
> 
> > +		default-brightness-level = <15>;
> > +		enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
> > +		power-supply = <&reg_ldo_io0>;
> > +	};
> > +
> >  	chosen {
> >  		stdout-path = "serial0:115200n8";
> >  	};
> > @@ -84,6 +93,30 @@ &dai {
> >  	status = "okay";
> >  };
> >  
> > +&de {
> > +	status = "okay";
> > +};
> > +
> > +&dphy {
> > +	status = "okay";
> > +};
> > +
> > +&dsi {
> > +	vcc-dsi-supply = <&reg_dldo1>;
> > +	#address-cells = <1>;
> > +	#size-cells = <0>;
> > +	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";
> >  };
> > @@ -188,6 +221,10 @@ &r_pio {
> >  	 */
> >  };
> >  
> > +&r_pwm {
> > +	status = "okay";
> > +};
> > +
> >  &r_rsb {
> >  	status = "okay";
> >  
> > -- 
> > 2.24.1
> > 
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index cefda145c3c9..96d9150423e0 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -16,6 +16,15 @@  aliases {
 		serial0 = &uart0;
 	};
 
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
+		brightness-levels = <0 16 18 20 22 24 26 29 32 35 38 42 46 51 56 62 68 75 83 91 100>;
+		default-brightness-level = <15>;
+		enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
+		power-supply = <&reg_ldo_io0>;
+	};
+
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
@@ -84,6 +93,30 @@  &dai {
 	status = "okay";
 };
 
+&de {
+	status = "okay";
+};
+
+&dphy {
+	status = "okay";
+};
+
+&dsi {
+	vcc-dsi-supply = <&reg_dldo1>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	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";
 };
@@ -188,6 +221,10 @@  &r_pio {
 	 */
 };
 
+&r_pwm {
+	status = "okay";
+};
+
 &r_rsb {
 	status = "okay";