Lines Matching full:power
3 * drivers/base/power/runtime.c - Helper functions for device runtime PM
17 #include "power.h"
55 * update_pm_runtime_accounting - Update the time accounting of power states
58 * In order to be able to have time accounting of the various power states
69 if (dev->power.disable_depth > 0) in update_pm_runtime_accounting()
72 last = dev->power.accounting_timestamp; in update_pm_runtime_accounting()
75 dev->power.accounting_timestamp = now; in update_pm_runtime_accounting()
87 if (dev->power.runtime_status == RPM_SUSPENDED) in update_pm_runtime_accounting()
88 dev->power.suspended_time += delta; in update_pm_runtime_accounting()
90 dev->power.active_time += delta; in update_pm_runtime_accounting()
96 dev->power.runtime_status = status; in __update_runtime_status()
104 spin_lock_irqsave(&dev->power.lock, flags); in rpm_get_accounted_time()
107 time = suspended ? dev->power.suspended_time : dev->power.active_time; in rpm_get_accounted_time()
109 spin_unlock_irqrestore(&dev->power.lock, flags); in rpm_get_accounted_time()
131 if (dev->power.timer_expires > 0) { in pm_runtime_deactivate_timer()
132 hrtimer_try_to_cancel(&dev->power.suspend_timer); in pm_runtime_deactivate_timer()
133 dev->power.timer_expires = 0; in pm_runtime_deactivate_timer()
148 dev->power.request = RPM_REQ_NONE; in pm_runtime_cancel_pending()
156 * power.last_busy time. If the delay has already expired or is disabled
157 * (negative) or the power.use_autosuspend flag isn't set, return 0.
160 * This function may be called either with or without dev->power.lock held.
161 * Either way it can be racy, since power.last_busy may be updated at any time.
168 if (!dev->power.use_autosuspend) in pm_runtime_autosuspend_expiration()
171 autosuspend_delay = READ_ONCE(dev->power.autosuspend_delay); in pm_runtime_autosuspend_expiration()
175 expires = READ_ONCE(dev->power.last_busy); in pm_runtime_autosuspend_expiration()
186 return dev->power.memalloc_noio; in dev_memalloc_noio()
225 /* hold power lock since bitfield is not SMP-safe. */ in pm_runtime_set_memalloc_noio()
226 spin_lock_irq(&dev->power.lock); in pm_runtime_set_memalloc_noio()
227 enabled = dev->power.memalloc_noio; in pm_runtime_set_memalloc_noio()
228 dev->power.memalloc_noio = enable; in pm_runtime_set_memalloc_noio()
229 spin_unlock_irq(&dev->power.lock); in pm_runtime_set_memalloc_noio()
262 if (dev->power.runtime_error) in rpm_check_suspend_allowed()
264 else if (dev->power.disable_depth > 0) in rpm_check_suspend_allowed()
266 else if (atomic_read(&dev->power.usage_count) > 0) in rpm_check_suspend_allowed()
268 else if (!dev->power.ignore_children && in rpm_check_suspend_allowed()
269 atomic_read(&dev->power.child_count)) in rpm_check_suspend_allowed()
273 else if ((dev->power.deferred_resume in rpm_check_suspend_allowed()
274 && dev->power.runtime_status == RPM_SUSPENDING) in rpm_check_suspend_allowed()
275 || (dev->power.request_pending in rpm_check_suspend_allowed()
276 && dev->power.request == RPM_REQ_RESUME)) in rpm_check_suspend_allowed()
280 else if (dev->power.runtime_status == RPM_SUSPENDED) in rpm_check_suspend_allowed()
326 __releases(&dev->power.lock) __acquires(&dev->power.lock) in __rpm_callback()
329 bool use_links = dev->power.links_count > 0; in __rpm_callback()
331 if (dev->power.irq_safe) { in __rpm_callback()
332 spin_unlock(&dev->power.lock); in __rpm_callback()
334 spin_unlock_irq(&dev->power.lock); in __rpm_callback()
343 if (use_links && dev->power.runtime_status == RPM_RESUMING) { in __rpm_callback()
356 if (dev->power.irq_safe) { in __rpm_callback()
357 spin_lock(&dev->power.lock); in __rpm_callback()
367 && ((dev->power.runtime_status == RPM_SUSPENDING && !retval) in __rpm_callback()
368 || (dev->power.runtime_status == RPM_RESUMING && retval))) { in __rpm_callback()
377 spin_lock_irq(&dev->power.lock); in __rpm_callback()
394 * This function must be called under dev->power.lock with interrupts disabled.
407 else if (dev->power.runtime_status != RPM_ACTIVE) in rpm_idle()
414 else if (dev->power.request_pending && in rpm_idle()
415 dev->power.request > RPM_REQ_IDLE) in rpm_idle()
419 else if (dev->power.idle_notification) in rpm_idle()
425 dev->power.request = RPM_REQ_NONE; in rpm_idle()
427 if (dev->power.no_callbacks) in rpm_idle()
432 dev->power.request = RPM_REQ_IDLE; in rpm_idle()
433 if (!dev->power.request_pending) { in rpm_idle()
434 dev->power.request_pending = true; in rpm_idle()
435 queue_work(pm_wq, &dev->power.work); in rpm_idle()
441 dev->power.idle_notification = true; in rpm_idle()
448 dev->power.idle_notification = false; in rpm_idle()
449 wake_up_all(&dev->power.wait_queue); in rpm_idle()
468 if (dev->power.memalloc_noio) { in rpm_callback()
487 dev->power.runtime_error = retval; in rpm_callback()
505 * ignore_children of parent->power and irq_safe of dev->power are not set).
510 * This function must be called under dev->power.lock with interrupts disabled.
513 __releases(&dev->power.lock) __acquires(&dev->power.lock) in rpm_suspend()
527 if (dev->power.runtime_status == RPM_RESUMING && !(rpmflags & RPM_ASYNC)) in rpm_suspend()
534 && dev->power.runtime_status != RPM_SUSPENDING) { in rpm_suspend()
539 dev->power.request = RPM_REQ_NONE; in rpm_suspend()
548 if (!(dev->power.timer_expires && in rpm_suspend()
549 dev->power.timer_expires <= expires)) { in rpm_suspend()
554 u64 slack = (u64)READ_ONCE(dev->power.autosuspend_delay) * in rpm_suspend()
557 dev->power.timer_expires = expires; in rpm_suspend()
558 hrtimer_start_range_ns(&dev->power.suspend_timer, in rpm_suspend()
563 dev->power.timer_autosuspends = 1; in rpm_suspend()
571 if (dev->power.runtime_status == RPM_SUSPENDING) { in rpm_suspend()
579 if (dev->power.irq_safe) { in rpm_suspend()
580 spin_unlock(&dev->power.lock); in rpm_suspend()
584 spin_lock(&dev->power.lock); in rpm_suspend()
590 prepare_to_wait(&dev->power.wait_queue, &wait, in rpm_suspend()
592 if (dev->power.runtime_status != RPM_SUSPENDING) in rpm_suspend()
595 spin_unlock_irq(&dev->power.lock); in rpm_suspend()
599 spin_lock_irq(&dev->power.lock); in rpm_suspend()
601 finish_wait(&dev->power.wait_queue, &wait); in rpm_suspend()
605 if (dev->power.no_callbacks) in rpm_suspend()
610 dev->power.request = (rpmflags & RPM_AUTO) ? in rpm_suspend()
612 if (!dev->power.request_pending) { in rpm_suspend()
613 dev->power.request_pending = true; in rpm_suspend()
614 queue_work(pm_wq, &dev->power.work); in rpm_suspend()
634 atomic_add_unless(&parent->power.child_count, -1, 0); in rpm_suspend()
636 wake_up_all(&dev->power.wait_queue); in rpm_suspend()
638 if (dev->power.deferred_resume) { in rpm_suspend()
639 dev->power.deferred_resume = false; in rpm_suspend()
646 if (parent && !parent->power.ignore_children && !dev->power.irq_safe) { in rpm_suspend()
647 spin_unlock(&dev->power.lock); in rpm_suspend()
649 spin_lock(&parent->power.lock); in rpm_suspend()
651 spin_unlock(&parent->power.lock); in rpm_suspend()
653 spin_lock(&dev->power.lock); in rpm_suspend()
664 dev->power.deferred_resume = false; in rpm_suspend()
665 wake_up_all(&dev->power.wait_queue); in rpm_suspend()
668 dev->power.runtime_error = 0; in rpm_suspend()
700 * This function must be called under dev->power.lock with interrupts disabled.
703 __releases(&dev->power.lock) __acquires(&dev->power.lock) in rpm_resume()
712 if (dev->power.runtime_error) in rpm_resume()
714 else if (dev->power.disable_depth == 1 && dev->power.is_suspended in rpm_resume()
715 && dev->power.runtime_status == RPM_ACTIVE) in rpm_resume()
717 else if (dev->power.disable_depth > 0) in rpm_resume()
728 dev->power.request = RPM_REQ_NONE; in rpm_resume()
729 if (!dev->power.timer_autosuspends) in rpm_resume()
732 if (dev->power.runtime_status == RPM_ACTIVE) { in rpm_resume()
737 if (dev->power.runtime_status == RPM_RESUMING in rpm_resume()
738 || dev->power.runtime_status == RPM_SUSPENDING) { in rpm_resume()
742 if (dev->power.runtime_status == RPM_SUSPENDING) in rpm_resume()
743 dev->power.deferred_resume = true; in rpm_resume()
749 if (dev->power.irq_safe) { in rpm_resume()
750 spin_unlock(&dev->power.lock); in rpm_resume()
754 spin_lock(&dev->power.lock); in rpm_resume()
760 prepare_to_wait(&dev->power.wait_queue, &wait, in rpm_resume()
762 if (dev->power.runtime_status != RPM_RESUMING in rpm_resume()
763 && dev->power.runtime_status != RPM_SUSPENDING) in rpm_resume()
766 spin_unlock_irq(&dev->power.lock); in rpm_resume()
770 spin_lock_irq(&dev->power.lock); in rpm_resume()
772 finish_wait(&dev->power.wait_queue, &wait); in rpm_resume()
778 * power.no_callbacks is set, because otherwise we don't know whether in rpm_resume()
781 if (dev->power.no_callbacks && !parent && dev->parent) { in rpm_resume()
782 spin_lock_nested(&dev->parent->power.lock, SINGLE_DEPTH_NESTING); in rpm_resume()
783 if (dev->parent->power.disable_depth > 0 in rpm_resume()
784 || dev->parent->power.ignore_children in rpm_resume()
785 || dev->parent->power.runtime_status == RPM_ACTIVE) { in rpm_resume()
786 atomic_inc(&dev->parent->power.child_count); in rpm_resume()
787 spin_unlock(&dev->parent->power.lock); in rpm_resume()
791 spin_unlock(&dev->parent->power.lock); in rpm_resume()
796 dev->power.request = RPM_REQ_RESUME; in rpm_resume()
797 if (!dev->power.request_pending) { in rpm_resume()
798 dev->power.request_pending = true; in rpm_resume()
799 queue_work(pm_wq, &dev->power.work); in rpm_resume()
812 if (dev->power.irq_safe) in rpm_resume()
814 spin_unlock(&dev->power.lock); in rpm_resume()
818 spin_lock(&parent->power.lock); in rpm_resume()
823 if (!parent->power.disable_depth in rpm_resume()
824 && !parent->power.ignore_children) { in rpm_resume()
826 if (parent->power.runtime_status != RPM_ACTIVE) in rpm_resume()
829 spin_unlock(&parent->power.lock); in rpm_resume()
831 spin_lock(&dev->power.lock); in rpm_resume()
838 if (dev->power.no_callbacks) in rpm_resume()
856 atomic_inc(&parent->power.child_count); in rpm_resume()
858 wake_up_all(&dev->power.wait_queue); in rpm_resume()
864 if (parent && !dev->power.irq_safe) { in rpm_resume()
865 spin_unlock_irq(&dev->power.lock); in rpm_resume()
869 spin_lock_irq(&dev->power.lock); in rpm_resume()
886 struct device *dev = container_of(work, struct device, power.work); in pm_runtime_work()
889 spin_lock_irq(&dev->power.lock); in pm_runtime_work()
891 if (!dev->power.request_pending) in pm_runtime_work()
894 req = dev->power.request; in pm_runtime_work()
895 dev->power.request = RPM_REQ_NONE; in pm_runtime_work()
896 dev->power.request_pending = false; in pm_runtime_work()
916 spin_unlock_irq(&dev->power.lock); in pm_runtime_work()
927 struct device *dev = container_of(timer, struct device, power.suspend_timer); in pm_suspend_timer_fn()
931 spin_lock_irqsave(&dev->power.lock, flags); in pm_suspend_timer_fn()
933 expires = dev->power.timer_expires; in pm_suspend_timer_fn()
939 dev->power.timer_expires = 0; in pm_suspend_timer_fn()
940 rpm_suspend(dev, dev->power.timer_autosuspends ? in pm_suspend_timer_fn()
944 spin_unlock_irqrestore(&dev->power.lock, flags); in pm_suspend_timer_fn()
960 spin_lock_irqsave(&dev->power.lock, flags); in pm_schedule_suspend()
975 dev->power.timer_expires = expires; in pm_schedule_suspend()
976 dev->power.timer_autosuspends = 0; in pm_schedule_suspend()
977 hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); in pm_schedule_suspend()
980 spin_unlock_irqrestore(&dev->power.lock, flags); in pm_schedule_suspend()
1004 if (!atomic_dec_and_test(&dev->power.usage_count)) { in __pm_runtime_idle()
1010 might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); in __pm_runtime_idle()
1012 spin_lock_irqsave(&dev->power.lock, flags); in __pm_runtime_idle()
1014 spin_unlock_irqrestore(&dev->power.lock, flags); in __pm_runtime_idle()
1038 if (!atomic_dec_and_test(&dev->power.usage_count)) { in __pm_runtime_suspend()
1044 might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); in __pm_runtime_suspend()
1046 spin_lock_irqsave(&dev->power.lock, flags); in __pm_runtime_suspend()
1048 spin_unlock_irqrestore(&dev->power.lock, flags); in __pm_runtime_suspend()
1070 might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe && in __pm_runtime_resume()
1071 dev->power.runtime_status != RPM_ACTIVE); in __pm_runtime_resume()
1074 atomic_inc(&dev->power.usage_count); in __pm_runtime_resume()
1076 spin_lock_irqsave(&dev->power.lock, flags); in __pm_runtime_resume()
1078 spin_unlock_irqrestore(&dev->power.lock, flags); in __pm_runtime_resume()
1111 spin_lock_irqsave(&dev->power.lock, flags); in pm_runtime_get_if_active()
1112 if (dev->power.disable_depth > 0) { in pm_runtime_get_if_active()
1114 } else if (dev->power.runtime_status != RPM_ACTIVE) { in pm_runtime_get_if_active()
1118 atomic_inc(&dev->power.usage_count); in pm_runtime_get_if_active()
1120 retval = atomic_inc_not_zero(&dev->power.usage_count); in pm_runtime_get_if_active()
1123 spin_unlock_irqrestore(&dev->power.lock, flags); in pm_runtime_get_if_active()
1134 * If runtime PM of the device is disabled or its power.runtime_error field is
1138 * parent's power.ignore_children flag is unset, the device's status cannot be
1141 * If successful, __pm_runtime_set_status() clears the power.runtime_error field
1162 spin_lock_irq(&dev->power.lock); in __pm_runtime_set_status()
1168 if (dev->power.runtime_error || dev->power.disable_depth) in __pm_runtime_set_status()
1169 dev->power.disable_depth++; in __pm_runtime_set_status()
1173 spin_unlock_irq(&dev->power.lock); in __pm_runtime_set_status()
1194 spin_lock_irq(&dev->power.lock); in __pm_runtime_set_status()
1196 if (dev->power.runtime_status == status || !parent) in __pm_runtime_set_status()
1200 atomic_add_unless(&parent->power.child_count, -1, 0); in __pm_runtime_set_status()
1201 notify_parent = !parent->power.ignore_children; in __pm_runtime_set_status()
1203 spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING); in __pm_runtime_set_status()
1208 * 'power.ignore_children' flag unset. in __pm_runtime_set_status()
1210 if (!parent->power.disable_depth in __pm_runtime_set_status()
1211 && !parent->power.ignore_children in __pm_runtime_set_status()
1212 && parent->power.runtime_status != RPM_ACTIVE) { in __pm_runtime_set_status()
1217 } else if (dev->power.runtime_status == RPM_SUSPENDED) { in __pm_runtime_set_status()
1218 atomic_inc(&parent->power.child_count); in __pm_runtime_set_status()
1221 spin_unlock(&parent->power.lock); in __pm_runtime_set_status()
1232 dev->power.runtime_error = 0; in __pm_runtime_set_status()
1235 spin_unlock_irq(&dev->power.lock); in __pm_runtime_set_status()
1261 * Should be called under dev->power.lock with interrupts disabled.
1267 if (dev->power.request_pending) { in __pm_runtime_barrier()
1268 dev->power.request = RPM_REQ_NONE; in __pm_runtime_barrier()
1269 spin_unlock_irq(&dev->power.lock); in __pm_runtime_barrier()
1271 cancel_work_sync(&dev->power.work); in __pm_runtime_barrier()
1273 spin_lock_irq(&dev->power.lock); in __pm_runtime_barrier()
1274 dev->power.request_pending = false; in __pm_runtime_barrier()
1277 if (dev->power.runtime_status == RPM_SUSPENDING in __pm_runtime_barrier()
1278 || dev->power.runtime_status == RPM_RESUMING in __pm_runtime_barrier()
1279 || dev->power.idle_notification) { in __pm_runtime_barrier()
1284 prepare_to_wait(&dev->power.wait_queue, &wait, in __pm_runtime_barrier()
1286 if (dev->power.runtime_status != RPM_SUSPENDING in __pm_runtime_barrier()
1287 && dev->power.runtime_status != RPM_RESUMING in __pm_runtime_barrier()
1288 && !dev->power.idle_notification) in __pm_runtime_barrier()
1290 spin_unlock_irq(&dev->power.lock); in __pm_runtime_barrier()
1294 spin_lock_irq(&dev->power.lock); in __pm_runtime_barrier()
1296 finish_wait(&dev->power.wait_queue, &wait); in __pm_runtime_barrier()
1319 spin_lock_irq(&dev->power.lock); in pm_runtime_barrier()
1321 if (dev->power.request_pending in pm_runtime_barrier()
1322 && dev->power.request == RPM_REQ_RESUME) { in pm_runtime_barrier()
1329 spin_unlock_irq(&dev->power.lock); in pm_runtime_barrier()
1341 * Increment power.disable_depth for the device and if it was zero previously,
1347 * __pm_runtime_disable() is called and power.disable_depth is zero, the
1352 spin_lock_irq(&dev->power.lock); in __pm_runtime_disable()
1354 if (dev->power.disable_depth > 0) { in __pm_runtime_disable()
1355 dev->power.disable_depth++; in __pm_runtime_disable()
1364 if (check_resume && dev->power.request_pending in __pm_runtime_disable()
1365 && dev->power.request == RPM_REQ_RESUME) { in __pm_runtime_disable()
1380 if (!dev->power.disable_depth++) in __pm_runtime_disable()
1384 spin_unlock_irq(&dev->power.lock); in __pm_runtime_disable()
1396 spin_lock_irqsave(&dev->power.lock, flags); in pm_runtime_enable()
1398 if (dev->power.disable_depth > 0) { in pm_runtime_enable()
1399 dev->power.disable_depth--; in pm_runtime_enable()
1402 if (!dev->power.disable_depth) in pm_runtime_enable()
1403 dev->power.accounting_timestamp = ktime_get_mono_fast_ns(); in pm_runtime_enable()
1408 WARN(!dev->power.disable_depth && in pm_runtime_enable()
1409 dev->power.runtime_status == RPM_SUSPENDED && in pm_runtime_enable()
1410 !dev->power.ignore_children && in pm_runtime_enable()
1411 atomic_read(&dev->power.child_count) > 0, in pm_runtime_enable()
1415 spin_unlock_irqrestore(&dev->power.lock, flags); in pm_runtime_enable()
1423 * Increase the device's usage count and clear its power.runtime_auto flag,
1429 spin_lock_irq(&dev->power.lock); in pm_runtime_forbid()
1430 if (!dev->power.runtime_auto) in pm_runtime_forbid()
1433 dev->power.runtime_auto = false; in pm_runtime_forbid()
1434 atomic_inc(&dev->power.usage_count); in pm_runtime_forbid()
1438 spin_unlock_irq(&dev->power.lock); in pm_runtime_forbid()
1446 * Decrease the device's usage count and set its power.runtime_auto flag.
1450 spin_lock_irq(&dev->power.lock); in pm_runtime_allow()
1451 if (dev->power.runtime_auto) in pm_runtime_allow()
1454 dev->power.runtime_auto = true; in pm_runtime_allow()
1455 if (atomic_dec_and_test(&dev->power.usage_count)) in pm_runtime_allow()
1461 spin_unlock_irq(&dev->power.lock); in pm_runtime_allow()
1469 * Set the power.no_callbacks flag, which tells the PM core that this
1470 * device is power-managed through its parent and has no runtime PM
1475 spin_lock_irq(&dev->power.lock); in pm_runtime_no_callbacks()
1476 dev->power.no_callbacks = 1; in pm_runtime_no_callbacks()
1477 spin_unlock_irq(&dev->power.lock); in pm_runtime_no_callbacks()
1487 * Set the power.irq_safe flag, which tells the PM core that the
1498 spin_lock_irq(&dev->power.lock); in pm_runtime_irq_safe()
1499 dev->power.irq_safe = 1; in pm_runtime_irq_safe()
1500 spin_unlock_irq(&dev->power.lock); in pm_runtime_irq_safe()
1513 * This function must be called under dev->power.lock with interrupts disabled.
1517 int delay = dev->power.autosuspend_delay; in update_autosuspend()
1520 if (dev->power.use_autosuspend && delay < 0) { in update_autosuspend()
1524 atomic_inc(&dev->power.usage_count); in update_autosuspend()
1536 atomic_dec(&dev->power.usage_count); in update_autosuspend()
1548 * Set the device's power.autosuspend_delay value. If it changes to negative
1549 * and the power.use_autosuspend flag is set, prevent runtime suspends. If it
1556 spin_lock_irq(&dev->power.lock); in pm_runtime_set_autosuspend_delay()
1557 old_delay = dev->power.autosuspend_delay; in pm_runtime_set_autosuspend_delay()
1558 old_use = dev->power.use_autosuspend; in pm_runtime_set_autosuspend_delay()
1559 dev->power.autosuspend_delay = delay; in pm_runtime_set_autosuspend_delay()
1561 spin_unlock_irq(&dev->power.lock); in pm_runtime_set_autosuspend_delay()
1570 * Set the device's power.use_autosuspend flag, and allow or prevent runtime
1577 spin_lock_irq(&dev->power.lock); in __pm_runtime_use_autosuspend()
1578 old_delay = dev->power.autosuspend_delay; in __pm_runtime_use_autosuspend()
1579 old_use = dev->power.use_autosuspend; in __pm_runtime_use_autosuspend()
1580 dev->power.use_autosuspend = use; in __pm_runtime_use_autosuspend()
1582 spin_unlock_irq(&dev->power.lock); in __pm_runtime_use_autosuspend()
1592 dev->power.runtime_status = RPM_SUSPENDED; in pm_runtime_init()
1593 dev->power.idle_notification = false; in pm_runtime_init()
1595 dev->power.disable_depth = 1; in pm_runtime_init()
1596 atomic_set(&dev->power.usage_count, 0); in pm_runtime_init()
1598 dev->power.runtime_error = 0; in pm_runtime_init()
1600 atomic_set(&dev->power.child_count, 0); in pm_runtime_init()
1602 dev->power.runtime_auto = true; in pm_runtime_init()
1604 dev->power.request_pending = false; in pm_runtime_init()
1605 dev->power.request = RPM_REQ_NONE; in pm_runtime_init()
1606 dev->power.deferred_resume = false; in pm_runtime_init()
1607 INIT_WORK(&dev->power.work, pm_runtime_work); in pm_runtime_init()
1609 dev->power.timer_expires = 0; in pm_runtime_init()
1610 hrtimer_init(&dev->power.suspend_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); in pm_runtime_init()
1611 dev->power.suspend_timer.function = pm_suspend_timer_fn; in pm_runtime_init()
1613 init_waitqueue_head(&dev->power.wait_queue); in pm_runtime_init()
1623 if (dev->power.runtime_status == RPM_ACTIVE) in pm_runtime_reinit()
1625 if (dev->power.irq_safe) { in pm_runtime_reinit()
1626 spin_lock_irq(&dev->power.lock); in pm_runtime_reinit()
1627 dev->power.irq_safe = 0; in pm_runtime_reinit()
1628 spin_unlock_irq(&dev->power.lock); in pm_runtime_reinit()
1691 spin_lock_irq(&dev->power.lock); in pm_runtime_new_link()
1692 dev->power.links_count++; in pm_runtime_new_link()
1693 spin_unlock_irq(&dev->power.lock); in pm_runtime_new_link()
1698 spin_lock_irq(&dev->power.lock); in pm_runtime_drop_link_count()
1699 WARN_ON(dev->power.links_count == 0); in pm_runtime_drop_link_count()
1700 dev->power.links_count--; in pm_runtime_drop_link_count()
1701 spin_unlock_irq(&dev->power.lock); in pm_runtime_drop_link_count()
1725 return atomic_read(&dev->power.usage_count) <= 1 && in pm_runtime_need_not_resume()
1726 (atomic_read(&dev->power.child_count) == 0 || in pm_runtime_need_not_resume()
1727 dev->power.ignore_children); in pm_runtime_need_not_resume()
1743 * sure the device is put into low power state and it should only be used during
1786 * into low power state by a call to pm_runtime_force_suspend(). Here we reverse
1787 * those actions and bring the device into full power, if it is expected to be