dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Yakir Yang <ykk@rock-chips.com>
To: Sean Paul <seanpaul@chromium.org>
Cc: k.kozlowski@samsung.com, linux-samsung-soc@vger.kernel.org,
	linux-rockchip@lists.infradead.org, yzq@rock-chips.com,
	jingoohan1@gmail.com, emil.l.velikov@gmail.com,
	dianders@chromium.org, dri-devel@lists.freedesktop.org,
	tfiga@chromium.org, javier@osg.samsung.com,
	daniel.vetter@ffwll.ch, marcheu@chromium.org, treding@nvidia.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/analogix_dp: Ensure the panel is properly prepared/unprepared
Date: Mon, 1 Aug 2016 11:28:15 +0800	[thread overview]
Message-ID: <579EC1CF.9000302@rock-chips.com> (raw)
In-Reply-To: <1469819791-31860-1-git-send-email-seanpaul@chromium.org>

Sean,

On 07/30/2016 03:16 AM, Sean Paul wrote:
> Instead of just preparing the panel on bind, actually prepare/unprepare
> during modeset/disable. The panel must be prepared in order to read hpd
> status, so we need to refcount the prepares in order to ensure we don't
> accidentally turn the panel off at the wrong time.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>
>
> Hi Yakir,
> This is what I was talking about upthread. I've tested it and it seems to be working.
>
> What do you think?

Thanks for your patch, and it works. But I have introduced two 
questions, and I haven't found a way to fixed them.

> Sean
>
>
>
> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 48 +++++++++++++++++-----
>   1 file changed, 37 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 32715da..7b764a4 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -960,11 +960,27 @@ enum drm_connector_status
>   analogix_dp_detect(struct drm_connector *connector, bool force)
>   {
>   	struct analogix_dp_device *dp = to_dp(connector);
> +	enum drm_connector_status status = connector_status_disconnected;
> +	int ret;
>   
> -	if (analogix_dp_detect_hpd(dp))
> -		return connector_status_disconnected;
> +	if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
> +		ret = drm_panel_prepare(dp->plat_data->panel);
> +		if (ret) {
> +			DRM_ERROR("failed to setup panel (%d)\n", ret);
> +			return connector_status_disconnected;
> +		}
> +	}
> +
> +	if (!analogix_dp_detect_hpd(dp))
> +		status = connector_status_connected;
> +
> +	if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
> +		ret = drm_panel_unprepare(dp->plat_data->panel);
> +		if (ret)
> +			DRM_ERROR("failed to setup the panel ret = %d\n", ret);
> +	}
>   
> -	return connector_status_connected;
> +	return status;

1. Panel would flicker at system boot time. Your patch would flash the 
panel power in connector->detect() function when dp->dpms_mode isn't 
DRM_MODE_DPMS_OFF. So when userspace keep detect the connector status in 
boot time, we could see panel would flicker (light up for a while, and 
turn off again, and keep loop for several time). I have copied some 
kernel logs:


[   11.065267] YKK --------- analogix_dp_detect:1052
[   11.729596] YKK --------- analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   13.315962] YKK --------- analogix_dp_detect:1052
[   13.984702] YKK --------- analogix_dp_get_modes:1016
[   13.992977] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.004414] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.015842] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.183109] YKK --------- analogix_dp_bridge_pre_enable:1147
[   14.306301] rockchip-dp ff970000.edp: Link Training Clock Recovery 
success
[   14.319130] rockchip-dp ff970000.edp: Link Training success!
[   14.326388] rockchip-dp ff970000.edp: wait SYS_CTL_2.
[   14.437247] rockchip-dp ff970000.edp: Timeout of video streamclk ok
[   14.443585] rockchip-dp ff970000.edp: unable to config video


>   }
>   
>   static void analogix_dp_connector_destroy(struct drm_connector *connector)
> @@ -1035,6 +1051,18 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge)
>   	return 0;
>   }
>   
> +static void analogix_dp_bridge_pre_enable(struct drm_bridge *bridge)
> +{
> +	struct analogix_dp_device *dp = bridge->driver_private;
> +	int ret;
> +
> +	if (dp->plat_data->panel) {
> +		ret = drm_panel_prepare(dp->plat_data->panel);
> +		if (ret)
> +			DRM_ERROR("failed to setup the panel ret = %d\n", ret);
> +	}

2. Driver would failed to read EDID in some case. Panel would only be 
powered up in bridge->pre_enable() function which later than 
connector->get_modes() function, and this would caused DPCD transfer 
failed in analogix_dp_handle_edid(). This seem won't caused too big 
issue, cause userspace would read EDID again after bridge/encoder is 
enabled. But it's better to avoid this potential bug.


[   11.065267] YKK --------- analogix_dp_detect:1052
[   11.729596] YKK --------- analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   13.315962] YKK --------- analogix_dp_detect:1052
[   13.984702] YKK --------- analogix_dp_get_modes:1016
[   13.992977] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.004414] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.015842] rockchip-dp ff970000.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.183109] YKK --------- analogix_dp_bridge_pre_enable:1147
[   14.306301] rockchip-dp ff970000.edp: Link Training Clock Recovery 
success
[   14.319130] rockchip-dp ff970000.edp: Link Training success!
[   14.326388] rockchip-dp ff970000.edp: wait SYS_CTL_2.
[   14.437247] rockchip-dp ff970000.edp: Timeout of video streamclk ok
[   14.443585] rockchip-dp ff970000.edp: unable to config video
[   14.520565] YKK --------- analogix_dp_detect:1052
[   14.525339] YKK --------- analogix_dp_get_modes:1016
[   14.531233] rockchip-dp ff970000.edp: EDID data does not include any 
extensions.
[   15.595724] YKK --------- analogix_dp_detect:1052
[   15.600488] YKK --------- analogix_dp_get_modes:1016
[   15.606451] rockchip-dp ff970000.edp: EDID data does not include any 
extensions.
[   17.327354] YKK --------- analogix_dp_detect:1052
[   17.332105] YKK --------- analogix_dp_get_modes:1016
[   17.338171] rockchip-dp ff970000.edp: EDID data does not include any 
extensions.
[   56.236024] YKK --------- analogix_dp_detect:1052
[   56.240820] YKK --------- analogix_dp_get_modes:1016
[   56.246855] rockchip-dp ff970000.edp: EDID data does not include any 
extensions.
[   64.092477] YKK --------- analogix_dp_detect:1052
[   64.763712] YKK --------- analogix_dp_get_modes:1016



