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
15afee3a
Commit
15afee3a
authored
Mar 17, 2014
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge back earlier 'pm-cpufreq' material.
parents
2ed99e39
2449d33a
Changes
46
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
298 additions
and
514 deletions
+298
-514
arch/arm/mach-spear/spear1310.c
arch/arm/mach-spear/spear1310.c
+1
-0
arch/arm/mach-spear/spear1340.c
arch/arm/mach-spear/spear1340.c
+1
-0
arch/arm64/Kconfig
arch/arm64/Kconfig
+8
-0
drivers/base/power/main.c
drivers/base/power/main.c
+5
-0
drivers/cpufreq/Kconfig
drivers/cpufreq/Kconfig
+1
-1
drivers/cpufreq/acpi-cpufreq.c
drivers/cpufreq/acpi-cpufreq.c
+0
-1
drivers/cpufreq/arm_big_little.c
drivers/cpufreq/arm_big_little.c
+0
-1
drivers/cpufreq/blackfin-cpufreq.c
drivers/cpufreq/blackfin-cpufreq.c
+0
-1
drivers/cpufreq/cpufreq-cpu0.c
drivers/cpufreq/cpufreq-cpu0.c
+0
-1
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq.c
+209
-206
drivers/cpufreq/cpufreq_stats.c
drivers/cpufreq/cpufreq_stats.c
+13
-25
drivers/cpufreq/cris-artpec3-cpufreq.c
drivers/cpufreq/cris-artpec3-cpufreq.c
+0
-1
drivers/cpufreq/cris-etraxfs-cpufreq.c
drivers/cpufreq/cris-etraxfs-cpufreq.c
+0
-1
drivers/cpufreq/davinci-cpufreq.c
drivers/cpufreq/davinci-cpufreq.c
+0
-1
drivers/cpufreq/e_powersaver.c
drivers/cpufreq/e_powersaver.c
+0
-1
drivers/cpufreq/elanfreq.c
drivers/cpufreq/elanfreq.c
+0
-1
drivers/cpufreq/exynos-cpufreq.c
drivers/cpufreq/exynos-cpufreq.c
+7
-90
drivers/cpufreq/exynos5440-cpufreq.c
drivers/cpufreq/exynos5440-cpufreq.c
+0
-1
drivers/cpufreq/freq_table.c
drivers/cpufreq/freq_table.c
+8
-38
drivers/cpufreq/ia64-acpi-cpufreq.c
drivers/cpufreq/ia64-acpi-cpufreq.c
+0
-1
drivers/cpufreq/imx6q-cpufreq.c
drivers/cpufreq/imx6q-cpufreq.c
+0
-1
drivers/cpufreq/intel_pstate.c
drivers/cpufreq/intel_pstate.c
+12
-14
drivers/cpufreq/kirkwood-cpufreq.c
drivers/cpufreq/kirkwood-cpufreq.c
+0
-1
drivers/cpufreq/longhaul.c
drivers/cpufreq/longhaul.c
+0
-1
drivers/cpufreq/loongson2_cpufreq.c
drivers/cpufreq/loongson2_cpufreq.c
+0
-1
drivers/cpufreq/omap-cpufreq.c
drivers/cpufreq/omap-cpufreq.c
+0
-1
drivers/cpufreq/p4-clockmod.c
drivers/cpufreq/p4-clockmod.c
+0
-1
drivers/cpufreq/pasemi-cpufreq.c
drivers/cpufreq/pasemi-cpufreq.c
+0
-1
drivers/cpufreq/powernow-k6.c
drivers/cpufreq/powernow-k6.c
+0
-1
drivers/cpufreq/powernow-k7.c
drivers/cpufreq/powernow-k7.c
+0
-2
drivers/cpufreq/powernow-k8.c
drivers/cpufreq/powernow-k8.c
+0
-2
drivers/cpufreq/ppc-corenet-cpufreq.c
drivers/cpufreq/ppc-corenet-cpufreq.c
+0
-1
drivers/cpufreq/ppc_cbe_cpufreq.c
drivers/cpufreq/ppc_cbe_cpufreq.c
+0
-1
drivers/cpufreq/pxa2xx-cpufreq.c
drivers/cpufreq/pxa2xx-cpufreq.c
+0
-1
drivers/cpufreq/pxa3xx-cpufreq.c
drivers/cpufreq/pxa3xx-cpufreq.c
+0
-1
drivers/cpufreq/s5pv210-cpufreq.c
drivers/cpufreq/s5pv210-cpufreq.c
+3
-46
drivers/cpufreq/sc520_freq.c
drivers/cpufreq/sc520_freq.c
+0
-1
drivers/cpufreq/sh-cpufreq.c
drivers/cpufreq/sh-cpufreq.c
+0
-1
drivers/cpufreq/sparc-us2e-cpufreq.c
drivers/cpufreq/sparc-us2e-cpufreq.c
+1
-3
drivers/cpufreq/sparc-us3-cpufreq.c
drivers/cpufreq/sparc-us3-cpufreq.c
+1
-3
drivers/cpufreq/spear-cpufreq.c
drivers/cpufreq/spear-cpufreq.c
+11
-3
drivers/cpufreq/speedstep-centrino.c
drivers/cpufreq/speedstep-centrino.c
+0
-2
drivers/cpufreq/speedstep-ich.c
drivers/cpufreq/speedstep-ich.c
+0
-1
drivers/cpufreq/speedstep-smi.c
drivers/cpufreq/speedstep-smi.c
+0
-1
drivers/cpufreq/tegra-cpufreq.c
drivers/cpufreq/tegra-cpufreq.c
+5
-42
include/linux/cpufreq.h
include/linux/cpufreq.h
+12
-10
No files found.
arch/arm/mach-spear/spear1310.c
View file @
15afee3a
...
...
@@ -28,6 +28,7 @@
static
void
__init
spear1310_dt_init
(
void
)
{
of_platform_populate
(
NULL
,
of_default_bus_match_table
,
NULL
,
NULL
);
platform_device_register_simple
(
"spear-cpufreq"
,
-
1
,
NULL
,
0
);
}
static
const
char
*
const
spear1310_dt_board_compat
[]
=
{
...
...
arch/arm/mach-spear/spear1340.c
View file @
15afee3a
...
...
@@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void)
{
of_platform_populate
(
NULL
,
of_default_bus_match_table
,
spear1340_auxdata_lookup
,
NULL
);
platform_device_register_simple
(
"spear-cpufreq"
,
-
1
,
NULL
,
0
);
}
static
const
char
*
const
spear1340_dt_board_compat
[]
=
{
...
...
arch/arm64/Kconfig
View file @
15afee3a
...
...
@@ -303,6 +303,14 @@ source "drivers/cpuidle/Kconfig"
endmenu
menu "Power management options"
source "kernel/power/Kconfig"
source "drivers/cpufreq/Kconfig"
endmenu
source "net/Kconfig"
source "drivers/Kconfig"
...
...
drivers/base/power/main.c
View file @
15afee3a
...
...
@@ -29,6 +29,7 @@
#include <linux/async.h>
#include <linux/suspend.h>
#include <trace/events/power.h>
#include <linux/cpufreq.h>
#include <linux/cpuidle.h>
#include <linux/timer.h>
...
...
@@ -789,6 +790,8 @@ void dpm_resume(pm_message_t state)
mutex_unlock
(
&
dpm_list_mtx
);
async_synchronize_full
();
dpm_show_time
(
starttime
,
state
,
NULL
);
cpufreq_resume
();
}
/**
...
...
@@ -1259,6 +1262,8 @@ int dpm_suspend(pm_message_t state)
might_sleep
();
cpufreq_suspend
();
mutex_lock
(
&
dpm_list_mtx
);
pm_transition
=
state
;
async_error
=
0
;
...
...
drivers/cpufreq/Kconfig
View file @
15afee3a
...
...
@@ -200,7 +200,7 @@ source "drivers/cpufreq/Kconfig.x86"
endmenu
menu "ARM CPU frequency scaling drivers"
depends on ARM
depends on ARM
|| ARM64
source "drivers/cpufreq/Kconfig.arm"
endmenu
...
...
drivers/cpufreq/acpi-cpufreq.c
View file @
15afee3a
...
...
@@ -855,7 +855,6 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
pr_debug
(
"acpi_cpufreq_cpu_exit
\n
"
);
if
(
data
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
per_cpu
(
acfreq_data
,
policy
->
cpu
)
=
NULL
;
acpi_processor_unregister_performance
(
data
->
acpi_data
,
policy
->
cpu
);
...
...
drivers/cpufreq/arm_big_little.c
View file @
15afee3a
...
...
@@ -478,7 +478,6 @@ static int bL_cpufreq_exit(struct cpufreq_policy *policy)
return
-
ENODEV
;
}
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
put_cluster_clk_and_freq_table
(
cpu_dev
);
dev_dbg
(
cpu_dev
,
"%s: Exited, cpu: %d
\n
"
,
__func__
,
policy
->
cpu
);
...
...
drivers/cpufreq/blackfin-cpufreq.c
View file @
15afee3a
...
...
@@ -195,7 +195,6 @@ static struct cpufreq_driver bfin_driver = {
.
target_index
=
bfin_target
,
.
get
=
bfin_getfreq_khz
,
.
init
=
__bfin_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"bfin cpufreq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/cpufreq-cpu0.c
View file @
15afee3a
...
...
@@ -109,7 +109,6 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
.
target_index
=
cpu0_set_target
,
.
get
=
cpufreq_generic_get
,
.
init
=
cpu0_cpufreq_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"generic_cpu0"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/cpufreq.c
View file @
15afee3a
This diff is collapsed.
Click to expand it.
drivers/cpufreq/cpufreq_stats.c
View file @
15afee3a
...
...
@@ -180,27 +180,25 @@ static void cpufreq_stats_free_table(unsigned int cpu)
cpufreq_cpu_put
(
policy
);
}
static
int
__cpufreq_stats_create_table
(
struct
cpufreq_policy
*
policy
,
struct
cpufreq_frequency_table
*
table
)
static
int
__cpufreq_stats_create_table
(
struct
cpufreq_policy
*
policy
)
{
unsigned
int
i
,
j
,
count
=
0
,
ret
=
0
;
struct
cpufreq_stats
*
stat
;
struct
cpufreq_policy
*
current_policy
;
unsigned
int
alloc_size
;
unsigned
int
cpu
=
policy
->
cpu
;
struct
cpufreq_frequency_table
*
table
;
table
=
cpufreq_frequency_get_table
(
cpu
);
if
(
unlikely
(
!
table
))
return
0
;
if
(
per_cpu
(
cpufreq_stats_table
,
cpu
))
return
-
EBUSY
;
stat
=
kzalloc
(
sizeof
(
*
stat
),
GFP_KERNEL
);
if
((
stat
)
==
NULL
)
return
-
ENOMEM
;
current_policy
=
cpufreq_cpu_get
(
cpu
);
if
(
current_policy
==
NULL
)
{
ret
=
-
EINVAL
;
goto
error_get_fail
;
}
ret
=
sysfs_create_group
(
&
current_policy
->
kobj
,
&
stats_attr_group
);
ret
=
sysfs_create_group
(
&
policy
->
kobj
,
&
stats_attr_group
);
if
(
ret
)
goto
error_out
;
...
...
@@ -223,7 +221,7 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
stat
->
time_in_state
=
kzalloc
(
alloc_size
,
GFP_KERNEL
);
if
(
!
stat
->
time_in_state
)
{
ret
=
-
ENOMEM
;
goto
error_
out
;
goto
error_
alloc
;
}
stat
->
freq_table
=
(
unsigned
int
*
)(
stat
->
time_in_state
+
count
);
...
...
@@ -243,11 +241,10 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
stat
->
last_time
=
get_jiffies_64
();
stat
->
last_index
=
freq_table_get_index
(
stat
,
policy
->
cur
);
spin_unlock
(
&
cpufreq_stats_lock
);
cpufreq_cpu_put
(
current_policy
);
return
0
;
error_alloc:
sysfs_remove_group
(
&
policy
->
kobj
,
&
stats_attr_group
);
error_out:
cpufreq_cpu_put
(
current_policy
);
error_get_fail:
kfree
(
stat
);
per_cpu
(
cpufreq_stats_table
,
cpu
)
=
NULL
;
return
ret
;
...
...
@@ -256,7 +253,6 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,
static
void
cpufreq_stats_create_table
(
unsigned
int
cpu
)
{
struct
cpufreq_policy
*
policy
;
struct
cpufreq_frequency_table
*
table
;
/*
* "likely(!policy)" because normally cpufreq_stats will be registered
...
...
@@ -266,9 +262,7 @@ static void cpufreq_stats_create_table(unsigned int cpu)
if
(
likely
(
!
policy
))
return
;
table
=
cpufreq_frequency_get_table
(
policy
->
cpu
);
if
(
likely
(
table
))
__cpufreq_stats_create_table
(
policy
,
table
);
__cpufreq_stats_create_table
(
policy
);
cpufreq_cpu_put
(
policy
);
}
...
...
@@ -291,20 +285,14 @@ static int cpufreq_stat_notifier_policy(struct notifier_block *nb,
{
int
ret
=
0
;
struct
cpufreq_policy
*
policy
=
data
;
struct
cpufreq_frequency_table
*
table
;
unsigned
int
cpu
=
policy
->
cpu
;
if
(
val
==
CPUFREQ_UPDATE_POLICY_CPU
)
{
cpufreq_stats_update_policy_cpu
(
policy
);
return
0
;
}
table
=
cpufreq_frequency_get_table
(
cpu
);
if
(
!
table
)
return
0
;
if
(
val
==
CPUFREQ_CREATE_POLICY
)
ret
=
__cpufreq_stats_create_table
(
policy
,
table
);
ret
=
__cpufreq_stats_create_table
(
policy
);
else
if
(
val
==
CPUFREQ_REMOVE_POLICY
)
__cpufreq_stats_free_table
(
policy
);
...
...
drivers/cpufreq/cris-artpec3-cpufreq.c
View file @
15afee3a
...
...
@@ -57,7 +57,6 @@ static struct cpufreq_driver cris_freq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
cris_freq_target
,
.
init
=
cris_freq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"cris_freq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/cris-etraxfs-cpufreq.c
View file @
15afee3a
...
...
@@ -57,7 +57,6 @@ static struct cpufreq_driver cris_freq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
cris_freq_target
,
.
init
=
cris_freq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"cris_freq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/davinci-cpufreq.c
View file @
15afee3a
...
...
@@ -125,7 +125,6 @@ static struct cpufreq_driver davinci_driver = {
.
target_index
=
davinci_target
,
.
get
=
cpufreq_generic_get
,
.
init
=
davinci_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"davinci"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/e_powersaver.c
View file @
15afee3a
...
...
@@ -382,7 +382,6 @@ static int eps_cpu_exit(struct cpufreq_policy *policy)
unsigned
int
cpu
=
policy
->
cpu
;
/* Bye */
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
kfree
(
eps_cpu
[
cpu
]);
eps_cpu
[
cpu
]
=
NULL
;
return
0
;
...
...
drivers/cpufreq/elanfreq.c
View file @
15afee3a
...
...
@@ -198,7 +198,6 @@ static struct cpufreq_driver elanfreq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
elanfreq_target
,
.
init
=
elanfreq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"elanfreq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/exynos-cpufreq.c
View file @
15afee3a
...
...
@@ -16,7 +16,6 @@
#include <linux/slab.h>
#include <linux/regulator/consumer.h>
#include <linux/cpufreq.h>
#include <linux/suspend.h>
#include <linux/platform_device.h>
#include <plat/cpu.h>
...
...
@@ -24,12 +23,8 @@
#include "exynos-cpufreq.h"
static
struct
exynos_dvfs_info
*
exynos_info
;
static
struct
regulator
*
arm_regulator
;
static
unsigned
int
locking_frequency
;
static
bool
frequency_locked
;
static
DEFINE_MUTEX
(
cpufreq_lock
);
static
int
exynos_cpufreq_get_index
(
unsigned
int
freq
)
{
...
...
@@ -134,83 +129,13 @@ static int exynos_cpufreq_scale(unsigned int target_freq)
static
int
exynos_target
(
struct
cpufreq_policy
*
policy
,
unsigned
int
index
)
{
struct
cpufreq_frequency_table
*
freq_table
=
exynos_info
->
freq_table
;
int
ret
=
0
;
mutex_lock
(
&
cpufreq_lock
);
if
(
frequency_locked
)
goto
out
;
ret
=
exynos_cpufreq_scale
(
freq_table
[
index
].
frequency
);
out:
mutex_unlock
(
&
cpufreq_lock
);
return
ret
;
}
#ifdef CONFIG_PM
static
int
exynos_cpufreq_suspend
(
struct
cpufreq_policy
*
policy
)
{
return
0
;
}
static
int
exynos_cpufreq_resume
(
struct
cpufreq_policy
*
policy
)
{
return
0
;
}
#endif
/**
* exynos_cpufreq_pm_notifier - block CPUFREQ's activities in suspend-resume
* context
* @notifier
* @pm_event
* @v
*
* While frequency_locked == true, target() ignores every frequency but
* locking_frequency. The locking_frequency value is the initial frequency,
* which is set by the bootloader. In order to eliminate possible
* inconsistency in clock values, we save and restore frequencies during
* suspend and resume and block CPUFREQ activities. Note that the standard
* suspend/resume cannot be used as they are too deep (syscore_ops) for
* regulator actions.
*/
static
int
exynos_cpufreq_pm_notifier
(
struct
notifier_block
*
notifier
,
unsigned
long
pm_event
,
void
*
v
)
{
int
ret
;
switch
(
pm_event
)
{
case
PM_SUSPEND_PREPARE
:
mutex_lock
(
&
cpufreq_lock
);
frequency_locked
=
true
;
mutex_unlock
(
&
cpufreq_lock
);
ret
=
exynos_cpufreq_scale
(
locking_frequency
);
if
(
ret
<
0
)
return
NOTIFY_BAD
;
break
;
case
PM_POST_SUSPEND
:
mutex_lock
(
&
cpufreq_lock
);
frequency_locked
=
false
;
mutex_unlock
(
&
cpufreq_lock
);
break
;
}
return
NOTIFY_OK
;
return
exynos_cpufreq_scale
(
exynos_info
->
freq_table
[
index
].
frequency
);
}
static
struct
notifier_block
exynos_cpufreq_nb
=
{
.
notifier_call
=
exynos_cpufreq_pm_notifier
,
};
static
int
exynos_cpufreq_cpu_init
(
struct
cpufreq_policy
*
policy
)
{
policy
->
clk
=
exynos_info
->
cpu_clk
;
policy
->
suspend_freq
=
locking_frequency
;
return
cpufreq_generic_init
(
policy
,
exynos_info
->
freq_table
,
100000
);
}
...
...
@@ -220,15 +145,13 @@ static struct cpufreq_driver exynos_driver = {
.
target_index
=
exynos_target
,
.
get
=
cpufreq_generic_get
,
.
init
=
exynos_cpufreq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"exynos_cpufreq"
,
.
attr
=
cpufreq_generic_attr
,
#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW
.
boost_supported
=
true
,
#endif
#ifdef CONFIG_PM
.
suspend
=
exynos_cpufreq_suspend
,
.
resume
=
exynos_cpufreq_resume
,
.
suspend
=
cpufreq_generic_suspend
,
#endif
};
...
...
@@ -263,19 +186,13 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
goto
err_vdd_arm
;
}
/* Done here as we want to capture boot frequency */
locking_frequency
=
clk_get_rate
(
exynos_info
->
cpu_clk
)
/
1000
;
register_pm_notifier
(
&
exynos_cpufreq_nb
);
if
(
cpufreq_register_driver
(
&
exynos_driver
))
{
pr_err
(
"%s: failed to register cpufreq driver
\n
"
,
__func__
);
goto
err_cpufreq
;
}
return
0
;
err_cpufreq:
unregister_pm_notifier
(
&
exynos_cpufreq_nb
);
if
(
!
cpufreq_register_driver
(
&
exynos_driver
))
return
0
;
pr_err
(
"%s: failed to register cpufreq driver
\n
"
,
__func__
);
regulator_put
(
arm_regulator
);
err_vdd_arm:
kfree
(
exynos_info
);
...
...
drivers/cpufreq/exynos5440-cpufreq.c
View file @
15afee3a
...
...
@@ -312,7 +312,6 @@ static struct cpufreq_driver exynos_driver = {
.
target_index
=
exynos_target
,
.
get
=
cpufreq_generic_get
,
.
init
=
exynos_cpufreq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
CPUFREQ_NAME
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/freq_table.c
View file @
15afee3a
...
...
@@ -91,8 +91,8 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
EXPORT_SYMBOL_GPL
(
cpufreq_frequency_table_verify
);
/*
* Generic routine to verify policy & frequency table, requires driver to
call
*
cpufreq_frequency_table_get_attr()
prior to it.
* Generic routine to verify policy & frequency table, requires driver to
set
*
policy->freq_table
prior to it.
*/
int
cpufreq_generic_frequency_table_verify
(
struct
cpufreq_policy
*
policy
)
{
...
...
@@ -203,8 +203,6 @@ int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
}
EXPORT_SYMBOL_GPL
(
cpufreq_frequency_table_get_index
);
static
DEFINE_PER_CPU
(
struct
cpufreq_frequency_table
*
,
cpufreq_show_table
);
/**
* show_available_freqs - show available frequencies for the specified CPU
*/
...
...
@@ -212,15 +210,12 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
bool
show_boost
)
{
unsigned
int
i
=
0
;
unsigned
int
cpu
=
policy
->
cpu
;
ssize_t
count
=
0
;
struct
cpufreq_frequency_table
*
table
;
struct
cpufreq_frequency_table
*
table
=
policy
->
freq_table
;
if
(
!
per_cpu
(
cpufreq_show_table
,
cpu
)
)
if
(
!
table
)
return
-
ENODEV
;
table
=
per_cpu
(
cpufreq_show_table
,
cpu
);
for
(
i
=
0
;
(
table
[
i
].
frequency
!=
CPUFREQ_TABLE_END
);
i
++
)
{
if
(
table
[
i
].
frequency
==
CPUFREQ_ENTRY_INVALID
)
continue
;
...
...
@@ -283,49 +278,24 @@ struct freq_attr *cpufreq_generic_attr[] = {
};
EXPORT_SYMBOL_GPL
(
cpufreq_generic_attr
);
/*
* if you use these, you must assure that the frequency table is valid
* all the time between get_attr and put_attr!
*/
void
cpufreq_frequency_table_get_attr
(
struct
cpufreq_frequency_table
*
table
,
unsigned
int
cpu
)
{
pr_debug
(
"setting show_table for cpu %u to %p
\n
"
,
cpu
,
table
);
per_cpu
(
cpufreq_show_table
,
cpu
)
=
table
;
}
EXPORT_SYMBOL_GPL
(
cpufreq_frequency_table_get_attr
);
void
cpufreq_frequency_table_put_attr
(
unsigned
int
cpu
)
{
pr_debug
(
"clearing show_table for cpu %u
\n
"
,
cpu
);
per_cpu
(
cpufreq_show_table
,
cpu
)
=
NULL
;
}
EXPORT_SYMBOL_GPL
(
cpufreq_frequency_table_put_attr
);
int
cpufreq_table_validate_and_show
(
struct
cpufreq_policy
*
policy
,
struct
cpufreq_frequency_table
*
table
)
{
int
ret
=
cpufreq_frequency_table_cpuinfo
(
policy
,
table
);
if
(
!
ret
)
cpufreq_frequency_table_get_attr
(
table
,
policy
->
cpu
)
;
policy
->
freq_table
=
table
;
return
ret
;
}
EXPORT_SYMBOL_GPL
(
cpufreq_table_validate_and_show
);
void
cpufreq_frequency_table_update_policy_cpu
(
struct
cpufreq_policy
*
policy
)
{
pr_debug
(
"Updating show_table for new_cpu %u from last_cpu %u
\n
"
,
policy
->
cpu
,
policy
->
last_cpu
);
per_cpu
(
cpufreq_show_table
,
policy
->
cpu
)
=
per_cpu
(
cpufreq_show_table
,
policy
->
last_cpu
);
per_cpu
(
cpufreq_show_table
,
policy
->
last_cpu
)
=
NULL
;
}
struct
cpufreq_policy
*
cpufreq_cpu_get_raw
(
unsigned
int
cpu
);
struct
cpufreq_frequency_table
*
cpufreq_frequency_get_table
(
unsigned
int
cpu
)
{
return
per_cpu
(
cpufreq_show_table
,
cpu
);
struct
cpufreq_policy
*
policy
=
cpufreq_cpu_get_raw
(
cpu
);
return
policy
?
policy
->
freq_table
:
NULL
;
}
EXPORT_SYMBOL_GPL
(
cpufreq_frequency_get_table
);
...
...
drivers/cpufreq/ia64-acpi-cpufreq.c
View file @
15afee3a
...
...
@@ -332,7 +332,6 @@ acpi_cpufreq_cpu_exit (
pr_debug
(
"acpi_cpufreq_cpu_exit
\n
"
);
if
(
data
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
acpi_io_data
[
policy
->
cpu
]
=
NULL
;
acpi_processor_unregister_performance
(
&
data
->
acpi_data
,
policy
->
cpu
);
...
...
drivers/cpufreq/imx6q-cpufreq.c
View file @
15afee3a
...
...
@@ -144,7 +144,6 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
.
target_index
=
imx6q_set_target
,
.
get
=
cpufreq_generic_get
,
.
init
=
imx6q_cpufreq_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"imx6q-cpufreq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/intel_pstate.c
View file @
15afee3a
...
...
@@ -99,8 +99,7 @@ struct cpudata {
u64
prev_aperf
;
u64
prev_mperf
;
unsigned
long
long
prev_tsc
;
int
sample_ptr
;
struct
sample
samples
[
SAMPLE_COUNT
];
struct
sample
sample
;
};
static
struct
cpudata
**
all_cpu_data
;
...
...
@@ -154,7 +153,7 @@ static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
pid
->
setpoint
=
setpoint
;
pid
->
deadband
=
deadband
;
pid
->
integral
=
int_tofp
(
integral
);
pid
->
last_err
=
setpoint
-
busy
;
pid
->
last_err
=
int_tofp
(
setpoint
)
-
int_tofp
(
busy
)
;
}
static
inline
void
pid_p_gain_set
(
struct
_pid
*
pid
,
int
percent
)
...
...
@@ -586,15 +585,14 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
mperf
=
mperf
>>
FRAC_BITS
;
tsc
=
tsc
>>
FRAC_BITS
;
cpu
->
sample_ptr
=
(
cpu
->
sample_ptr
+
1
)
%
SAMPLE_COUNT
;
cpu
->
samples
[
cpu
->
sample_ptr
].
aperf
=
aperf
;
cpu
->
samples
[
cpu
->
sample_ptr
].
mperf
=
mperf
;
cpu
->
samples
[
cpu
->
sample_ptr
].
tsc
=
tsc
;
cpu
->
samples
[
cpu
->
sample_ptr
].
aperf
-=
cpu
->
prev_aperf
;
cpu
->
samples
[
cpu
->
sample_ptr
].
mperf
-=
cpu
->
prev_mperf
;
cpu
->
samples
[
cpu
->
sample_ptr
].
tsc
-=
cpu
->
prev_tsc
;
cpu
->
sample
.
aperf
=
aperf
;
cpu
->
sample
.
mperf
=
mperf
;
cpu
->
sample
.
tsc
=
tsc
;
cpu
->
sample
.
aperf
-=
cpu
->
prev_aperf
;
cpu
->
sample
.
mperf
-=
cpu
->
prev_mperf
;
cpu
->
sample
.
tsc
-=
cpu
->
prev_tsc
;
intel_pstate_calc_busy
(
cpu
,
&
cpu
->
sample
s
[
cpu
->
sample_ptr
]
);
intel_pstate_calc_busy
(
cpu
,
&
cpu
->
sample
);
cpu
->
prev_aperf
=
aperf
;
cpu
->
prev_mperf
=
mperf
;
...
...
@@ -614,7 +612,7 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu)
{
int32_t
core_busy
,
max_pstate
,
current_pstate
;
core_busy
=
cpu
->
sample
s
[
cpu
->
sample_ptr
]
.
core_pct_busy
;
core_busy
=
cpu
->
sample
.
core_pct_busy
;
max_pstate
=
int_tofp
(
cpu
->
pstate
.
max_pstate
);
current_pstate
=
int_tofp
(
cpu
->
pstate
.
current_pstate
);
core_busy
=
mul_fp
(
core_busy
,
div_fp
(
max_pstate
,
current_pstate
));
...
...
@@ -648,7 +646,7 @@ static void intel_pstate_timer_func(unsigned long __data)
intel_pstate_sample
(
cpu
);
sample
=
&
cpu
->
sample
s
[
cpu
->
sample_ptr
]
;
sample
=
&
cpu
->
sample
;
intel_pstate_adjust_busy_pstate
(
cpu
);
...
...
@@ -729,7 +727,7 @@ static unsigned int intel_pstate_get(unsigned int cpu_num)
cpu
=
all_cpu_data
[
cpu_num
];
if
(
!
cpu
)
return
0
;
sample
=
&
cpu
->
sample
s
[
cpu
->
sample_ptr
]
;
sample
=
&
cpu
->
sample
;
return
sample
->
freq
;
}
...
...
drivers/cpufreq/kirkwood-cpufreq.c
View file @
15afee3a
...
...
@@ -102,7 +102,6 @@ static struct cpufreq_driver kirkwood_cpufreq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
kirkwood_cpufreq_target
,
.
init
=
kirkwood_cpufreq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"kirkwood-cpufreq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/longhaul.c
View file @
15afee3a
...
...
@@ -913,7 +913,6 @@ static struct cpufreq_driver longhaul_driver = {
.
target_index
=
longhaul_target
,
.
get
=
longhaul_get
,
.
init
=
longhaul_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"longhaul"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/loongson2_cpufreq.c
View file @
15afee3a
...
...
@@ -104,7 +104,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
static
int
loongson2_cpufreq_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
clk_put
(
policy
->
clk
);
return
0
;
}
...
...
drivers/cpufreq/omap-cpufreq.c
View file @
15afee3a
...
...
@@ -143,7 +143,6 @@ static int omap_cpu_init(struct cpufreq_policy *policy)
static
int
omap_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
freq_table_free
();
clk_put
(
policy
->
clk
);
return
0
;
...
...
drivers/cpufreq/p4-clockmod.c
View file @
15afee3a
...
...
@@ -237,7 +237,6 @@ static struct cpufreq_driver p4clockmod_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
cpufreq_p4_target
,
.
init
=
cpufreq_p4_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
get
=
cpufreq_p4_get
,
.
name
=
"p4-clockmod"
,
.
attr
=
cpufreq_generic_attr
,
...
...
drivers/cpufreq/pasemi-cpufreq.c
View file @
15afee3a
...
...
@@ -234,7 +234,6 @@ static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy)
if
(
sdcpwr_mapbase
)
iounmap
(
sdcpwr_mapbase
);
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
return
0
;
}
...
...
drivers/cpufreq/powernow-k6.c
View file @
15afee3a
...
...
@@ -231,7 +231,6 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
if
(
i
==
max_multiplier
)
powernow_k6_target
(
policy
,
i
);
}
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
return
0
;
}
...
...
drivers/cpufreq/powernow-k7.c
View file @
15afee3a
...
...
@@ -664,8 +664,6 @@ static int powernow_cpu_init(struct cpufreq_policy *policy)
static
int
powernow_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
#ifdef CONFIG_X86_POWERNOW_K7_ACPI
if
(
acpi_processor_perf
)
{
acpi_processor_unregister_performance
(
acpi_processor_perf
,
0
);
...
...
drivers/cpufreq/powernow-k8.c
View file @
15afee3a
...
...
@@ -1164,8 +1164,6 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
powernow_k8_cpu_exit_acpi
(
data
);
cpufreq_frequency_table_put_attr
(
pol
->
cpu
);
kfree
(
data
->
powernow_table
);
kfree
(
data
);
for_each_cpu
(
cpu
,
pol
->
cpus
)
...
...
drivers/cpufreq/ppc-corenet-cpufreq.c
View file @
15afee3a
...
...
@@ -228,7 +228,6 @@ static int __exit corenet_cpufreq_cpu_exit(struct cpufreq_policy *policy)
struct
cpu_data
*
data
=
per_cpu
(
cpu_data
,
policy
->
cpu
);
unsigned
int
cpu
;
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
of_node_put
(
data
->
parent
);
kfree
(
data
->
table
);
kfree
(
data
);
...
...
drivers/cpufreq/ppc_cbe_cpufreq.c
View file @
15afee3a
...
...
@@ -141,7 +141,6 @@ static struct cpufreq_driver cbe_cpufreq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
cbe_cpufreq_target
,
.
init
=
cbe_cpufreq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"cbe-cpufreq"
,
.
flags
=
CPUFREQ_CONST_LOOPS
,
};
...
...
drivers/cpufreq/pxa2xx-cpufreq.c
View file @
15afee3a
...
...
@@ -427,7 +427,6 @@ static struct cpufreq_driver pxa_cpufreq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
pxa_set_target
,
.
init
=
pxa_cpufreq_init
,
.
exit
=
cpufreq_generic_exit
,
.
get
=
pxa_cpufreq_get
,
.
name
=
"PXA2xx"
,
};
...
...
drivers/cpufreq/pxa3xx-cpufreq.c
View file @
15afee3a
...
...
@@ -205,7 +205,6 @@ static struct cpufreq_driver pxa3xx_cpufreq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
pxa3xx_cpufreq_set
,
.
init
=
pxa3xx_cpufreq_init
,
.
exit
=
cpufreq_generic_exit
,
.
get
=
pxa3xx_cpufreq_get
,
.
name
=
"pxa3xx-cpufreq"
,
};
...
...
drivers/cpufreq/s5pv210-cpufreq.c
View file @
15afee3a
...
...
@@ -18,7 +18,6 @@
#include <linux/cpufreq.h>
#include <linux/reboot.h>
#include <linux/regulator/consumer.h>
#include <linux/suspend.h>
#include <mach/map.h>
#include <mach/regs-clock.h>
...
...
@@ -435,18 +434,6 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
return
ret
;
}
#ifdef CONFIG_PM
static
int
s5pv210_cpufreq_suspend
(
struct
cpufreq_policy
*
policy
)
{
return
0
;
}
static
int
s5pv210_cpufreq_resume
(
struct
cpufreq_policy
*
policy
)
{
return
0
;
}
#endif
static
int
check_mem_type
(
void
__iomem
*
dmc_reg
)
{
unsigned
long
val
;
...
...
@@ -502,6 +489,7 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy)
s5pv210_dram_conf
[
1
].
refresh
=
(
__raw_readl
(
S5P_VA_DMC1
+
0x30
)
*
1000
);
s5pv210_dram_conf
[
1
].
freq
=
clk_get_rate
(
dmc1_clk
);
policy
->
suspend_freq
=
SLEEP_FREQ
;
return
cpufreq_generic_init
(
policy
,
s5pv210_freq_table
,
40000
);
out_dmc1:
...
...
@@ -511,32 +499,6 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy)
return
ret
;
}
static
int
s5pv210_cpufreq_notifier_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
{
int
ret
;
switch
(
event
)
{
case
PM_SUSPEND_PREPARE
:
ret
=
cpufreq_driver_target
(
cpufreq_cpu_get
(
0
),
SLEEP_FREQ
,
0
);
if
(
ret
<
0
)
return
NOTIFY_BAD
;
/* Disable updation of cpu frequency */
no_cpufreq_access
=
true
;
return
NOTIFY_OK
;
case
PM_POST_RESTORE
:
case
PM_POST_SUSPEND
:
/* Enable updation of cpu frequency */
no_cpufreq_access
=
false
;
cpufreq_driver_target
(
cpufreq_cpu_get
(
0
),
SLEEP_FREQ
,
0
);
return
NOTIFY_OK
;
}
return
NOTIFY_DONE
;
}
static
int
s5pv210_cpufreq_reboot_notifier_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
{
...
...
@@ -558,15 +520,11 @@ static struct cpufreq_driver s5pv210_driver = {
.
init
=
s5pv210_cpu_init
,
.
name
=
"s5pv210"
,
#ifdef CONFIG_PM
.
suspend
=
s5pv210_cpufreq
_suspend
,
.
resume
=
s5pv210_cpufreq_resume
,
.
suspend
=
cpufreq_generic
_suspend
,
.
resume
=
cpufreq_generic_suspend
,
/* We need to set SLEEP FREQ again */
#endif
};
static
struct
notifier_block
s5pv210_cpufreq_notifier
=
{
.
notifier_call
=
s5pv210_cpufreq_notifier_event
,
};
static
struct
notifier_block
s5pv210_cpufreq_reboot_notifier
=
{
.
notifier_call
=
s5pv210_cpufreq_reboot_notifier_event
,
};
...
...
@@ -586,7 +544,6 @@ static int __init s5pv210_cpufreq_init(void)
return
PTR_ERR
(
int_regulator
);
}
register_pm_notifier
(
&
s5pv210_cpufreq_notifier
);
register_reboot_notifier
(
&
s5pv210_cpufreq_reboot_notifier
);
return
cpufreq_register_driver
(
&
s5pv210_driver
);
...
...
drivers/cpufreq/sc520_freq.c
View file @
15afee3a
...
...
@@ -93,7 +93,6 @@ static struct cpufreq_driver sc520_freq_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
sc520_freq_target
,
.
init
=
sc520_freq_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
name
=
"sc520_freq"
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/sh-cpufreq.c
View file @
15afee3a
...
...
@@ -143,7 +143,6 @@ static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy)
unsigned
int
cpu
=
policy
->
cpu
;
struct
clk
*
cpuclk
=
&
per_cpu
(
sh_cpuclk
,
cpu
);
cpufreq_frequency_table_put_attr
(
cpu
);
clk_put
(
cpuclk
);
return
0
;
...
...
drivers/cpufreq/sparc-us2e-cpufreq.c
View file @
15afee3a
...
...
@@ -301,10 +301,8 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
static
int
us2e_freq_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
if
(
cpufreq_us2e_driver
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
if
(
cpufreq_us2e_driver
)
us2e_freq_target
(
policy
,
0
);
}
return
0
;
}
...
...
drivers/cpufreq/sparc-us3-cpufreq.c
View file @
15afee3a
...
...
@@ -156,10 +156,8 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
static
int
us3_freq_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
if
(
cpufreq_us3_driver
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
if
(
cpufreq_us3_driver
)
us3_freq_target
(
policy
,
0
);
}
return
0
;
}
...
...
drivers/cpufreq/spear-cpufreq.c
View file @
15afee3a
...
...
@@ -19,6 +19,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/types.h>
...
...
@@ -163,11 +164,10 @@ static struct cpufreq_driver spear_cpufreq_driver = {
.
target_index
=
spear_cpufreq_target
,
.
get
=
cpufreq_generic_get
,
.
init
=
spear_cpufreq_init
,
.
exit
=
cpufreq_generic_exit
,
.
attr
=
cpufreq_generic_attr
,
};
static
int
spear_cpufreq_
driver_init
(
void
)
static
int
spear_cpufreq_
probe
(
struct
platform_device
*
pdev
)
{
struct
device_node
*
np
;
const
struct
property
*
prop
;
...
...
@@ -235,7 +235,15 @@ static int spear_cpufreq_driver_init(void)
of_node_put
(
np
);
return
ret
;
}
late_initcall
(
spear_cpufreq_driver_init
);
static
struct
platform_driver
spear_cpufreq_platdrv
=
{
.
driver
=
{
.
name
=
"spear-cpufreq"
,
.
owner
=
THIS_MODULE
,
},
.
probe
=
spear_cpufreq_probe
,
};
module_platform_driver
(
spear_cpufreq_platdrv
);
MODULE_AUTHOR
(
"Deepak Sikri <deepak.sikri@st.com>"
);
MODULE_DESCRIPTION
(
"SPEAr CPUFreq driver"
);
...
...
drivers/cpufreq/speedstep-centrino.c
View file @
15afee3a
...
...
@@ -406,8 +406,6 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy)
if
(
!
per_cpu
(
centrino_model
,
cpu
))
return
-
ENODEV
;
cpufreq_frequency_table_put_attr
(
cpu
);
per_cpu
(
centrino_model
,
cpu
)
=
NULL
;
return
0
;
...
...
drivers/cpufreq/speedstep-ich.c
View file @
15afee3a
...
...
@@ -311,7 +311,6 @@ static struct cpufreq_driver speedstep_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
speedstep_target
,
.
init
=
speedstep_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
get
=
speedstep_get
,
.
attr
=
cpufreq_generic_attr
,
};
...
...
drivers/cpufreq/speedstep-smi.c
View file @
15afee3a
...
...
@@ -280,7 +280,6 @@ static struct cpufreq_driver speedstep_driver = {
.
verify
=
cpufreq_generic_frequency_table_verify
,
.
target_index
=
speedstep_target
,
.
init
=
speedstep_cpu_init
,
.
exit
=
cpufreq_generic_exit
,
.
get
=
speedstep_get
,
.
resume
=
speedstep_resume
,
.
attr
=
cpufreq_generic_attr
,
...
...
drivers/cpufreq/tegra-cpufreq.c
View file @
15afee3a
...
...
@@ -26,7 +26,6 @@
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/suspend.h>
static
struct
cpufreq_frequency_table
freq_table
[]
=
{
{
.
frequency
=
216000
},
...
...
@@ -47,9 +46,6 @@ static struct clk *pll_x_clk;
static
struct
clk
*
pll_p_clk
;
static
struct
clk
*
emc_clk
;
static
DEFINE_MUTEX
(
tegra_cpu_lock
);
static
bool
is_suspended
;
static
int
tegra_cpu_clk_set_rate
(
unsigned
long
rate
)
{
int
ret
;
...
...
@@ -112,42 +108,9 @@ static int tegra_update_cpu_speed(struct cpufreq_policy *policy,
static
int
tegra_target
(
struct
cpufreq_policy
*
policy
,
unsigned
int
index
)
{
int
ret
=
-
EBUSY
;
mutex_lock
(
&
tegra_cpu_lock
);
if
(
!
is_suspended
)
ret
=
tegra_update_cpu_speed
(
policy
,
freq_table
[
index
].
frequency
);
mutex_unlock
(
&
tegra_cpu_lock
);
return
ret
;
return
tegra_update_cpu_speed
(
policy
,
freq_table
[
index
].
frequency
);
}
static
int
tegra_pm_notify
(
struct
notifier_block
*
nb
,
unsigned
long
event
,
void
*
dummy
)
{
mutex_lock
(
&
tegra_cpu_lock
);
if
(
event
==
PM_SUSPEND_PREPARE
)
{
struct
cpufreq_policy
*
policy
=
cpufreq_cpu_get
(
0
);
is_suspended
=
true
;
pr_info
(
"Tegra cpufreq suspend: setting frequency to %d kHz
\n
"
,
freq_table
[
0
].
frequency
);
if
(
clk_get_rate
(
cpu_clk
)
/
1000
!=
freq_table
[
0
].
frequency
)
tegra_update_cpu_speed
(
policy
,
freq_table
[
0
].
frequency
);
cpufreq_cpu_put
(
policy
);
}
else
if
(
event
==
PM_POST_SUSPEND
)
{
is_suspended
=
false
;
}
mutex_unlock
(
&
tegra_cpu_lock
);
return
NOTIFY_OK
;
}
static
struct
notifier_block
tegra_cpu_pm_notifier
=
{
.
notifier_call
=
tegra_pm_notify
,
};
static
int
tegra_cpu_init
(
struct
cpufreq_policy
*
policy
)
{
int
ret
;
...
...
@@ -166,16 +129,13 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
return
ret
;
}
if
(
policy
->
cpu
==
0
)
register_pm_notifier
(
&
tegra_cpu_pm_notifier
);
policy
->
clk
=
cpu_clk
;
policy
->
suspend_freq
=
freq_table
[
0
].
frequency
;
return
0
;
}
static
int
tegra_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
clk_disable_unprepare
(
cpu_clk
);
clk_disable_unprepare
(
emc_clk
);
return
0
;
...
...
@@ -190,6 +150,9 @@ static struct cpufreq_driver tegra_cpufreq_driver = {
.
exit
=
tegra_cpu_exit
,
.
name
=
"tegra"
,
.
attr
=
cpufreq_generic_attr
,
#ifdef CONFIG_PM
.
suspend
=
cpufreq_generic_suspend
,
#endif
};
static
int
__init
tegra_cpufreq_init
(
void
)
...
...
include/linux/cpufreq.h
View file @
15afee3a
...
...
@@ -74,6 +74,8 @@ struct cpufreq_policy {
unsigned
int
max
;
/* in kHz */
unsigned
int
cur
;
/* in kHz, only needed if cpufreq
* governors are used */
unsigned
int
suspend_freq
;
/* freq to set during suspend */
unsigned
int
policy
;
/* see above */
struct
cpufreq_governor
*
governor
;
/* see below */
void
*
governor_data
;
...
...
@@ -83,6 +85,7 @@ struct cpufreq_policy {
* called, but you're in IRQ context */
struct
cpufreq_real_policy
user_policy
;
struct
cpufreq_frequency_table
*
freq_table
;
struct
list_head
policy_list
;
struct
kobject
kobj
;
...
...
@@ -296,6 +299,15 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
policy
->
cpuinfo
.
max_freq
);
}
#ifdef CONFIG_CPU_FREQ
void
cpufreq_suspend
(
void
);
void
cpufreq_resume
(
void
);
int
cpufreq_generic_suspend
(
struct
cpufreq_policy
*
policy
);
#else
static
inline
void
cpufreq_suspend
(
void
)
{}
static
inline
void
cpufreq_resume
(
void
)
{}
#endif
/*********************************************************************
* CPUFREQ NOTIFIER INTERFACE *
*********************************************************************/
...
...
@@ -463,7 +475,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
int
cpufreq_frequency_table_get_index
(
struct
cpufreq_policy
*
policy
,
unsigned
int
freq
);
void
cpufreq_frequency_table_update_policy_cpu
(
struct
cpufreq_policy
*
policy
);
ssize_t
cpufreq_show_cpus
(
const
struct
cpumask
*
mask
,
char
*
buf
);
#ifdef CONFIG_CPU_FREQ
...
...
@@ -490,9 +501,6 @@ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
/* the following are really really optional */
extern
struct
freq_attr
cpufreq_freq_attr_scaling_available_freqs
;
extern
struct
freq_attr
*
cpufreq_generic_attr
[];
void
cpufreq_frequency_table_get_attr
(
struct
cpufreq_frequency_table
*
table
,
unsigned
int
cpu
);
void
cpufreq_frequency_table_put_attr
(
unsigned
int
cpu
);
int
cpufreq_table_validate_and_show
(
struct
cpufreq_policy
*
policy
,
struct
cpufreq_frequency_table
*
table
);
...
...
@@ -500,10 +508,4 @@ unsigned int cpufreq_generic_get(unsigned int cpu);
int
cpufreq_generic_init
(
struct
cpufreq_policy
*
policy
,
struct
cpufreq_frequency_table
*
table
,
unsigned
int
transition_latency
);
static
inline
int
cpufreq_generic_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
return
0
;
}
#endif
/* _LINUX_CPUFREQ_H */
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