From patchwork Tue Feb 25 15:53:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11404153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1366292A for ; Tue, 25 Feb 2020 15:53:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DFDD62072D for ; Tue, 25 Feb 2020 15:53:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jVKlvRGB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFDD62072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Rdy84tPcY+3vWutsZa6Bv5bUNbpY2czL+R7zhXQvmi0=; b=jVKlvRGBOvjSoP 2X5AyyXx6reQt0dH3R+2i4G8yGMIevgAFOzMD/XtvQ5e3M8t20/O1v3yt0H7NZN/F7sPBa+ABclAX gREuZ2yeKDseysXkBD/z5L0nCDLb6OQZlCszkI0x7LDOm6coDA08ZYh0Fuk4L3D2W/SaqiYukVdcZ /X+7/J56teTRN8KA7vPciRSh7y1k1jObCvMZWUeNy3wOGpnhRq97gz+CqQcqGSAfIhGC6wYcjv7e4 wnK3+ifdhtJjiOvuyT1C4+UZL7iNBaZEUj+0CwgeSJmyWdeBAKSTh6Qt7uOA9MrJZik9ekmmpaEXy uWkBlSWrOeTY6/+hR8hw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j6cWv-0006Cs-ES; Tue, 25 Feb 2020 15:53:53 +0000 Received: from honk.sigxcpu.org ([24.134.29.49]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j6cWm-00063x-FE for linux-arm-kernel@lists.infradead.org; Tue, 25 Feb 2020 15:53:45 +0000 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 32887FB02; Tue, 25 Feb 2020 16:53:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rzxrP2PCQqbW; Tue, 25 Feb 2020 16:53:36 +0100 (CET) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 077B9405AD; Tue, 25 Feb 2020 16:53:34 +0100 (CET) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Kishon Vijay Abraham I , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , =?utf-8?q?Guido_G=C3=BCnther?= , Robert Chiras , Sam Ravnborg , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/1] phy: fsl-imx8-mipi-dphy: Hook into runtime pm Date: Tue, 25 Feb 2020 16:53:34 +0100 Message-Id: X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200225_075344_665302_0E43AA45 X-CRM114-Status: GOOD ( 14.39 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [24.134.29.49 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This allows us to shut down the mipi power domain on the SOC. The alternative would be to drop the dphy from the mipi power domain in the SOCs device tree and only have the DSI host controller visible there (and rely on the phy layer's built in runtime pm handling) but this would make the power domain dependency less explicit. Currently the pm domain can't be shut off when blanking the panel: pm_genpd_summary domain status slaves /device runtime status ---------------------------------------------------------------------- mipi on /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended while with this change we can shut down the power domain on panel blank: mipi off-0 /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended Signed-off-by: Guido Günther --- .../phy/freescale/phy-fsl-imx8-mipi-dphy.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c index 9f2c1da14f5a..75bfcc49466f 100644 --- a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c +++ b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c @@ -14,6 +14,7 @@ #include #include #include +#include #include /* DPHY registers */ @@ -93,6 +94,7 @@ struct mixel_dphy_cfg { }; struct mixel_dphy_priv { + struct device *dev; struct mixel_dphy_cfg cfg; struct regmap *regmap; struct clk *phy_ref_clk; @@ -382,6 +384,7 @@ static int mixel_dphy_power_on(struct phy *phy) ret = clk_prepare_enable(priv->phy_ref_clk); if (ret < 0) return ret; + pm_runtime_get_sync(priv->dev); phy_write(phy, PWR_ON, DPHY_PD_PLL); ret = regmap_read_poll_timeout(priv->regmap, DPHY_LOCK, locked, @@ -395,6 +398,7 @@ static int mixel_dphy_power_on(struct phy *phy) return 0; clock_disable: + pm_runtime_put(priv->dev); clk_disable_unprepare(priv->phy_ref_clk); return ret; } @@ -406,6 +410,7 @@ static int mixel_dphy_power_off(struct phy *phy) phy_write(phy, PWR_OFF, DPHY_PD_PLL); phy_write(phy, PWR_OFF, DPHY_PD_DPHY); + pm_runtime_put(priv->dev); clk_disable_unprepare(priv->phy_ref_clk); return 0; @@ -469,6 +474,7 @@ static int mixel_dphy_probe(struct platform_device *pdev) dev_dbg(dev, "phy_ref clock rate: %lu\n", clk_get_rate(priv->phy_ref_clk)); + priv->dev = dev; dev_set_drvdata(dev, priv); phy = devm_phy_create(dev, np, &mixel_dphy_phy_ops); @@ -479,12 +485,26 @@ static int mixel_dphy_probe(struct platform_device *pdev) phy_set_drvdata(phy, priv); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); - return PTR_ERR_OR_ZERO(phy_provider); + pm_runtime_enable(dev); + + return 0; +} + +static int mixel_dphy_remove(struct platform_device *pdev) +{ + struct mixel_dphy_priv *priv = platform_get_drvdata(pdev); + + pm_runtime_disable(priv->dev); + + return 0; } static struct platform_driver mixel_dphy_driver = { .probe = mixel_dphy_probe, + .remove = mixel_dphy_remove, .driver = { .name = "mixel-mipi-dphy", .of_match_table = mixel_dphy_of_match,