Skip to content

Commit

Permalink
drm/stm: ltdc: reset ltdc on crtc enable
Browse files Browse the repository at this point in the history
To avoid any blocking point between uboot and the kernel,
ltdc must be reset. To have a continuous display,
the reset is conditional on the boolean "default-on".
The reset must be done when activating the crtc.

Change-Id: I1f8c31087ea28fab4ff56400f1aa863541ed08c3
Signed-off-by: Yannick Fertre <[email protected]>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/416185
  • Loading branch information
Yannick Fertre authored and fourmone committed Nov 4, 2024
1 parent 49ba6ad commit 3682d60
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
21 changes: 15 additions & 6 deletions drivers/gpu/drm/stm/ltdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,18 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,

DRM_DEBUG_DRIVER("\n");

if (pm_runtime_active(ddev->dev))
if (pm_runtime_active(ddev->dev)) {
if (!IS_ERR(ldev->rstc)) {
reset_control_assert(ldev->rstc);
usleep_range(10, 20);
reset_control_deassert(ldev->rstc);
}

/* Wait a while to clear the current display */
mdelay(30);

pm_runtime_put_sync_suspend(ddev->dev);
}

/* get encoder from crtc */
drm_for_each_encoder(en_iter, ddev)
Expand Down Expand Up @@ -2413,7 +2423,6 @@ int ltdc_load(struct drm_device *ddev)
struct drm_bridge *bridge;
struct drm_panel *panel;
struct drm_crtc *crtc;
struct reset_control *rstc;
struct resource *res;
int irq, i, nb_endpoints;
int ret = -ENODEV;
Expand Down Expand Up @@ -2472,7 +2481,7 @@ int ltdc_load(struct drm_device *ddev)
}
}

rstc = devm_reset_control_get_exclusive(dev, NULL);
ldev->rstc = devm_reset_control_get_exclusive(dev, NULL);

mutex_init(&ldev->err_lock);

Expand All @@ -2483,10 +2492,10 @@ int ltdc_load(struct drm_device *ddev)
* remain activated and reset shouldn't be done
*/
if (!def_value) {
if (!IS_ERR(rstc)) {
reset_control_assert(rstc);
if (!IS_ERR(ldev->rstc)) {
reset_control_assert(ldev->rstc);
usleep_range(10, 20);
reset_control_deassert(rstc);
reset_control_deassert(ldev->rstc);
}
}

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/stm/ltdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct ltdc_device {
u32 crc;
u32 max_burst_length;
struct reserved_mem *rot_mem;
struct reset_control *rstc;
struct stm32_firewall firewall[LTDC_MAX_FIREWALL];
bool plane_enabled[LTDC_MAX_LAYER];
};
Expand Down

0 comments on commit 3682d60

Please sign in to comment.