From patchwork Wed Sep 10 09:07:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 4875301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E8CF2C0338 for ; Wed, 10 Sep 2014 09:10:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A085C200E0 for ; Wed, 10 Sep 2014 09:10:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57496200D9 for ; Wed, 10 Sep 2014 09:10:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XRdsN-0002Jb-CL; Wed, 10 Sep 2014 09:07:43 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XRdsK-0002FT-OV for linux-arm-kernel@lists.infradead.org; Wed, 10 Sep 2014 09:07:41 +0000 Received: from paszta.hi.pengutronix.de ([2001:67c:670:100:96de:80ff:fec2:9969]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1XRdrl-0001KC-3g; Wed, 10 Sep 2014 11:07:05 +0200 Message-ID: <1410340023.4508.4.camel@paszta.hi.pengutronix.de> Subject: Re: [PATCH v8 2/5] ARM: imx6: gpc: Add PU power domain for GPU/VPU From: Philipp Zabel To: Robin Gong Date: Wed, 10 Sep 2014 11:07:03 +0200 In-Reply-To: <20140910034918.GA28759@Robin-OptiPlex-780> References: <1410267915-18126-1-git-send-email-p.zabel@pengutronix.de> <1410267915-18126-3-git-send-email-p.zabel@pengutronix.de> <20140910034918.GA28759@Robin-OptiPlex-780> X-Mailer: Evolution 3.12.2-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140910_020741_023099_FC7463AB X-CRM114-Status: GOOD ( 17.14 ) X-Spam-Score: -2.5 (--) Cc: Mark Rutland , devicetree@vger.kernel.org, Ulf Hansson , Tomasz Figa , Rob Herring , Geert Uytterhoeven , kernel@pengutronix.de, Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Robin, Am Mittwoch, den 10.09.2014, 11:49 +0800 schrieb Robin Gong: > Hi Philipp, > Thanks for your great job, power domain make things clear. But looks your > patch depend on 'PU regulator', if there is no PU regulator passed down from > dts, we'll never implement your way for PGC. On i.mx6sx, there is no internal > PU regulator, so I suggest you consider this case. thank you for the hint. Would making the PU regulator optional be enough to make this work on i.MX6SX? regards Philipp ---8<--- From: Philipp Zabel Subject: [PATCH] ARM: imx6: gpc: Make PU regulator optional On i.MX6SX there is no internal PU regulator, make it optional. Signed-off-by: Philipp Zabel --- arch/arm/mach-imx/gpc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c index cdf8a06..b36703d 100644 --- a/arch/arm/mach-imx/gpc.c +++ b/arch/arm/mach-imx/gpc.c @@ -186,7 +186,8 @@ static int imx6q_pm_pu_power_off(struct generic_pm_domain *genpd) /* Wait ISO + ISO2SW IPG clock cycles */ ndelay((iso + iso2sw) * 1000 / 66); - regulator_disable(pu->reg); + if (pu->reg) + regulator_disable(pu->reg); return 0; } @@ -197,8 +198,9 @@ static int imx6q_pm_pu_power_on(struct generic_pm_domain *genpd) int i, ret, sw, sw2iso; u32 val; - ret = regulator_enable(pu->reg); - if (ret) { + if (pu->reg) + ret = regulator_enable(pu->reg); + if (pu->reg && ret) { pr_err("%s: failed to enable regulator: %d\n", __func__, ret); return ret; } @@ -309,7 +311,9 @@ static int imx_gpc_probe(struct platform_device *pdev) struct regulator *pu_reg; int ret; - pu_reg = devm_regulator_get(&pdev->dev, "pu"); + pu_reg = devm_regulator_get_optional(&pdev->dev, "pu"); + if (PTR_ERR(pu_reg) == -ENODEV) + pu_reg = NULL; if (IS_ERR(pu_reg)) { ret = PTR_ERR(pu_reg); dev_err(&pdev->dev, "failed to get pu regulator: %d\n", ret); @@ -317,8 +321,9 @@ static int imx_gpc_probe(struct platform_device *pdev) } /* The regulator is initially enabled */ - ret = regulator_enable(pu_reg); - if (ret < 0) { + if (pu_reg) + ret = regulator_enable(pu_reg); + if (pu_reg && ret < 0) { dev_err(&pdev->dev, "failed to enable pu regulator: %d\n", ret); return ret; }