Message ID | 1457249646-23072-2-git-send-email-philippe.longepe@linux.intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On Sun, 2016-03-06 at 08:34 +0100, Philippe Longepe wrote: > pid->setpoint and pid->deadband can be initialize in float so we > can remove the int_tofp in pid_calc. Rafael had some comments on this patch: "s/initialize/initialized/ > can remove the int_tofp in pid_calc. This is not "float", but "fixed point". Also "avoid" rather than "remove". " Not sure if Rafael is OK without change. > Signed-off-by: Philippe Longepe <philippe.longepe@linux.intel.com> > --- > drivers/cpufreq/intel_pstate.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/intel_pstate.c > b/drivers/cpufreq/intel_pstate.c > index eb0aef0..114e4e0 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); -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index eb0aef0..114e4e0 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);
pid->setpoint and pid->deadband can be initialize in float so we can remove the int_tofp in pid_calc. Signed-off-by: Philippe Longepe <philippe.longepe@linux.intel.com> --- drivers/cpufreq/intel_pstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)