Configure CPU frequency early at boot


#1

I would like to change the Snapdragon 410 CPU frequency (for each core) early during the boot process (i.e. bootloader or kernel startup). Right now, I set the CPU frequency using a sysvinit script and call cpufreq-set to set the preferred governor and cpu frequency thresholds. However, I would like to know whether I make these changes take effect sooner during the boot process (ideally as soon as possible).
I’m currently digging through both the little kernel (bootloader) and linux kernel source for where these might be configured or configurable. Also sifting through the APQ8016 and PMIC data sheets for any clues.

Is this even possible (i.e. do I need source to the SBL code or is there some hidden register?)

Thanks!


#2

Have you already looked at modifying the device tree for the board? Look for cpu_opp_table in arch/arm64/boot/dts/qcom/msm8916.dtsi (https://git.linaro.org/people/amit.kucheria/kernel.git/commit/?h=tracking/8016/dvfs&id=4a0235c1fc5a537542e2cea03347b78da60a008f)

It should have made it to the 4.14 release, but I don’t see it. I’ll investigate next week and make sure it does.


#3

I am just curious if can build a kernel with ‘performance’ governor as default governor, and then after system finish booting (Like UI has started), you can change to other more power efficiency governor (e.g. ‘ondemand’ or ‘schedutil’ governor). The benefit of this method is to avoid any code change :slight_smile: Not sure if this can meet your requirement or not.

FWIW, suggest you could take a look for Viresh Kumar’s patch set for “boot constraint”: https://lkml.org/lkml/2018/2/23/197, I think at least it can give some hints for this kind optimization.