rk3288平台关于温度调节cpu频率有个bug.
在rk3288.dtsi中,有:
temp-limit-enable = <1>;
target-temp = <80>;
min_temp_limit = <48>;
当温度升到超过80°时,随着温度升高,cpu频率最终会降到min_temp_limit的值,每次降的level按照下表执行
target-temp = <80>;
normal-temp-limit = <
/* delta-temp delta-freq */
3 96000
6 144000
9 192000
15 384000
>;
第一列为降低每一级阀值,第二列为降低频率,默认温控开始温度是80°.
例如当前温度是82°,那么不作用,当达到83°时, 温控降频开始有效,假设系统当前要设置1008000KHz,那么经过温控系统之后会减去96000KHz. 如果温度很高,就会一直这样减下去,减到不能低于min_temp_limit为止.
最终影响系统频率的地方是在dvfs_get_limit_rate().
不过原始code中min_temp_limit的单位有问题,应该是KHz.
改动:
kris@eco:~/rk3288/kernel$ g df 15b426e089c6f5091168ab3a0552ac96faa290c1 b3e70eaeda236c57e239ea2c3c24da49304b240f
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index e8dd31f..7d8804f 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -997,7 +997,9 @@
tsadc-ch = <1>;
temp-limit-enable = <1>;
target-temp = <80>;
- min_temp_limit = <48>;
+ min_temp_limit = <312000>;
312MHz是rk给的建议频率.
代码使用:
dvfs.c:
读取:
static int dvfs_node_parse_dt(struct device_node *np,
struct dvfs_node *dvfs_node)
{
of_property_read_u32_index(np, "min_temp_limit",
0, &dvfs_node->min_temp_limit);
dvfs_node->min_temp_limit *= 1000;
}
比较:
static void dvfs_temp_limit_normal(struct dvfs_node *dvfs_node, int temp)
{
if (arm_rate_step &&
(dvfs_node->temp_limit_rate > arm_rate_step)) {
dvfs_node->temp_limit_rate -= arm_rate_step;
printk("temp_limit_rate:%ldn", dvfs_node->temp_limit_rate);
if (dvfs_node->temp_limit_rate <
dvfs_node->min_temp_limit)
dvfs_node->temp_limit_rate =
dvfs_node->min_temp_limit;
dvfs_clk_set_rate(dvfs_node,
dvfs_node->last_set_rate);
dvfs_temp_limit_4k();
}
}
rk3288平台关于温度调节cpu频率有个bug.
在rk3288.dtsi中,有:
temp-limit-enable = <1>;
target-temp = <80>;
min_temp_limit = <48>;
当温度升到超过80°时,随着温度升高,cpu频率最终会降到min_temp_limit的值,每次降的level按照下表执行
target-temp = <80>;
normal-temp-limit = <
/* delta-temp delta-freq */
3 96000
6 144000
9 192000
15 384000
>;
第一列为降低每一级阀值,第二列为降低频率,默认温控开始温度是80°.
例如当前温度是82°,那么不作用,当达到83°时, 温控降频开始有效,假设系统当前要设置1008000KHz,那么经过温控系统之后会减去96000KHz. 如果温度很高,就会一直这样减下去,减到不能低于min_temp_limit为止.
最终影响系统频率的地方是在dvfs_get_limit_rate().
不过原始code中min_temp_limit的单位有问题,应该是KHz.
改动:
kris@eco:~/rk3288/kernel$ g df 15b426e089c6f5091168ab3a0552ac96faa290c1 b3e70eaeda236c57e239ea2c3c24da49304b240f
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index e8dd31f..7d8804f 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -997,7 +997,9 @@
tsadc-ch = <1>;
temp-limit-enable = <1>;
target-temp = <80>;
- min_temp_limit = <48>;
+ min_temp_limit = <312000>;
312MHz是rk给的建议频率.
代码使用:
dvfs.c:
读取:
static int dvfs_node_parse_dt(struct device_node *np,
struct dvfs_node *dvfs_node)
{
of_property_read_u32_index(np, "min_temp_limit",
0, &dvfs_node->min_temp_limit);
dvfs_node->min_temp_limit *= 1000;
}
比较:
static void dvfs_temp_limit_normal(struct dvfs_node *dvfs_node, int temp)
{
if (arm_rate_step &&
(dvfs_node->temp_limit_rate > arm_rate_step)) {
dvfs_node->temp_limit_rate -= arm_rate_step;
printk("temp_limit_rate:%ldn", dvfs_node->temp_limit_rate);
if (dvfs_node->temp_limit_rate <
dvfs_node->min_temp_limit)
dvfs_node->temp_limit_rate =
dvfs_node->min_temp_limit;
dvfs_clk_set_rate(dvfs_node,
dvfs_node->last_set_rate);
dvfs_temp_limit_4k();
}
}
举报