Skip to content

Commit a5663c9

Browse files
committed
opp: Allow opp-level to be set to 0
The DT bindings don't put such a constraint, nor should the kernel. It is perfectly fine for opp-level to be set to 0, if we need to put the performance state votes for a domain for a particular OPP. Reported-by: Stephan Gerhold <stephan@gerhold.net> Tested-by: Stephan Gerhold <stephan@gerhold.net> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent cb60e96 commit a5663c9

2 files changed

Lines changed: 7 additions & 16 deletions

File tree

drivers/opp/core.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,9 +2109,6 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table,
21092109
int dest_pstate = -EINVAL;
21102110
int i;
21112111

2112-
if (!pstate)
2113-
return 0;
2114-
21152112
/*
21162113
* Normally the src_table will have the "required_opps" property set to
21172114
* point to one of the OPPs in the dst_table, but in some cases the

drivers/opp/of.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
842842
static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
843843
{
844844
struct device_node *np;
845-
int ret, count = 0, pstate_count = 0;
845+
int ret, count = 0;
846846
struct dev_pm_opp *opp;
847847

848848
/* OPP table is already initialized for the device */
@@ -876,20 +876,14 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
876876
goto remove_static_opp;
877877
}
878878

879-
list_for_each_entry(opp, &opp_table->opp_list, node)
880-
pstate_count += !!opp->pstate;
881-
882-
/* Either all or none of the nodes shall have performance state set */
883-
if (pstate_count && pstate_count != count) {
884-
dev_err(dev, "Not all nodes have performance state set (%d: %d)\n",
885-
count, pstate_count);
886-
ret = -ENOENT;
887-
goto remove_static_opp;
879+
list_for_each_entry(opp, &opp_table->opp_list, node) {
880+
/* Any non-zero performance state would enable the feature */
881+
if (opp->pstate) {
882+
opp_table->genpd_performance_state = true;
883+
break;
884+
}
888885
}
889886

890-
if (pstate_count)
891-
opp_table->genpd_performance_state = true;
892-
893887
return 0;
894888

895889
remove_static_opp:

0 commit comments

Comments
 (0)