Skip to content

Commit

Permalink
staging: board: Migrate away from __pm_genpd_name_add_device()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ulf Hansson <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
geertu authored and rafaeljw committed Sep 9, 2015
1 parent 30e7a65 commit f33b774
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/board/armadillo800eva.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
.pdev = &lcdc0_device,
.clocks = lcdc0_clocks,
.nclocks = ARRAY_SIZE(lcdc0_clocks),
.domain = "a4lc",
.domain = "/system-controller@e6180000/pm-domains/c5/a4lc@1"
},
};

Expand Down
36 changes: 35 additions & 1 deletion drivers/staging/board/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,40 @@ int __init board_staging_register_clock(const struct board_staging_clk *bsc)
return error;
}

#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
static int board_staging_add_dev_domain(struct platform_device *pdev,
const char *domain)
{
struct of_phandle_args pd_args;
struct generic_pm_domain *pd;
struct device_node *np;

np = of_find_node_by_path(domain);
if (!np) {
pr_err("Cannot find domain node %s\n", domain);
return -ENOENT;
}

pd_args.np = np;
pd_args.args_count = 0;
pd = of_genpd_get_from_provider(&pd_args);
if (IS_ERR(pd)) {
pr_err("Cannot find genpd %s (%ld)\n", domain, PTR_ERR(pd));
return PTR_ERR(pd);

}
pr_debug("Found genpd %s for device %s\n", pd->name, pdev->name);

return pm_genpd_add_device(pd, &pdev->dev);
}
#else
static inline int board_staging_add_dev_domain(struct platform_device *pdev,
const char *domain)
{
return 0;
}
#endif

int __init board_staging_register_device(const struct board_staging_dev *dev)
{
struct platform_device *pdev = dev->pdev;
Expand All @@ -161,7 +195,7 @@ int __init board_staging_register_device(const struct board_staging_dev *dev)
}

if (dev->domain)
__pm_genpd_name_add_device(dev->domain, &pdev->dev, NULL);
board_staging_add_dev_domain(pdev, dev->domain);

return error;
}
Expand Down

0 comments on commit f33b774

Please sign in to comment.