2de8eb6394ca2d1bdc2728da1fabb27e77a69378
[openwrt/staging/ansuel.git] /
1 From fe6ef09358dc0cfead9d383a8676fbe7a40fcef7 Mon Sep 17 00:00:00 2001
2 From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
3 Date: Fri, 24 Mar 2023 18:11:30 +0800
4 Subject: [PATCH 20/21] cpufreq: mediatek: Raise proc and sram max voltage for
5 MT7622/7623
6
7 During the addition of SRAM voltage tracking for CCI scaling, this
8 driver got some voltage limits set for the vtrack algorithm: these
9 were moved to platform data first, then enforced in a later commit
10 6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()")
11 using these as max values for the regulator_set_voltage() calls.
12
13 In this case, the vsram/vproc constraints for MT7622 and MT7623
14 were supposed to be the same as MT2701 (and a number of other SoCs),
15 but that turned out to be a mistake because the aforementioned two
16 SoCs' maximum voltage for both VPROC and VPROC_SRAM is 1.36V.
17
18 Fix that by adding new platform data for MT7622/7623 declaring the
19 right {proc,sram}_max_volt parameter.
20
21 Fixes: ead858bd128d ("cpufreq: mediatek: Move voltage limits to platform data")
22 Fixes: 6a17b3876bc8 ("cpufreq: mediatek: Refine mtk_cpufreq_voltage_tracking()")
23 Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
24 Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
25 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
26 ---
27 drivers/cpufreq/mediatek-cpufreq.c | 13 +++++++++++--
28 1 file changed, 11 insertions(+), 2 deletions(-)
29
30 --- a/drivers/cpufreq/mediatek-cpufreq.c
31 +++ b/drivers/cpufreq/mediatek-cpufreq.c
32 @@ -693,6 +693,15 @@ static const struct mtk_cpufreq_platform
33 .ccifreq_supported = false,
34 };
35
36 +static const struct mtk_cpufreq_platform_data mt7622_platform_data = {
37 + .min_volt_shift = 100000,
38 + .max_volt_shift = 200000,
39 + .proc_max_volt = 1360000,
40 + .sram_min_volt = 0,
41 + .sram_max_volt = 1360000,
42 + .ccifreq_supported = false,
43 +};
44 +
45 static const struct mtk_cpufreq_platform_data mt8183_platform_data = {
46 .min_volt_shift = 100000,
47 .max_volt_shift = 200000,
48 @@ -724,8 +733,8 @@ static const struct mtk_cpufreq_platform
49 static const struct of_device_id mtk_cpufreq_machines[] __initconst = {
50 { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data },
51 { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data },
52 - { .compatible = "mediatek,mt7622", .data = &mt2701_platform_data },
53 - { .compatible = "mediatek,mt7623", .data = &mt2701_platform_data },
54 + { .compatible = "mediatek,mt7622", .data = &mt7622_platform_data },
55 + { .compatible = "mediatek,mt7623", .data = &mt7622_platform_data },
56 { .compatible = "mediatek,mt8167", .data = &mt8516_platform_data },
57 { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data },
58 { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data },