]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cpufreq: Add Loongson-3 CPUFreq driver support
authorHuacai Chen <chenhuacai@loongson.cn>
Fri, 5 Jul 2024 06:06:49 +0000 (14:06 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 9 Jul 2024 03:15:43 +0000 (08:45 +0530)
commitccf51454145bffd98e31cdbe54a4262473c609e2
treec0490a3b616120418fd50825d9f8f841e77df50f
parentb4b1ddc9dfe997a5f492fa3a36487f8e7a5de30d
cpufreq: Add Loongson-3 CPUFreq driver support

Some of LoongArch processors (Loongson-3 series) support DVFS, their
IOCSR.FEATURES has IOCSRF_FREQSCALE set. And they has a micro-core in
the package called SMC (System Management Controller), which can be
used to detect temperature, control fans, scale frequency and voltage,
etc.

The Loongson-3 CPUFreq driver is very simple now, it communicate with
SMC, get DVFS info, set target frequency from CPUFreq core, and so on.

There is a command list to interact with SMC, widely-used commands in
the CPUFreq driver include:

CMD_GET_VERSION: Get SMC firmware version.

CMD_GET_FEATURE: Get enabled SMC features.

CMD_SET_FEATURE: Enable SMC features, such as basic DVFS, BOOST.

CMD_GET_FREQ_LEVEL_NUM: Get the number of all frequency levels.

CMD_GET_FREQ_BOOST_LEVEL: Get the first boost frequency level.

CMD_GET_FREQ_LEVEL_INFO: Get the detail info of a frequency level.

CMD_GET_FREQ_INFO: Get the current frequency.

CMD_SET_FREQ_INFO: Set the target frequency.

In future we will add automatic frequency scaling, which is similar to
Intel's HWP (HardWare P-State).

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
[ Viresh: Minor formatting cleanups, change return type of exit() to
  void and use devm_mutex_init() ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
MAINTAINERS
drivers/cpufreq/Kconfig
drivers/cpufreq/Makefile
drivers/cpufreq/loongson3_cpufreq.c [new file with mode: 0644]