Lines Matching +full:io +full:- +full:domains
1 // SPDX-License-Identifier: GPL-2.0-only
9 #include <linux/io.h>
23 * These device power state values are not well-defined in the specification.
44 ret = pd->ops->device_set_power_state(pd->domain, state); in scpi_pd_power()
48 return !(state == pd->ops->device_get_power_state(pd->domain)); in scpi_pd_power()
67 struct device *dev = &pdev->dev; in scpi_pm_domain_probe()
68 struct device_node *np = dev->of_node; in scpi_pm_domain_probe()
71 struct generic_pm_domain **domains; in scpi_pm_domain_probe() local
77 return -EPROBE_DEFER; in scpi_pm_domain_probe()
81 return -ENODEV; in scpi_pm_domain_probe()
84 if (!scpi_ops->device_set_power_state || in scpi_pm_domain_probe()
85 !scpi_ops->device_get_power_state) { in scpi_pm_domain_probe()
86 dev_err(dev, "power domains not supported in the firmware\n"); in scpi_pm_domain_probe()
87 return -ENODEV; in scpi_pm_domain_probe()
90 ret = of_property_read_u32(np, "num-domains", &num_domains); in scpi_pm_domain_probe()
92 dev_err(dev, "number of domains not found\n"); in scpi_pm_domain_probe()
93 return -EINVAL; in scpi_pm_domain_probe()
98 return -ENOMEM; in scpi_pm_domain_probe()
102 return -ENOMEM; in scpi_pm_domain_probe()
104 domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); in scpi_pm_domain_probe()
105 if (!domains) in scpi_pm_domain_probe()
106 return -ENOMEM; in scpi_pm_domain_probe()
109 domains[i] = &scpi_pd->genpd; in scpi_pm_domain_probe()
111 scpi_pd->domain = i; in scpi_pm_domain_probe()
112 scpi_pd->ops = scpi_ops; in scpi_pm_domain_probe()
113 scpi_pd->genpd.name = devm_kasprintf(dev, GFP_KERNEL, in scpi_pm_domain_probe()
115 if (!scpi_pd->genpd.name) { in scpi_pm_domain_probe()
120 scpi_pd->genpd.power_off = scpi_pd_power_off; in scpi_pm_domain_probe()
121 scpi_pd->genpd.power_on = scpi_pd_power_on; in scpi_pm_domain_probe()
124 * Treat all power domains as off at boot. in scpi_pm_domain_probe()
126 * The SCP firmware itself may have switched on some domains, in scpi_pm_domain_probe()
129 pm_genpd_init(&scpi_pd->genpd, NULL, true); in scpi_pm_domain_probe()
132 scpi_pd_data->domains = domains; in scpi_pm_domain_probe()
133 scpi_pd_data->num_domains = num_domains; in scpi_pm_domain_probe()
141 { .compatible = "arm,scpi-power-domains", },