Tests:R-CAR-GEN3-CPUFreq

Kernel Version Configuration
CPUFreq support for R-Car Gen3 H3 (ES1.*) is currently available in a topic branch:

https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git topic/rcar-gen3-cpufreq

The ARM64 defconfig was used in with the following extra options enabled:

CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

Hardware Environment

 * Salvator-X/r8a7795 (Gen 3 R-Car H3 SoC) ES1.0
 * Salvator-XS/r8a7795 (Gen 3 R-Car H3 SoC) ES2.0
 * Salvator-X/r8a7796 (Gen 3 R-Car M3-W SoC) ES1.0

The results shown below are from tests performed on the Salvator-X/r8a7795.

The Salvator-XS/r8a7795 gives the same results.

The Salvator-X/r8a7796 gives similar results but with 2 CPU cores rather than 4.

Verify Driver Initialisation
Initialisation of CPUFreq can be checked by checking for the presence of cpufreq directories in sysfs

/sys/devices/system/cpu/cpu3/cpufreq /sys/devices/system/cpu/cpu1/cpufreq /sys/devices/system/cpu/cpufreq /sys/devices/system/cpu/cpu2/cpufreq /sys/devices/system/cpu/cpu0/cpufreq /sys/module/cpufreq
 * 1) find /sys -name cpufreq

Change to cpu sysfs directory

 * 1) cd /sys/devices/system/cpu

Inspect Available Frequencies
cpu0/cpufreq/scaling_available_frequencies:500000 1000000 1500000 cpu1/cpufreq/scaling_available_frequencies:500000 1000000 1500000 cpu2/cpufreq/scaling_available_frequencies:500000 1000000 1500000 cpu3/cpufreq/scaling_available_frequencies:500000 1000000 1500000
 * 1) grep . */cpufreq/scaling_available_frequencies

Inspect Available Governors
cpu0/cpufreq/scaling_available_governors:conservative performance cpu1/cpufreq/scaling_available_governors:conservative performance cpu2/cpufreq/scaling_available_governors:conservative performance cpu3/cpufreq/scaling_available_governors:conservative performance
 * 1) grep . */cpufreq/scaling_available_governors

Change to cpu sysfs directory

 * 1) cd /sys/devices/system/cpu

Set Governor
The conservative governor will be used for this test


 * 1) echo conservative > cpu0/cpufreq/scaling_governor

cpu0/cpufreq/scaling_governor:conservative cpu1/cpufreq/scaling_governor:conservative cpu2/cpufreq/scaling_governor:conservative cpu3/cpufreq/scaling_governor:conservative
 * 1) grep . */cpufreq/scaling_governor

Observe CPU Frequency Changes
On an idle system:
 * 1) Check the frequency; it should be a low value
 * 2) Apply some load to the system
 * 3) Check the frequency again; it should be a higher value
 * 4) Wait; the system is once again idle
 * 5) Check the frequency one last time; it should be reduced again

cpu0/cpufreq/scaling_cur_freq:500000 cpu1/cpufreq/scaling_cur_freq:500000 cpu2/cpufreq/scaling_cur_freq:500000 cpu3/cpufreq/scaling_cur_freq:500000
 * 1) grep . */cpufreq/scaling_cur_freq

cpu0/cpufreq/scaling_cur_freq:1500000 cpu1/cpufreq/scaling_cur_freq:1500000 cpu2/cpufreq/scaling_cur_freq:1500000 cpu3/cpufreq/scaling_cur_freq:1500000
 * 1) for i in $(seq 1000000); do :; done
 * 2) grep . */cpufreq/scaling_cur_freq

cpu0/cpufreq/scaling_cur_freq:500000 cpu1/cpufreq/scaling_cur_freq:500000 cpu2/cpufreq/scaling_cur_freq:500000 cpu3/cpufreq/scaling_cur_freq:500000
 * 1) sleep 5
 * 2) grep . */cpufreq/scaling_cur_freq