From patchwork Tue Jan 8 05:50:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rajagopal.venkat@linaro.org X-Patchwork-Id: 13901 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 918F223E2A for ; Tue, 8 Jan 2013 05:54:50 +0000 (UTC) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by fiordland.canonical.com (Postfix) with ESMTP id 3FA8BA18919 for ; Tue, 8 Jan 2013 05:54:50 +0000 (UTC) Received: by mail-vb0-f41.google.com with SMTP id l22so28530vbn.28 for ; Mon, 07 Jan 2013 21:54:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=rRYqhT4mujU+c9LvPRufgqlF/pxSanL3cs77CovCGV8=; b=UVIRr6Al6gPCoGFzwRslRzG/Z0nY8MylJ7OlzgzMulnmwBv0zLauuRV/5UvXMUtmDK BtVaqG8wzk+mZwWx5inEu8VL1axFk4C4LAqn85bP/+iixLTQwkdI6Me6iGy/Rzp+THiz +N6Wb9zqbvPHaTdKkzw4/bLp7f2VCk/IZRoTGszn4nW9CwKM6cRW/QaL5yqsw0t2k/wu pPl/t/znRSgNH7ZJzISk2rvq6izYzsN24h+qqq6cyILUjX8H9HqIUKraYOUaL0rJeipA WexNw0aWz0QZgGg4rxYvXVefH82iBYVWcQ2Sox5+YlrWJjOqYdwgKZVODsNj+dnpp2Wu Ryfw== X-Received: by 10.52.70.205 with SMTP id o13mr74576054vdu.75.1357624489736; Mon, 07 Jan 2013 21:54:49 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp95418veb; Mon, 7 Jan 2013 21:54:49 -0800 (PST) X-Received: by 10.68.135.99 with SMTP id pr3mr196660665pbb.151.1357624488819; Mon, 07 Jan 2013 21:54:48 -0800 (PST) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx.google.com with ESMTPS id ak3si61537395pbd.5.2013.01.07.21.54.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Jan 2013 21:54:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.160.54; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) smtp.mail=rajagopal.venkat@linaro.org Received: by mail-pb0-f54.google.com with SMTP id wz12so24583pbc.41 for ; Mon, 07 Jan 2013 21:54:48 -0800 (PST) X-Received: by 10.68.125.201 with SMTP id ms9mr195660148pbb.78.1357624488466; Mon, 07 Jan 2013 21:54:48 -0800 (PST) Received: from localhost.localdomain ([115.242.216.217]) by mx.google.com with ESMTPS id ty4sm38989248pbc.57.2013.01.07.21.54.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Jan 2013 21:54:47 -0800 (PST) From: Rajagopal Venkat To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, mturquette@linaro.org, rjw@sisk.pl Cc: patches@linaro.org, linaro-dev@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajagopal Venkat Subject: [PATCH 3/3] PM / devfreq: account suspend/resume for stats Date: Tue, 8 Jan 2013 11:20:39 +0530 Message-Id: <1357624239-13938-3-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1357624239-13938-1-git-send-email-rajagopal.venkat@linaro.org> References: <1357624239-13938-1-git-send-email-rajagopal.venkat@linaro.org> X-Gm-Message-State: ALoCoQlPG9rbktC1pKFxWCJTXFIR4jSxdC1mS+bc0ph4OExbxqrEfaBTeNQ+dltNkxNZjID9yX4I devfreq stats is not taking device suspend and resume into account. Fix it. Signed-off-by: Rajagopal Venkat Acked-by: MyungJoo Ham --- drivers/devfreq/devfreq.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 2843a22..4c50235 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -297,6 +297,7 @@ void devfreq_monitor_suspend(struct devfreq *devfreq) return; } + devfreq_update_status(devfreq, devfreq->previous_freq); devfreq->stop_polling = true; mutex_unlock(&devfreq->lock); cancel_delayed_work_sync(&devfreq->work); @@ -313,6 +314,8 @@ EXPORT_SYMBOL(devfreq_monitor_suspend); */ void devfreq_monitor_resume(struct devfreq *devfreq) { + unsigned long freq; + mutex_lock(&devfreq->lock); if (!devfreq->stop_polling) goto out; @@ -321,8 +324,14 @@ void devfreq_monitor_resume(struct devfreq *devfreq) devfreq->profile->polling_ms) queue_delayed_work(devfreq_wq, &devfreq->work, msecs_to_jiffies(devfreq->profile->polling_ms)); + + devfreq->last_stat_updated = jiffies; devfreq->stop_polling = false; + if (devfreq->profile->get_cur_freq && + !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) + devfreq->previous_freq = freq; + out: mutex_unlock(&devfreq->lock); } @@ -931,11 +940,11 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att { struct devfreq *devfreq = to_devfreq(dev); ssize_t len; - int i, j, err; + int i, j; unsigned int max_state = devfreq->profile->max_state; - err = devfreq_update_status(devfreq, devfreq->previous_freq); - if (err) + if (!devfreq->stop_polling && + devfreq_update_status(devfreq, devfreq->previous_freq)) return 0; len = sprintf(buf, " From : To\n");