^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * drivers/base/power/common.c - Common device power management code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/pm_clock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/pm_domain.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "power.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * dev_pm_get_subsys_data - Create or refcount power.subsys_data for device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * @dev: Device to handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * If power.subsys_data is NULL, point it to a new object, otherwise increment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * its reference counter. Return 0 if new object has been created or refcount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * increased, otherwise negative error code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int dev_pm_get_subsys_data(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct pm_subsys_data *psd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) psd = kzalloc(sizeof(*psd), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) if (!psd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) spin_lock_irq(&dev->power.lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) if (dev->power.subsys_data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) dev->power.subsys_data->refcount++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) spin_lock_init(&psd->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) psd->refcount = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) dev->power.subsys_data = psd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) pm_clk_init(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) psd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) spin_unlock_irq(&dev->power.lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /* kfree() verifies that its argument is nonzero. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) kfree(psd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * dev_pm_put_subsys_data - Drop reference to power.subsys_data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * @dev: Device to handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * If the reference counter of power.subsys_data is zero after dropping the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * reference, power.subsys_data is removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void dev_pm_put_subsys_data(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct pm_subsys_data *psd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) spin_lock_irq(&dev->power.lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) psd = dev_to_psd(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) if (!psd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) if (--psd->refcount == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) dev->power.subsys_data = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) psd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) spin_unlock_irq(&dev->power.lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) kfree(psd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * dev_pm_domain_attach - Attach a device to its PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * @dev: Device to attach.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * @power_on: Used to indicate whether we should power on the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * The @dev may only be attached to a single PM domain. By iterating through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * the available alternatives we try to find a valid PM domain for the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * As attachment succeeds, the ->detach() callback in the struct dev_pm_domain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * should be assigned by the corresponding attach function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * This function should typically be invoked from subsystem level code during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * the probe phase. Especially for those that holds devices which requires
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * power management through PM domains.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * Callers must ensure proper synchronization of this function with power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * management callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * Returns 0 on successfully attached PM domain, or when it is found that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * device doesn't need a PM domain, else a negative error code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) int dev_pm_domain_attach(struct device *dev, bool power_on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (dev->pm_domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) ret = acpi_dev_pm_attach(dev, power_on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) if (!ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ret = genpd_dev_pm_attach(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) return ret < 0 ? ret : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) EXPORT_SYMBOL_GPL(dev_pm_domain_attach);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * dev_pm_domain_attach_by_id - Associate a device with one of its PM domains.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * @dev: The device used to lookup the PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * @index: The index of the PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * As @dev may only be attached to a single PM domain, the backend PM domain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * provider creates a virtual device to attach instead. If attachment succeeds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * the ->detach() callback in the struct dev_pm_domain are assigned by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * corresponding backend attach function, as to deal with detaching of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * created virtual device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * This function should typically be invoked by a driver during the probe phase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * in case its device requires power management through multiple PM domains. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * driver may benefit from using the received device, to configure device-links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * towards its original device. Depending on the use-case and if needed, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * links may be dynamically changed by the driver, which allows it to control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * the power to the PM domains independently from each other.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * Callers must ensure proper synchronization of this function with power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * management callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * Returns the virtual created device when successfully attached to its PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * domain, NULL in case @dev don't need a PM domain, else an ERR_PTR().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * Note that, to detach the returned virtual device, the driver shall call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * dev_pm_domain_detach() on it, typically during the remove phase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct device *dev_pm_domain_attach_by_id(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) unsigned int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) if (dev->pm_domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return ERR_PTR(-EEXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) return genpd_dev_pm_attach_by_id(dev, index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * dev_pm_domain_attach_by_name - Associate a device with one of its PM domains.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * @dev: The device used to lookup the PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * @name: The name of the PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * For a detailed function description, see dev_pm_domain_attach_by_id().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct device *dev_pm_domain_attach_by_name(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) if (dev->pm_domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) return ERR_PTR(-EEXIST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) return genpd_dev_pm_attach_by_name(dev, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * dev_pm_domain_detach - Detach a device from its PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * @dev: Device to detach.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * @power_off: Used to indicate whether we should power off the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * This functions will reverse the actions from dev_pm_domain_attach() and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * dev_pm_domain_attach_by_id(), thus it detaches @dev from its PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * Typically it should be invoked during the remove phase, either from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * subsystem level code or from drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * Callers must ensure proper synchronization of this function with power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * management callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) void dev_pm_domain_detach(struct device *dev, bool power_off)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) if (dev->pm_domain && dev->pm_domain->detach)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) dev->pm_domain->detach(dev, power_off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) EXPORT_SYMBOL_GPL(dev_pm_domain_detach);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * dev_pm_domain_start - Start the device through its PM domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * @dev: Device to start.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * This function should typically be called during probe by a subsystem/driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * when it needs to start its device from the PM domain's perspective. Note
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * that, it's assumed that the PM domain is already powered on when this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * function is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * Returns 0 on success and negative error values on failures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int dev_pm_domain_start(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (dev->pm_domain && dev->pm_domain->start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) return dev->pm_domain->start(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) EXPORT_SYMBOL_GPL(dev_pm_domain_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * dev_pm_domain_set - Set PM domain of a device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) * @dev: Device whose PM domain is to be set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * @pd: PM domain to be set, or NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * Sets the PM domain the device belongs to. The PM domain of a device needs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * to be set before its probe finishes (it's bound to a driver).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * This function must be called with the device lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if (dev->pm_domain == pd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) WARN(pd && device_is_bound(dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) "PM domains can only be changed for unbound devices\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) dev->pm_domain = pd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) device_pm_check_callbacks(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) EXPORT_SYMBOL_GPL(dev_pm_domain_set);