Re: [PATCH V2 07/15] cpufreq: mediatek: Add opp notification for SVS support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il 08/04/22 06:59, Rex-BC Chen ha scritto:
From: "Andrew-sh.Cheng" <andrew-sh.cheng@xxxxxxxxxxxx>

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@xxxxxxxxxxxx>
Signed-off-by: Jia-Wei Chang <jia-wei.chang@xxxxxxxxxxxx>
Signed-off-by: Rex-BC Chen <rex-bc.chen@xxxxxxxxxxxx>
---
  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.





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux