From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Walmsley Subject: [PATCH 01/12] ARM: OMAP2+: powerdomain: add functions that report on powerdomain capabilities Date: Sun, 09 Dec 2012 10:52:53 -0700 Message-ID: <20121209175249.6933.71752.stgit@dusk.lan> References: <20121209174545.6933.59371.stgit@dusk.lan> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: Received: from utopia.booyaka.com ([74.50.51.50]:39967 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934314Ab2LIRyn (ORCPT ); Sun, 9 Dec 2012 12:54:43 -0500 In-Reply-To: <20121209174545.6933.59371.stgit@dusk.lan> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: linux-omap@vger.kernel.org, linux-arm-kernel@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 */ /**