Lines Matching +full:performance +full:- +full:domains
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.
89 * As attachment succeeds, the ->detach() callback in the struct dev_pm_domain
94 * power management through PM domains.
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.
124 * the ->detach() callback in the struct dev_pm_domain are assigned by the
129 * in case its device requires power management through multiple PM domains. The
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
133 * the power to the PM domains independently from each other.
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.
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()
226 "PM domains can only be changed for unbound devices\n"); in dev_pm_domain_set()
227 dev->pm_domain = pd; in dev_pm_domain_set()
233 * dev_pm_domain_set_performance_state - Request a new performance state.
235 * @state: Target performance state for the device.
237 * This function should be called when a new performance state needs to be
239 * support for performance scaling for PM domains is optional.
241 * Returns 0 on success and when performance scaling isn't supported, negative
246 if (dev->pm_domain && dev->pm_domain->set_performance_state) in dev_pm_domain_set_performance_state()
247 return dev->pm_domain->set_performance_state(dev, state); in dev_pm_domain_set_performance_state()