Lines Matching +full:child +full:- +full:node
1 // SPDX-License-Identifier: GPL-2.0-only
15 #include <linux/pci-pwrctrl.h>
28 if (dev_fwnode(dev) != dev_fwnode(pwrctrl->dev)) in pci_pwrctrl_notify()
35 * drivers on different buses but consuming the same DT node. We in pci_pwrctrl_notify()
40 * power control platform device. Mark its OF node as reused. in pci_pwrctrl_notify()
42 dev->of_node_reused = true; in pci_pwrctrl_notify()
50 * pci_pwrctrl_init() - Initialize the PCI power control context struct
57 pwrctrl->dev = dev; in pci_pwrctrl_init()
63 * pci_pwrctrl_device_set_ready() - Notify the pwrctrl subsystem that the PCI
64 * device is powered-up and ready to be detected.
80 if (!pwrctrl->dev) in pci_pwrctrl_device_set_ready()
81 return -ENODEV; in pci_pwrctrl_device_set_ready()
83 pwrctrl->nb.notifier_call = pci_pwrctrl_notify; in pci_pwrctrl_device_set_ready()
84 ret = bus_register_notifier(&pci_bus_type, &pwrctrl->nb); in pci_pwrctrl_device_set_ready()
93 * pci_pwrctrl_device_unset_ready() - Notify the pwrctrl subsystem that the PCI
94 * device is about to be powered-down.
103 * it is being detached then the child PCI device must have already in pci_pwrctrl_device_unset_ready()
106 bus_unregister_notifier(&pci_bus_type, &pwrctrl->nb); in pci_pwrctrl_device_unset_ready()
118 * devm_pci_pwrctrl_device_set_ready - Managed variant of
149 return pwrctrl->power_off(pwrctrl); in __pci_pwrctrl_power_off_device()
157 for_each_available_child_of_node_scoped(np, child) in pci_pwrctrl_power_off_device()
158 pci_pwrctrl_power_off_device(child); in pci_pwrctrl_power_off_device()
164 if (device_is_bound(&pdev->dev)) { in pci_pwrctrl_power_off_device()
165 ret = __pci_pwrctrl_power_off_device(&pdev->dev); in pci_pwrctrl_power_off_device()
167 dev_err(&pdev->dev, "Failed to power off device: %d", ret); in pci_pwrctrl_power_off_device()
174 * pci_pwrctrl_power_off_devices - Power off pwrctrl devices
184 struct device_node *np = parent->of_node; in pci_pwrctrl_power_off_devices()
186 for_each_available_child_of_node_scoped(np, child) in pci_pwrctrl_power_off_devices()
187 pci_pwrctrl_power_off_device(child); in pci_pwrctrl_power_off_devices()
198 return pwrctrl->power_on(pwrctrl); in __pci_pwrctrl_power_on_device()
210 for_each_available_child_of_node_scoped(np, child) { in pci_pwrctrl_power_on_device()
211 ret = pci_pwrctrl_power_on_device(child); in pci_pwrctrl_power_on_device()
220 if (device_is_bound(&pdev->dev)) { in pci_pwrctrl_power_on_device()
221 ret = __pci_pwrctrl_power_on_device(&pdev->dev); in pci_pwrctrl_power_on_device()
224 dev_dbg(&pdev->dev, "driver is not bound\n"); in pci_pwrctrl_power_on_device()
225 ret = -EPROBE_DEFER; in pci_pwrctrl_power_on_device()
234 * pci_pwrctrl_power_on_devices - Power on pwrctrl devices
242 * Return: 0 on success, -EPROBE_DEFER if any pwrctrl driver is not bound, an
247 struct device_node *np = parent->of_node; in pci_pwrctrl_power_on_devices()
248 struct device_node *child = NULL; in pci_pwrctrl_power_on_devices() local
251 for_each_available_child_of_node(np, child) { in pci_pwrctrl_power_on_devices()
252 ret = pci_pwrctrl_power_on_device(child); in pci_pwrctrl_power_on_devices()
261 if (tmp == child) in pci_pwrctrl_power_on_devices()
265 of_node_put(child); in pci_pwrctrl_power_on_devices()
273 * pwrctrl device will only be created if the node satisfies below requirements:
277 * 2. At least one of the power supplies defined in the devicetree node of the
278 * device (OR) in the remote endpoint parent node to indicate pwrctrl
319 for_each_available_child_of_node_scoped(np, child) { in pci_pwrctrl_create_device()
320 ret = pci_pwrctrl_create_device(child, parent); in pci_pwrctrl_create_device()
325 /* Bail out if the platform device is already available for the node */ in pci_pwrctrl_create_device()
333 dev_dbg(parent, "Skipping OF node: %s\n", np->name); in pci_pwrctrl_create_device()
340 dev_err(parent, "Failed to create pwrctrl device for node: %s\n", np->name); in pci_pwrctrl_create_device()
341 return -EINVAL; in pci_pwrctrl_create_device()
348 * pci_pwrctrl_create_devices - Create pwrctrl devices
362 for_each_available_child_of_node_scoped(parent->of_node, child) { in pci_pwrctrl_create_devices()
363 ret = pci_pwrctrl_create_device(child, parent); in pci_pwrctrl_create_devices()
378 for_each_available_child_of_node_scoped(np, child) in pci_pwrctrl_destroy_device()
379 pci_pwrctrl_destroy_device(child); in pci_pwrctrl_destroy_device()
392 * pci_pwrctrl_destroy_devices - Destroy pwrctrl devices
401 struct device_node *np = parent->of_node; in pci_pwrctrl_destroy_devices()
403 for_each_available_child_of_node_scoped(np, child) in pci_pwrctrl_destroy_devices()
404 pci_pwrctrl_destroy_device(child); in pci_pwrctrl_destroy_devices()