From patchwork Wed Aug 15 10:02:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1325191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5D446DFFED for ; Wed, 15 Aug 2012 10:07:14 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T1aSW-0006ly-43; Wed, 15 Aug 2012 10:04:16 +0000 Received: from mail-wg0-f41.google.com ([74.125.82.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T1aRZ-0006VA-6n for linux-arm-kernel@lists.infradead.org; Wed, 15 Aug 2012 10:03:23 +0000 Received: by wgbds1 with SMTP id ds1so4489715wgb.0 for ; Wed, 15 Aug 2012 03:03:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=uBQV1SxHVMl53rmnsZ9ik2FHLTer3SmbDWigBAi1Kj8=; b=JKb1fq3fnLorxizlVhPwuU+GbpwTyqyuPgpH/NLh8SeZBMBFvxEwxXcxPBj2SU2IoR ZbK8ETp6n+CWmRZYh1NIH/7ER059+vA9D10W4GC/T4xWFbvQXWm9BpAN8PGPz1YuziwD 2/GRrQ+DYEO52NFXZ3pe8+NzPGZURwibbs/TD7cFbo1n7lEyQNnWAwQ0cAyBSw4jV5SL hE8j9rOhvp86siuQ/bTvTmVIZ4kj+XZFa3/wc81lY7zZp19R5YPgc0bQvWlUZMpTAJ3I raQ2BzlGZC5kwh7E81gXppwTW4P+ex5KY1Uu0UQkcmyfPccjG2DwOQRBJXyDrSD3s1BC Ts2w== Received: by 10.216.181.195 with SMTP id l45mr7932143wem.52.1345024995220; Wed, 15 Aug 2012 03:03:15 -0700 (PDT) Received: from localhost.localdomain (49.68-66-87.adsl-dyn.isp.belgacom.be. [87.66.68.49]) by mx.google.com with ESMTPS id q4sm27679093wix.9.2012.08.15.03.03.14 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Aug 2012 03:03:14 -0700 (PDT) From: Jean Pihet To: linux-omap@vger.kernel.org, paul@pwsan.com, linux-arm-kernel@lists.infradead.org, khilman@ti.com, Rajendra Nayak , Santosh Shilimkar , Nishanth Menon Subject: [PATCH 5/8] ARM: OMAP2+: PM: use power domain functional state in stats counters Date: Wed, 15 Aug 2012 12:02:45 +0200 Message-Id: <1345024968-28951-6-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1345024968-28951-1-git-send-email-j-pihet@ti.com> References: <1345024968-28951-1-git-send-email-j-pihet@ti.com> X-Gm-Message-State: ALoCoQmqmMA6/0UzZ5GHc+biTvdl0mGgKi/C3FTn6zIhWNdotlGKENzoLMhnmnBvjPxlARv5EDa9 X-Spam-Note: CRM114 invocation failed 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.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.41 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jean Pihet 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The PM code uses some counters to keep track of the power domains transitions, in order to provide the information to drivers (in pwrdm_get_context_loss_count) and to expose the information to sysfs for debug purpose. This patch provides the information for each functional state. Signed-off-by: Jean Pihet --- arch/arm/mach-omap2/pm-debug.c | 15 ++++++++------- arch/arm/mach-omap2/powerdomain.c | 12 ++++++------ arch/arm/mach-omap2/powerdomain.h | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 814bcd9..8eaa3f2 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -53,9 +53,10 @@ enum { DEBUG_FILE_TIMERS, }; -static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = { +static const char pwrdm_state_names[][PWRDM_MAX_FUNC_PWRSTS] = { "OFF", - "RET", + "OSWR", + "CSWR", "INA", "ON" }; @@ -102,13 +103,13 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user) strncmp(pwrdm->name, "dpll", 4) == 0) return 0; - if (pwrdm->state != pwrdm_read_pwrst(pwrdm)) + if (pwrdm->state != pwrdm_read_fpwrst(pwrdm)) printk(KERN_ERR "pwrdm state mismatch(%s) %d != %d\n", - pwrdm->name, pwrdm->state, pwrdm_read_pwrst(pwrdm)); + pwrdm->name, pwrdm->state, pwrdm_read_fpwrst(pwrdm)); seq_printf(s, "%s (%s)", pwrdm->name, pwrdm_state_names[pwrdm->state]); - for (i = 0; i < PWRDM_MAX_PWRSTS; i++) + for (i = 0; i < PWRDM_MAX_FUNC_PWRSTS; i++) seq_printf(s, ",%s:%d", pwrdm_state_names[i], pwrdm->state_counter[i]); @@ -137,7 +138,7 @@ static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user) seq_printf(s, "%s (%s)", pwrdm->name, pwrdm_state_names[pwrdm->state]); - for (i = 0; i < 4; i++) + for (i = 0; i < PWRDM_MAX_FUNC_PWRSTS; i++) seq_printf(s, ",%s:%lld", pwrdm_state_names[i], pwrdm->state_timer[i]); @@ -211,7 +212,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) t = sched_clock(); - for (i = 0; i < 4; i++) + for (i = 0; i < PWRDM_MAX_FUNC_PWRSTS; i++) pwrdm->state_timer[i] = 0; pwrdm->timer = t; diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 1f9ed2c..6b8580b 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -106,7 +106,7 @@ static int _pwrdm_register(struct powerdomain *pwrdm) list_add(&pwrdm->node, &pwrdm_list); /* Initialize the powerdomain's state counter */ - for (i = 0; i < PWRDM_MAX_PWRSTS; i++) + for (i = 0; i < PWRDM_MAX_FUNC_PWRSTS; i++) pwrdm->state_counter[i] = 0; pwrdm->ret_logic_off_counter = 0; @@ -114,7 +114,7 @@ static int _pwrdm_register(struct powerdomain *pwrdm) pwrdm->ret_mem_off_counter[i] = 0; pwrdm_wait_transition(pwrdm); - pwrdm->state = pwrdm_read_pwrst(pwrdm); + pwrdm->state = pwrdm_read_fpwrst(pwrdm); pwrdm->state_counter[pwrdm->state] = 1; pr_debug("powerdomain: registered %s\n", pwrdm->name); @@ -149,17 +149,17 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) if (pwrdm == NULL) return -EINVAL; - state = pwrdm_read_pwrst(pwrdm); + state = pwrdm_read_fpwrst(pwrdm); switch (flag) { case PWRDM_STATE_NOW: prev = pwrdm->state; break; case PWRDM_STATE_PREV: - prev = pwrdm_read_prev_pwrst(pwrdm); + prev = pwrdm_read_prev_fpwrst(pwrdm); if (pwrdm->state != prev) pwrdm->state_counter[prev]++; - if (prev == PWRDM_POWER_RET) + if (prev == PWRDM_FUNC_PWRST_OSWR) _update_logic_membank_counters(pwrdm); /* * If the power domain did not hit the desired state, @@ -1367,7 +1367,7 @@ int pwrdm_get_context_loss_count(struct powerdomain *pwrdm) return -ENODEV; } - count = pwrdm->state_counter[PWRDM_POWER_OFF]; + count = pwrdm->state_counter[PWRDM_FUNC_PWRST_OFF]; count += pwrdm->ret_logic_off_counter; for (i = 0; i < pwrdm->banks; i++) diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h index 23b9da9..df83c7c 100644 --- a/arch/arm/mach-omap2/powerdomain.h +++ b/arch/arm/mach-omap2/powerdomain.h @@ -146,7 +146,7 @@ struct powerdomain { struct list_head voltdm_node; spinlock_t lock; int state; - unsigned state_counter[PWRDM_MAX_PWRSTS]; + unsigned state_counter[PWRDM_MAX_FUNC_PWRSTS]; unsigned ret_logic_off_counter; unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS]; @@ -160,7 +160,7 @@ struct powerdomain { #ifdef CONFIG_PM_DEBUG s64 timer; - s64 state_timer[PWRDM_MAX_PWRSTS]; + s64 state_timer[PWRDM_MAX_FUNC_PWRSTS]; #endif };