From patchwork Wed Jun 19 08:53:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 17975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9DC1D2397B for ; Wed, 19 Jun 2013 08:55:26 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id lx15sf4822509lab.8 for ; Wed, 19 Jun 2013 01:55:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=rCB+fLXkQxL0odl+jtQe7KUgJ3gf2PzcKzu44pR0FsE=; b=PEvBOai5dUBfQu+aV4RmIgJLmXitzhMC3lTH8hNA8BXgIiWTpOwLT1VjQdDHA5TGhT 59v52A5kdxvluBRtMsv1SYKSLby0RR4jMzyvkGraTSL92YOVxJ1PIgMe/+9eoA/mHvIg hR9hUCG1oUcpXWt9cnFjfVu5zrlHGgT3ZOqysyu8HIpgzZh2X4dOZSCvsv8ogwhO1y1F RbXG37m0NHiK6hnyzR5xU63OnwkHEA/F6K+zR84DTOxF3WIvmPrcY7M/T70iC7urSZ79 Z2bgAzi92Q9xiYQaMyCS0lDXU4TXQnhqXPMaLWKBx4N/mlKtazu6zWEzBc/t3tWgWC7k oAIw== X-Received: by 10.180.85.134 with SMTP id h6mr689467wiz.1.1371632124852; Wed, 19 Jun 2013 01:55:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.38.11 with SMTP id c11ls114521wik.6.gmail; Wed, 19 Jun 2013 01:55:24 -0700 (PDT) X-Received: by 10.180.106.163 with SMTP id gv3mr1267794wib.53.1371632124625; Wed, 19 Jun 2013 01:55:24 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id t3si2224034wij.24.2013.06.19.01.55.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 01:55:24 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id oz10so3885617veb.33 for ; Wed, 19 Jun 2013 01:55:23 -0700 (PDT) X-Received: by 10.52.22.174 with SMTP id e14mr546862vdf.21.1371632123544; Wed, 19 Jun 2013 01:55:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp100280veb; Wed, 19 Jun 2013 01:55:23 -0700 (PDT) X-Received: by 10.68.131.133 with SMTP id om5mr1776598pbb.148.1371632122576; Wed, 19 Jun 2013 01:55:22 -0700 (PDT) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id xx2si10384485pac.190.2013.06.19.01.55.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 01:55:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id v14so4866008pde.4 for ; Wed, 19 Jun 2013 01:55:22 -0700 (PDT) X-Received: by 10.68.98.165 with SMTP id ej5mr1812039pbb.111.1371632122182; Wed, 19 Jun 2013 01:55:22 -0700 (PDT) Received: from localhost ([106.198.29.238]) by mx.google.com with ESMTPSA id ig4sm22278428pbc.18.2013.06.19.01.55.13 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 19 Jun 2013 01:55:21 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, dave.martin@arm.com, Viresh Kumar , Santosh Shilimkar Subject: [PATCH 08/13] cpufreq: omap: call CPUFREQ_POSTCHANGE notfier in error cases Date: Wed, 19 Jun 2013 14:23:02 +0530 Message-Id: <957838f1065ccc20b0252e0a6d37b61f6b173970.1371630975.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQlvPkTxj/mQnfMX8tFEiuv23yPLJwelwD7YJXEwQIV9ma4aa1QD6ErO1i0G35TLekQTh7ij X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , PRECHANGE and POSTCHANGE notifiers must be called in groups, i.e either both should be called or both shouldn't be. In case we have started PRECHANGE notifier and found an error, we must call POSTCHANGE notifier with freqs.new = freqs.old to guarantee that sequence of calling notifiers is complete. Omap driver was taking care of it well, but wasn't restoring freqs.new to freqs.old in some cases. I wasn't required to add code for it as moving PRECHANGE notifier down was a better option, so that we call it just before starting frequency transition. Cc: Santosh Shilimkar Signed-off-by: Viresh Kumar Acked-by: Santosh Shilimkar --- drivers/cpufreq/omap-cpufreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 0279d18..29468a5 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -93,9 +93,6 @@ static int omap_target(struct cpufreq_policy *policy, if (freqs.old == freqs.new && policy->cur == freqs.new) return ret; - /* notifiers */ - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - freq = freqs.new * 1000; ret = clk_round_rate(mpu_clk, freq); if (IS_ERR_VALUE(ret)) { @@ -125,6 +122,9 @@ static int omap_target(struct cpufreq_policy *policy, freqs.old / 1000, volt_old ? volt_old / 1000 : -1, freqs.new / 1000, volt ? volt / 1000 : -1); + /* notifiers */ + cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); + /* scaling up? scale voltage before frequency */ if (mpu_reg && (freqs.new > freqs.old)) { r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);