From patchwork Wed Sep 12 09:55:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1441671 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 318B43FE79 for ; Wed, 12 Sep 2012 09:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755611Ab2ILJz4 (ORCPT ); Wed, 12 Sep 2012 05:55:56 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:39318 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316Ab2ILJzy (ORCPT ); Wed, 12 Sep 2012 05:55:54 -0400 Received: by weyx8 with SMTP id x8so870219wey.19 for ; Wed, 12 Sep 2012 02:55:53 -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=EmWgFEK5vWCns2Q635n30uCKGlyq89pfG/JIvVYPGjQ=; b=GZrMMstNq6IodPmnhNAZuwQ4r+AGdwTGsX2NIyhG60Y47VIZKvIyJ4uay9khcNqgJW VDNshfbRrD+Pc6bkK9rgAD2teeJNzbfswTY5wf8yYEDTbKBg9GPpROwUDSY+Me0uTeaX JAHExgrrd+1u7OErEPNIcSPj+scdiHpBI08xRhbLH4VqT/Ahcq53Yivx36TdfWs6Znhh 5ci9uMBl/DzEaCNtKisoMN5E0+beUMVliGNugk3VDqyW2f1NYJO8Rg/n56JDN8cA5t/b 9D/rEv1AaPENGXKC80Y/SwKQSsbCUQBEFCzRG+QSog3pJiGx30xrgC5IvQUIAAv9GEIo xiNQ== Received: by 10.216.133.148 with SMTP id q20mr10720594wei.201.1347443753003; Wed, 12 Sep 2012 02:55:53 -0700 (PDT) Received: from localhost.localdomain (52.60-66-87.adsl-dyn.isp.belgacom.be. [87.66.60.52]) by mx.google.com with ESMTPS id w7sm7312997wiz.0.2012.09.12.02.55.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 02:55:52 -0700 (PDT) From: Jean Pihet To: linux-omap@vger.kernel.org, paul@pwsan.com, linux-arm-kernel@lists.infradead.org, khilman@ti.com, Benoit Cousson , Santosh Shilimkar , Nishanth Menon , Rajendra Nayak Cc: Jean Pihet Subject: [PATCH 4/7] ARM: OMAP2+: PM: use power domain functional state in stats counters Date: Wed, 12 Sep 2012 11:55:29 +0200 Message-Id: <1347443732-7411-5-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1347443732-7411-1-git-send-email-j-pihet@ti.com> References: <1347443732-7411-1-git-send-email-j-pihet@ti.com> X-Gm-Message-State: ALoCoQm1v3z61WVhhwCWk6zG1fmS0tx5RVgw2j58NEX+KAvzWag8KGafqnQohgsCgk5+Z5LAv55q Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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 82ae9e9..267241f 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, @@ -1414,7 +1414,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 c3dc363..a29caec 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 };