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
nexedi
linux
Commits
28ed0573
Commit
28ed0573
authored
May 05, 2016
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pm-opp' into pm-cpufreq
parents
d9c99acb
411466c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
44 deletions
+112
-44
drivers/base/power/opp/core.c
drivers/base/power/opp/core.c
+43
-15
drivers/base/power/opp/cpu.c
drivers/base/power/opp/cpu.c
+49
-19
include/linux/pm_opp.h
include/linux/pm_opp.h
+20
-10
No files found.
drivers/base/power/opp/core.c
View file @
28ed0573
...
@@ -1845,21 +1845,11 @@ struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev)
...
@@ -1845,21 +1845,11 @@ struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev)
}
}
EXPORT_SYMBOL_GPL
(
dev_pm_opp_get_notifier
);
EXPORT_SYMBOL_GPL
(
dev_pm_opp_get_notifier
);
#ifdef CONFIG_OF
/*
/**
* Free OPPs either created using static entries present in DT or even the
* dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
* dynamically added entries based on remove_all param.
* entries
* @dev: device pointer used to lookup OPP table.
*
* Free OPPs created using static entries present in DT.
*
* Locking: The internal opp_table and opp structures are RCU protected.
* Hence this function indirectly uses RCU updater strategy with mutex locks
* to keep the integrity of the internal data structures. Callers should ensure
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
*/
*/
void
dev_pm_opp_of_remove_table
(
struct
device
*
dev
)
static
void
_dev_pm_opp_remove_table
(
struct
device
*
dev
,
bool
remove_all
)
{
{
struct
opp_table
*
opp_table
;
struct
opp_table
*
opp_table
;
struct
dev_pm_opp
*
opp
,
*
tmp
;
struct
dev_pm_opp
*
opp
,
*
tmp
;
...
@@ -1884,7 +1874,7 @@ void dev_pm_opp_of_remove_table(struct device *dev)
...
@@ -1884,7 +1874,7 @@ void dev_pm_opp_of_remove_table(struct device *dev)
if
(
list_is_singular
(
&
opp_table
->
dev_list
))
{
if
(
list_is_singular
(
&
opp_table
->
dev_list
))
{
/* Free static OPPs */
/* Free static OPPs */
list_for_each_entry_safe
(
opp
,
tmp
,
&
opp_table
->
opp_list
,
node
)
{
list_for_each_entry_safe
(
opp
,
tmp
,
&
opp_table
->
opp_list
,
node
)
{
if
(
!
opp
->
dynamic
)
if
(
remove_all
||
!
opp
->
dynamic
)
_opp_remove
(
opp_table
,
opp
,
true
);
_opp_remove
(
opp_table
,
opp
,
true
);
}
}
}
else
{
}
else
{
...
@@ -1894,6 +1884,44 @@ void dev_pm_opp_of_remove_table(struct device *dev)
...
@@ -1894,6 +1884,44 @@ void dev_pm_opp_of_remove_table(struct device *dev)
unlock:
unlock:
mutex_unlock
(
&
opp_table_lock
);
mutex_unlock
(
&
opp_table_lock
);
}
}
/**
* dev_pm_opp_remove_table() - Free all OPPs associated with the device
* @dev: device pointer used to lookup OPP table.
*
* Free both OPPs created using static entries present in DT and the
* dynamically added entries.
*
* Locking: The internal opp_table and opp structures are RCU protected.
* Hence this function indirectly uses RCU updater strategy with mutex locks
* to keep the integrity of the internal data structures. Callers should ensure
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
*/
void
dev_pm_opp_remove_table
(
struct
device
*
dev
)
{
_dev_pm_opp_remove_table
(
dev
,
true
);
}
EXPORT_SYMBOL_GPL
(
dev_pm_opp_remove_table
);
#ifdef CONFIG_OF
/**
* dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
* entries
* @dev: device pointer used to lookup OPP table.
*
* Free OPPs created using static entries present in DT.
*
* Locking: The internal opp_table and opp structures are RCU protected.
* Hence this function indirectly uses RCU updater strategy with mutex locks
* to keep the integrity of the internal data structures. Callers should ensure
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
*/
void
dev_pm_opp_of_remove_table
(
struct
device
*
dev
)
{
_dev_pm_opp_remove_table
(
dev
,
false
);
}
EXPORT_SYMBOL_GPL
(
dev_pm_opp_of_remove_table
);
EXPORT_SYMBOL_GPL
(
dev_pm_opp_of_remove_table
);
/* Returns opp descriptor node for a device, caller must do of_node_put() */
/* Returns opp descriptor node for a device, caller must do of_node_put() */
...
...
drivers/base/power/opp/cpu.c
View file @
28ed0573
...
@@ -119,20 +119,8 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev,
...
@@ -119,20 +119,8 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev,
EXPORT_SYMBOL_GPL
(
dev_pm_opp_free_cpufreq_table
);
EXPORT_SYMBOL_GPL
(
dev_pm_opp_free_cpufreq_table
);
#endif
/* CONFIG_CPU_FREQ */
#endif
/* CONFIG_CPU_FREQ */
#ifdef CONFIG_OF
static
void
/**
_dev_pm_opp_cpumask_remove_table
(
const
struct
cpumask
*
cpumask
,
bool
of
)
* dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
* @cpumask: cpumask for which OPP table needs to be removed
*
* This removes the OPP tables for CPUs present in the @cpumask.
*
* Locking: The internal opp_table and opp structures are RCU protected.
* Hence this function internally uses RCU updater strategy with mutex locks
* to keep the integrity of the internal data structures. Callers should ensure
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
*/
void
dev_pm_opp_of_cpumask_remove_table
(
cpumask_var_t
cpumask
)
{
{
struct
device
*
cpu_dev
;
struct
device
*
cpu_dev
;
int
cpu
;
int
cpu
;
...
@@ -147,9 +135,51 @@ void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask)
...
@@ -147,9 +135,51 @@ void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask)
continue
;
continue
;
}
}
dev_pm_opp_of_remove_table
(
cpu_dev
);
if
(
of
)
dev_pm_opp_of_remove_table
(
cpu_dev
);
else
dev_pm_opp_remove_table
(
cpu_dev
);
}
}
}
}
/**
* dev_pm_opp_cpumask_remove_table() - Removes OPP table for @cpumask
* @cpumask: cpumask for which OPP table needs to be removed
*
* This removes the OPP tables for CPUs present in the @cpumask.
* This should be used to remove all the OPPs entries associated with
* the cpus in @cpumask.
*
* Locking: The internal opp_table and opp structures are RCU protected.
* Hence this function internally uses RCU updater strategy with mutex locks
* to keep the integrity of the internal data structures. Callers should ensure
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
*/
void
dev_pm_opp_cpumask_remove_table
(
const
struct
cpumask
*
cpumask
)
{
_dev_pm_opp_cpumask_remove_table
(
cpumask
,
false
);
}
EXPORT_SYMBOL_GPL
(
dev_pm_opp_cpumask_remove_table
);
#ifdef CONFIG_OF
/**
* dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
* @cpumask: cpumask for which OPP table needs to be removed
*
* This removes the OPP tables for CPUs present in the @cpumask.
* This should be used only to remove static entries created from DT.
*
* Locking: The internal opp_table and opp structures are RCU protected.
* Hence this function internally uses RCU updater strategy with mutex locks
* to keep the integrity of the internal data structures. Callers should ensure
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
*/
void
dev_pm_opp_of_cpumask_remove_table
(
const
struct
cpumask
*
cpumask
)
{
_dev_pm_opp_cpumask_remove_table
(
cpumask
,
true
);
}
EXPORT_SYMBOL_GPL
(
dev_pm_opp_of_cpumask_remove_table
);
EXPORT_SYMBOL_GPL
(
dev_pm_opp_of_cpumask_remove_table
);
/**
/**
...
@@ -164,7 +194,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
...
@@ -164,7 +194,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
* that this function is *NOT* called under RCU protection or in contexts where
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
* mutex cannot be locked.
*/
*/
int
dev_pm_opp_of_cpumask_add_table
(
c
pumask_var_t
cpumask
)
int
dev_pm_opp_of_cpumask_add_table
(
c
onst
struct
cpumask
*
cpumask
)
{
{
struct
device
*
cpu_dev
;
struct
device
*
cpu_dev
;
int
cpu
,
ret
=
0
;
int
cpu
,
ret
=
0
;
...
@@ -217,7 +247,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_add_table);
...
@@ -217,7 +247,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_add_table);
* that this function is *NOT* called under RCU protection or in contexts where
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
* mutex cannot be locked.
*/
*/
int
dev_pm_opp_of_get_sharing_cpus
(
struct
device
*
cpu_dev
,
cpumask_var_t
cpumask
)
int
dev_pm_opp_of_get_sharing_cpus
(
struct
device
*
cpu_dev
,
struct
cpumask
*
cpumask
)
{
{
struct
device_node
*
np
,
*
tmp_np
;
struct
device_node
*
np
,
*
tmp_np
;
struct
device
*
tcpu_dev
;
struct
device
*
tcpu_dev
;
...
@@ -288,7 +318,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus);
...
@@ -288,7 +318,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus);
* mutex cannot be locked.
* mutex cannot be locked.
*/
*/
int
dev_pm_opp_set_sharing_cpus
(
struct
device
*
cpu_dev
,
int
dev_pm_opp_set_sharing_cpus
(
struct
device
*
cpu_dev
,
const
cpumask_var_t
cpumask
)
const
struct
cpumask
*
cpumask
)
{
{
struct
opp_device
*
opp_dev
;
struct
opp_device
*
opp_dev
;
struct
opp_table
*
opp_table
;
struct
opp_table
*
opp_table
;
...
@@ -346,7 +376,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus);
...
@@ -346,7 +376,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus);
* that this function is *NOT* called under RCU protection or in contexts where
* that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked.
* mutex cannot be locked.
*/
*/
int
dev_pm_opp_get_sharing_cpus
(
struct
device
*
cpu_dev
,
cpumask_var_t
cpumask
)
int
dev_pm_opp_get_sharing_cpus
(
struct
device
*
cpu_dev
,
struct
cpumask
*
cpumask
)
{
{
struct
opp_device
*
opp_dev
;
struct
opp_device
*
opp_dev
;
struct
opp_table
*
opp_table
;
struct
opp_table
*
opp_table
;
...
...
include/linux/pm_opp.h
View file @
28ed0573
...
@@ -65,8 +65,10 @@ void dev_pm_opp_put_prop_name(struct device *dev);
...
@@ -65,8 +65,10 @@ void dev_pm_opp_put_prop_name(struct device *dev);
int
dev_pm_opp_set_regulator
(
struct
device
*
dev
,
const
char
*
name
);
int
dev_pm_opp_set_regulator
(
struct
device
*
dev
,
const
char
*
name
);
void
dev_pm_opp_put_regulator
(
struct
device
*
dev
);
void
dev_pm_opp_put_regulator
(
struct
device
*
dev
);
int
dev_pm_opp_set_rate
(
struct
device
*
dev
,
unsigned
long
target_freq
);
int
dev_pm_opp_set_rate
(
struct
device
*
dev
,
unsigned
long
target_freq
);
int
dev_pm_opp_set_sharing_cpus
(
struct
device
*
cpu_dev
,
const
cpumask_var_t
cpumask
);
int
dev_pm_opp_set_sharing_cpus
(
struct
device
*
cpu_dev
,
const
struct
cpumask
*
cpumask
);
int
dev_pm_opp_get_sharing_cpus
(
struct
device
*
cpu_dev
,
cpumask_var_t
cpumask
);
int
dev_pm_opp_get_sharing_cpus
(
struct
device
*
cpu_dev
,
struct
cpumask
*
cpumask
);
void
dev_pm_opp_remove_table
(
struct
device
*
dev
);
void
dev_pm_opp_cpumask_remove_table
(
const
struct
cpumask
*
cpumask
);
#else
#else
static
inline
unsigned
long
dev_pm_opp_get_voltage
(
struct
dev_pm_opp
*
opp
)
static
inline
unsigned
long
dev_pm_opp_get_voltage
(
struct
dev_pm_opp
*
opp
)
{
{
...
@@ -180,24 +182,32 @@ static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_f
...
@@ -180,24 +182,32 @@ static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_f
return
-
ENOTSUPP
;
return
-
ENOTSUPP
;
}
}
static
inline
int
dev_pm_opp_set_sharing_cpus
(
struct
device
*
cpu_dev
,
const
cpumask_var_t
cpumask
)
static
inline
int
dev_pm_opp_set_sharing_cpus
(
struct
device
*
cpu_dev
,
const
struct
cpumask
*
cpumask
)
{
{
return
-
ENOTSUPP
;
return
-
ENOTSUPP
;
}
}
static
inline
int
dev_pm_opp_get_sharing_cpus
(
struct
device
*
cpu_dev
,
cpumask_var_t
cpumask
)
static
inline
int
dev_pm_opp_get_sharing_cpus
(
struct
device
*
cpu_dev
,
struct
cpumask
*
cpumask
)
{
{
return
-
EINVAL
;
return
-
EINVAL
;
}
}
static
inline
void
dev_pm_opp_remove_table
(
struct
device
*
dev
)
{
}
static
inline
void
dev_pm_opp_cpumask_remove_table
(
const
struct
cpumask
*
cpumask
)
{
}
#endif
/* CONFIG_PM_OPP */
#endif
/* CONFIG_PM_OPP */
#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
int
dev_pm_opp_of_add_table
(
struct
device
*
dev
);
int
dev_pm_opp_of_add_table
(
struct
device
*
dev
);
void
dev_pm_opp_of_remove_table
(
struct
device
*
dev
);
void
dev_pm_opp_of_remove_table
(
struct
device
*
dev
);
int
dev_pm_opp_of_cpumask_add_table
(
c
pumask_var_t
cpumask
);
int
dev_pm_opp_of_cpumask_add_table
(
c
onst
struct
cpumask
*
cpumask
);
void
dev_pm_opp_of_cpumask_remove_table
(
c
pumask_var_t
cpumask
);
void
dev_pm_opp_of_cpumask_remove_table
(
c
onst
struct
cpumask
*
cpumask
);
int
dev_pm_opp_of_get_sharing_cpus
(
struct
device
*
cpu_dev
,
cpumask_var_t
cpumask
);
int
dev_pm_opp_of_get_sharing_cpus
(
struct
device
*
cpu_dev
,
struct
cpumask
*
cpumask
);
#else
#else
static
inline
int
dev_pm_opp_of_add_table
(
struct
device
*
dev
)
static
inline
int
dev_pm_opp_of_add_table
(
struct
device
*
dev
)
{
{
...
@@ -208,16 +218,16 @@ static inline void dev_pm_opp_of_remove_table(struct device *dev)
...
@@ -208,16 +218,16 @@ static inline void dev_pm_opp_of_remove_table(struct device *dev)
{
{
}
}
static
inline
int
dev_pm_opp_of_cpumask_add_table
(
c
pumask_var_t
cpumask
)
static
inline
int
dev_pm_opp_of_cpumask_add_table
(
c
onst
struct
cpumask
*
cpumask
)
{
{
return
-
ENOTSUPP
;
return
-
ENOTSUPP
;
}
}
static
inline
void
dev_pm_opp_of_cpumask_remove_table
(
c
pumask_var_t
cpumask
)
static
inline
void
dev_pm_opp_of_cpumask_remove_table
(
c
onst
struct
cpumask
*
cpumask
)
{
{
}
}
static
inline
int
dev_pm_opp_of_get_sharing_cpus
(
struct
device
*
cpu_dev
,
cpumask_var_t
cpumask
)
static
inline
int
dev_pm_opp_of_get_sharing_cpus
(
struct
device
*
cpu_dev
,
struct
cpumask
*
cpumask
)
{
{
return
-
ENOTSUPP
;
return
-
ENOTSUPP
;
}
}
...
...
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