From 616f73c9d3255342a037c5204ce381a4d7aa274a Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 15 Sep 2023 10:53:22 +0200 Subject: drm: renesas: shmobile: Add support for Runtime PM The SH-Mobile LCD Controller is part of a PM Domain on all relevant SoCs (clock domain on all, power domain on some). Hence it may not be sufficient to manage the LCDC module clock explicitly (e.g. if the selected clock source differs from SHMOB_DRM_CLK_BUS). Fix this by using Runtime PM for all clock handling. Add an explicit dependency on CONFIG_PM, which should already be met on all affected platforms. Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/e7359a64963bd9a4f1531c2beae850774ce140bc.1694767209.git.geert+renesas@glider.be --- drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c | 32 +++-------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c') diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c index fbfd906844da..2d9ae0c6ab7b 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -34,29 +35,6 @@ * TODO: panel support */ -/* ----------------------------------------------------------------------------- - * Clock management - */ - -static int shmob_drm_clk_on(struct shmob_drm_device *sdev) -{ - int ret; - - if (sdev->clock) { - ret = clk_prepare_enable(sdev->clock); - if (ret < 0) - return ret; - } - - return 0; -} - -static void shmob_drm_clk_off(struct shmob_drm_device *sdev) -{ - if (sdev->clock) - clk_disable_unprepare(sdev->clock); -} - /* ----------------------------------------------------------------------------- * CRTC */ @@ -170,9 +148,8 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc) if (WARN_ON(format == NULL)) return; - /* Enable clocks before accessing the hardware. */ - ret = shmob_drm_clk_on(sdev); - if (ret < 0) + ret = pm_runtime_resume_and_get(sdev->dev); + if (ret) return; /* Reset and enable the LCDC. */ @@ -268,8 +245,7 @@ static void shmob_drm_crtc_stop(struct shmob_drm_crtc *scrtc) /* Disable the display output. */ lcdc_write(sdev, LDCNT1R, 0); - /* Stop clocks. */ - shmob_drm_clk_off(sdev); + pm_runtime_put(sdev->dev); scrtc->started = false; } -- cgit v1.2.3