Lines Matching +full:single +full:- +full:phase
1 // SPDX-License-Identifier: GPL-2.0
3 * drivers/base/power/common.c - Common device power management code.
18 * dev_pm_get_subsys_data - Create or refcount power.subsys_data for device.
31 return -ENOMEM; in dev_pm_get_subsys_data()
33 spin_lock_irq(&dev->power.lock); in dev_pm_get_subsys_data()
35 if (dev->power.subsys_data) { in dev_pm_get_subsys_data()
36 dev->power.subsys_data->refcount++; in dev_pm_get_subsys_data()
38 spin_lock_init(&psd->lock); in dev_pm_get_subsys_data()
39 psd->refcount = 1; in dev_pm_get_subsys_data()
40 dev->power.subsys_data = psd; in dev_pm_get_subsys_data()
45 spin_unlock_irq(&dev->power.lock); in dev_pm_get_subsys_data()
55 * dev_pm_put_subsys_data - Drop reference to power.subsys_data.
65 spin_lock_irq(&dev->power.lock); in dev_pm_put_subsys_data()
71 if (--psd->refcount == 0) in dev_pm_put_subsys_data()
72 dev->power.subsys_data = NULL; in dev_pm_put_subsys_data()
77 spin_unlock_irq(&dev->power.lock); in dev_pm_put_subsys_data()
83 * dev_pm_domain_attach - Attach a device to its PM domain.
87 * The @dev may only be attached to a single PM domain. By iterating through
89 * As attachment succeeds, the ->detach() callback in the struct dev_pm_domain
93 * the probe phase. Especially for those that holds devices which requires
106 if (dev->pm_domain) in dev_pm_domain_attach()
118 * dev_pm_domain_attach_by_id - Associate a device with one of its PM domains.
122 * As @dev may only be attached to a single PM domain, the backend PM domain
124 * the ->detach() callback in the struct dev_pm_domain are assigned by the
128 * This function should typically be invoked by a driver during the probe phase,
130 * driver may benefit from using the received device, to configure device-links
131 * towards its original device. Depending on the use-case and if needed, the
141 * dev_pm_domain_detach() on it, typically during the remove phase.
146 if (dev->pm_domain) in dev_pm_domain_attach_by_id()
147 return ERR_PTR(-EEXIST); in dev_pm_domain_attach_by_id()
154 * dev_pm_domain_attach_by_name - Associate a device with one of its PM domains.
163 if (dev->pm_domain) in dev_pm_domain_attach_by_name()
164 return ERR_PTR(-EEXIST); in dev_pm_domain_attach_by_name()
171 * dev_pm_domain_detach - Detach a device from its PM domain.
178 * remove phase, either from subsystem level code or from drivers.
185 if (dev->pm_domain && dev->pm_domain->detach) in dev_pm_domain_detach()
186 dev->pm_domain->detach(dev, power_off); in dev_pm_domain_detach()
191 * dev_pm_domain_start - Start the device through its PM domain.
203 if (dev->pm_domain && dev->pm_domain->start) in dev_pm_domain_start()
204 return dev->pm_domain->start(dev); in dev_pm_domain_start()
211 * dev_pm_domain_set - Set PM domain of a device.
222 if (dev->pm_domain == pd) in dev_pm_domain_set()
227 dev->pm_domain = pd; in dev_pm_domain_set()