Lines Matching +full:zynqmp +full:- +full:firmware
1 // SPDX-License-Identifier: GPL-2.0
3 * ZynqMP Generic PM domain support
5 * Copyright (C) 2015-2019 Xilinx, Inc.
20 #include <linux/firmware/xlnx-zynqmp.h>
29 * struct zynqmp_pm_domain - Wrapper around struct generic_pm_domain
32 * @flags: ZynqMP PM domain flags
41 * zynqmp_gpd_is_active_wakeup_path() - Check if device is in wakeup source
64 * zynqmp_gpd_power_on() - Power on PM domain
78 ret = zynqmp_pm_set_requirement(pd->node_id, in zynqmp_gpd_power_on()
84 __func__, domain->name, pd->node_id, ret); in zynqmp_gpd_power_on()
88 pr_debug("%s() Powered on %s domain\n", __func__, domain->name); in zynqmp_gpd_power_on()
93 * zynqmp_gpd_power_off() - Power off PM domain
112 if (!(pd->flags & ZYNQMP_PM_DOMAIN_REQUESTED)) { in zynqmp_gpd_power_off()
114 __func__, domain->name); in zynqmp_gpd_power_off()
118 list_for_each_entry_safe(pdd, tmp, &domain->dev_list, list_node) { in zynqmp_gpd_power_off()
120 may_wakeup = zynqmp_gpd_is_active_wakeup_path(pdd->dev, NULL); in zynqmp_gpd_power_off()
122 dev_dbg(pdd->dev, "device is in wakeup path in %s\n", in zynqmp_gpd_power_off()
123 domain->name); in zynqmp_gpd_power_off()
129 ret = zynqmp_pm_set_requirement(pd->node_id, capabilities, 0, in zynqmp_gpd_power_off()
137 __func__, domain->name, pd->node_id, ret); in zynqmp_gpd_power_off()
141 pr_debug("%s() Powered off %s domain\n", __func__, domain->name); in zynqmp_gpd_power_off()
146 * zynqmp_gpd_attach_dev() - Attach device to the PM domain
161 if (domain->device_count) in zynqmp_gpd_attach_dev()
164 ret = zynqmp_pm_request_node(pd->node_id, 0, 0, in zynqmp_gpd_attach_dev()
169 __func__, domain->name, pd->node_id, ret); in zynqmp_gpd_attach_dev()
173 pd->flags |= ZYNQMP_PM_DOMAIN_REQUESTED; in zynqmp_gpd_attach_dev()
176 dev_name(dev), domain->name); in zynqmp_gpd_attach_dev()
181 * zynqmp_gpd_detach_dev() - Detach device from the PM domain
194 if (domain->device_count) in zynqmp_gpd_detach_dev()
197 ret = zynqmp_pm_release_node(pd->node_id); in zynqmp_gpd_detach_dev()
201 __func__, domain->name, pd->node_id, ret); in zynqmp_gpd_detach_dev()
205 pd->flags &= ~ZYNQMP_PM_DOMAIN_REQUESTED; in zynqmp_gpd_detach_dev()
208 dev_name(dev), domain->name); in zynqmp_gpd_detach_dev()
215 unsigned int i, idx = genpdspec->args[0]; in zynqmp_gpd_xlate()
218 pd = container_of(genpd_data->domains[0], struct zynqmp_pm_domain, gpd); in zynqmp_gpd_xlate()
220 if (genpdspec->args_count != 1) in zynqmp_gpd_xlate()
221 return ERR_PTR(-EINVAL); in zynqmp_gpd_xlate()
241 if (!genpd_data->domains[i] || i == ZYNQMP_NUM_DOMAINS) in zynqmp_gpd_xlate()
242 return ERR_PTR(-ENOENT); in zynqmp_gpd_xlate()
244 return genpd_data->domains[i]; in zynqmp_gpd_xlate()
253 struct device *dev = &pdev->dev; in zynqmp_gpd_probe()
257 return -ENOMEM; in zynqmp_gpd_probe()
261 return -ENOMEM; in zynqmp_gpd_probe()
263 zynqmp_pd_data->xlate = zynqmp_gpd_xlate; in zynqmp_gpd_probe()
268 return -ENOMEM; in zynqmp_gpd_probe()
270 if (!of_device_is_compatible(dev->parent->of_node, in zynqmp_gpd_probe()
271 "xlnx,zynqmp-firmware")) in zynqmp_gpd_probe()
275 pd->node_id = 0; in zynqmp_gpd_probe()
276 pd->gpd.name = kasprintf(GFP_KERNEL, "domain%d", i); in zynqmp_gpd_probe()
277 pd->gpd.power_off = zynqmp_gpd_power_off; in zynqmp_gpd_probe()
278 pd->gpd.power_on = zynqmp_gpd_power_on; in zynqmp_gpd_probe()
279 pd->gpd.attach_dev = zynqmp_gpd_attach_dev; in zynqmp_gpd_probe()
280 pd->gpd.detach_dev = zynqmp_gpd_detach_dev; in zynqmp_gpd_probe()
282 domains[i] = &pd->gpd; in zynqmp_gpd_probe()
285 pm_genpd_init(&pd->gpd, NULL, true); in zynqmp_gpd_probe()
288 zynqmp_pd_data->domains = domains; in zynqmp_gpd_probe()
289 zynqmp_pd_data->num_domains = ZYNQMP_NUM_DOMAINS; in zynqmp_gpd_probe()
290 of_genpd_add_provider_onecell(dev->parent->of_node, zynqmp_pd_data); in zynqmp_gpd_probe()
297 of_genpd_del_provider(pdev->dev.parent->of_node); in zynqmp_gpd_remove()