[PATCH 3/4] cpufreq: mediatek: clean up cpufreq driver

Jia-Wei Chang jia-wei.chang at mediatek.com
Thu Mar 24 02:47:47 PDT 2022


On Mon, 2022-03-07 at 20:02 +0100, Krzysztof Kozlowski wrote:
> On 07/03/2022 13:21, Tim Chang wrote:
> > cleanup of naming, print log and comments.
> > 
> > Signed-off-by: Jia-Wei Chang <
> > jia-wei.chang at mediatek.corp-partner.google.com>
> > ---
> >  drivers/cpufreq/mediatek-cpufreq.c | 487 ++++++++++++++-----------
> > ----
> >  1 file changed, 233 insertions(+), 254 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/mediatek-cpufreq.c
> > b/drivers/cpufreq/mediatek-cpufreq.c
> > index 8e9d706d8081..3f00c7eb01f1 100644
> > --- a/drivers/cpufreq/mediatek-cpufreq.c
> > +++ b/drivers/cpufreq/mediatek-cpufreq.c
> > @@ -1,7 +1,6 @@
> >  // SPDX-License-Identifier: GPL-2.0-only
> >  /*
> > - * Copyright (c) 2015 Linaro Ltd.
> > - * Author: Pi-Cheng Chen <pi-cheng.chen at linaro.org>
> > + * Copyright (C) 2022 MediaTek Inc.
> 
> Removal of authorship and existing copyrights does not fit into
> "clean
> up". Please explain this thoroughly.

This is my mistake.
I will keep it as before and add myself as a new author.

> 
> >   */
> >  
> >  #include <linux/clk.h>
> > @@ -22,7 +21,7 @@
> >  #define VOLT_TOL		(10000)
> >  
> >  /*
> > - * The struct mtk_cpu_dvfs_info holds necessary information for
> > doing CPU DVFS
> > + * The struct mtk_cpufreq_drv holds necessary information for
> > doing CPU DVFS
> >   * on each CPU power/clock domain of Mediatek SoCs. Each CPU
> > cluster in
> >   * Mediatek SoCs has two voltage inputs, Vproc and Vsram. In some
> > cases the two
> >   * voltage inputs need to be controlled under a hardware
> > limitation:
> > @@ -32,7 +31,7 @@
> >   * needs to be switched to another stable PLL clock temporarily
> > until
> >   * the original PLL becomes stable at target frequency.
> >   */
> > -struct mtk_cpu_dvfs_info {
> > +struct mtk_cpufreq_drv {
> >  	struct cpumask cpus;
> >  	struct device *cpu_dev;
> >  	struct regulator *proc_reg;
> > @@ -40,45 +39,45 @@ struct mtk_cpu_dvfs_info {
> >  	struct clk *cpu_clk;
> >  	struct clk *inter_clk;
> >  	struct list_head list_head;
> > -	int intermediate_voltage;
> > +	int inter_voltage;
> >  	bool need_voltage_tracking;
> > -	int old_vproc;
> > -	struct mutex lock; /* avoid notify and policy race condition */
> > +	int old_voltage;
> > +	struct mutex lock;  /* avoid notify and policy race condition
> > */
> >  	struct notifier_block opp_nb;
> >  	int opp_cpu;
> >  	unsigned long opp_freq;
> >  };
> >  
> > -static LIST_HEAD(dvfs_info_list);
> > +static LIST_HEAD(drv_list);
> >  
> > -static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu)
> > +static struct mtk_cpufreq_drv *mtk_cpufreq_drv_lookup(int cpu)
> >  {
> > -	struct mtk_cpu_dvfs_info *info;
> > +	struct mtk_cpufreq_drv *drv;
> >  
> > -	list_for_each_entry(info, &dvfs_info_list, list_head) {
> > -		if (cpumask_test_cpu(cpu, &info->cpus))
> > -			return info;
> > +	list_for_each_entry(drv, &drv_list, list_head) {
> > +		if (cpumask_test_cpu(cpu, &drv->cpus))
> > +			return drv;>  	}
> >  
> >  	return NULL;
> >  }
> >  
> > -static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info
> > *info,
> > -					int new_vproc)
> > +static int mtk_cpufreq_voltage_tracking(struct mtk_cpufreq_drv
> > *drv,
> > +					int new_voltage)
> >  {
> > -	struct regulator *proc_reg = info->proc_reg;
> > -	struct regulator *sram_reg = info->sram_reg;
> > -	int old_vproc, old_vsram, new_vsram, vsram, vproc, ret;
> > -
> > -	old_vproc = regulator_get_voltage(proc_reg);
> > -	if (old_vproc < 0) {
> > -		pr_err("%s: invalid Vproc value: %d\n", __func__,
> > old_vproc);
> > -		return old_vproc;
> > +	struct regulator *proc_reg = drv->proc_reg;
> > +	struct regulator *sram_reg = drv->sram_reg;
> > +	int old_voltage, old_vsram, new_vsram, vsram, voltage, ret;
> > +
> > +	old_voltage = regulator_get_voltage(proc_reg);
> > +	if (old_voltage < 0) {
> > +		pr_err("%s: invalid vproc value: %d\n", __func__,
> > old_voltage);
> > +		return old_voltage;
> 
> 
> Several different changes in one commit. Please read the document
> "Submitting patches".
> 
> (...)

Sorry for my ignorance.
I will split the changes and send one change in one commit.

> 
> > -MODULE_AUTHOR("Pi-Cheng Chen <pi-cheng.chen at linaro.org>");
> > +MODULE_AUTHOR("Jia-Wei Chang <jia-wei.chang at mediatek.com>");
> 
> Ekhm, why? He was not the author?

This is my mistake.
I will keep it as before and add myself as a new author.

> 
> Best regards,
> Krzysztof




More information about the Linux-mediatek mailing list