Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b707c89 authored by Stratos Karafotis's avatar Stratos Karafotis Committed by Rafael J. Wysocki
Browse files

cpufreq: intel_pstate: Simplify P state adjustment logic.



Simplify the code by removing the inline functions pstate_increase and
pstate_decrease and use directly the intel_pstate_set_pstate.

Signed-off-by: default avatarStratos Karafotis <stratosk@semaphore.gr>
Acked-by: default avatarDirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent ac658131
Loading
Loading
Loading
Loading
+3 −23
Original line number Original line Diff line number Diff line
@@ -530,21 +530,6 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
	pstate_funcs.set(cpu, pstate);
	pstate_funcs.set(cpu, pstate);
}
}


static inline void intel_pstate_pstate_increase(struct cpudata *cpu, int steps)
{
	int target;
	target = cpu->pstate.current_pstate + steps;

	intel_pstate_set_pstate(cpu, target);
}

static inline void intel_pstate_pstate_decrease(struct cpudata *cpu, int steps)
{
	int target;
	target = cpu->pstate.current_pstate - steps;
	intel_pstate_set_pstate(cpu, target);
}

static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
{
{
	cpu->pstate.min_pstate = pstate_funcs.get_min();
	cpu->pstate.min_pstate = pstate_funcs.get_min();
@@ -632,20 +617,15 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
{
{
	int32_t busy_scaled;
	int32_t busy_scaled;
	struct _pid *pid;
	struct _pid *pid;
	signed int ctl = 0;
	signed int ctl;
	int steps;


	pid = &cpu->pid;
	pid = &cpu->pid;
	busy_scaled = intel_pstate_get_scaled_busy(cpu);
	busy_scaled = intel_pstate_get_scaled_busy(cpu);


	ctl = pid_calc(pid, busy_scaled);
	ctl = pid_calc(pid, busy_scaled);


	steps = abs(ctl);
	/* Negative values of ctl increase the pstate and vice versa */

	intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl);
	if (ctl < 0)
		intel_pstate_pstate_increase(cpu, steps);
	else
		intel_pstate_pstate_decrease(cpu, steps);
}
}


static void intel_pstate_timer_func(unsigned long __data)
static void intel_pstate_timer_func(unsigned long __data)