From patchwork Wed Feb 12 18:01:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 3639791 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 132479F334 for ; Wed, 12 Feb 2014 18:03:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01E6E20160 for ; Wed, 12 Feb 2014 18:03:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A41820142 for ; Wed, 12 Feb 2014 18:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753322AbaBLSBi (ORCPT ); Wed, 12 Feb 2014 13:01:38 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33775 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752707AbaBLSBf (ORCPT ); Wed, 12 Feb 2014 13:01:35 -0500 Received: by mail-pa0-f47.google.com with SMTP id kp14so9540164pab.20 for ; Wed, 12 Feb 2014 10:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Edq0t5Rt5FxHVyx6awEJvgad+YRDkWq0gr6zjtBi5Jo=; b=g++N8Ol82UxHJNWtCaBo3vMgKOOZBjiteNHESM2YpQsQnZrdxfeLp1LEnGJ++hkft7 Pjrryhhu7703EsSWe2/wkyzDValenL7YPzgi5SocrG8z7cFZIlnDZtTydNdjdrduBVm4 ulhpEWCzayz7fQHPICjwdJNRR5PV0a+vJc/E4z60Nizaz5xYDTguNLkK8BmVMU+5aWc5 M3Cn0aRDl3/NDNRGNi1AGX/fBrmvv8iPPoO6tWZDoOAYidI4SikXsr2zd6RbXz7boHvj fUwq7raoIrnqytTEne2j38+U+7vyHw1nVJj5olqCgsV+S2+4IOFvqA3vq5qvgn5lNHKg fITw== X-Received: by 10.68.114.163 with SMTP id jh3mr51775281pbb.99.1392228094971; Wed, 12 Feb 2014 10:01:34 -0800 (PST) Received: from echolake.localdomain (static-50-43-42-35.bvtn.or.frontiernet.net. [50.43.42.35]) by mx.google.com with ESMTPSA id ss2sm66199689pab.8.2014.02.12.10.01.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Feb 2014 10:01:34 -0800 (PST) From: dirk.brandewie@gmail.com To: linux-pm@vger.kernel.org, rjw@rjwysocki.net Cc: linux-kernel@vger.kernel.org, Dirk Brandewie Subject: [PATCH 3/5] intel_pstate: fix pid_reset to use fixed point values Date: Wed, 12 Feb 2014 10:01:05 -0800 Message-Id: <1392228067-14817-4-git-send-email-dirk.j.brandewie@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1392228067-14817-1-git-send-email-dirk.j.brandewie@intel.com> References: <1392228067-14817-1-git-send-email-dirk.j.brandewie@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dirk Brandewie commit d253d2a526 Improve accuracy by not truncating until final result, changed internal variables of the PID to be fixed point numbers. Update the pid_reset() to reflect this change. Signed-off-by: Dirk Brandewie --- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index d692b10..b80c03d 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -150,7 +150,7 @@ static inline void pid_reset(struct _pid *pid, int setpoint, int busy, pid->setpoint = setpoint; pid->deadband = deadband; pid->integral = int_tofp(integral); - pid->last_err = setpoint - busy; + pid->last_err = int_tofp(setpoint) - int_tofp(busy); } static inline void pid_p_gain_set(struct _pid *pid, int percent)