Commit 3b4ed2e2 authored by Vincent Guittot's avatar Vincent Guittot Committed by Rafael J. Wysocki

drm/i915: Move on the new pm runtime interface

Use the new PM-runtime interface to get the accounted suspended time:
pm_runtime_suspended_time().

This new interface helps to simplify and cleanup the code that computes
__I915_SAMPLE_RC6_ESTIMATED and to remove direct access to internals of
PM-runtime.
Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 8a62ffe2
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/pm_runtime.h>
#include "i915_pmu.h" #include "i915_pmu.h"
#include "intel_ringbuffer.h" #include "intel_ringbuffer.h"
#include "i915_drv.h" #include "i915_drv.h"
...@@ -478,7 +479,6 @@ static u64 get_rc6(struct drm_i915_private *i915) ...@@ -478,7 +479,6 @@ static u64 get_rc6(struct drm_i915_private *i915)
* counter value. * counter value.
*/ */
spin_lock_irqsave(&i915->pmu.lock, flags); spin_lock_irqsave(&i915->pmu.lock, flags);
spin_lock(&kdev->power.lock);
/* /*
* After the above branch intel_runtime_pm_get_if_in_use failed * After the above branch intel_runtime_pm_get_if_in_use failed
...@@ -491,16 +491,13 @@ static u64 get_rc6(struct drm_i915_private *i915) ...@@ -491,16 +491,13 @@ static u64 get_rc6(struct drm_i915_private *i915)
* suspended and if not we cannot do better than report the last * suspended and if not we cannot do better than report the last
* known RC6 value. * known RC6 value.
*/ */
if (kdev->power.runtime_status == RPM_SUSPENDED) { if (pm_runtime_status_suspended(kdev)) {
if (!i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur) val = pm_runtime_suspended_time(kdev);
i915->pmu.suspended_jiffies_last =
kdev->power.suspended_jiffies;
val = kdev->power.suspended_jiffies - if (!i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur)
i915->pmu.suspended_jiffies_last; i915->pmu.suspended_time_last = val;
val += jiffies - kdev->power.accounting_timestamp;
val = jiffies_to_nsecs(val); val -= i915->pmu.suspended_time_last;
val += i915->pmu.sample[__I915_SAMPLE_RC6].cur; val += i915->pmu.sample[__I915_SAMPLE_RC6].cur;
i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur = val; i915->pmu.sample[__I915_SAMPLE_RC6_ESTIMATED].cur = val;
...@@ -510,7 +507,6 @@ static u64 get_rc6(struct drm_i915_private *i915) ...@@ -510,7 +507,6 @@ static u64 get_rc6(struct drm_i915_private *i915)
val = i915->pmu.sample[__I915_SAMPLE_RC6].cur; val = i915->pmu.sample[__I915_SAMPLE_RC6].cur;
} }
spin_unlock(&kdev->power.lock);
spin_unlock_irqrestore(&i915->pmu.lock, flags); spin_unlock_irqrestore(&i915->pmu.lock, flags);
} }
......
...@@ -95,9 +95,9 @@ struct i915_pmu { ...@@ -95,9 +95,9 @@ struct i915_pmu {
*/ */
struct i915_pmu_sample sample[__I915_NUM_PMU_SAMPLERS]; struct i915_pmu_sample sample[__I915_NUM_PMU_SAMPLERS];
/** /**
* @suspended_jiffies_last: Cached suspend time from PM core. * @suspended_time_last: Cached suspend time from PM core.
*/ */
unsigned long suspended_jiffies_last; u64 suspended_time_last;
/** /**
* @i915_attr: Memory block holding device attributes. * @i915_attr: Memory block holding device attributes.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment