c0137894c934133b2feb058b4c6227c8bc62f4e7
[openwrt/staging/wigyori.git] /
1 From 75d19b24aa3203d6c78e4c431c2cc07157ce12fe Mon Sep 17 00:00:00 2001
2 From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
3 Date: Wed, 13 Jul 2022 13:15:36 +0200
4 Subject: [PATCH 15/21] cpufreq: mediatek: Handle sram regulator probe deferral
5
6 If the regulator_get_optional() call for the SRAM regulator returns
7 a probe deferral, we must bail out and retry probing later: failing
8 to do this will produce unstabilities on platforms requiring the
9 handling for this regulator.
10
11 Fixes: ffa7bdf7f344 ("cpufreq: mediatek: Make sram regulator optional")
12 Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
13 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
14 ---
15 drivers/cpufreq/mediatek-cpufreq.c | 8 ++++++--
16 1 file changed, 6 insertions(+), 2 deletions(-)
17
18 --- a/drivers/cpufreq/mediatek-cpufreq.c
19 +++ b/drivers/cpufreq/mediatek-cpufreq.c
20 @@ -439,9 +439,13 @@ static int mtk_cpu_dvfs_info_init(struct
21
22 /* Both presence and absence of sram regulator are valid cases. */
23 info->sram_reg = regulator_get_optional(cpu_dev, "sram");
24 - if (IS_ERR(info->sram_reg))
25 + if (IS_ERR(info->sram_reg)) {
26 + ret = PTR_ERR(info->sram_reg);
27 + if (ret == -EPROBE_DEFER)
28 + goto out_free_resources;
29 +
30 info->sram_reg = NULL;
31 - else {
32 + } else {
33 ret = regulator_enable(info->sram_reg);
34 if (ret) {
35 dev_warn(cpu_dev, "cpu%d: failed to enable vsram\n", cpu);