Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
1cc9c595
Commit
1cc9c595
authored
Feb 01, 2019
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge back earlier PM core material for v5.1.
parents
15efb47d
a08c2a5a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
29 deletions
+58
-29
drivers/base/power/clock_ops.c
drivers/base/power/clock_ops.c
+9
-4
drivers/base/power/runtime.c
drivers/base/power/runtime.c
+28
-7
drivers/base/power/sysfs.c
drivers/base/power/sysfs.c
+8
-3
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/i915_pmu.c
+6
-10
drivers/gpu/drm/i915/i915_pmu.h
drivers/gpu/drm/i915/i915_pmu.h
+2
-2
include/linux/pm.h
include/linux/pm.h
+3
-3
include/linux/pm_runtime.h
include/linux/pm_runtime.h
+2
-0
No files found.
drivers/base/power/clock_ops.c
View file @
1cc9c595
...
...
@@ -65,10 +65,15 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
if
(
IS_ERR
(
ce
->
clk
))
{
ce
->
status
=
PCE_STATUS_ERROR
;
}
else
{
clk_prepare
(
ce
->
clk
);
ce
->
status
=
PCE_STATUS_ACQUIRED
;
dev_dbg
(
dev
,
"Clock %pC con_id %s managed by runtime PM.
\n
"
,
ce
->
clk
,
ce
->
con_id
);
if
(
clk_prepare
(
ce
->
clk
))
{
ce
->
status
=
PCE_STATUS_ERROR
;
dev_err
(
dev
,
"clk_prepare() failed
\n
"
);
}
else
{
ce
->
status
=
PCE_STATUS_ACQUIRED
;
dev_dbg
(
dev
,
"Clock %pC con_id %s managed by runtime PM.
\n
"
,
ce
->
clk
,
ce
->
con_id
);
}
}
}
...
...
drivers/base/power/runtime.c
View file @
1cc9c595
...
...
@@ -66,8 +66,8 @@ static int rpm_suspend(struct device *dev, int rpmflags);
*/
void
update_pm_runtime_accounting
(
struct
device
*
dev
)
{
u
nsigned
long
now
=
jiffies
;
u
nsigned
long
delta
;
u
64
now
=
ktime_to_ns
(
ktime_get
())
;
u
64
delta
;
delta
=
now
-
dev
->
power
.
accounting_timestamp
;
...
...
@@ -77,9 +77,9 @@ void update_pm_runtime_accounting(struct device *dev)
return
;
if
(
dev
->
power
.
runtime_status
==
RPM_SUSPENDED
)
dev
->
power
.
suspended_
jiffies
+=
delta
;
dev
->
power
.
suspended_
time
+=
delta
;
else
dev
->
power
.
active_
jiffies
+=
delta
;
dev
->
power
.
active_
time
+=
delta
;
}
static
void
__update_runtime_status
(
struct
device
*
dev
,
enum
rpm_status
status
)
...
...
@@ -88,6 +88,22 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status)
dev
->
power
.
runtime_status
=
status
;
}
u64
pm_runtime_suspended_time
(
struct
device
*
dev
)
{
u64
time
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
dev
->
power
.
lock
,
flags
);
update_pm_runtime_accounting
(
dev
);
time
=
dev
->
power
.
suspended_time
;
spin_unlock_irqrestore
(
&
dev
->
power
.
lock
,
flags
);
return
time
;
}
EXPORT_SYMBOL_GPL
(
pm_runtime_suspended_time
);
/**
* pm_runtime_deactivate_timer - Deactivate given device's suspend timer.
* @dev: Device to handle.
...
...
@@ -1294,10 +1310,15 @@ void pm_runtime_enable(struct device *dev)
spin_lock_irqsave
(
&
dev
->
power
.
lock
,
flags
);
if
(
dev
->
power
.
disable_depth
>
0
)
if
(
dev
->
power
.
disable_depth
>
0
)
{
dev
->
power
.
disable_depth
--
;
else
/* About to enable runtime pm, set accounting_timestamp to now */
if
(
!
dev
->
power
.
disable_depth
)
dev
->
power
.
accounting_timestamp
=
ktime_to_ns
(
ktime_get
());
}
else
{
dev_warn
(
dev
,
"Unbalanced %s!
\n
"
,
__func__
);
}
WARN
(
!
dev
->
power
.
disable_depth
&&
dev
->
power
.
runtime_status
==
RPM_SUSPENDED
&&
...
...
@@ -1494,7 +1515,7 @@ void pm_runtime_init(struct device *dev)
dev
->
power
.
request_pending
=
false
;
dev
->
power
.
request
=
RPM_REQ_NONE
;
dev
->
power
.
deferred_resume
=
false
;
dev
->
power
.
accounting_timestamp
=
jiffies
;
dev
->
power
.
accounting_timestamp
=
0
;
INIT_WORK
(
&
dev
->
power
.
work
,
pm_runtime_work
);
dev
->
power
.
timer_expires
=
0
;
...
...
drivers/base/power/sysfs.c
View file @
1cc9c595
...
...
@@ -125,9 +125,12 @@ static ssize_t runtime_active_time_show(struct device *dev,
struct
device_attribute
*
attr
,
char
*
buf
)
{
int
ret
;
u64
tmp
;
spin_lock_irq
(
&
dev
->
power
.
lock
);
update_pm_runtime_accounting
(
dev
);
ret
=
sprintf
(
buf
,
"%i
\n
"
,
jiffies_to_msecs
(
dev
->
power
.
active_jiffies
));
tmp
=
dev
->
power
.
active_time
;
do_div
(
tmp
,
NSEC_PER_MSEC
);
ret
=
sprintf
(
buf
,
"%llu
\n
"
,
tmp
);
spin_unlock_irq
(
&
dev
->
power
.
lock
);
return
ret
;
}
...
...
@@ -138,10 +141,12 @@ static ssize_t runtime_suspended_time_show(struct device *dev,
struct
device_attribute
*
attr
,
char
*
buf
)
{
int
ret
;
u64
tmp
;
spin_lock_irq
(
&
dev
->
power
.
lock
);
update_pm_runtime_accounting
(
dev
);
ret
=
sprintf
(
buf
,
"%i
\n
"
,
jiffies_to_msecs
(
dev
->
power
.
suspended_jiffies
));
tmp
=
dev
->
power
.
suspended_time
;
do_div
(
tmp
,
NSEC_PER_MSEC
);
ret
=
sprintf
(
buf
,
"%llu
\n
"
,
tmp
);
spin_unlock_irq
(
&
dev
->
power
.
lock
);
return
ret
;
}
...
...
drivers/gpu/drm/i915/i915_pmu.c
View file @
1cc9c595
...
...
@@ -5,6 +5,7 @@
*/
#include <linux/irq.h>
#include <linux/pm_runtime.h>
#include "i915_pmu.h"
#include "intel_ringbuffer.h"
#include "i915_drv.h"
...
...
@@ -478,7 +479,6 @@ static u64 get_rc6(struct drm_i915_private *i915)
* counter value.
*/
spin_lock_irqsave
(
&
i915
->
pmu
.
lock
,
flags
);
spin_lock
(
&
kdev
->
power
.
lock
);
/*
* 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)
* suspended and if not we cannot do better than report the last
* known RC6 value.
*/
if
(
kdev
->
power
.
runtime_status
==
RPM_SUSPENDED
)
{
if
(
!
i915
->
pmu
.
sample
[
__I915_SAMPLE_RC6_ESTIMATED
].
cur
)
i915
->
pmu
.
suspended_jiffies_last
=
kdev
->
power
.
suspended_jiffies
;
if
(
pm_runtime_status_suspended
(
kdev
))
{
val
=
pm_runtime_suspended_time
(
kdev
);
val
=
kdev
->
power
.
suspended_jiffies
-
i915
->
pmu
.
suspended_jiffies_last
;
val
+=
jiffies
-
kdev
->
power
.
accounting_timestamp
;
if
(
!
i915
->
pmu
.
sample
[
__I915_SAMPLE_RC6_ESTIMATED
].
cur
)
i915
->
pmu
.
suspended_time_last
=
val
;
val
=
jiffies_to_nsecs
(
val
)
;
val
-=
i915
->
pmu
.
suspended_time_last
;
val
+=
i915
->
pmu
.
sample
[
__I915_SAMPLE_RC6
].
cur
;
i915
->
pmu
.
sample
[
__I915_SAMPLE_RC6_ESTIMATED
].
cur
=
val
;
...
...
@@ -510,7 +507,6 @@ static u64 get_rc6(struct drm_i915_private *i915)
val
=
i915
->
pmu
.
sample
[
__I915_SAMPLE_RC6
].
cur
;
}
spin_unlock
(
&
kdev
->
power
.
lock
);
spin_unlock_irqrestore
(
&
i915
->
pmu
.
lock
,
flags
);
}
...
...
drivers/gpu/drm/i915/i915_pmu.h
View file @
1cc9c595
...
...
@@ -95,9 +95,9 @@ struct i915_pmu {
*/
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.
*/
u
nsigned
long
suspended_jiffies
_last
;
u
64
suspended_time
_last
;
/**
* @i915_attr: Memory block holding device attributes.
*/
...
...
include/linux/pm.h
View file @
1cc9c595
...
...
@@ -633,9 +633,9 @@ struct dev_pm_info {
int
runtime_error
;
int
autosuspend_delay
;
u64
last_busy
;
u
nsigned
long
active_jiffies
;
u
nsigned
long
suspended_jiffies
;
u
nsigned
long
accounting_timestamp
;
u
64
active_time
;
u
64
suspended_time
;
u
64
accounting_timestamp
;
#endif
struct
pm_subsys_data
*
subsys_data
;
/* Owned by the subsystem. */
void
(
*
set_latency_tolerance
)(
struct
device
*
,
s32
);
...
...
include/linux/pm_runtime.h
View file @
1cc9c595
...
...
@@ -113,6 +113,8 @@ static inline bool pm_runtime_is_irq_safe(struct device *dev)
return
dev
->
power
.
irq_safe
;
}
extern
u64
pm_runtime_suspended_time
(
struct
device
*
dev
);
#else
/* !CONFIG_PM */
static
inline
bool
queue_pm_work
(
struct
work_struct
*
work
)
{
return
false
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment