...
It implements ACPI Processor Clock Throttling for X86. The commit message as below.
...
Only supports 4 throttling states for cpufreq control, Obviously, it doesn't work with the ARM platform.
...
As the max_state increase in ARM64, the calculation of max_freq changes. Before this, the max_freq decreases by twenty percent for each increase in state. After this solution, the max_freq decreases by one percent for each increase in state.
The commit(ACPI Thermal: Add a new governor for Thermal (83eb2db9) · Commits · LinaroLtd / clientpc / linux · GitLab) implement the governor. In the function get_delta_performance
, calculate the target delta performance:
Code Block | ||
---|---|---|
| ||
static int get_delta_performance(struct thermal_instance *instance, int *delta_p)
{
int ret;
unsigned int tc1, tc2;
int cur_temp, pre_temp, trip_temp;
struct thermal_zone_device *tz;
int trip;
tz = instance->tz;
trip = instance->trip;
ret = get_para(tz, &tc1, &tc2);
if (ret)
return ret;
ret = get_temp(tz, &pre_temp, &cur_temp);
if (ret)
return ret;
ret = get_trip_temp(tz, trip, &trip_temp);
if (ret)
return ret;
*delta_p = tc1 * (cur_temp - pre_temp) + tc2 * (cur_temp - trip_temp);
return 0;
}
|
The get_target_state
function using the delta performance to calculate the target state.
Code Block |
---|
static int get_target_state(struct thermal_instance *instance)
{
int ret;
unsigned long next_state;
int cur_p;
int delta_p;
int performance;
ret = get_delta_performance(instance, &delta_p);
if (ret)
return ret;
ret = get_processor_performance(instance, &cur_p);
if (ret)
return ret;
performance = clamp((cur_p - delta_p), MIN_PERFORMANCE, MAX_PERFORMANCE);
next_state = MAX_PERFORMANCE - performance;
instance->target = next_state;
return 0;
}
|
It will update the instance->target
, then the system will change the cooling device’s state by the target value.
Reference:
11.1. Thermal Control — ACPI Specification 6.4 documentation (uefi.org)
Commits · thermal_acpi · LinaroLtd / clientpc / linux · GitLab