thermal: cooldev: update cpucore cooldev for multi cluster chip [1/1]

PD#SWPL-5366

Problem:
g12b cpucore cooling devices hotplug a little core and a big
when hot trippoint trigger, need to update cooling devices that
hotplug one core one hotstep for big core to little core.

Solution:
1.modify cpucore cooling for new solution.
2.modify hotplug core for can hotplug all big core.
3.ipa dts no cluster id, all cpucore is one cooling device
  dts have cluster id, one cluster is one cooling devices.

Verify:
test on g12b w400.

Change-Id: I3320b007e35e7ac415cf7623f74f0a5153fed9b5
Signed-off-by: Huan Biao <huan.biao@amlogic.com>
This commit is contained in:
Huan Biao
2019-03-04 13:45:05 +08:00
committed by Luke Go
parent 66324a04ae
commit 438cd09ff8
6 changed files with 28 additions and 92 deletions

View File

@@ -1597,20 +1597,11 @@
node_name = "cpufreq_cool1";
device_type = "cpufreq";
};
cpucore_cool_cluster0 {
cpucore_cool_cluster {
min_state = <1>;
dyn_coeff = <0>;
cluster_id = <0>;
gpu_pp = <2>;
node_name = "cpucore_cool0";
device_type = "cpucore";
};
cpucore_cool_cluster1 {
min_state = <0>;
dyn_coeff = <0>;
cluster_id = <1>;
gpu_pp = <2>;
node_name = "cpucore_cool1";
node_name = "cpucore_cool";
device_type = "cpucore";
};
gpufreq_cool {
@@ -1636,10 +1627,7 @@
cpufreq_cool1:cpufreq_cool1 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool0:cpucore_cool0 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool1:cpucore_cool1 {
cpucore_cool:cpucore_cool {
#cooling-cells = <2>; /* min followed by max */
};
gpufreq_cool0:gpufreq_cool0 {
@@ -1691,14 +1679,9 @@
cooling-device = <&cpufreq_cool1 0 9>;
contribution = <1024>;
};
cpucore_cooling_map0 {
cpucore_cooling_map {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool0 0 1>;
contribution = <1024>;
};
cpucore_cooling_map1 {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool1 0 4>;
cooling-device = <&cpucore_cool 0 5>;
contribution = <1024>;
};
gpufreq_cooling_map {

View File

@@ -1591,20 +1591,11 @@
node_name = "cpufreq_cool1";
device_type = "cpufreq";
};
cpucore_cool_cluster0 {
cpucore_cool_cluster {
min_state = <1>;
dyn_coeff = <0>;
cluster_id = <0>;
gpu_pp = <2>;
node_name = "cpucore_cool0";
device_type = "cpucore";
};
cpucore_cool_cluster1 {
min_state = <0>;
dyn_coeff = <0>;
cluster_id = <1>;
gpu_pp = <2>;
node_name = "cpucore_cool1";
node_name = "cpucore_cool";
device_type = "cpucore";
};
gpufreq_cool {
@@ -1630,10 +1621,7 @@
cpufreq_cool1:cpufreq_cool1 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool0:cpucore_cool0 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool1:cpucore_cool1 {
cpucore_cool:cpucore_cool {
#cooling-cells = <2>; /* min followed by max */
};
gpufreq_cool0:gpufreq_cool0 {
@@ -1685,14 +1673,9 @@
cooling-device = <&cpufreq_cool1 0 9>;
contribution = <1024>;
};
cpucore_cooling_map0 {
cpucore_cooling_map {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool0 0 1>;
contribution = <1024>;
};
cpucore_cooling_map1 {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool1 0 4>;
cooling-device = <&cpucore_cool 0 5>;
contribution = <1024>;
};
gpufreq_cooling_map {

View File

@@ -1582,20 +1582,11 @@
node_name = "cpufreq_cool1";
device_type = "cpufreq";
};
cpucore_cool_cluster0 {
cpucore_cool_cluster {
min_state = <1>;
dyn_coeff = <0>;
cluster_id = <0>;
gpu_pp = <2>;
node_name = "cpucore_cool0";
device_type = "cpucore";
};
cpucore_cool_cluster1 {
min_state = <0>;
dyn_coeff = <0>;
cluster_id = <1>;
gpu_pp = <2>;
node_name = "cpucore_cool1";
node_name = "cpucore_cool";
device_type = "cpucore";
};
gpufreq_cool {
@@ -1621,10 +1612,7 @@
cpufreq_cool1:cpufreq_cool1 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool0:cpucore_cool0 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool1:cpucore_cool1 {
cpucore_cool:cpucore_cool {
#cooling-cells = <2>; /* min followed by max */
};
gpufreq_cool0:gpufreq_cool0 {
@@ -1678,12 +1666,7 @@
};
cpucore_cooling_map0 {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool0 0 1>;
contribution = <1024>;
};
cpucore_cooling_map1 {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool1 0 4>;
cooling-device = <&cpucore_cool 0 5>;
contribution = <1024>;
};
gpufreq_cooling_map {

View File

@@ -1591,20 +1591,11 @@
node_name = "cpufreq_cool1";
device_type = "cpufreq";
};
cpucore_cool_cluster0 {
cpucore_cool_cluster {
min_state = <1>;
dyn_coeff = <0>;
cluster_id = <0>;
gpu_pp = <2>;
node_name = "cpucore_cool0";
device_type = "cpucore";
};
cpucore_cool_cluster1 {
min_state = <0>;
dyn_coeff = <0>;
cluster_id = <1>;
gpu_pp = <2>;
node_name = "cpucore_cool1";
node_name = "cpucore_cool";
device_type = "cpucore";
};
gpufreq_cool {
@@ -1630,10 +1621,7 @@
cpufreq_cool1:cpufreq_cool1 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool0:cpucore_cool0 {
#cooling-cells = <2>; /* min followed by max */
};
cpucore_cool1:cpucore_cool1 {
cpucore_cool:cpucore_cool {
#cooling-cells = <2>; /* min followed by max */
};
gpufreq_cool0:gpufreq_cool0 {
@@ -1685,14 +1673,9 @@
cooling-device = <&cpufreq_cool1 0 9>;
contribution = <1024>;
};
cpucore_cooling_map0 {
cpucore_cooling_map {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool0 0 1>;
contribution = <1024>;
};
cpucore_cooling_map1 {
trip = <&pcontrol>;
cooling-device = <&cpucore_cool1 0 4>;
cooling-device = <&cpucore_cool 0 5>;
contribution = <1024>;
};
gpufreq_cooling_map {

View File

@@ -98,7 +98,7 @@ void cpu_hotplug_set_max(unsigned int num, int clustr)
{
unsigned int cpu_online;
if (!num || clustr > hpg.clusters) {
if (clustr > hpg.clusters) {
dev_err(NULL, " %s <:%d %d>\n", __func__, num, clustr);
return;
}
@@ -182,7 +182,7 @@ static int __ref cpu_hotplug_thread(void *data)
}
} else if (flg == CPU_HOTPLUG_UNPLUG) {
cnt = 0;
while ((online = cpu_num_online(clustr)) > 1) {
while ((online = cpu_num_online(clustr)) > 0) {
if (online <= hpg.gov_num[clustr] &&
online <= hpg.max_num[clustr])
break;
@@ -205,7 +205,8 @@ static int __ref cpu_hotplug_thread(void *data)
goto clear_cpu;
}
if (!cpu_online(target) ||
cpumask_first(hpg.cpumask) == target)
(cpumask_first(hpg.cpumask) == target &&
clustr == 0))
goto clear_cpu;
device_offline(get_cpu_device(target));
clear_cpu:
@@ -255,8 +256,7 @@ static ssize_t store_hotplug_max_cpus(struct kobject *kobj,
for (c = 0; c < hpg.clusters; c++) {
max = input & 0xff;
if (max)
cpu_hotplug_set_max(max, c);
cpu_hotplug_set_max(max, c);
input = input >> 8;
}
return count;

View File

@@ -20,6 +20,9 @@
#include <linux/thermal.h>
#include <linux/cpumask.h>
#define MAX_CLUSTER 2
#define CLUSTER_FLAG 0xF
struct cpucore_cooling_device {
int id;
struct thermal_cooling_device *cool_dev;
@@ -29,6 +32,7 @@ struct cpucore_cooling_device {
int max_cpu_core_num;
int cluster_id;
int stop_flag;
int core_num[MAX_CLUSTER];
};
#define CPU_STOP 0x80000000
#ifdef CONFIG_AMLOGIC_CPUCORE_THERMAL