Lines Matching +full:semi +full:- +full:static

1 // SPDX-License-Identifier: GPL-2.0+
3 * Actions Semi Owl Smart Power System (SPS)
5 * Copyright 2012 Actions Semi Inc.
6 * Author: Actions Semi, Inc.
16 #include <linux/soc/actions/owl-sps.h>
17 #include <dt-bindings/power/owl-s500-powergate.h>
18 #include <dt-bindings/power/owl-s700-powergate.h>
19 #include <dt-bindings/power/owl-s900-powergate.h>
49 static int owl_sps_set_power(struct owl_sps_domain *pd, bool enable) in owl_sps_set_power()
53 ack_mask = BIT(pd->info->ack_bit); in owl_sps_set_power()
54 pwr_mask = BIT(pd->info->pwr_bit); in owl_sps_set_power()
56 return owl_sps_set_pg(pd->sps->base, pwr_mask, ack_mask, enable); in owl_sps_set_power()
59 static int owl_sps_power_on(struct generic_pm_domain *domain) in owl_sps_power_on()
63 dev_dbg(pd->sps->dev, "%s power on", pd->info->name); in owl_sps_power_on()
68 static int owl_sps_power_off(struct generic_pm_domain *domain) in owl_sps_power_off()
72 dev_dbg(pd->sps->dev, "%s power off", pd->info->name); in owl_sps_power_off()
77 static int owl_sps_init_domain(struct owl_sps *sps, int index) in owl_sps_init_domain()
81 pd = devm_kzalloc(sps->dev, sizeof(*pd), GFP_KERNEL); in owl_sps_init_domain()
83 return -ENOMEM; in owl_sps_init_domain()
85 pd->info = &sps->info->domains[index]; in owl_sps_init_domain()
86 pd->sps = sps; in owl_sps_init_domain()
88 pd->genpd.name = pd->info->name; in owl_sps_init_domain()
89 pd->genpd.power_on = owl_sps_power_on; in owl_sps_init_domain()
90 pd->genpd.power_off = owl_sps_power_off; in owl_sps_init_domain()
91 pd->genpd.flags = pd->info->genpd_flags; in owl_sps_init_domain()
92 pm_genpd_init(&pd->genpd, NULL, false); in owl_sps_init_domain()
94 sps->genpd_data.domains[index] = &pd->genpd; in owl_sps_init_domain()
99 static int owl_sps_probe(struct platform_device *pdev) in owl_sps_probe()
105 sps_info = device_get_match_data(&pdev->dev); in owl_sps_probe()
107 dev_err(&pdev->dev, "unknown compatible or missing data\n"); in owl_sps_probe()
108 return -EINVAL; in owl_sps_probe()
111 sps = devm_kzalloc(&pdev->dev, in owl_sps_probe()
112 struct_size(sps, domains, sps_info->num_domains), in owl_sps_probe()
115 return -ENOMEM; in owl_sps_probe()
117 sps->base = of_io_request_and_map(pdev->dev.of_node, 0, "owl-sps"); in owl_sps_probe()
118 if (IS_ERR(sps->base)) { in owl_sps_probe()
119 dev_err(&pdev->dev, "failed to map sps registers\n"); in owl_sps_probe()
120 return PTR_ERR(sps->base); in owl_sps_probe()
123 sps->dev = &pdev->dev; in owl_sps_probe()
124 sps->info = sps_info; in owl_sps_probe()
125 sps->genpd_data.domains = sps->domains; in owl_sps_probe()
126 sps->genpd_data.num_domains = sps_info->num_domains; in owl_sps_probe()
128 for (i = 0; i < sps_info->num_domains; i++) { in owl_sps_probe()
134 ret = of_genpd_add_provider_onecell(pdev->dev.of_node, &sps->genpd_data); in owl_sps_probe()
136 dev_err(&pdev->dev, "failed to add provider (%d)", ret); in owl_sps_probe()
143 static const struct owl_sps_domain_info s500_sps_domains[] = {
193 static const struct owl_sps_info s500_sps_info = {
198 static const struct owl_sps_domain_info s700_sps_domains[] = {
233 static const struct owl_sps_info s700_sps_info = {
238 static const struct owl_sps_domain_info s900_sps_domains[] = {
289 static const struct owl_sps_info s900_sps_info = {
294 static const struct of_device_id owl_sps_of_matches[] = {
295 { .compatible = "actions,s500-sps", .data = &s500_sps_info },
296 { .compatible = "actions,s700-sps", .data = &s700_sps_info },
297 { .compatible = "actions,s900-sps", .data = &s900_sps_info },
301 static struct platform_driver owl_sps_platform_driver = {
304 .name = "owl-sps",
310 static int __init owl_sps_init(void) in owl_sps_init()