2 * Copyright (C) 2014 Linaro Ltd.
4 * Author: Ulf Hansson <ulf.hansson@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
7 * Implements PM domains using the generic PM domain for ux500.
9 #include <linux/printk.h>
10 #include <linux/slab.h>
11 #include <linux/err.h>
13 #include <linux/pm_domain.h>
15 #include <dt-bindings/arm/ux500_pm_domains.h>
16 #include "pm_domains.h"
18 static int pd_power_off(struct generic_pm_domain
*domain
)
21 * Handle the gating of the PM domain regulator here.
23 * Drivers/subsystems handling devices in the PM domain needs to perform
24 * register context save/restore from their respective runtime PM
25 * callbacks, to be able to enable PM domain gating/ungating.
30 static int pd_power_on(struct generic_pm_domain
*domain
)
33 * Handle the ungating of the PM domain regulator here.
35 * Drivers/subsystems handling devices in the PM domain needs to perform
36 * register context save/restore from their respective runtime PM
37 * callbacks, to be able to enable PM domain gating/ungating.
42 static struct generic_pm_domain ux500_pm_domain_vape
= {
44 .power_off
= pd_power_off
,
45 .power_on
= pd_power_on
,
48 static struct generic_pm_domain
*ux500_pm_domains
[NR_DOMAINS
] = {
49 [DOMAIN_VAPE
] = &ux500_pm_domain_vape
,
52 static const struct of_device_id ux500_pm_domain_matches
[] __initconst
= {
53 { .compatible
= "stericsson,ux500-pm-domains", },
57 int __init
ux500_pm_domains_init(void)
59 struct device_node
*np
;
60 struct genpd_onecell_data
*genpd_data
;
63 np
= of_find_matching_node(NULL
, ux500_pm_domain_matches
);
67 genpd_data
= kzalloc(sizeof(*genpd_data
), GFP_KERNEL
);
71 genpd_data
->domains
= ux500_pm_domains
;
72 genpd_data
->num_domains
= ARRAY_SIZE(ux500_pm_domains
);
74 for (i
= 0; i
< ARRAY_SIZE(ux500_pm_domains
); ++i
)
75 pm_genpd_init(ux500_pm_domains
[i
], NULL
, false);
77 of_genpd_add_provider_onecell(np
, genpd_data
);