[<prev] [next>] [day] [month] [year] [list]
Message-ID: <d9f514b6-1116-30d3-274f-11e04a2dc8e9@collabora.com>
Date: Fri, 8 Apr 2022 15:36:53 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Rex-BC Chen <rex-bc.chen@...iatek.com>, rafael@...nel.org,
viresh.kumar@...aro.org, robh+dt@...nel.org, krzk+dt@...nel.org
Cc: matthias.bgg@...il.com, jia-wei.chang@...iatek.com,
roger.lu@...iatek.com, hsinyi@...gle.com, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Project_Global_Chrome_Upstream_Group@...iatek.com,
"Andrew-sh.Cheng" <andrew-sh.cheng@...iatek.com>
Subject: Re: [PATCH V2 07/15] cpufreq: mediatek: Add opp notification for SVS
support
Il 08/04/22 06:59, Rex-BC Chen ha scritto:
> From: "Andrew-sh.Cheng" <andrew-sh.cheng@...iatek.com>
>
> The Smart Voltage Scaling (SVS) is a hardware which calculates suitable
> SVS bank voltages to OPP voltage table.
>
> When the SVS is enabled, cpufreq should listen to opp notification and do
> proper actions when receiving events of disable and voltage adjustment.
>
> Signed-off-by: Andrew-sh.Cheng <andrew-sh.cheng@...iatek.com>
> Signed-off-by: Jia-Wei Chang <jia-wei.chang@...iatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@...iatek.com>
> ---
> drivers/cpufreq/mediatek-cpufreq.c | 90 +++++++++++++++++++++++++++---
> 1 file changed, 82 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
> index 472f4de29e5f..1369da62780a 100644
> --- a/drivers/cpufreq/mediatek-cpufreq.c
> +++ b/drivers/cpufreq/mediatek-cpufreq.c
..snip..
> +
> static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
> {
> struct device *cpu_dev;
> @@ -392,6 +455,17 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
> info->intermediate_voltage = dev_pm_opp_get_voltage(opp);
> dev_pm_opp_put(opp);
>
> + info->opp_cpu = cpu;
> + info->opp_nb.notifier_call = mtk_cpufreq_opp_notifier;
> + ret = dev_pm_opp_register_notifier(cpu_dev, &info->opp_nb);
You are registering this notifier, but never unregistering it.
Please unregister it in error conditions and also upon runtime removal of the
mediatek-cpufreq module.
-> dev_pm_opp_unregister_notifier()
Regards,
Angelo
> + if (ret) {
> + dev_warn(cpu_dev, "cpu%d: failed to register opp notifier\n", cpu);
> + goto out_disable_inter_clock;
> + }
> +
> + mutex_init(&info->reg_lock);
> + info->opp_freq = clk_get_rate(info->cpu_clk);
> +
> /*
> * If SRAM regulator is present, software "voltage tracking" is needed
> * for this CPU power domain.
Powered by blists - more mailing lists