drm/tidss: Fix dss reset
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Thu, 9 Nov 2023 07:38:01 +0000 (09:38 +0200)
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Fri, 1 Dec 2023 10:04:42 +0000 (12:04 +0200)
commitbc288a927815efcf9d7f4a54d4d89c5df478c635
treeb5de79aa52f321becee56214228662d6febd4ff7
parent576d96c5c896221b5bc8feae473739469a92e144
drm/tidss: Fix dss reset

The probe function calls dispc_softreset() before runtime PM is enabled
and without enabling any of the DSS clocks. This happens to work by
luck, and we need to make sure the DSS HW is active and the fclk is
enabled.

To fix the above, add a new function, dispc_init_hw(), which does:

- pm_runtime_set_active()
- clk_prepare_enable(fclk)
- dispc_softreset().

This ensures that the reset can be successfully accomplished.

Note that we use pm_runtime_set_active(), not the normal
pm_runtime_get(). The reason for this is that at this point we haven't
enabled the runtime PM yet and also we don't want the normal resume
callback to be called: the dispc resume callback does some initial HW
setup, and it expects that the HW was off (no video ports are
streaming). If the bootloader has enabled the DSS and has set up a
boot time splash-screen, the DSS would be enabled and streaming which
might lead to issues with the normal resume callback.

Fixes: c9b2d923befd ("drm/tidss: Soft Reset DISPC on startup")
Reviewed-by: Aradhya Bhatia <a-bhatia1@ti.com>
Link: https://lore.kernel.org/r/20231109-tidss-probe-v2-8-ac91b5ea35c0@ideasonboard.com
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
drivers/gpu/drm/tidss/tidss_dispc.c