Skip to content

Commit

Permalink
drm/lima: Fix opp clkname setting in case of missing regulator
Browse files Browse the repository at this point in the history
[ Upstream commit e17a025 ]

Commit d8c32d3 ("drm/lima: Migrate to dev_pm_opp_set_config()")
introduced a regression as it may undo the clk_names setting in case
the optional regulator is missing. This resulted in test and performance
regressions with lima.

Restore the old behavior where clk_names is set separately so it is not
undone in case of a missing optional regulator.

Fixes: d8c32d3 ("drm/lima: Migrate to dev_pm_opp_set_config()")
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221027073200.3885839-1-nunes.erico@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
enunes authored and gregkh committed Nov 26, 2022
1 parent 6ee3a0a commit c08566d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/gpu/drm/lima/lima_devfreq.c
Expand Up @@ -112,19 +112,22 @@ int lima_devfreq_init(struct lima_device *ldev)
unsigned long cur_freq;
int ret;
const char *regulator_names[] = { "mali", NULL };
const char *clk_names[] = { "core", NULL };
struct dev_pm_opp_config config = {
.regulator_names = regulator_names,
.clk_names = clk_names,
};

if (!device_property_present(dev, "operating-points-v2"))
/* Optional, continue without devfreq */
return 0;

spin_lock_init(&ldevfreq->lock);

ret = devm_pm_opp_set_config(dev, &config);
/*
* clkname is set separately so it is not affected by the optional
* regulator setting which may return error.
*/
ret = devm_pm_opp_set_clkname(dev, "core");
if (ret)
return ret;

ret = devm_pm_opp_set_regulators(dev, regulator_names);
if (ret) {
/* Continue if the optional regulator is missing */
if (ret != -ENODEV)
Expand Down

0 comments on commit c08566d

Please sign in to comment.