linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] add pine64 touch panel support to rockpro64
@ 2022-01-07  5:13 Peter Geis
  2022-01-07  5:13 ` [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional Peter Geis
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Peter Geis @ 2022-01-07  5:13 UTC (permalink / raw)
  Cc: Peter Geis, dri-devel, devicetree, linux-kernel,
	linux-arm-kernel, linux-rockchip

This patch series adds support for the Pine64 touch panel to the
rockpro64 single board computer.
This panel attaches to the dsi port and includes an i2c touch screen.

The first two patches involve making the reset pin to the Feiyang
fy07024di26a30d panel optional. On the rockpro64 and quartz64-a this pin
is tied to dvdd and automatically comes high when power is applied.
The third patch adds the device tree nodes to rockpro64 to permit the
panel to be used.
The fourth patch is an example patch to enable this support, tagged do
not merge as this is something for the end user to enable only when they
have the panel attached.

Peter Geis (4):
  dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio
    optional
  drm/panel: feiyang-fy07024di26a30d: make reset gpio optional
  arm64: dts: rockchip: add pine64 touch panel display to rockpro64
  arm64: dts: rockchip: enable the pine64 touch screen on rockpro64

 .../panel/feiyang,fy07024di26a30d.yaml        |  1 -
 .../boot/dts/rockchip/rk3399-rockpro64.dtsi   | 80 ++++++++++++++++++-
 .../drm/panel/panel-feiyang-fy07024di26a30d.c | 11 ++-
 3 files changed, 83 insertions(+), 9 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional
  2022-01-07  5:13 [PATCH 0/4] add pine64 touch panel support to rockpro64 Peter Geis
@ 2022-01-07  5:13 ` Peter Geis
  2022-01-12  1:48   ` Rob Herring
  2022-01-07  5:13 ` [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: " Peter Geis
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Peter Geis @ 2022-01-07  5:13 UTC (permalink / raw)
  To: Jagan Teki, Thierry Reding, Sam Ravnborg, David Airlie,
	Daniel Vetter, Rob Herring
  Cc: Peter Geis, dri-devel, devicetree, linux-kernel

Some implementations do not use the reset signal, instead tying it to dvdd.
Make the reset gpio optional to permit this.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 .../bindings/display/panel/feiyang,fy07024di26a30d.yaml          | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml b/Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml
index 95acf9e96f1c..1cf84c8dd85e 100644
--- a/Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml
+++ b/Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml
@@ -35,7 +35,6 @@ required:
   - reg
   - avdd-supply
   - dvdd-supply
-  - reset-gpios
 
 additionalProperties: false
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: make reset gpio optional
  2022-01-07  5:13 [PATCH 0/4] add pine64 touch panel support to rockpro64 Peter Geis
  2022-01-07  5:13 ` [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional Peter Geis
@ 2022-01-07  5:13 ` Peter Geis
  2022-01-31  0:03   ` Heiko Stübner
  2022-01-07  5:13 ` [PATCH 3/4] arm64: dts: rockchip: add pine64 touch panel display to rockpro64 Peter Geis
  2022-01-07  5:13 ` [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64 Peter Geis
  3 siblings, 1 reply; 9+ messages in thread
From: Peter Geis @ 2022-01-07  5:13 UTC (permalink / raw)
  To: Jagan Teki, Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter
  Cc: Peter Geis, dri-devel, linux-kernel

Some implementations do not use the reset signal, instead tying it to dvdd.
Make the reset gpio optional to permit this.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
index 581661b506f8..1c88d752b14e 100644
--- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
+++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
@@ -65,7 +65,8 @@ static int feiyang_prepare(struct drm_panel *panel)
 	/* T3 (dvdd rise + avdd start + avdd rise) T3 >= 20ms */
 	msleep(20);
 
-	gpiod_set_value(ctx->reset, 0);
+	if (ctx->reset)
+		gpiod_set_value(ctx->reset, 0);
 
 	/*
 	 * T5 + T6 (avdd rise + video & logic signal rise)
@@ -73,7 +74,8 @@ static int feiyang_prepare(struct drm_panel *panel)
 	 */
 	msleep(20);
 
-	gpiod_set_value(ctx->reset, 1);
+	if (ctx->reset)
+		gpiod_set_value(ctx->reset, 1);
 
 	/* T12 (video & logic signal rise + backlight rise) T12 >= 200ms */
 	msleep(200);
@@ -126,7 +128,8 @@ static int feiyang_unprepare(struct drm_panel *panel)
 	/* T13 (backlight fall + video & logic signal fall) T13 >= 200ms */
 	msleep(200);
 
-	gpiod_set_value(ctx->reset, 0);
+	if (ctx->reset)
+		gpiod_set_value(ctx->reset, 0);
 
 	regulator_disable(ctx->avdd);
 
@@ -211,7 +214,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
 		return PTR_ERR(ctx->avdd);
 	}
 
-	ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
+	ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->reset)) {
 		dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
 		return PTR_ERR(ctx->reset);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] arm64: dts: rockchip: add pine64 touch panel display to rockpro64
  2022-01-07  5:13 [PATCH 0/4] add pine64 touch panel support to rockpro64 Peter Geis
  2022-01-07  5:13 ` [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional Peter Geis
  2022-01-07  5:13 ` [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: " Peter Geis
@ 2022-01-07  5:13 ` Peter Geis
  2022-01-07  5:13 ` [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64 Peter Geis
  3 siblings, 0 replies; 9+ messages in thread
From: Peter Geis @ 2022-01-07  5:13 UTC (permalink / raw)
  To: Rob Herring, Heiko Stuebner
  Cc: Peter Geis, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel

The Pine64 touch panel is a panel consisting of the Feiyang fy07024di26a30d
panel with a Goodix gt911 touch screen.
Add the device tree nodes to the rockpro64 to permit attaching this display to
the device.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 .../boot/dts/rockchip/rk3399-rockpro64.dtsi   | 80 ++++++++++++++++++-
 1 file changed, 76 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
index 83db4ca67334..158befb9a48c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
@@ -20,6 +20,15 @@ chosen {
 		stdout-path = "serial2:1500000n8";
 	};
 
+	/* enable for panel backlight support */
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm0 0 1000000 0>;
+		brightness-levels = <0 4 8 16 32 64 128 255>;
+		default-brightness-level = <5>;
+		status = "disabled";
+	};
+
 	clkin_gmac: external-gmac-clock {
 		compatible = "fixed-clock";
 		clock-frequency = <125000000>;
@@ -220,6 +229,14 @@ vdd_log: vdd-log {
 		regulator-max-microvolt = <1700000>;
 		vin-supply = <&vcc5v0_sys>;
 	};
+
+	avdd: avdd {
+		compatible = "regulator-fixed";
+		regulator-name = "avdd";
+		regulator-min-microvolt = <11000000>;
+		regulator-max-microvolt = <11000000>;
+		vin-supply = <&vcc3v3_s0>;
+	};
 };
 
 &cpu_l0 {
@@ -301,6 +318,11 @@ &hdmi {
 	status = "okay";
 };
 
+/* force hdmi to vopb */
+&hdmi_in_vopl {
+	status = "disabled";
+};
+
 &hdmi_sound {
 	status = "okay";
 };
@@ -400,8 +422,6 @@ regulator-state-mem {
 
 			vcc3v0_touch: LDO_REG2 {
 				regulator-name = "vcc3v0_touch";
-				regulator-always-on;
-				regulator-boot-on;
 				regulator-min-microvolt = <3000000>;
 				regulator-max-microvolt = <3000000>;
 				regulator-state-mem {
@@ -490,8 +510,6 @@ regulator-state-mem {
 
 			vcc3v3_s0: SWITCH_REG2 {
 				regulator-name = "vcc3v3_s0";
-				regulator-always-on;
-				regulator-boot-on;
 				regulator-state-mem {
 					regulator-off-in-suspend;
 				};
@@ -565,6 +583,19 @@ fusb0: typec-portc@22 {
 		vbus-supply = <&vcc5v0_typec>;
 		status = "okay";
 	};
+
+	/* enable for pine64 touch screen support */
+	touch: touchscreen@5d {
+		compatible = "goodix,gt911";
+		reg = <0x5d>;
+		AVDD28-supply = <&vcc3v0_touch>;
+		VDDIO-supply = <&vcc3v0_touch>;
+		interrupt-parent = <&gpio4>;
+		interrupts = <RK_PD5 IRQ_TYPE_EDGE_FALLING>;
+		irq-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>;
+		status = "disabled";
+	};
 };
 
 &i2s0 {
@@ -600,6 +631,47 @@ &io_domains {
 	gpio1830-supply = <&vcc_3v0>;
 };
 
+/* enable for pine64 panel display support */
+&mipi_dsi {
+	status = "disabled";
+	clock-master;
+
+	ports {
+		mipi_out: port@1 {
+			reg = <1>;
+
+			mipi_out_panel: endpoint {
+				remote-endpoint = <&mipi_in_panel>;
+			};
+		};
+	};
+
+	mipi_panel: panel@0 {
+		compatible = "feiyang,fy07024di26a30d";
+		reg = <0>;
+		avdd-supply = <&avdd>;
+		backlight = <&backlight>;
+		dvdd-supply = <&vcc3v3_s0>;
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				mipi_in_panel: endpoint {
+					remote-endpoint = <&mipi_out_panel>;
+				};
+			};
+		};
+	};
+};
+
+/* force dsi to vopl */
+&mipi_in_vopb {
+	status="disabled";
+};
+
 &pcie0 {
 	ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
 	num-lanes = <4>;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64
  2022-01-07  5:13 [PATCH 0/4] add pine64 touch panel support to rockpro64 Peter Geis
                   ` (2 preceding siblings ...)
  2022-01-07  5:13 ` [PATCH 3/4] arm64: dts: rockchip: add pine64 touch panel display to rockpro64 Peter Geis
@ 2022-01-07  5:13 ` Peter Geis
  2022-01-23 15:30   ` Heiko Stuebner
  3 siblings, 1 reply; 9+ messages in thread
From: Peter Geis @ 2022-01-07  5:13 UTC (permalink / raw)
  To: Rob Herring, Heiko Stuebner
  Cc: Peter Geis, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel

Enable the touch screen, backlight, and dsi nodes for the Pine64 touch panel
attached to the rockpro64.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
index 158befb9a48c..f6c36fcd6db3 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
@@ -26,7 +26,7 @@ backlight: backlight {
 		pwms = <&pwm0 0 1000000 0>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <5>;
-		status = "disabled";
+		status = "okay";
 	};
 
 	clkin_gmac: external-gmac-clock {
@@ -594,7 +594,7 @@ touch: touchscreen@5d {
 		interrupts = <RK_PD5 IRQ_TYPE_EDGE_FALLING>;
 		irq-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
 		reset-gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>;
-		status = "disabled";
+		status = "okay";
 	};
 };
 
@@ -633,7 +633,7 @@ &io_domains {
 
 /* enable for pine64 panel display support */
 &mipi_dsi {
-	status = "disabled";
+	status = "okay";
 	clock-master;
 
 	ports {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional
  2022-01-07  5:13 ` [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional Peter Geis
@ 2022-01-12  1:48   ` Rob Herring
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2022-01-12  1:48 UTC (permalink / raw)
  To: Peter Geis
  Cc: David Airlie, Daniel Vetter, Rob Herring, devicetree,
	Sam Ravnborg, dri-devel, linux-kernel, Jagan Teki,
	Thierry Reding

On Fri, 07 Jan 2022 00:13:32 -0500, Peter Geis wrote:
> Some implementations do not use the reset signal, instead tying it to dvdd.
> Make the reset gpio optional to permit this.
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  .../bindings/display/panel/feiyang,fy07024di26a30d.yaml          | 1 -
>  1 file changed, 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64
  2022-01-07  5:13 ` [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64 Peter Geis
@ 2022-01-23 15:30   ` Heiko Stuebner
  2022-01-23 16:50     ` Peter Geis
  0 siblings, 1 reply; 9+ messages in thread
From: Heiko Stuebner @ 2022-01-23 15:30 UTC (permalink / raw)
  To: Rob Herring, Peter Geis
  Cc: Peter Geis, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel

Hi Peter,

Am Freitag, 7. Januar 2022, 06:13:35 CET schrieb Peter Geis:
> Enable the touch screen, backlight, and dsi nodes for the Pine64 touch panel
> attached to the rockpro64.

can you please also include me in the other patches of the series?
I.e. they introduce a new property for the display, so it's nice to know
when they get applied.

While I do agree with patch 3/4, I'm hesistant about this one.
The display/touchscreen will probably not be connected on every rockpro64
so what happens if it doesn't?

I.e are there alternative uses for the affected pins, that may get fried
when this is always enabled?

So part of me would think that an dt-overlay enabling this might be the
nicer way to go?


Heiko


> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> index 158befb9a48c..f6c36fcd6db3 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> @@ -26,7 +26,7 @@ backlight: backlight {
>  		pwms = <&pwm0 0 1000000 0>;
>  		brightness-levels = <0 4 8 16 32 64 128 255>;
>  		default-brightness-level = <5>;
> -		status = "disabled";
> +		status = "okay";
>  	};
>  
>  	clkin_gmac: external-gmac-clock {
> @@ -594,7 +594,7 @@ touch: touchscreen@5d {
>  		interrupts = <RK_PD5 IRQ_TYPE_EDGE_FALLING>;
>  		irq-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
>  		reset-gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>;
> -		status = "disabled";
> +		status = "okay";
>  	};
>  };
>  
> @@ -633,7 +633,7 @@ &io_domains {
>  
>  /* enable for pine64 panel display support */
>  &mipi_dsi {
> -	status = "disabled";
> +	status = "okay";
>  	clock-master;
>  
>  	ports {
> 





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64
  2022-01-23 15:30   ` Heiko Stuebner
@ 2022-01-23 16:50     ` Peter Geis
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Geis @ 2022-01-23 16:50 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Rob Herring, devicetree, arm-mail-list,
	open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List

On Sun, Jan 23, 2022 at 10:30 AM Heiko Stuebner <heiko@sntech.de> wrote:
>
> Hi Peter,
>
> Am Freitag, 7. Januar 2022, 06:13:35 CET schrieb Peter Geis:
> > Enable the touch screen, backlight, and dsi nodes for the Pine64 touch panel
> > attached to the rockpro64.
>
> can you please also include me in the other patches of the series?
> I.e. they introduce a new property for the display, so it's nice to know
> when they get applied.

Apologies, I use get-maintainers.pl automatically and it seems to need
some help with tagging you in some Rockchip elements.
I'll be sure to always manually include you and the rockchip mailing
list on all patches in future series of this sort.

>
> While I do agree with patch 3/4, I'm hesistant about this one.
> The display/touchscreen will probably not be connected on every rockpro64
> so what happens if it doesn't?

This was supposed to be tagged as Do-Not-Merge, but it seems I failed
to do so on the actual patch.
It's here for purely completeness and testing purposes.

>
> I.e are there alternative uses for the affected pins, that may get fried
> when this is always enabled?
>
> So part of me would think that an dt-overlay enabling this might be the
> nicer way to go?

Absolutely.

>
>
> Heiko

Thanks,
Peter

>
>
> > Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> > ---
> >  arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> > index 158befb9a48c..f6c36fcd6db3 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> > +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> > @@ -26,7 +26,7 @@ backlight: backlight {
> >               pwms = <&pwm0 0 1000000 0>;
> >               brightness-levels = <0 4 8 16 32 64 128 255>;
> >               default-brightness-level = <5>;
> > -             status = "disabled";
> > +             status = "okay";
> >       };
> >
> >       clkin_gmac: external-gmac-clock {
> > @@ -594,7 +594,7 @@ touch: touchscreen@5d {
> >               interrupts = <RK_PD5 IRQ_TYPE_EDGE_FALLING>;
> >               irq-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
> >               reset-gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>;
> > -             status = "disabled";
> > +             status = "okay";
> >       };
> >  };
> >
> > @@ -633,7 +633,7 @@ &io_domains {
> >
> >  /* enable for pine64 panel display support */
> >  &mipi_dsi {
> > -     status = "disabled";
> > +     status = "okay";
> >       clock-master;
> >
> >       ports {
> >
>
>
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: make reset gpio optional
  2022-01-07  5:13 ` [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: " Peter Geis
@ 2022-01-31  0:03   ` Heiko Stübner
  0 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2022-01-31  0:03 UTC (permalink / raw)
  To: Jagan Teki, Thierry Reding, Sam Ravnborg, David Airlie,
	Daniel Vetter, Peter Geis
  Cc: Peter Geis, dri-devel, linux-kernel

Hi Peter,

Am Freitag, 7. Januar 2022, 06:13:33 CET schrieb Peter Geis:
> Some implementations do not use the reset signal, instead tying it to dvdd.
> Make the reset gpio optional to permit this.
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> index 581661b506f8..1c88d752b14e 100644
> --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> @@ -65,7 +65,8 @@ static int feiyang_prepare(struct drm_panel *panel)
>  	/* T3 (dvdd rise + avdd start + avdd rise) T3 >= 20ms */
>  	msleep(20);
>  
> -	gpiod_set_value(ctx->reset, 0);
> +	if (ctx->reset)
> +		gpiod_set_value(ctx->reset, 0);

gpio_set_value does 
	VALIDATE_DESC_VOID(desc);

which checks for "desc" (ctx->reset in this case) to be valid and especially
not null and simply returns when this is the case.

So from what I see, we don't need all the added conditionals here and below
and would just need the switch to devm_gpiod_get_optional alone.

Heiko

>  
>  	/*
>  	 * T5 + T6 (avdd rise + video & logic signal rise)
> @@ -73,7 +74,8 @@ static int feiyang_prepare(struct drm_panel *panel)
>  	 */
>  	msleep(20);
>  
> -	gpiod_set_value(ctx->reset, 1);
> +	if (ctx->reset)
> +		gpiod_set_value(ctx->reset, 1);
>  
>  	/* T12 (video & logic signal rise + backlight rise) T12 >= 200ms */
>  	msleep(200);
> @@ -126,7 +128,8 @@ static int feiyang_unprepare(struct drm_panel *panel)
>  	/* T13 (backlight fall + video & logic signal fall) T13 >= 200ms */
>  	msleep(200);
>  
> -	gpiod_set_value(ctx->reset, 0);
> +	if (ctx->reset)
> +		gpiod_set_value(ctx->reset, 0);
>  
>  	regulator_disable(ctx->avdd);
>  
> @@ -211,7 +214,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
>  		return PTR_ERR(ctx->avdd);
>  	}
>  
> -	ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
> +	ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ctx->reset)) {
>  		dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
>  		return PTR_ERR(ctx->reset);
> 





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-31  0:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07  5:13 [PATCH 0/4] add pine64 touch panel support to rockpro64 Peter Geis
2022-01-07  5:13 ` [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: make reset gpio optional Peter Geis
2022-01-12  1:48   ` Rob Herring
2022-01-07  5:13 ` [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: " Peter Geis
2022-01-31  0:03   ` Heiko Stübner
2022-01-07  5:13 ` [PATCH 3/4] arm64: dts: rockchip: add pine64 touch panel display to rockpro64 Peter Geis
2022-01-07  5:13 ` [PATCH 4/4] arm64: dts: rockchip: enable the pine64 touch screen on rockpro64 Peter Geis
2022-01-23 15:30   ` Heiko Stuebner
2022-01-23 16:50     ` Peter Geis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).