Thread (7 messages) 7 messages, 3 authors, 2021-08-19

Re: [PATCH] drm/stm: ltdc: improve pm_runtime to stop clocks

From: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Date: 2021-07-02 09:23:44
Also in: dri-devel, lkml

Hello Marek,


Sorry for the late answer.


On 6/30/21 2:35 AM, Marek Vasut wrote:
On 6/29/21 1:58 PM, Raphael GALLAIS-POU - foss wrote:

[...]
quoted
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -425,10 +425,17 @@ static void ltdc_crtc_atomic_enable(struct 
drm_crtc *crtc,
  {
      struct ltdc_device *ldev = crtc_to_ltdc(crtc);
      struct drm_device *ddev = crtc->dev;
+    int ret;
        DRM_DEBUG_DRIVER("\n");
  -    pm_runtime_get_sync(ddev->dev);
+    if (!pm_runtime_active(ddev->dev)) {
+        ret = pm_runtime_get_sync(ddev->dev);
All these if (!pm_runtime_active()) then pm_runtime_get_sync() calls 
look like workaround for some larger issue. Shouldn't the pm_runtime 
do some refcounting on its own , so this shouldn't be needed ?

This problem purely comes from the driver internals, so I don't think it 
is a workaround.

Because of the "ltdc_crtc_mode_set_nofb" function which does not have 
any "symmetrical" call, such as enable/disable functions, there was two 
calls to pm_runtime_get_sync against one call to pm_runtime_put_sync.

This instability resulted in the LTDC clocks being always enabled, even 
when the peripheral was disabled. This could be seen in the clk_summary 
as explained in the patch summary among other things.

By doing so, we first check if the clocks are not already activated, and 
in that case we call pm_runtime_get_sync.



Regards,

Raphaël G-P


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help