BR,
- Yakir

> +}
> +
>   static void analogix_dp_bridge_enable(struct drm_bridge *bridge)
>   {
>   	struct analogix_dp_device *dp = bridge->driver_private;
> @@ -1058,6 +1086,7 @@ static void analogix_dp_bridge_enable(struct drm_bridge *bridge)
>   static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
>   {
>   	struct analogix_dp_device *dp = bridge->driver_private;
> +	int ret;
>   
>   	if (dp->dpms_mode != DRM_MODE_DPMS_ON)
>   		return;
> @@ -1077,6 +1106,10 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
>   
>   	pm_runtime_put_sync(dp->dev);
>   
> +	ret = drm_panel_unprepare(dp->plat_data->panel);
> +	if (ret)
> +		DRM_ERROR("failed to setup the panel ret = %d\n", ret);
> +
>   	dp->dpms_mode = DRM_MODE_DPMS_OFF;
>   }
>   
> @@ -1165,9 +1198,9 @@ static void analogix_dp_bridge_nop(struct drm_bridge *bridge)
>   }
>   
>   static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
> +	.pre_enable = analogix_dp_bridge_pre_enable,
>   	.enable = analogix_dp_bridge_enable,
>   	.disable = analogix_dp_bridge_disable,
> -	.pre_enable = analogix_dp_bridge_nop,
>   	.post_disable = analogix_dp_bridge_nop,
>   	.mode_set = analogix_dp_bridge_mode_set,
>   	.attach = analogix_dp_bridge_attach,
> @@ -1333,13 +1366,6 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
>   
>   	phy_power_on(dp->phy);
>   
> -	if (dp->plat_data->panel) {
> -		if (drm_panel_prepare(dp->plat_data->panel)) {
> -			DRM_ERROR("failed to setup the panel\n");
> -			return -EBUSY;
> -		}
> -	}
> -
>   	analogix_dp_init_dp(dp);
>   
>   	ret = devm_request_threaded_irq(&pdev->dev, dp->irq,


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-08-01  3:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 13:14 [PATCH v1 1/2] drm/panel: simple-panel: add the delay timing for Sharp LQ123P1JX31 Yakir Yang
2016-07-21 13:14 ` [PATCH v1 2/2] drm/bridge: analogix_dp: turn off the panel when eDP need to disable Yakir Yang
2016-07-21 14:28   ` Sean Paul
2016-07-22  1:00     ` Yakir Yang
2016-07-22 15:03       ` Sean Paul
2016-07-28  3:28         ` Yakir Yang
2016-07-28 14:06           ` Sean Paul
2016-07-29 19:16             ` [PATCH] drm/analogix_dp: Ensure the panel is properly prepared/unprepared Sean Paul
2016-08-01  3:27               ` Yakir Yang
2016-08-01 20:20                 ` Sean Paul
2016-08-01 20:46                   ` Sean Paul
2016-08-01  3:28               ` Yakir Yang [this message]
2016-08-08 18:53               ` [PATCH v2] drm/bridge: analogix_dp: " Sean Paul
2016-08-09  2:35                 ` Yakir Yang
2016-08-09  6:05                   ` Daniel Vetter
2016-08-17  5:08                   ` Archit Taneja
2016-07-21 14:14 ` [PATCH v1.1 2/2] drm/bridge: analogix_dp: turn off the panel when eDP need to disable Yakir Yang
2016-07-21 14:30 ` [PATCH v1 1/2] drm/panel: simple-panel: add the delay timing for Sharp LQ123P1JX31 Sean Paul
2016-07-22  1:00   ` Yakir Yang

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=579EC1CF.9000302@rock-chips.com \
    --to=ykk@rock-chips.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=javier@osg.samsung.com \
    --cc=jingoohan1@gmail.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=seanpaul@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=treding@nvidia.com \
    --cc=yzq@rock-chips.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 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).