Skip to content

Commit f33b774

Browse files
geerturafaeljw
authored andcommitted
staging: board: Migrate away from __pm_genpd_name_add_device()
The named genpd APIs are deprecated. Hence convert the board staging code from using genpd names to DT node paths. For now this supports PM domains with "#power-domain-cells = <0>" only. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 30e7a65 commit f33b774

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

drivers/staging/board/armadillo800eva.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
9191
.pdev = &lcdc0_device,
9292
.clocks = lcdc0_clocks,
9393
.nclocks = ARRAY_SIZE(lcdc0_clocks),
94-
.domain = "a4lc",
94+
.domain = "/system-controller@e6180000/pm-domains/c5/a4lc@1"
9595
},
9696
};
9797

drivers/staging/board/board.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,40 @@ int __init board_staging_register_clock(const struct board_staging_clk *bsc)
135135
return error;
136136
}
137137

138+
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
139+
static int board_staging_add_dev_domain(struct platform_device *pdev,
140+
const char *domain)
141+
{
142+
struct of_phandle_args pd_args;
143+
struct generic_pm_domain *pd;
144+
struct device_node *np;
145+
146+
np = of_find_node_by_path(domain);
147+
if (!np) {
148+
pr_err("Cannot find domain node %s\n", domain);
149+
return -ENOENT;
150+
}
151+
152+
pd_args.np = np;
153+
pd_args.args_count = 0;
154+
pd = of_genpd_get_from_provider(&pd_args);
155+
if (IS_ERR(pd)) {
156+
pr_err("Cannot find genpd %s (%ld)\n", domain, PTR_ERR(pd));
157+
return PTR_ERR(pd);
158+
159+
}
160+
pr_debug("Found genpd %s for device %s\n", pd->name, pdev->name);
161+
162+
return pm_genpd_add_device(pd, &pdev->dev);
163+
}
164+
#else
165+
static inline int board_staging_add_dev_domain(struct platform_device *pdev,
166+
const char *domain)
167+
{
168+
return 0;
169+
}
170+
#endif
171+
138172
int __init board_staging_register_device(const struct board_staging_dev *dev)
139173
{
140174
struct platform_device *pdev = dev->pdev;
@@ -161,7 +195,7 @@ int __init board_staging_register_device(const struct board_staging_dev *dev)
161195
}
162196

163197
if (dev->domain)
164-
__pm_genpd_name_add_device(dev->domain, &pdev->dev, NULL);
198+
board_staging_add_dev_domain(pdev, dev->domain);
165199

166200
return error;
167201
}

0 commit comments

Comments
 (0)