From patchwork Sun Dec 9 17:52:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 1854041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 589393FC64 for ; Sun, 9 Dec 2012 17:58:38 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Thl5i-0003Br-60; Sun, 09 Dec 2012 17:55:02 +0000 Received: from utopia.booyaka.com ([74.50.51.50]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Thl5R-00038C-A5 for linux-arm-kernel@lists.infradead.org; Sun, 09 Dec 2012 17:54:46 +0000 Received: (qmail 2352 invoked by uid 1019); 9 Dec 2012 17:54:42 -0000 MBOX-Line: From nobody Sun Dec 9 10:52:53 2012 Subject: [PATCH 01/12] ARM: OMAP2+: powerdomain: add functions that report on powerdomain capabilities To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Paul Walmsley Date: Sun, 09 Dec 2012 10:52:53 -0700 Message-ID: <20121209175249.6933.71752.stgit@dusk.lan> In-Reply-To: <20121209174545.6933.59371.stgit@dusk.lan> References: <20121209174545.6933.59371.stgit@dusk.lan> User-Agent: StGit/0.16-37-g27ac3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121209_125445_661160_63999611 X-CRM114-Status: GOOD ( 16.35 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add several functions to report on whether powerdomains can change their power state or logic retention power state, and whether those abilities can be controlled by the kernel. This code is used in subsequent patches that add the functional power state code. Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/powerdomain.c | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 2a5f15b..94b89a25 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -203,6 +203,62 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused) return 0; } +/** + * _pwrdm_pwrst_is_controllable - can software change the powerdomain pwrst? + * @pwrdm: struct powerdomain * to test + * + * If the kernel can program the power state that the powerdomain + * @pwrdm should enter next, return 1; otherwise, return 0. + */ +static bool _pwrdm_pwrst_is_controllable(struct powerdomain *pwrdm) +{ + return (!pwrdm->pwrsts || pwrdm->pwrsts == PWRSTS_ON) ? 0 : 1; +} + +/** + * _pwrdm_pwrst_can_change - can the power state of @pwrdm change? + * @pwrdm: struct powerdomain * to test + * + * If the power state of the powerdomain represented by @pwrdm can + * change (i.e., is not always on), and the kernel has some way to + * detect this, return 1; otherwise, return 0. XXX The current + * implementation of this is based on an assumption and has not been + * verified against all OMAPs. + */ +static bool _pwrdm_pwrst_can_change(struct powerdomain *pwrdm) +{ + return _pwrdm_pwrst_is_controllable(pwrdm); +} + +/** + * _pwrdm_logic_retst_is_controllable - can software change the logic retst? + * @pwrdm: struct powerdomain * to test + * + * If the kernel can program the power state that the powerdomain + * @pwrdm logic should enter when the @pwrdm enters the RETENTION + * power state, return 1; otherwise, return 0. + */ +static bool _pwrdm_logic_retst_is_controllable(struct powerdomain *pwrdm) +{ + return (!pwrdm->pwrsts_logic_ret || + pwrdm->pwrsts_logic_ret == PWRSTS_RET) ? 0 : 1; +} + +/** + * _pwrdm_logic_retst_can_change - can the logic retst change on @pwrdm? + * @pwrdm: struct powerdomain * to test + * + * If the logic powerstate for the powerdomain represented by @pwrdm + * can ever be something other than the powerdomain's powerstate, and + * the kernel has some way to detect this, return 1; otherwise, return + * 0. XXX The current implementation of this is based on an + * assumption and has not been verified against all OMAPs. + */ +static bool _pwrdm_logic_retst_can_change(struct powerdomain *pwrdm) +{ + return _pwrdm_logic_retst_is_controllable(pwrdm); +} + /* Public functions */ /**