summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/tegra194-cpufreq.c
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2021-09-15 11:55:16 +0300
committerViresh Kumar <viresh.kumar@linaro.org>2021-10-04 10:01:36 +0300
commitc2ace21f937a0c7a296d233b4441b99b66579bda (patch)
treedd1513bdcac5837479778bc8dc3b3aea7879754e /drivers/cpufreq/tegra194-cpufreq.c
parent6065a672679f0502ede024a03db82c03534a5e00 (diff)
downloadlinux-c2ace21f937a0c7a296d233b4441b99b66579bda.tar.xz
cpufreq: tegra186/tegra194: Handle errors in BPMP response
The return value from tegra_bpmp_transfer indicates the success or failure of the IPC transaction with BPMP. If the transaction succeeded, we also need to check the actual command's result code. Add code to do this. While at it, explicitly handle missing CPU clusters, which can occur on floorswept chips. This worked before as well, but possibly only by accident. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq/tegra194-cpufreq.c')
-rw-r--r--drivers/cpufreq/tegra194-cpufreq.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index a9620e4489ae..ac381db25dbe 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -242,7 +242,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
- if (cl >= data->num_clusters)
+ if (cl >= data->num_clusters || !data->tables[cl])
return -EINVAL;
/* set same policy for all cpus in a cluster */
@@ -310,6 +310,12 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp,
err = tegra_bpmp_transfer(bpmp, &msg);
if (err)
return ERR_PTR(err);
+ if (msg.rx.ret == -BPMP_EINVAL) {
+ /* Cluster not available */
+ return NULL;
+ }
+ if (msg.rx.ret)
+ return ERR_PTR(-EINVAL);
/*
* Make sure frequency table step is a multiple of mdiv to match