* [PATCH] drm/tilcdc: do the complete reset sequence if the LCDC is enabled
@ 2017-03-28 8:11 Emiliano Ingrassia
2017-04-10 11:15 ` Jyri Sarha
0 siblings, 1 reply; 2+ messages in thread
From: Emiliano Ingrassia @ 2017-03-28 8:11 UTC (permalink / raw)
To: Jyri Sarha; +Cc: Tomi Valkeinen, dri-devel
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@epigenesys.com>
---
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);
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/tilcdc: do the complete reset sequence if the LCDC is enabled
2017-03-28 8:11 [PATCH] drm/tilcdc: do the complete reset sequence if the LCDC is enabled Emiliano Ingrassia
@ 2017-04-10 11:15 ` Jyri Sarha
0 siblings, 0 replies; 2+ messages in thread
From: Jyri Sarha @ 2017-04-10 11:15 UTC (permalink / raw)
To: Emiliano Ingrassia; +Cc: Tomi Valkeinen, dri-devel
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@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);
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-10 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 8:11 [PATCH] drm/tilcdc: do the complete reset sequence if the LCDC is enabled Emiliano Ingrassia
2017-04-10 11:15 ` Jyri Sarha
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.