Difference between revisions of "CPU"

From FriendlyELEC WiKi
Jump to: navigation, search
(S5P4418/S5P6818 降低CPU频率)
Line 22: Line 22:
 
     {  500000,  940000, },
 
     {  500000,  940000, },
 
     {  400000,  940000, },
 
     {  400000,  940000, },
 +
};
 +
</syntaxhighlight>
 +
 +
==H3 DVFS==
 +
H3 Linux-4.14 DVFS的设置位于arch/arm/boot/dts/sun8i-h3-nanopi.dtsi:
 +
<syntaxhighlight lang="bash">
 +
&cpu0 {
 +
operating-points = <
 +
1008000 1300000
 +
816000 1100000
 +
624000 1100000
 +
480000 1100000
 +
312000 1100000
 +
240000 1100000
 +
120000 1100000
 +
>;
 +
#cooling-cells = <2>;
 +
cooling-min-level = <0>;
 +
cooling-max-level = <6>;
 +
cpu0-supply = <&vdd_cpux>;
 +
};
 +
 +
&cpu_thermal {
 +
trips {
 +
cpu_warm: cpu_warm {
 +
temperature = <65000>;
 +
hysteresis = <2000>;
 +
type = "passive";
 +
};
 +
cpu_hot: cpu_hot {
 +
temperature = <75000>;
 +
hysteresis = <2000>;
 +
type = "passive";
 +
};
 +
cpu_very_hot: cpu_very_hot {
 +
temperature = <90000>;
 +
hysteresis = <2000>;
 +
type = "passive";
 +
};
 +
cpu_crit: cpu_crit {
 +
temperature = <105000>;
 +
hysteresis = <2000>;
 +
type = "critical";
 +
};
 +
};
 +
 +
cooling-maps {
 +
cpu_warm_limit_cpu {
 +
trip = <&cpu_warm>;
 +
cooling-device = <&cpu0 THERMAL_NO_LIMIT 1>;
 +
};
 +
cpu_hot_limit_cpu {
 +
trip = <&cpu_hot>;
 +
cooling-device = <&cpu0 2 3>;
 +
};
 +
cpu_very_hot_limit_cpu {
 +
trip = <&cpu_very_hot>;
 +
cooling-device = <&cpu0 5 THERMAL_NO_LIMIT>;
 +
};
 +
};
 +
};
 +
</syntaxhighlight>
 +
 +
==H5 DVFS==
 +
以NanoPi NEO2 Linux-4.14 DVFS的设置位于arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts:
 +
<syntaxhighlight lang="bash">
 +
&cpu0 {
 +
operating-points = <
 +
1008000 1100000
 +
816000 1100000
 +
624000 1100000
 +
480000 1100000
 +
312000 1100000
 +
240000 1100000
 +
120000 1100000
 +
>;
 +
#cooling-cells = <2>;
 +
cooling-min-level = <0>;
 +
cooling-max-level = <6>;
 +
cpu0-supply = <&vdd_cpux>;
 +
};
 +
 +
&cpu_thermal {
 +
trips {
 +
cpu_warm: cpu_warm {
 +
temperature = <65000>;
 +
hysteresis = <2000>;
 +
type = "passive";
 +
};
 +
cpu_hot: cpu_hot {
 +
temperature = <75000>;
 +
hysteresis = <2000>;
 +
type = "passive";
 +
};
 +
cpu_very_hot: cpu_very_hot {
 +
temperature = <90000>;
 +
hysteresis = <2000>;
 +
type = "passive";
 +
};
 +
cpu_crit: cpu_crit {
 +
temperature = <105000>;
 +
hysteresis = <2000>;
 +
type = "critical";
 +
};
 +
};
 +
 +
cooling-maps {
 +
cpu_warm_limit_cpu {
 +
trip = <&cpu_warm>;
 +
cooling-device = <&cpu0 THERMAL_NO_LIMIT 1>;
 +
};
 +
cpu_hot_limit_cpu {
 +
trip = <&cpu_hot>;
 +
cooling-device = <&cpu0 2 3>;
 +
};
 +
cpu_very_hot_limit_cpu {
 +
trip = <&cpu_very_hot>;
 +
cooling-device = <&cpu0 5 THERMAL_NO_LIMIT>;
 +
};
 +
};
 
};
 
};
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 07:53, 16 November 2018

