lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be50d7db-3455-2357-8601-501bc4b5aeb4@baylibre.com>
Date:   Fri, 30 Apr 2021 10:35:16 +0200
From:   Neil Armstrong <narmstrong@...libre.com>
To:     Liu Ying <victor.liu@....com>, dri-devel@...ts.freedesktop.org
Cc:     linux-kernel@...r.kernel.org, a.hajda@...sung.com,
        robert.foss@...aro.org, Laurent.pinchart@...asonboard.com,
        jonas@...boo.se, jernej.skrabec@...l.net, airlied@...ux.ie,
        daniel@...ll.ch, agx@...xcpu.org, robert.chiras@....com,
        linux-imx@....com
Subject: Re: [PATCH v3 3/3] drm/bridge: nwl-dsi: Get MIPI DSI controller and
 PHY ready in ->mode_set()

On 23/04/2021 11:26, Liu Ying wrote:
> Some MIPI DSI panel drivers like 'raydium,rm68200' send
> MIPI_DCS_SET_DISPLAY_ON commands in panel_funcs->prepare(), which
> requires the MIPI DSI controller and PHY to be ready beforehand.
> Without this patch, the nwl-dsi driver gets the MIPI DSI controller
> and PHY ready in bridge_funcs->atomic_pre_enable(), which happens after
> the panel_funcs->prepare().  So, this patch shifts the bridge operation
> ealier from bridge_funcs->atomic_pre_enable() to bridge_funcs->mode_set().
> This way, more MIPI DSI panels can connect to this nwl-dsi bridge.
> 
> Cc: Andrzej Hajda <a.hajda@...sung.com>
> Cc: Neil Armstrong <narmstrong@...libre.com>
> Cc: Robert Foss <robert.foss@...aro.org>
> Cc: Laurent Pinchart <Laurent.pinchart@...asonboard.com>
> Cc: Jonas Karlman <jonas@...boo.se>
> Cc: Jernej Skrabec <jernej.skrabec@...l.net>
> Cc: David Airlie <airlied@...ux.ie>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: Guido Günther <agx@...xcpu.org>
> Cc: Robert Chiras <robert.chiras@....com>
> Cc: NXP Linux Team <linux-imx@....com>
> Signed-off-by: Liu Ying <victor.liu@....com>
> ---
> v2->v3:
> * Split some changes to patch 1/3 and 2/3, to clarify changes. (Neil)
> 
> v1->v2:
> * Fix a typo in commit message - s/unchange/unchanged/
> 
>  drivers/gpu/drm/bridge/nwl-dsi.c | 28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 601ccc4a7cdc7..873995f0a7416 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -662,7 +662,7 @@ static irqreturn_t nwl_dsi_irq_handler(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> -static int nwl_dsi_enable(struct nwl_dsi *dsi)
> +static int nwl_dsi_mode_set(struct nwl_dsi *dsi)
>  {
>  	struct device *dev = dsi->dev;
>  	union phy_configure_opts *phy_cfg = &dsi->phy_cfg;
> @@ -834,7 +834,12 @@ static int nwl_dsi_bridge_atomic_check(struct drm_bridge *bridge,
>  	adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
>  	adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
>  
> -	/* Do a full modeset if crtc_state->active is changed to be true. */
> +	/*
> +	 * Do a full modeset if crtc_state->active is changed to be true.
> +	 * This ensures our ->mode_set() is called to get the DSI controller
> +	 * and the PHY ready to send DCS commands, when only the connector's
> +	 * DPMS is brought out of "Off" status.
> +	 */
>  	if (crtc_state->active_changed && crtc_state->active)
>  		crtc_state->mode_changed = true;
>  
> @@ -863,16 +868,8 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
>  
>  	memcpy(&dsi->mode, adjusted_mode, sizeof(dsi->mode));
>  	drm_mode_debug_printmodeline(adjusted_mode);
> -}
> -
> -static void
> -nwl_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> -				 struct drm_bridge_state *old_bridge_state)
> -{
> -	struct nwl_dsi *dsi = bridge_to_dsi(bridge);
> -	int ret;
>  
> -	pm_runtime_get_sync(dsi->dev);
> +	pm_runtime_get_sync(dev);
>  
>  	if (clk_prepare_enable(dsi->lcdif_clk) < 0)
>  		return;
> @@ -882,22 +879,22 @@ nwl_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>  	/* Step 1 from DSI reset-out instructions */
>  	ret = reset_control_deassert(dsi->rst_pclk);
>  	if (ret < 0) {
> -		DRM_DEV_ERROR(dsi->dev, "Failed to deassert PCLK: %d\n", ret);
> +		DRM_DEV_ERROR(dev, "Failed to deassert PCLK: %d\n", ret);
>  		return;
>  	}
>  
>  	/* Step 2 from DSI reset-out instructions */
> -	nwl_dsi_enable(dsi);
> +	nwl_dsi_mode_set(dsi);
>  
>  	/* Step 3 from DSI reset-out instructions */
>  	ret = reset_control_deassert(dsi->rst_esc);
>  	if (ret < 0) {
> -		DRM_DEV_ERROR(dsi->dev, "Failed to deassert ESC: %d\n", ret);
> +		DRM_DEV_ERROR(dev, "Failed to deassert ESC: %d\n", ret);
>  		return;
>  	}
>  	ret = reset_control_deassert(dsi->rst_byte);
>  	if (ret < 0) {
> -		DRM_DEV_ERROR(dsi->dev, "Failed to deassert BYTE: %d\n", ret);
> +		DRM_DEV_ERROR(dev, "Failed to deassert BYTE: %d\n", ret);
>  		return;
>  	}
>  }
> @@ -953,7 +950,6 @@ static const struct drm_bridge_funcs nwl_dsi_bridge_funcs = {
>  	.atomic_destroy_state	= drm_atomic_helper_bridge_destroy_state,
>  	.atomic_reset		= drm_atomic_helper_bridge_reset,
>  	.atomic_check		= nwl_dsi_bridge_atomic_check,
> -	.atomic_pre_enable	= nwl_dsi_bridge_atomic_pre_enable,
>  	.atomic_enable		= nwl_dsi_bridge_atomic_enable,
>  	.atomic_disable		= nwl_dsi_bridge_atomic_disable,
>  	.mode_set		= nwl_dsi_bridge_mode_set,
> 

Reviewed-by: Neil Armstrong <narmstrong@...libre.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