[PATCH] drm/tilcdc: do the complete reset sequence if the LCDC is enabled

Jyri Sarha jsarha at ti.com
Mon Apr 10 11:15:48 UTC 2017


On 03/28/17 11:11, Emiliano Ingrassia wrote:
> If the LCD controller was already enabled (e.g. by the bootloader),
> do the complete software reset sequence to avoid time out while loading
> the palette and a consequent time out waiting for vblank.
> 
> Signed-off-by: Emiliano Ingrassia <ingrassia at epigenesys.com>

Thanks for the patch, and sorry that I did not respond to you earlier.

The issue is obviously real, but I do not like duplicating the already
existing code for CRTC disable irq enable. Another issue is making the
check every time the CRTC is turned on.

I'll send a patch of my own to try to fix the issue shortly. Could you
spare time to test it if it fixes the issue on your platform?

Best regards,
Jyri

> ---
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> index 3621ff42979f..589156b2f76c 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -208,10 +208,33 @@ static void reset(struct drm_crtc *crtc)
>  {
>  	struct drm_device *dev = crtc->dev;
>  	struct tilcdc_drm_private *priv = dev->dev_private;
> +	struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
> +	int ret;
>  
>  	if (priv->rev != 2)
>  		return;
>  
> +	/*
> +	 * If the LCDC was already enabled (e.g. by the bootloader)
> +	 * do the complete software reset sequence.
> +	 */
> +	if (tilcdc_read(dev, LCDC_RASTER_CTRL_REG) & LCDC_RASTER_ENABLE) {
> +
> +		/* Enable DMA Frame Done Interrupt */
> +		tilcdc_write(dev, LCDC_INT_ENABLE_SET_REG, LCDC_FRAME_DONE);
> +		tilcdc_clear_irqstatus(dev, 0xffffffff);
> +
> +		tilcdc_crtc->frame_done = false;
> +		tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
> +
> +		ret = wait_event_timeout(tilcdc_crtc->frame_done_wq,
> +					 tilcdc_crtc->frame_done,
> +					 msecs_to_jiffies(500));
> +		if (ret == 0)
> +			dev_err(dev->dev, "%s: timeout waiting for framedone while resetting LCDC\n",
> +				__func__);
> +	}
> +
>  	tilcdc_set(dev, LCDC_CLK_RESET_REG, LCDC_CLK_MAIN_RESET);
>  	usleep_range(250, 1000);
>  	tilcdc_clear(dev, LCDC_CLK_RESET_REG, LCDC_CLK_MAIN_RESET);
> 



More information about the dri-devel mailing list