mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	a.hajda@samsung.com
Cc: narmstrong@baylibre.com, robert.foss@linaro.org,
	Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se,
	jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, kernel@collabora.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] drm/bridge: parade-ps8640: Perform full poweroff if poweron fails
Date: Wed, 10 Nov 2021 14:48:27 +0200	[thread overview]
Message-ID: <6a1ee7d7-abc7-ed9f-fca0-91a0950b13a8@collabora.com> (raw)
In-Reply-To: <20211102093618.114928-3-angelogioacchino.delregno@collabora.com>



On 02.11.21 11:36, AngeloGioacchino Del Regno wrote:
> In function ps8640_bridge_poweron(), in case of a failure not relative
> to the regulators enablement, the code was disabling the regulators but
> the gpio changes that happened during the poweron sequence were not
> being reverted back to a clean poweroff state.
> 
> Since it is expected that, when we enter ps8640_bridge_poweron(), the
> powerdown and reset GPIOs are both in active state exactly as they were
> left in the poweroff function before, we can simply call function
> __ps8640_bridge_poweroff() in the failure case, reverting every change
> that was done during the power on sequence.
> 
> Of course it was chosen to call the poweroff function instead of adding
> code to revert the GPIO changes to the poweron one to avoid duplicating
> code, as we would be doing exactly what the poweroff function does.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

> ---
>   drivers/gpu/drm/bridge/parade-ps8640.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
> index 41f5d511d516..ef1b51d8b676 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8640.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -344,7 +344,7 @@ static int ps8640_bridge_poweron(struct ps8640 *ps_bridge)
>   
>   	if (ret < 0) {
>   		DRM_ERROR("failed read PAGE2_GPIO_H: %d\n", ret);
> -		goto err_regulators_disable;
> +		goto err_poweroff;
>   	}
>   
>   	msleep(50);
> @@ -360,23 +360,22 @@ static int ps8640_bridge_poweron(struct ps8640 *ps_bridge)
>   	ret = regmap_update_bits(map, PAGE2_MCS_EN, MCS_EN, 0);
>   	if (ret < 0) {
>   		DRM_ERROR("failed write PAGE2_MCS_EN: %d\n", ret);
> -		goto err_regulators_disable;
> +		goto err_poweroff;
>   	}
>   
>   	/* Switch access edp panel's edid through i2c */
>   	ret = regmap_write(map, PAGE2_I2C_BYPASS, I2C_BYPASS_EN);
>   	if (ret < 0) {
>   		DRM_ERROR("failed write PAGE2_I2C_BYPASS: %d\n", ret);
> -		goto err_regulators_disable;
> +		goto err_poweroff;
>   	}
>   
>   	ps_bridge->powered = true;
>   
>   	return 0;
>   
> -err_regulators_disable:
> -	regulator_bulk_disable(ARRAY_SIZE(ps_bridge->supplies),
> -			       ps_bridge->supplies);
> +err_poweroff:
> +	__ps8640_bridge_poweroff(ps_bridge);
>   
>   	return ret;
>   }
> 

  reply	other threads:[~2021-11-10 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02  9:36 [PATCH v2 1/3] drm/bridge: parade-ps8640: Don't try to enable VDO " AngeloGioacchino Del Regno
2021-11-02  9:36 ` [PATCH v2 2/3] drm/bridge: parade-ps8640: Move real poweroff action to new function AngeloGioacchino Del Regno
2021-11-10 12:44   ` Dafna Hirschfeld
2021-11-10 12:46     ` AngeloGioacchino Del Regno
2021-11-19 13:19       ` Robert Foss
2021-11-19 15:08         ` AngeloGioacchino Del Regno
2021-11-02  9:36 ` [PATCH v2 3/3] drm/bridge: parade-ps8640: Perform full poweroff if poweron fails AngeloGioacchino Del Regno
2021-11-10 12:48   ` Dafna Hirschfeld [this message]
2021-11-10 12:42 ` [PATCH v2 1/3] drm/bridge: parade-ps8640: Don't try to enable VDO " Dafna Hirschfeld

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=6a1ee7d7-abc7-ed9f-fca0-91a0950b13a8@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=robert.foss@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®