From patchwork Wed Sep 12 09:55:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1441691 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 1124C3FE79 for ; Wed, 12 Sep 2012 09:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755627Ab2ILJz5 (ORCPT ); Wed, 12 Sep 2012 05:55:57 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:44698 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753445Ab2ILJzz (ORCPT ); Wed, 12 Sep 2012 05:55:55 -0400 Received: by weyx8 with SMTP id x8so870232wey.19 for ; Wed, 12 Sep 2012 02:55:54 -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=Pf+5pEfJXXfq+wJk3GR6GIcCeZq3eOu+vMPL8ZmdUXs=; b=g1bibMhle635jZQf++6s+aJl3zgGgLsAr+rVhuS71yKBKwyV6qFpcqP4qFeZbX1bEH LZAGhimnF4FuyWV29z1OEfkFeTmKU5fGYc1UXr1KPW7Q+9klZbEP14+7/yX7Q0dSYjDm ZBb8gRQmpMlqqlEUZGq2OuePBfYPdiMgRsM2JUMjgTJjvHzaTiwAvjroDZUKDJPw1c2V W1J01n866CvddhILUtZ+xqV11UBS0I7jI4cmif5kf5cFD0p7JLH99eFDnZ9EXzocCZq5 tWMZaWBHrU9PopJL3eSSgh2gfkNrISAWo0tFcbaUm/3+pBsS2zkPs6uSkxJZ5qQhDYKx xxDQ== Received: by 10.216.198.10 with SMTP id u10mr11577044wen.80.1347443754156; Wed, 12 Sep 2012 02:55:54 -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.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 02:55:53 -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 5/7] ARM: OMAP2+: PM debug: trace the functional power domains states Date: Wed, 12 Sep 2012 11:55:30 +0200 Message-Id: <1347443732-7411-6-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: ALoCoQkUgzCSE46jj6J3PBvcUlf0s01V+1Z7PSlMHp8gMVDgHyKlcq3ZMrFnEXCF6DbCQJByCTn6 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Trace the power domain transitions using the functional power states, which include the power and logic states. While at it, fix the trace in the case a power domain did not hit the desired state, as reported by Paul Walmsley. Reported-by: Paul Walmsley Signed-off-by: Jean Pihet --- arch/arm/mach-omap2/powerdomain.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 267241f..2277ad3 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -144,7 +144,7 @@ static void _update_logic_membank_counters(struct powerdomain *pwrdm) static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) { - int prev, state, trace_state = 0; + int prev, next, state, trace_state; if (pwrdm == NULL) return -EINVAL; @@ -165,10 +165,10 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) * If the power domain did not hit the desired state, * generate a trace event with both the desired and hit states */ - if (state != prev) { + next = pwrdm_read_next_fpwrst(pwrdm); + if (next != prev) { trace_state = (PWRDM_TRACE_STATES_FLAG | - ((state & OMAP_POWERSTATE_MASK) << 8) | - ((prev & OMAP_POWERSTATE_MASK) << 0)); + (next << 8) | (prev << 0)); trace_power_domain_target(pwrdm->name, trace_state, smp_processor_id()); } @@ -723,6 +723,10 @@ int pwrdm_set_fpwrst(struct powerdomain *pwrdm, enum pwrdm_func_state fpwrst) } } + /* Trace the pwrdm desired target state */ + trace_power_domain_target(pwrdm->name, next_fpwrst, + smp_processor_id()); + if (logic != pwrdm_read_logic_retst(pwrdm)) pwrdm_set_logic_retst(pwrdm, logic); @@ -776,6 +780,10 @@ int pwrdm_set_next_fpwrst(struct powerdomain *pwrdm, spin_lock_irqsave(&pwrdm->lock, flags); + /* Trace the pwrdm desired target state */ + trace_power_domain_target(pwrdm->name, fpwrst, + smp_processor_id()); + ret = pwrdm_set_logic_retst(pwrdm, logic); if (ret) pr_err("%s: unable to set logic state %0x of powerdomain: %s\n", @@ -821,13 +829,8 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) pr_debug("powerdomain: setting next powerstate for %s to %0x\n", pwrdm->name, pwrst); - if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) { - /* Trace the pwrdm desired target state */ - trace_power_domain_target(pwrdm->name, pwrst, - smp_processor_id()); - /* Program the pwrdm desired target state */ + if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst); - } return ret; }