Skip to contentSkip to conversation

drm/stm: ltdc: check crtc state before enabling LIE

PATCH In review Yannick Fertre 3 participants 3 messages Jan 21, 2020 – Feb 4, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/stm: ltdc: check crtc state before enabling LIE

Following investigations of a hardware bug, the LIE interrupt can occur while the display controller is not activated. LIE interrupt (vblank) don't have to be set if the CRTC is not enabled.

---
 drivers/gpu/drm/stm/ltdc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/stm/ltdc.c +6 -1
index c2815e8..ea654c7 100644
@@ -648,9 +648,14 @@ static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
 static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
 {
 	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+	struct drm_crtc_state *state = crtc->state;
 
 	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	if (state->enable)
+		reg_set(ldev->regs, LTDC_IER, IER_LIE);
+	else
+		return -EPERM;
 
 	return 0;
 }
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw

Dear Yannick,
Thank you for your patch,

Philippe :-)

Quoted 21 lines · Yannick Fertre

Following investigations of a hardware bug, the LIE interrupt can occur while the display controller is not activated. LIE interrupt (vblank) don't have to be set if the CRTC is not enabled.

---
  drivers/gpu/drm/stm/ltdc.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/stm/ltdc.c +1 -0
index c2815e8..ea654c7 100644
@@ -648,9 +648,14 @@ static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
  static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
  {
  	struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+	struct drm_crtc_state *state = crtc->state;
 

drivers/gpu/drm/stm/ltdc.c static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = { · line 661

Quoted 10 lines
drivers/gpu/drm/stm/ltdc.c +5 -1
  	DRM_DEBUG_DRIVER("\n");
-	reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+	if (state->enable)
+		reg_set(ldev->regs, LTDC_IER, IER_LIE);
+	else
+		return -EPERM;
 
  	return 0;
  }

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
Quoted 14 lines · Philippe CORNU

Dear Yannick,
Thank you for your patch,

Philippe :-)

Quoted 5 lines · Yannick Fertre

Following investigations of a hardware bug, the LIE interrupt can occur while the display controller is not activated. LIE interrupt (vblank) don't have to be set if the CRTC is not enabled.

Applied on drm-misc-next.

Thanks
Benjamin

Quoted 23 lines
Quoted 23 lines
---
  drivers/gpu/drm/stm/ltdc.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/stm/ltdc.c +6 -1
index c2815e8..ea654c7 100644
@@ -648,9 +648,14 @@ static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = {
  static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
  {
      struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+     struct drm_crtc_state *state = crtc->state;
 
      DRM_DEBUG_DRIVER("\n");
-     reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+     if (state->enable)
+             reg_set(ldev->regs, LTDC_IER, IER_LIE);
+     else
+             return -EPERM;
 
Quoted 7 lines

drivers/gpu/drm/stm/ltdc.c static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = { · line 661

Quoted 3 lines
drivers/gpu/drm/stm/ltdc.c +0 -0
      return 0;
  }

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel