3.2.2.11.2. DVFS

Note

AM62x supports dynamic frequency scaling only. The voltage remains constant based on the device speed grade.

Overview

Dynamic voltage and frequency scaling, or DVFS as it is commonly known, is the ability of a part to modify both the voltage and frequency it operates at based on need, user preference, or other factors. MPU DVFS is supported in the kernel by the cpufreq driver. All supported SoCs use the generic cpufreq driver. The frequency at which the MPU operates is selected by a driver called a governor. Each governor has a different strategy for selecting the most appropriate frequency. The following governors are available within the kernel: Performance, Powersave, Userspace, Ondemand, Conservative, Schedutil. More in depth documentation about each governor can be found in the linux kernel documentation here: https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt

By default, cpufreq, the cpufreq-dt driver, and all of the standard governors are enabled with the performance governor selected as the default. AM62x supports dynamic frequency scaling only. The voltage remains constant based on the device speed grade.

Kernel Configuration Options

The driver can be built into the kernel as a static module, dynamic module, or both.

$ make menuconfig

Select CPU Power Management from the main menu.

...
Boot options --->
Power management options  --->
CPU Power Management --->
...

Select CPU Frequency Scaling as shown here:

CPU Idle  --->
CPU Frequency Scaling --->

All relevant options are listed below:

[*] CPU Frequency scaling
[*]   CPU frequency transition statistics
      Default CPUFreq governor (performance)  --->
<*>   'performance' governor
<M>   'powersave' governor
-*-   'userspace' governor for userspace frequency scaling
<*>   'ondemand' cpufreq policy governor
<M>   'conservative' cpufreq governor
[*]   'schedutil' cpufreq policy governor
      *** CPU frequency scaling drivers ***
<*>   Generic DT based cpufreq driver
[*]    Texas Instruments CPUFreq support

Driver Usage

All of the standard governors are built-in to the kernel, and by default the performance governor is selected.

To view available governors,

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand userspace performance schedutil

To view current governor,

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance

To set a governor,

$ echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

To view current OPP (frequency in kHz)

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
1400000

To view supported OPP’s (frequency in kHz),

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
200000 400000 600000 800000 1000000 1250000 1400000

To change OPP (can be done only for userspace governor. If governors like ondemand is used, OPP change happens automatically based on the system load)

$ echo 200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

Operating Points

The OPP tables defined in arch/arm64/boot/dts/ti/k3-am625.dtsi allows defining of a different set of OPPs for each different SoC.

/* From arch/arm64/boot/dts/ti/k3-am625.dtsi */
a53_opp_table: opp-table {
        compatible = "operating-points-v2-ti-cpu";
        opp-shared;
        syscon = <&wkup_conf>;

        opp-200000000 {
                opp-hz = /bits/ 64 <200000000>;
                opp-supported-hw = <0x01 0x0007>;
                clock-latency-ns = <6000000>;
                opp-suspend;
        };

        opp-400000000 {
                opp-hz = /bits/ 64 <400000000>;
                opp-supported-hw = <0x01 0x0007>;
                clock-latency-ns = <6000000>;
        };

        opp-600000000 {
                opp-hz = /bits/ 64 <600000000>;
                opp-supported-hw = <0x01 0x0007>;
                clock-latency-ns = <6000000>;
        };

        opp-800000000 {
                opp-hz = /bits/ 64 <800000000>;
                opp-supported-hw = <0x01 0x0007>;
                clock-latency-ns = <6000000>;
        };

        opp-1000000000 {
                opp-hz = /bits/ 64 <1000000000>;
                opp-supported-hw = <0x01 0x0006>;
                clock-latency-ns = <6000000>;
        };

        opp-1250000000 {
                opp-hz = /bits/ 64 <1250000000>;
                opp-supported-hw = <0x01 0x0004>;
                clock-latency-ns = <6000000>;
        };
};

To disable any of the above OPP’s one can simply add

status = "disabled";

to the corresponding DT Node.