Skip to content

Commit

Permalink
Merge branch 'pm-cpufreq'
Browse files Browse the repository at this point in the history
* pm-cpufreq: (21 commits)
  cpufreq: ondemand: update sampling rate only on right CPUs
  cpufreq: SPEAr: Add CPUFreq driver
  cpufreq: governors: Fix jiffies/cputime mixup (revisited)
  cpufreq: ondemand: fix wrong delay sampling rate
  cpufreq: exynos: Use static for functions used in only this file
  cpufreq: exynos: Broadcast frequency change notifications for all cores
  cpufreq: remove use of __devexit
  cpufreq: remove use of __devinit
  cpufreq: remove use of __devexit_p
  cpufreq: Remove unnecessary initialization of a local variable
  cpufreq: Make sure target freq is within limits
  cpufreq: Avoid calling cpufreq driver's target() routine if target_freq == policy->cur
  cpufreq: Fix sparse warning by making local function static
  cpufreq: Fix sparse warnings by updating cputime64_t to u64
  cpufreq: governors: remove redundant code
  cpufreq: return early from __cpufreq_driver_getavg()
  cpufreq: fix jiffies/cputime mixup in conservative/ondemand governors
  cpufreq: Improve debug prints
  cpufreq: Move common part from governors to separate file, v2
  cpufreq / core: Fix printing of governor and driver name
  ...
  • Loading branch information
Rafael J. Wysocki committed Nov 29, 2012
2 parents d4c091f + 3e33ee9 commit aa84950
Show file tree
Hide file tree
Showing 20 changed files with 1,265 additions and 939 deletions.
42 changes: 42 additions & 0 deletions Documentation/devicetree/bindings/cpufreq/cpufreq-spear.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
SPEAr cpufreq driver
-------------------

SPEAr SoC cpufreq driver for CPU frequency scaling.
It supports both uniprocessor (UP) and symmetric multiprocessor (SMP) systems
which share clock across all CPUs.

Required properties:
- cpufreq_tbl: Table of frequencies CPU could be transitioned into, in the
increasing order.

Optional properties:
- clock-latency: Specify the possible maximum transition latency for clock, in
unit of nanoseconds.

Both required and optional properties listed above must be defined under node
/cpus/cpu@0.

Examples:
--------
cpus {

<...>

cpu@0 {
compatible = "arm,cortex-a9";
reg = <0>;

<...>

cpufreq_tbl = < 166000
200000
250000
300000
400000
500000
600000 >;
};

<...>

};
1 change: 1 addition & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ config ARCH_NOMADIK

config PLAT_SPEAR
bool "ST SPEAr"
select ARCH_HAS_CPUFREQ
select ARCH_REQUIRE_GPIOLIB
select ARM_AMBA
select CLKDEV_LOOKUP
Expand Down
7 changes: 7 additions & 0 deletions drivers/cpufreq/Kconfig.arm
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ config ARM_EXYNOS5250_CPUFREQ
help
This adds the CPUFreq driver for Samsung EXYNOS5250
SoC.

config ARM_SPEAR_CPUFREQ
bool "SPEAr CPUFreq support"
depends on PLAT_SPEAR
default y
help
This adds the CPUFreq driver support for SPEAr SOCs.
5 changes: 3 additions & 2 deletions drivers/cpufreq/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ obj-$(CONFIG_CPU_FREQ_STAT) += cpufreq_stats.o
obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o
obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o
obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o
obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o
obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o
obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o cpufreq_governor.o
obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o cpufreq_governor.o

# CPUfreq cross-arch helpers
obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o
Expand Down Expand Up @@ -50,6 +50,7 @@ obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o
obj-$(CONFIG_ARM_EXYNOS4X12_CPUFREQ) += exynos4x12-cpufreq.o
obj-$(CONFIG_ARM_EXYNOS5250_CPUFREQ) += exynos5250-cpufreq.o
obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o
obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o

##################################################################################
# PowerPC platform drivers
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/cpufreq-cpu0.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
.attr = cpu0_cpufreq_attr,
};

static int __devinit cpu0_cpufreq_driver_init(void)
static int cpu0_cpufreq_driver_init(void)
{
struct device_node *np;
int ret;
Expand Down
37 changes: 26 additions & 11 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
Expand Down Expand Up @@ -127,7 +129,7 @@ static int __init init_cpufreq_transition_notifier_list(void)
pure_initcall(init_cpufreq_transition_notifier_list);

static int off __read_mostly;
int cpufreq_disabled(void)
static int cpufreq_disabled(void)
{
return off;
}
Expand Down Expand Up @@ -402,7 +404,7 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
static ssize_t store_##file_name \
(struct cpufreq_policy *policy, const char *buf, size_t count) \
{ \
unsigned int ret = -EINVAL; \
unsigned int ret; \
struct cpufreq_policy new_policy; \
\
ret = cpufreq_get_policy(&new_policy, policy->cpu); \
Expand Down Expand Up @@ -445,7 +447,7 @@ static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE)
return sprintf(buf, "performance\n");
else if (policy->governor)
return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n",
return scnprintf(buf, CPUFREQ_NAME_PLEN, "%s\n",
policy->governor->name);
return -EINVAL;
}
Expand All @@ -457,7 +459,7 @@ static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf)
static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
const char *buf, size_t count)
{
unsigned int ret = -EINVAL;
unsigned int ret;
char str_governor[16];
struct cpufreq_policy new_policy;

Expand Down Expand Up @@ -491,7 +493,7 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
*/
static ssize_t show_scaling_driver(struct cpufreq_policy *policy, char *buf)
{
return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", cpufreq_driver->name);
return scnprintf(buf, CPUFREQ_NAME_PLEN, "%s\n", cpufreq_driver->name);
}

/**
Expand All @@ -512,7 +514,7 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy,
if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char))
- (CPUFREQ_NAME_LEN + 2)))
goto out;
i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name);
i += scnprintf(&buf[i], CPUFREQ_NAME_PLEN, "%s ", t->name);
}
out:
i += sprintf(&buf[i], "\n");
Expand Down Expand Up @@ -581,7 +583,7 @@ static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf)
}

/**
* show_scaling_driver - show the current cpufreq HW/BIOS limitation
* show_bios_limit - show the current cpufreq HW/BIOS limitation
*/
static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
{
Expand Down Expand Up @@ -1468,12 +1470,23 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int relation)
{
int retval = -EINVAL;
unsigned int old_target_freq = target_freq;

if (cpufreq_disabled())
return -ENODEV;

pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
target_freq, relation);
/* Make sure that target_freq is within supported range */
if (target_freq > policy->max)
target_freq = policy->max;
if (target_freq < policy->min)
target_freq = policy->min;

pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
policy->cpu, target_freq, relation, old_target_freq);

if (target_freq == policy->cur)
return 0;

if (cpu_online(policy->cpu) && cpufreq_driver->target)
retval = cpufreq_driver->target(policy, target_freq, relation);

Expand Down Expand Up @@ -1509,12 +1522,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
{
int ret = 0;

if (!(cpu_online(cpu) && cpufreq_driver->getavg))
return 0;

policy = cpufreq_cpu_get(policy->cpu);
if (!policy)
return -EINVAL;

if (cpu_online(cpu) && cpufreq_driver->getavg)
ret = cpufreq_driver->getavg(policy, cpu);
ret = cpufreq_driver->getavg(policy, cpu);

cpufreq_cpu_put(policy);
return ret;
Expand Down
Loading

0 comments on commit aa84950

Please sign in to comment.