[PATCH 3/5] drm/panel/samsung-sofef00: make gpio optional

Bjorn Andersson bjorn.andersson at linaro.org
Tue Jul 20 16:03:03 UTC 2021


On Tue 20 Jul 10:33 CDT 2021, Caleb Connolly wrote:

> The OnePlus 6T panel fails to initialise if it has been reset,
> workaround this by allowing panels to not specify a reset GPIO.
> 
> Signed-off-by: Caleb Connolly <caleb at connolly.tech>
> ---
>  drivers/gpu/drm/panel/panel-samsung-sofef00.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
> index 8cb1853574bb..a20a5af14653 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
> @@ -44,6 +44,8 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
> 
>  static void sofef00_panel_reset(struct sofef00_panel *ctx)
>  {
> +	if (!ctx->reset_gpio)

gpiod_set_value_cansleep(NULL, 1) is a perfectly valid nop, so I don't
think you need to make this conditional.

That said, don't you need this to get the panel out of reset once you
apply power after it being powered off?

> +		return;
>  	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
>  	usleep_range(5000, 6000);
>  	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> @@ -137,7 +139,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
>  	ret = sofef00_panel_on(ctx);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to initialize panel: %d\n", ret);
> -		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> +		if (ctx->reset_gpio)

Ditto.


Regards,
Bjorn

> +			gpiod_set_value_cansleep(ctx->reset_gpio, 1);
>  		return ret;
>  	}
> 
> @@ -276,7 +279,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
>  		return ret;
>  	}
> 
> -	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> +	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>  	if (IS_ERR(ctx->reset_gpio)) {
>  		ret = PTR_ERR(ctx->reset_gpio);
>  		dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);
> --
> 2.32.0
> 
> 


More information about the dri-devel mailing list