OSDN Git Service

opp: Don't skip freq update for different frequency
authorJonathan Marek <jonathan@marek.ca>
Tue, 16 Feb 2021 20:10:29 +0000 (15:10 -0500)
committerViresh Kumar <viresh.kumar@linaro.org>
Thu, 18 Feb 2021 07:01:08 +0000 (12:31 +0530)
commitde04241ab87afcaac26f15fcc32a7bd27294dd47
tree2f3771a6619683890f71a1b24fdeb476b2b07450
parent86ad9a24f21ea7aac7deed06fe9556392568d88a
opp: Don't skip freq update for different frequency

We skip the OPP update if the current and target OPPs are same. This is
fine for the devices that don't support frequency but may cause issues
for the ones that need to program frequency.

An OPP entry doesn't really signify a single operating frequency but
rather the highest frequency at which the other properties of the OPP
entry apply. And we may reach here with different frequency values,
while all of them would point to the same OPP entry in the OPP table.

We just need to update the clock frequency in that case, though in order
to not add special exit points we reuse the code flow from a normal
path.

While at it, rearrange the conditionals in the 'if' statement to check
'enabled' flag at the end.

Fixes: 81c4d8a3c414 ("opp: Keep track of currently programmed OPP")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
[ Viresh: Improved commit log and subject, rename current_freq as
  current_rate, document it, remove local variable and rearrange
  code. ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c
drivers/opp/opp.h