fix cpufreq

Signed-off-by: a@b.com <a@b.com>
This commit is contained in:
a@b.com 2023-04-27 15:47:49 +08:00
parent 359d67a0a0
commit b49c6eb3ae
4 changed files with 15 additions and 3 deletions

View File

@ -340,3 +340,9 @@ config ARM_PXA2xx_CPUFREQ
This add the CPUFreq driver support for Intel PXA2xx SOCs.
If in doubt, say N.
config ARM64_PHYTIUM_CPUFREQ
bool "Phytium CPUFreq support"
depends on CPUFREQ_DT && CPUFREQ_DT_PLATDEV
default y
help
This add the CPUFreq driver support for Ft2004

View File

@ -86,6 +86,7 @@ obj-$(CONFIG_ARM_TEGRA186_CPUFREQ) += tegra186-cpufreq.o
obj-$(CONFIG_ARM_TEGRA194_CPUFREQ) += tegra194-cpufreq.o
obj-$(CONFIG_ARM_TI_CPUFREQ) += ti-cpufreq.o
obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
obj-$(CONFIG_ARM64_PHYTIUM_CPUFREQ) += ft2004-cpufreq.o
##################################################################################

View File

@ -153,6 +153,7 @@ static struct cpufreq_driver ft2004_freq_driver = {
.attr = cpufreq_generic_attr,
};
extern bool cpu_is_phytium(void);
static int __init ft2004_freq_init(void)
{
int ret;
@ -177,13 +178,12 @@ static int __init ft2004_freq_init(void)
return ret;
}
static void __exit ft2004_freq_exit(void)
{
int i;
if (!cpu_is_phytium()) {
return -EPERM;
return ;
}
cpufreq_unregister_driver(&ft2004_freq_driver);

View File

@ -47,8 +47,13 @@ char *get_cpu_name(void)
dmi_walk(get_cpuname_by_dmi, cpu_name);
if(cpu_name == NULL) {
#ifdef CONFIG_ARCH_PHYTIUM
pr_info("Q cpu_name null, change\n");
return "FT-2000/4";
#else
/* Some BIOS don't support getting CPU name from DMI */
return "UNKNOWN-CPU";
#endif
}
return cpu_name;