Lines Matching +full:num +full:- +full:domains
1 // SPDX-License-Identifier: GPL-2.0-only
22 * These device power state values are not well-defined in the specification.
43 ret = pd->ops->device_set_power_state(pd->domain, state); in scpi_pd_power()
47 return !(state == pd->ops->device_get_power_state(pd->domain)); in scpi_pd_power()
66 struct device *dev = &pdev->dev; in scpi_pm_domain_probe()
67 struct device_node *np = dev->of_node; in scpi_pm_domain_probe()
70 struct generic_pm_domain **domains; in scpi_pm_domain_probe() local
76 return -EPROBE_DEFER; in scpi_pm_domain_probe()
80 return -ENODEV; in scpi_pm_domain_probe()
83 if (!scpi_ops->device_set_power_state || in scpi_pm_domain_probe()
84 !scpi_ops->device_get_power_state) { in scpi_pm_domain_probe()
85 dev_err(dev, "power domains not supported in the firmware\n"); in scpi_pm_domain_probe()
86 return -ENODEV; in scpi_pm_domain_probe()
89 ret = of_property_read_u32(np, "num-domains", &num_domains); in scpi_pm_domain_probe()
91 dev_err(dev, "number of domains not found\n"); in scpi_pm_domain_probe()
92 return -EINVAL; in scpi_pm_domain_probe()
97 return -ENOMEM; in scpi_pm_domain_probe()
101 return -ENOMEM; in scpi_pm_domain_probe()
103 domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); in scpi_pm_domain_probe()
104 if (!domains) in scpi_pm_domain_probe()
105 return -ENOMEM; in scpi_pm_domain_probe()
108 domains[i] = &scpi_pd->genpd; in scpi_pm_domain_probe()
110 scpi_pd->domain = i; in scpi_pm_domain_probe()
111 scpi_pd->ops = scpi_ops; in scpi_pm_domain_probe()
112 scpi_pd->genpd.name = devm_kasprintf(dev, GFP_KERNEL, in scpi_pm_domain_probe()
114 if (!scpi_pd->genpd.name) { in scpi_pm_domain_probe()
119 scpi_pd->genpd.power_off = scpi_pd_power_off; in scpi_pm_domain_probe()
120 scpi_pd->genpd.power_on = scpi_pd_power_on; in scpi_pm_domain_probe()
123 * Treat all power domains as off at boot. in scpi_pm_domain_probe()
125 * The SCP firmware itself may have switched on some domains, in scpi_pm_domain_probe()
128 pm_genpd_init(&scpi_pd->genpd, NULL, true); in scpi_pm_domain_probe()
131 scpi_pd_data->domains = domains; in scpi_pm_domain_probe()
132 scpi_pd_data->num_domains = num_domains; in scpi_pm_domain_probe()
140 { .compatible = "arm,scpi-power-domains", },