Jiri Slaby c783a0
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Jiri Slaby c783a0
Date: Fri, 24 Mar 2023 18:11:30 +0800
Jiri Slaby c783a0
Subject: [PATCH] cpufreq: mediatek: Raise proc and sram max voltage for
Jiri Slaby c783a0
 MT7622/7623
Jiri Slaby c783a0
References: bsc#1012628
Jiri Slaby c783a0
Patch-mainline: 6.3.2
Jiri Slaby c783a0
Git-commit: 0883426fd07e39355362e3f2eb9aee1a154dcaf6
Jiri Slaby c783a0
Jiri Slaby c783a0
[ Upstream commit 0883426fd07e39355362e3f2eb9aee1a154dcaf6 ]
Jiri Slaby c783a0
Jiri Slaby c783a0
During the addition of SRAM voltage tracking for CCI scaling, this
Jiri Slaby c783a0
driver got some voltage limits set for the vtrack algorithm: these
Jiri Slaby c783a0
were moved to platform data first, then enforced in a later commit
Jiri Slaby c783a0
6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()")
Jiri Slaby c783a0
using these as max values for the regulator_set_voltage() calls.
Jiri Slaby c783a0
Jiri Slaby c783a0
In this case, the vsram/vproc constraints for MT7622 and MT7623
Jiri Slaby c783a0
were supposed to be the same as MT2701 (and a number of other SoCs),
Jiri Slaby c783a0
but that turned out to be a mistake because the aforementioned two
Jiri Slaby c783a0
SoCs' maximum voltage for both VPROC and VPROC_SRAM is 1.36V.
Jiri Slaby c783a0
Jiri Slaby c783a0
Fix that by adding new platform data for MT7622/7623 declaring the
Jiri Slaby c783a0
right {proc,sram}_max_volt parameter.
Jiri Slaby c783a0
Jiri Slaby c783a0
Fixes: ead858bd128d ("cpufreq: mediatek: Move voltage limits to platform data")
Jiri Slaby c783a0
Fixes: 6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()")
Jiri Slaby c783a0
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Jiri Slaby c783a0
Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
Jiri Slaby c783a0
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Jiri Slaby c783a0
Signed-off-by: Sasha Levin <sashal@kernel.org>
Jiri Slaby c783a0
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Jiri Slaby c783a0
---
Jiri Slaby c783a0
 drivers/cpufreq/mediatek-cpufreq.c | 13 +++++++++++--
Jiri Slaby c783a0
 1 file changed, 11 insertions(+), 2 deletions(-)
Jiri Slaby c783a0
Jiri Slaby c783a0
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
Jiri Slaby c783a0
index 764e4fbd..9a39a7cc 100644
Jiri Slaby c783a0
--- a/drivers/cpufreq/mediatek-cpufreq.c
Jiri Slaby c783a0
+++ b/drivers/cpufreq/mediatek-cpufreq.c
Jiri Slaby c783a0
@@ -693,6 +693,15 @@ static const struct mtk_cpufreq_platform_data mt2701_platform_data = {
Jiri Slaby c783a0
 	.ccifreq_supported = false,
Jiri Slaby c783a0
 };
Jiri Slaby c783a0
 
Jiri Slaby c783a0
+static const struct mtk_cpufreq_platform_data mt7622_platform_data = {
Jiri Slaby c783a0
+	.min_volt_shift = 100000,
Jiri Slaby c783a0
+	.max_volt_shift = 200000,
Jiri Slaby c783a0
+	.proc_max_volt = 1360000,
Jiri Slaby c783a0
+	.sram_min_volt = 0,
Jiri Slaby c783a0
+	.sram_max_volt = 1360000,
Jiri Slaby c783a0
+	.ccifreq_supported = false,
Jiri Slaby c783a0
+};
Jiri Slaby c783a0
+
Jiri Slaby c783a0
 static const struct mtk_cpufreq_platform_data mt8183_platform_data = {
Jiri Slaby c783a0
 	.min_volt_shift = 100000,
Jiri Slaby c783a0
 	.max_volt_shift = 200000,
Jiri Slaby c783a0
@@ -724,8 +733,8 @@ static const struct mtk_cpufreq_platform_data mt8516_platform_data = {
Jiri Slaby c783a0
 static const struct of_device_id mtk_cpufreq_machines[] __initconst = {
Jiri Slaby c783a0
 	{ .compatible = "mediatek,mt2701", .data = &mt2701_platform_data },
Jiri Slaby c783a0
 	{ .compatible = "mediatek,mt2712", .data = &mt2701_platform_data },
Jiri Slaby c783a0
-	{ .compatible = "mediatek,mt7622", .data = &mt2701_platform_data },
Jiri Slaby c783a0
-	{ .compatible = "mediatek,mt7623", .data = &mt2701_platform_data },
Jiri Slaby c783a0
+	{ .compatible = "mediatek,mt7622", .data = &mt7622_platform_data },
Jiri Slaby c783a0
+	{ .compatible = "mediatek,mt7623", .data = &mt7622_platform_data },
Jiri Slaby c783a0
 	{ .compatible = "mediatek,mt8167", .data = &mt8516_platform_data },
Jiri Slaby c783a0
 	{ .compatible = "mediatek,mt817x", .data = &mt2701_platform_data },
Jiri Slaby c783a0
 	{ .compatible = "mediatek,mt8173", .data = &mt2701_platform_data },
Jiri Slaby c783a0
-- 
Jiri Slaby c783a0
2.35.3
Jiri Slaby c783a0