提交 8a62ffe2 编写于 作者: V Vincent Guittot 提交者: Rafael J. Wysocki

PM-runtime: Add new interface to get accounted time

Some drivers (like i915/drm) needs to get the accounted suspended time.
pm_runtime_suspended_time() will return the suspended accounted time
in ns unit.
Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NVincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 1c7fc5cb
...@@ -88,6 +88,21 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status) ...@@ -88,6 +88,21 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status)
dev->power.runtime_status = status; dev->power.runtime_status = status;
} }
u64 pm_runtime_suspended_time(struct device *dev)
{
unsigned long flags, time;
spin_lock_irqsave(&dev->power.lock, flags);
update_pm_runtime_accounting(dev);
time = dev->power.suspended_jiffies;
spin_unlock_irqrestore(&dev->power.lock, flags);
return jiffies_to_nsecs(time);
}
EXPORT_SYMBOL_GPL(pm_runtime_suspended_time);
/** /**
* pm_runtime_deactivate_timer - Deactivate given device's suspend timer. * pm_runtime_deactivate_timer - Deactivate given device's suspend timer.
* @dev: Device to handle. * @dev: Device to handle.
......
...@@ -113,6 +113,8 @@ static inline bool pm_runtime_is_irq_safe(struct device *dev) ...@@ -113,6 +113,8 @@ static inline bool pm_runtime_is_irq_safe(struct device *dev)
return dev->power.irq_safe; return dev->power.irq_safe;
} }
extern u64 pm_runtime_suspended_time(struct device *dev);
#else /* !CONFIG_PM */ #else /* !CONFIG_PM */
static inline bool queue_pm_work(struct work_struct *work) { return false; } static inline bool queue_pm_work(struct work_struct *work) { return false; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册