RPI, cpufreq is not supported?

RPI 3B+, IPfire core 184.

I noticed I cannot use cpufreq-set to change power saving mode. Directory /sys/devices/system/cpu/cpufreq/ is empty, like kernel doesn’t support cpufreq

Commands cpufreq-set and cpufreq-info are not installed by default but could be added with pakfire install cpufrequtils

[root@rpifire ~]# cpufreq-set -g ondemand
Error setting new values. Common errors:
- Do you have proper administration rights? (super-user?)
- Is the governor you requested available and modprobed?
- Trying to set an invalid policy?
- Trying to set a specific frequency, but userspace governor is not available,
   for example because of hardware which cannot be set to a specific frequency
   or because the userspace governor isn't loaded?

[root@rpifire ~]# cpufreq-info 
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 1:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 2:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 3:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.

[root@rpifire ~]# ls /sys/devices/system/cpu/cpufreq/

[root@rpifire ~]# uname -a
Linux rpifire.localdomain 6.6.15-ipfire #1 SMP PREEMPT_DYNAMIC Fri Feb  9 18:47:53 GMT 2024 aarch64 GNU/Linux

Mainline linux has no special driver for the used broadcom platform on the RPi and all possible drivers are enabled.

#
# CPU frequency scaling drivers
#
CONFIG_CPUFREQ_DT=y
CONFIG_CPUFREQ_DT_PLATDEV=y
CONFIG_ACPI_CPPC_CPUFREQ=m
CONFIG_ACPI_CPPC_CPUFREQ_FIE=y
CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM=m
CONFIG_ARM_ARMADA_37XX_CPUFREQ=m
CONFIG_ARM_ARMADA_8K_CPUFREQ=m
CONFIG_ARM_IMX6Q_CPUFREQ=m
CONFIG_ARM_IMX_CPUFREQ_DT=m
CONFIG_ARM_SCMI_CPUFREQ=m
CONFIG_QORIQ_CPUFREQ=m
# end of CPU Frequency scaling
1 Like

This is Ubuntu 20.04.6 running at RPI4, it has older kernel and it supports cpufreq:

$ uname -a
Linux rpi4 5.4.0-1093-raspi #104-Ubuntu SMP PREEMPT Thu Aug 24 08:54:40 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

$ cpufreq-info 
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: cpufreq-dt
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 0.97 ms.
  hardware limits: 600 MHz - 1.50 GHz
  available frequency steps: 600 MHz, 700 MHz, 800 MHz, 900 MHz, 1000 MHz, 1.10 GHz, 1.20 GHz, 1.30 GHz, 1.40 GHz, 1.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 600 MHz and 1.50 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.50 GHz.
  cpufreq stats: 600 MHz:22.66%, 700 MHz:1.31%, 800 MHz:0.14%, 900 MHz:0.15%, 1000 MHz:0.16%, 1.10 GHz:0.21%, 1.20 GHz:0.17%, 1.30 GHz:0.08%, 1.40 GHz:0.06%, 1.50 GHz:75.05%  (48734165)
analyzing CPU 1:
...

$ ls /sys/devices/system/cpu/cpufreq/
ondemand  policy0

looks like there is devicetree change. Maybee ubuntu ships a modified version.

cpufreq-dt itself is supported by the IPFire kernel but it need special node from the devicetree/bootloader to find the hardware.

There should be an extra option for RPI, CONFIG_ARM_RASPBERRYPI_CPUFREQ

But this options is not preset so it depends on some other option. I will check this in the sourcecode…

This one has to be enabled:

# CONFIG_CLK_RASPBERRYPI is not set

I know now and i have already done this.

https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=732199b11b6f85b33bd36dedf521e074e81d170d

But build and testing needs time so i have not posted this yet.
You can get in unstable tree or from nightly builds now.
https://nightly.ipfire.org/next/

2 Likes