Skip to content

Commit 670c900

Browse files
tombastorulf
authored andcommitted
pmdomain: ti-sci: Fix duplicate PD referrals
When the dts file has multiple referrers to a single PD (e.g. simple-framebuffer and dss nodes both point to the DSS power-domain) the ti-sci driver will create two power domains, both with the same ID, and that will cause problems as one of the power domains will hide the other one. Fix this checking if a PD with the ID has already been created, and only create a PD for new IDs. Fixes: efa5c01 ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one") Signed-off-by: Tomi Valkeinen <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 39cd87c commit 670c900

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

drivers/pmdomain/ti/ti_sci_pm_domains.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ static const struct of_device_id ti_sci_pm_domain_matches[] = {
114114
};
115115
MODULE_DEVICE_TABLE(of, ti_sci_pm_domain_matches);
116116

117+
static bool ti_sci_pm_idx_exists(struct ti_sci_genpd_provider *pd_provider, u32 idx)
118+
{
119+
struct ti_sci_pm_domain *pd;
120+
121+
list_for_each_entry(pd, &pd_provider->pd_list, node) {
122+
if (pd->idx == idx)
123+
return true;
124+
}
125+
126+
return false;
127+
}
128+
117129
static int ti_sci_pm_domain_probe(struct platform_device *pdev)
118130
{
119131
struct device *dev = &pdev->dev;
@@ -149,8 +161,14 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
149161
break;
150162

151163
if (args.args_count >= 1 && args.np == dev->of_node) {
152-
if (args.args[0] > max_id)
164+
if (args.args[0] > max_id) {
153165
max_id = args.args[0];
166+
} else {
167+
if (ti_sci_pm_idx_exists(pd_provider, args.args[0])) {
168+
index++;
169+
continue;
170+
}
171+
}
154172

155173
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
156174
if (!pd) {

0 commit comments

Comments
 (0)