From nobody Mon Feb 9 16:52:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB8DEB64DA for ; Thu, 22 Jun 2023 09:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232396AbjFVJbd (ORCPT ); Thu, 22 Jun 2023 05:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232358AbjFVJ3w (ORCPT ); Thu, 22 Jun 2023 05:29:52 -0400 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47C8D4C37 for ; Thu, 22 Jun 2023 02:22:46 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:991a:a831:ea4b:6058]) by baptiste.telenet-ops.be with bizsmtp id C9Nj2A0031yfRTD019Njq8; Thu, 22 Jun 2023 11:22:43 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qCGWX-000Bvb-EC; Thu, 22 Jun 2023 11:22:43 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qCGWZ-003Vw1-0Y; Thu, 22 Jun 2023 11:22:43 +0200 From: Geert Uytterhoeven To: Laurent Pinchart , Kieran Bingham , David Airlie , Daniel Vetter , Thomas Zimmermann , Magnus Damm Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 06/39] drm: renesas: shmobile: Add support for Runtime PM Date: Thu, 22 Jun 2023 11:21:18 +0200 Message-Id: <742b3351c1aed1f546ac2dcc1de15e0d04cc24d4.1687423204.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 instead. Signed-off-by: Geert Uytterhoeven --- drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c | 11 ++++++++++- drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c b/drivers/gp= u/drm/renesas/shmobile/shmob_drm_crtc.c index fbfd906844da490c..84dbf35025d7be63 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 @@ =20 #include #include +#include =20 #include #include @@ -170,10 +171,16 @@ static void shmob_drm_crtc_start(struct shmob_drm_crt= c *scrtc) if (WARN_ON(format =3D=3D NULL)) return; =20 + ret =3D pm_runtime_resume_and_get(sdev->dev); + if (ret) + return; + /* Enable clocks before accessing the hardware. */ ret =3D shmob_drm_clk_on(sdev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put(sdev->dev); return; + } =20 /* Reset and enable the LCDC. */ lcdc_write(sdev, LDCNT2R, lcdc_read(sdev, LDCNT2R) | LDCNT2R_BR); @@ -271,6 +278,8 @@ static void shmob_drm_crtc_stop(struct shmob_drm_crtc *= scrtc) /* Stop clocks. */ shmob_drm_clk_off(sdev); =20 + pm_runtime_put(sdev->dev); + scrtc->started =3D false; } =20 diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu= /drm/renesas/shmobile/shmob_drm_drv.c index 30493ce874192e3e..4f01caa119637032 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c @@ -13,6 +13,7 @@ #include #include #include +#include #include =20 #include @@ -216,6 +217,10 @@ static int shmob_drm_probe(struct platform_device *pde= v) if (IS_ERR(sdev->mmio)) return PTR_ERR(sdev->mmio); =20 + ret =3D devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; + ret =3D shmob_drm_setup_clocks(sdev, pdata->clk_source); if (ret < 0) return ret; --=20 2.34.1