1 S5P4418/S5P6818 锁定CPU的最高频率

1.1 Method 1

The following command is used to temporarily limit the maximum CPU frequency to 1GHz: echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq


1.2 Method 2

Modify the kernel source code:

arch/arm/plat-s5p4418/nanopi2/device.c

Delete the unwanted frequencies in the following array:

static unsigned long dfs_freq_table[][2] = {
    { 1400000, 1200000, },
    { 1200000, 1120000, },
    { 1000000, 1040000, },
    {  800000, 1000000, },
    {  700000,  940000, },
    {  600000,  940000, },
    {  500000,  940000, },
    {  400000,  940000, },
};

2 H3 DVFS

H3 Linux-4.14 DVFS的设置位于arch/arm/boot/dts/sun8i-h3-nanopi.dtsi:

&cpu0 {
	operating-points = <
		1008000	1300000
		816000	1100000
		624000	1100000
		480000	1100000
		312000	1100000
		240000	1100000
		120000	1100000
		>;
	#cooling-cells = <2>;
	cooling-min-level = <0>;
	cooling-max-level = <6>;
	cpu0-supply = <&vdd_cpux>;
};
 
&cpu_thermal {
	trips {
		cpu_warm: cpu_warm {
			temperature = <65000>;
			hysteresis = <2000>;
			type = "passive";
		};
		cpu_hot: cpu_hot {
			temperature = <75000>;
			hysteresis = <2000>;
			type = "passive";
		};
		cpu_very_hot: cpu_very_hot {
			temperature = <90000>;
			hysteresis = <2000>;
			type = "passive";
		};
		cpu_crit: cpu_crit {
			temperature = <105000>;
			hysteresis = <2000>;
			type = "critical";
		};
	};
 
	cooling-maps {
		cpu_warm_limit_cpu {
			trip = <&cpu_warm>;
			cooling-device = <&cpu0 THERMAL_NO_LIMIT 1>;
		};
		cpu_hot_limit_cpu {
			trip = <&cpu_hot>;
			cooling-device = <&cpu0 2 3>;
		};
		cpu_very_hot_limit_cpu {
			trip = <&cpu_very_hot>;
			cooling-device = <&cpu0 5 THERMAL_NO_LIMIT>;
		};
	};
};

3 H5 DVFS

以NanoPi NEO2 Linux-4.14 DVFS的设置位于arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts:

&cpu0 {
	operating-points = <
		1008000	1100000
		816000	1100000
		624000	1100000
		480000	1100000
		312000	1100000
		240000	1100000
		120000	1100000
		>;
	#cooling-cells = <2>;
	cooling-min-level = <0>;
	cooling-max-level = <6>;
	cpu0-supply = <&vdd_cpux>;
};
 
&cpu_thermal {
	trips {
		cpu_warm: cpu_warm {
			temperature = <65000>;
			hysteresis = <2000>;
			type = "passive";
		};
		cpu_hot: cpu_hot {
			temperature = <75000>;
			hysteresis = <2000>;
			type = "passive";
		};
		cpu_very_hot: cpu_very_hot {
			temperature = <90000>;
			hysteresis = <2000>;
			type = "passive";
		};
		cpu_crit: cpu_crit {
			temperature = <105000>;
			hysteresis = <2000>;
			type = "critical";
		};
	};
 
	cooling-maps {
		cpu_warm_limit_cpu {
			trip = <&cpu_warm>;
			cooling-device = <&cpu0 THERMAL_NO_LIMIT 1>;
		};
		cpu_hot_limit_cpu {
			trip = <&cpu_hot>;
			cooling-device = <&cpu0 2 3>;
		};
		cpu_very_hot_limit_cpu {
			trip = <&cpu_very_hot>;
			cooling-device = <&cpu0 5 THERMAL_NO_LIMIT>;
		};
	};
};

4 获取CPU温度

读取以下文件获得当前的CPU温度:
S5P4418/S5P6818:
/sys/class/hwmon/hwmon0/device/temp_label
Allwinner H3/H5/A64:
/sys/class/thermal/thermal_zone0/temp
RK3399:
/sys/class/thermal/thermal_zone0/temp