aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/runtime.c15
-rw-r--r--include/linux/pm_runtime.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 457be03b744d..a453090c9449 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -88,6 +88,21 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status)
88 dev->power.runtime_status = status; 88 dev->power.runtime_status = status;
89} 89}
90 90
91u64 pm_runtime_suspended_time(struct device *dev)
92{
93 unsigned long flags, time;
94
95 spin_lock_irqsave(&dev->power.lock, flags);
96
97 update_pm_runtime_accounting(dev);
98 time = dev->power.suspended_jiffies;
99
100 spin_unlock_irqrestore(&dev->power.lock, flags);
101
102 return jiffies_to_nsecs(time);
103}
104EXPORT_SYMBOL_GPL(pm_runtime_suspended_time);
105
91/** 106/**
92 * pm_runtime_deactivate_timer - Deactivate given device's suspend timer. 107 * pm_runtime_deactivate_timer - Deactivate given device's suspend timer.
93 * @dev: Device to handle. 108 * @dev: Device to handle.
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 54af4eef169f..a370006921c0 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -113,6 +113,8 @@ static inline bool pm_runtime_is_irq_safe(struct device *dev)
113 return dev->power.irq_safe; 113 return dev->power.irq_safe;
114} 114}
115 115
116extern u64 pm_runtime_suspended_time(struct device *dev);
117
116#else /* !CONFIG_PM */ 118#else /* !CONFIG_PM */
117 119
118static inline bool queue_pm_work(struct work_struct *work) { return false; } 120static inline bool queue_pm_work(struct work_struct *work) { return false; }