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: 1853981 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 74DD93FC64 for ; Sun, 9 Dec 2012 17:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934320Ab2LIRyo (ORCPT ); Sun, 9 Dec 2012 12:54:44 -0500 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 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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(+) -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 */ /**