Re: [PATCH] cpufreq: loongson3: Support older SMC firmware
From: Yao Zi
Date: Mon Jun 23 2025 - 21:42:30 EST
On Mon, Jun 23, 2025 at 10:59:50PM +0800, Xi Ruoyao wrote:
> On Mon, 2025-06-23 at 12:33 +0000, Yao Zi wrote:
>
> /* snip */
>
> > -static struct cpufreq_driver loongson3_cpufreq_driver = {
> > +static struct cpufreq_driver loongson3_cpufreq_smc0_driver = {
> > .name = "loongson3",
>
> How about using different names for the drivers?
I don't have a strong opinion on the name since it could be considered
in both ways,
- SMCv0 and SMCv1 provide similar functions and are implemented in the
same driver. The firmware version is already printed in the probe
callback, which should be enough for debugging purpose.
- Meanwhile, loongson3_cpufreq_smc0_driver and
loongson3_cpufreq_smc1_driver ARE different sets of callbacks,
different names may avoid future confusion.
I'm willing to provide different names in v2 unless you change your mind
or there're further objections, thanks.
> > .flags = CPUFREQ_CONST_LOOPS,
> > - .init = loongson3_cpufreq_cpu_init,
> > + .init = loongson3_cpufreq_cpu_smc0_init,
> > .exit = loongson3_cpufreq_cpu_exit,
> > .online = loongson3_cpufreq_cpu_online,
> > .offline = loongson3_cpufreq_cpu_offline,
> > - .get = loongson3_cpufreq_get,
> > - .target_index = loongson3_cpufreq_target,
> > + .target_index = loongson3_cpufreq_smc0_target,
> > + .verify = cpufreq_generic_frequency_table_verify,
> > + .suspend = cpufreq_generic_suspend,
> > +};
> > +
> > +static struct cpufreq_driver loongson3_cpufreq_smc1_driver = {
> > + .name = "loongson3",
>
> Tested on a 3A6000 laptop with the schedutil policy. On idle one core
> is at 2000MHz and other cores are at 250MHz, when building the kernel
> all cores are at 2000MHz.
>
> Tested-by: Xi Ruoyao <xry111@xxxxxxxxxxx>
>
> --
> Xi Ruoyao <xry111@xxxxxxxxxxx>
>
Regards,
Yao Zi