From patchwork Thu Apr 29 07:30:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 12230541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 438F7C433ED for ; Thu, 29 Apr 2021 07:02:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 A1CED6144E for ; Thu, 29 Apr 2021 07:02:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1CED6144E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZQhtN98jr/w6xIoHezXBpJ1SwDJTHG3rcdM78Qr/8KU=; b=aaDiFuiNcAVIIsLYWQqg5Z9Vp H3zId89El2SSbowy1vMS0Ij3gGVtkmKW7Qa3GtTgxPbmNqJ0TKIwt3GrTZQJgkDLMBTk8c4vR0L8t 9vvrQD7mA1w3r8AvFr+fxb3c4Du5d7jZgp0vi5cU3HoQz478or5IKbWvuEvnv1FTGn2qqc9Xl0BkB 0ycFJoNZ076MlB6dnI1+ykVHhAldEXVjGBzR7bYunMrsbP5XrjMkLp59W5/z9W1ee4X42mBXfwCCu vIIZkYXBqAQkvaDc7UCaNQPeALPjwMOHBAgJYyZHt8cee49DDKjcFoZjRbOLVOHxiBzjuFhWpG0Uv dh3rQtJiA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lc0fP-0057kh-LH; Thu, 29 Apr 2021 07:00:55 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc0eJ-0057UJ-WD for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 06:59:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=1f+Qunlsir5qWbv5njsoGllEEToCJYtPIul9+hHO7eo=; b=QxWAUfZ0Devvj3Xo8MD7RRMnoR rmcl3AlMjPt+xXbHhTrS/8M0xeq46TBtsiEUDk1phD9t4JPum/OcVy6IQF2mMfluIEyiaxZCfI24X P6gwAmivIqw3jatMeOYHCC3uDm95c0DqXHMkMjlrvd3ROV0IUeDsB5RN6pySITiS+p+SJV42ra9SR 94LhCGitfBdxoeAwHmDOZJoVZ0ezq3Xf1b5Netji7sX9yUcdh0d9DFGw+h6HAYq9JDKw93/cg4CBK GxHeMUdNN4I4d0PRhzgfshkXApmvppMPb43xzudLzDBDrg1m4gFbglKCfDSFKalkTlBRIRSlC8pwp lf1z/yKw==; Received: from mail-db8eur05on2064.outbound.protection.outlook.com ([40.107.20.64] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lc0eH-000QJk-3E for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 06:59:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iOs5tc9tPGARcNWv1dNBwiLXmfQX6iszeHNI43YXAvBPlKE/6IxTnznMhHzOrruU2IJAls2+ONSftUe7AnUNtb9rqMvahsGZKnCtql52Nm7biegRRyAbtJhlW4TpEEOZASoHs9nlpaapm3yN8vcIiWXEcWzelYiYMVzusAIcBoGCif2gdH3ifjPmKYB7K0oJNkU8LKuCwcbv6P+FboscDhRoAvm8q72ccMnZs+HCRGk0vLOGVFyvUNOC07h/iPuZAxYftDxOvCclRRM20W9K8MA6Hm0i9muXSiXSO8KRTx0jQqfJ4ZPv25ljoWI0cKN9qWCOr2KdaLsP3IhDjh1/cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1f+Qunlsir5qWbv5njsoGllEEToCJYtPIul9+hHO7eo=; b=jMHMpDxlE5B4Nrl8i8rCaZATbOD225TF+atpFQAtSf3tTTd4SCIY4eM8xEv5l7z45Z19Ra+HPy0D91Lo9IJrrAla2k0Yy/ttnxbZq+bjNS+Zk82dEFcuC3G3KvWySDDASrriu8D9qvKJwNpHhyga6/N6ygarWgBUnvRTEURTc6xV2Zd271dd+LToAwvMDdTDQIhowJOjc28FPEQcMrO35s8uHQyXUtOffl+/kR3bI2EYBFTYBLkvbChCRP8wOKgIVLHUaW6P/iX6jqXAA6UPR3o5rlRUEDCiJGhu8bn1jWcgoMXNMhMOhRSHk6MB2SUT/BRsweKgP1+vNiqC2ZVoeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1f+Qunlsir5qWbv5njsoGllEEToCJYtPIul9+hHO7eo=; b=Il3QsT4lxLn928XMq4GQ76LeE6coq/CdVNsDYRvUDId1CTkCBFjPYShLuSb9u6zxBkldV75245raMZC9aEYHsxKhFpVZiAJo3AZQr6/xfj0fYiOgz7L8A9jN3VBIt6vxMFNLMXwLhSDVXwiu77aJV4pz8QKvbT7+QfjsnZeJXdg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB7PR04MB5468.eurprd04.prod.outlook.com (2603:10a6:10:86::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.25; Thu, 29 Apr 2021 06:59:39 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::45b9:c993:87ec:9a64%8]) with mapi id 15.20.4065.023; Thu, 29 Apr 2021 06:59:39 +0000 From: "Peng Fan (OSS)" To: robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, p.zabel@pengutronix.de, l.stach@pengutronix.de, krzk@kernel.org, agx@sigxcpu.org, marex@denx.de, andrew.smirnov@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ping.bai@nxp.com, frieder.schrempf@kontron.de, aford173@gmail.com, abel.vesa@nxp.com Subject: [PATCH 06/16] soc: imx: gpcv2: add runtime PM support for power-domains Date: Thu, 29 Apr 2021 15:30:40 +0800 Message-Id: <20210429073050.21039-7-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210429073050.21039-1-peng.fan@oss.nxp.com> References: <20210429073050.21039-1-peng.fan@oss.nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR02CA0208.apcprd02.prod.outlook.com (2603:1096:201:20::20) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from linux-1xn6.ap.freescale.net (119.31.174.71) by HK2PR02CA0208.apcprd02.prod.outlook.com (2603:1096:201:20::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.29 via Frontend Transport; Thu, 29 Apr 2021 06:59:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 987293ba-39b5-4c8c-9a2f-08d90adc5b61 X-MS-TrafficTypeDiagnostic: DB7PR04MB5468: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:454; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DibhZkSB8uX8TINSuuv8KdTPrOPVMXjbGtfzpfJAgt5q1ASjLiBA3JKHYzJNblMvpT3Q1kK338pTHbA75e2dThBaWUihwNrzgbs7I0Ha6K+adSnIO+rCuVikNJWdv5hvLNHGHkknUAuPA7CFmYlMOzC19qQHS/RxarqTTYgRqi6DcFOCEklvwhwGm2IkcX+V1UjrKLS+U7sil/VmTxsFbkhdLBMRJ7aqtkvtRHohd1934hP7HWyFRQpItdxGdoA2GU8/f1mFOrVSXP6gr0AFar7o4L5mtpHbKzCgqhMcFjKLT5U2m3kVkfkfUWmAxm45NiMrGb6tA0qmo7yCk2N30nQ2X/gV7ErUhYeJQfMMcQ1NNmEVNkV9N+GZA8D42u4W6wDt0R71nL81h5JwKOUwVxU89YDnmUal7Zbw4LlWwdd3rCPTfKDwun8ABY5DyBjvzMhu9Eo3dU+/6C/khpm7mHNoptd267WA1gYRt5itdMKcLYkg1mgZzsTx3dFunsd1s6HR24xw/AGnb8laZ4iYR8T/r2R9lqoO2yEGYv9yZZYFc6W3qD6VclmN3rliupL6iI1y8PDc/K1MV9QklLHoljR0rh6aQmGaSpkD/MhIwkfTLa5HO303TyUAqDnS/sJ6bCV5X7e2/4PAmzZcVyvKSoQkL1ysiVAk/4BduWFUtvg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(376002)(39860400002)(346002)(136003)(2906002)(8936002)(4326008)(52116002)(38100700002)(38350700002)(6666004)(956004)(6512007)(83380400001)(8676002)(66946007)(66476007)(16526019)(2616005)(1076003)(6506007)(186003)(6486002)(66556008)(7416002)(478600001)(5660300002)(26005)(316002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: K8fmMoJXrgs3E0a0wkJ8Oc+PBVnjeyeLHSrBjKHVOKNgU5nW8aJtjL3u2/QY2UUjhl4QypW9/p9T+o1bv+2B+M1+SRxbTcpym2WgEjyuxH3aywLgSrkQmi9sAzqgkA0DiKgd5jJAdHO8d1PiONak751r+29YLAT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kWAh/vmmosqFYj6m61SV7Pi8ERZ0aqMvrxfpGECCislAO1xz28M8s0NH7ODPeCoFpw7vxGH/CvhXIomdHi5ARTNYt3p3irsE4R4kAC0yrcYUMtAHVyN X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 987293ba-39b5-4c8c-9a2f-08d90adc5b61 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 06:59:39.3651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pfdsM7ja41voJg3iL6hq7TtHLNXJITznfUcbyYz3L5fpiQwj4Z/JurT8+/LK5N/cYoZtqDWiAfSK1UW3sM7QGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5468 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_235945_164643_B1E312BF X-CRM114-Status: GOOD ( 12.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Lucas Stach This allows to nest domains into other power domains and have the parent domain powered up/down as required by the child domains. Signed-off-by: Lucas Stach Reviewed-by: Frieder Schrempf --- drivers/soc/imx/gpcv2.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index d27025e37a9e..87165619a689 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -141,11 +142,17 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd) u32 reg_val; int ret; + ret = pm_runtime_get_sync(domain->dev); + if (ret) { + pm_runtime_put_noidle(domain->dev); + return ret; + } + if (!IS_ERR(domain->regulator)) { ret = regulator_enable(domain->regulator); if (ret) { dev_err(domain->dev, "failed to enable regulator\n"); - return ret; + goto out_put_pm; } } @@ -200,6 +207,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd) out_regulator_disable: if (!IS_ERR(domain->regulator)) regulator_disable(domain->regulator); +out_put_pm: + pm_runtime_put(domain->dev); return ret; } @@ -262,6 +271,8 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd) } } + pm_runtime_put(domain->dev); + return 0; out_clk_disable: @@ -519,6 +530,8 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) return dev_err_probe(domain->dev, domain->num_clks, "Failed to get domain's clocks\n"); + pm_runtime_enable(domain->dev); + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, domain->bits.map, domain->bits.map); @@ -542,6 +555,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) out_domain_unmap: regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, domain->bits.map, 0); + pm_runtime_disable(domain->dev); return ret; } @@ -556,6 +570,8 @@ static int imx_pgc_domain_remove(struct platform_device *pdev) regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, domain->bits.map, 0); + pm_runtime_disable(domain->dev); + return 0; }