summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorPhilippe Longepe <philippe.longepe@linux.intel.com>2016-03-08 10:31:14 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-11 00:04:42 +0100
commitb54a0dfd56d5c314302987e0ff173b3f1bfcb555 (patch)
tree8edbdec3197f8e2cfd7ee0262cbe7334b7b72c78 /drivers/cpufreq
parenta5acbfbd70bc6a0cd4c8ca8f4f5e52ac3ee7dca4 (diff)
downloadop-kernel-dev-b54a0dfd56d5c314302987e0ff173b3f1bfcb555.zip
op-kernel-dev-b54a0dfd56d5c314302987e0ff173b3f1bfcb555.tar.gz
intel_pstate: Remove extra conversions in pid calculation
pid->setpoint and pid->deadband can be initialized in fixed point, so we can avoid the int_tofp in pid_calc. Signed-off-by: Philippe Longepe <philippe.longepe@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/intel_pstate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 23bb798..864214d 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -198,8 +198,8 @@ static struct perf_limits *limits = &powersave_limits;
static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
int deadband, int integral) {
- pid->setpoint = setpoint;
- pid->deadband = deadband;
+ pid->setpoint = int_tofp(setpoint);
+ pid->deadband = int_tofp(deadband);
pid->integral = int_tofp(integral);
pid->last_err = int_tofp(setpoint) - int_tofp(busy);
}
@@ -225,9 +225,9 @@ static signed int pid_calc(struct _pid *pid, int32_t busy)
int32_t pterm, dterm, fp_error;
int32_t integral_limit;
- fp_error = int_tofp(pid->setpoint) - busy;
+ fp_error = pid->setpoint - busy;
- if (abs(fp_error) <= int_tofp(pid->deadband))
+ if (abs(fp_error) <= pid->deadband)
return 0;
pterm = mul_fp(pid->p_gain, fp_error);
OpenPOWER on IntegriCloud