All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Jagan Teki <jagan@amarulasolutions.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>, Peter Geis <pgwipeout@gmail.com>
Cc: dri-devel@lists.freedesktop.org, Peter Geis <pgwipeout@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: make reset gpio optional
Date: Mon, 31 Jan 2022 01:03:35 +0100	[thread overview]
Message-ID: <4380260.tF47cCTlra@diego> (raw)
In-Reply-To: <20220107051335.3812535-3-pgwipeout@gmail.com>

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);
> 





WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: Jagan Teki <jagan@amarulasolutions.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>, Peter Geis <pgwipeout@gmail.com>
Cc: Peter Geis <pgwipeout@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: make reset gpio optional
Date: Mon, 31 Jan 2022 01:03:35 +0100	[thread overview]
Message-ID: <4380260.tF47cCTlra@diego> (raw)
In-Reply-To: <20220107051335.3812535-3-pgwipeout@gmail.com>

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);
> 





  reply	other threads:[~2022-01-31  0:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-07  5:13 ` Peter Geis
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
2022-01-07  5:13   ` [PATCH 1/4] dt-bindings: display: panel: feiyang, fy07024di26a30d: " Peter Geis
2022-01-12  1:48   ` [PATCH 1/4] dt-bindings: display: panel: feiyang,fy07024di26a30d: " Rob Herring
2022-01-12  1:48     ` Rob Herring
2022-01-07  5:13 ` [PATCH 2/4] drm/panel: feiyang-fy07024di26a30d: " Peter Geis
2022-01-07  5:13   ` Peter Geis
2022-01-31  0:03   ` Heiko Stübner [this message]
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   ` 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
2022-01-07  5:13   ` Peter Geis
2022-01-07  5:13   ` Peter Geis
2022-01-23 15:30   ` Heiko Stuebner
2022-01-23 15:30     ` Heiko Stuebner
2022-01-23 15:30     ` Heiko Stuebner
2022-01-23 16:50     ` Peter Geis
2022-01-23 16:50       ` Peter Geis
2022-01-23 16:50       ` Peter Geis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4380260.tF47cCTlra@diego \
    --to=heiko@sntech.de \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@amarulasolutions.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pgwipeout@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.