Skip to content

Commit

Permalink
Merge back earlier 'pm-cpufreq' material.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael J. Wysocki committed Aug 22, 2013
2 parents b36f4be + 5025d62 commit 4eb5178
Show file tree
Hide file tree
Showing 59 changed files with 691 additions and 854 deletions.
2 changes: 0 additions & 2 deletions Documentation/cpu-freq/cpu-drivers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ What shall this struct cpufreq_driver contain?

cpufreq_driver.name - The name of this driver.

cpufreq_driver.owner - THIS_MODULE;

cpufreq_driver.init - A pointer to the per-CPU initialization
function.

Expand Down
29 changes: 0 additions & 29 deletions arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -942,35 +942,6 @@ extern int set_tsc_mode(unsigned int val);

extern u16 amd_get_nb_id(int cpu);

struct aperfmperf {
u64 aperf, mperf;
};

static inline void get_aperfmperf(struct aperfmperf *am)
{
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_APERFMPERF));

rdmsrl(MSR_IA32_APERF, am->aperf);
rdmsrl(MSR_IA32_MPERF, am->mperf);
}

#define APERFMPERF_SHIFT 10

static inline
unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
struct aperfmperf *new)
{
u64 aperf = new->aperf - old->aperf;
u64 mperf = new->mperf - old->mperf;
unsigned long ratio = aperf;

mperf >>= APERFMPERF_SHIFT;
if (mperf)
ratio = div64_u64(aperf, mperf);

return ratio;
}

extern unsigned long arch_align_stack(unsigned long sp);
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);

Expand Down
36 changes: 24 additions & 12 deletions drivers/cpufreq/Kconfig.arm
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,56 @@ config ARM_DT_BL_CPUFREQ
big.LITTLE platform. This gets frequency tables from DT.

config ARM_EXYNOS_CPUFREQ
bool "SAMSUNG EXYNOS SoCs"
depends on ARCH_EXYNOS
bool
select CPU_FREQ_TABLE
default y
help
This adds the CPUFreq driver common part for Samsung
EXYNOS SoCs.

If in doubt, say N.

config ARM_EXYNOS4210_CPUFREQ
def_bool CPU_EXYNOS4210
bool "SAMSUNG EXYNOS4210"
depends on CPU_EXYNOS4210
default y
select ARM_EXYNOS_CPUFREQ
help
This adds the CPUFreq driver for Samsung EXYNOS4210
SoC (S5PV310 or S5PC210).

If in doubt, say N.

config ARM_EXYNOS4X12_CPUFREQ
def_bool (SOC_EXYNOS4212 || SOC_EXYNOS4412)
bool "SAMSUNG EXYNOS4x12"
depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412)
default y
select ARM_EXYNOS_CPUFREQ
help
This adds the CPUFreq driver for Samsung EXYNOS4X12
SoC (EXYNOS4212 or EXYNOS4412).

If in doubt, say N.

config ARM_EXYNOS5250_CPUFREQ
def_bool SOC_EXYNOS5250
bool "SAMSUNG EXYNOS5250"
depends on SOC_EXYNOS5250
default y
select ARM_EXYNOS_CPUFREQ
help
This adds the CPUFreq driver for Samsung EXYNOS5250
SoC.

If in doubt, say N.

config ARM_EXYNOS5440_CPUFREQ
def_bool SOC_EXYNOS5440
bool "SAMSUNG EXYNOS5440"
depends on SOC_EXYNOS5440
depends on HAVE_CLK && PM_OPP && OF
default y
select CPU_FREQ_TABLE
help
This adds the CPUFreq driver for Samsung EXYNOS5440
SoC. The nature of exynos5440 clock controller is
different than previous exynos controllers so not using
the common exynos framework.

If in doubt, say N.

config ARM_HIGHBANK_CPUFREQ
tristate "Calxeda Highbank-based"
depends on ARCH_HIGHBANK
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ obj-$(CONFIG_GENERIC_CPUFREQ_CPU0) += cpufreq-cpu0.o
# powernow-k8 can load then. ACPI is preferred to all other hardware-specific drivers.
# speedstep-* is preferred over p4-clockmod.

obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o mperf.o
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o
obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
obj-$(CONFIG_X86_PCC_CPUFREQ) += pcc-cpufreq.o
obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o
Expand Down
12 changes: 3 additions & 9 deletions drivers/cpufreq/acpi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include <asm/msr.h>
#include <asm/processor.h>
#include <asm/cpufeature.h>
#include "mperf.h"

MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
MODULE_DESCRIPTION("ACPI Processor P-States Driver");
Expand Down Expand Up @@ -198,7 +197,7 @@ static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf)
return sprintf(buf, "%u\n", boost_enabled);
}

static struct freq_attr cpb = __ATTR(cpb, 0644, show_cpb, store_cpb);
cpufreq_freq_attr_rw(cpb);
#endif

static int check_est_cpu(unsigned int cpuid)
Expand Down Expand Up @@ -710,7 +709,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
return blacklisted;
#endif

data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL);
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand Down Expand Up @@ -800,7 +799,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
goto err_unreg;
}

data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) *
data->freq_table = kmalloc(sizeof(*data->freq_table) *
(perf->state_count+1), GFP_KERNEL);
if (!data->freq_table) {
result = -ENOMEM;
Expand Down Expand Up @@ -861,10 +860,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
/* notify BIOS that we exist */
acpi_processor_notify_smm(THIS_MODULE);

/* Check for APERF/MPERF support in hardware */
if (boot_cpu_has(X86_FEATURE_APERFMPERF))
acpi_cpufreq_driver.getavg = cpufreq_get_measured_perf;

pr_debug("CPU%u - ACPI performance management activated.\n", cpu);
for (i = 0; i < perf->state_count; i++)
pr_debug(" %cP%d: %d MHz, %d mW, %d uS\n",
Expand Down Expand Up @@ -941,7 +936,6 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.exit = acpi_cpufreq_cpu_exit,
.resume = acpi_cpufreq_resume,
.name = "acpi-cpufreq",
.owner = THIS_MODULE,
.attr = acpi_cpufreq_attr,
};

Expand Down
1 change: 0 additions & 1 deletion drivers/cpufreq/at32ap-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy)

static struct cpufreq_driver at32_driver = {
.name = "at32ap",
.owner = THIS_MODULE,
.init = at32_cpufreq_driver_init,
.verify = at32_verify_speed,
.target = at32_set_target,
Expand Down
1 change: 0 additions & 1 deletion drivers/cpufreq/blackfin-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ static struct cpufreq_driver bfin_driver = {
.get = bfin_getfreq_khz,
.init = __bfin_cpu_init,
.name = "bfin cpufreq",
.owner = THIS_MODULE,
.attr = bfin_freq_attr,
};

Expand Down
9 changes: 4 additions & 5 deletions drivers/cpufreq/cpufreq-cpu0.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,

cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);

if (cpu_reg) {
if (!IS_ERR(cpu_reg)) {
rcu_read_lock();
opp = opp_find_freq_ceil(cpu_dev, &freq_Hz);
if (IS_ERR(opp)) {
Expand All @@ -90,7 +90,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
freqs.new / 1000, volt ? volt / 1000 : -1);

/* scaling up? scale voltage before frequency */
if (cpu_reg && freqs.new > freqs.old) {
if (!IS_ERR(cpu_reg) && freqs.new > freqs.old) {
ret = regulator_set_voltage_tol(cpu_reg, volt, tol);
if (ret) {
pr_err("failed to scale voltage up: %d\n", ret);
Expand All @@ -102,14 +102,14 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
ret = clk_set_rate(cpu_clk, freq_exact);
if (ret) {
pr_err("failed to set clock rate: %d\n", ret);
if (cpu_reg)
if (!IS_ERR(cpu_reg))
regulator_set_voltage_tol(cpu_reg, volt_old, tol);
freqs.new = freqs.old;
goto post_notify;
}

/* scaling down? scale voltage after frequency */
if (cpu_reg && freqs.new < freqs.old) {
if (!IS_ERR(cpu_reg) && freqs.new < freqs.old) {
ret = regulator_set_voltage_tol(cpu_reg, volt, tol);
if (ret) {
pr_err("failed to scale voltage down: %d\n", ret);
Expand Down Expand Up @@ -210,7 +210,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
}
pr_warn("failed to get cpu0 regulator: %ld\n",
PTR_ERR(cpu_reg));
cpu_reg = NULL;
}

cpu_clk = devm_clk_get(cpu_dev, NULL);
Expand Down
1 change: 0 additions & 1 deletion drivers/cpufreq/cpufreq-nforce2.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ static struct cpufreq_driver nforce2_driver = {
.get = nforce2_get,
.init = nforce2_cpu_init,
.exit = nforce2_cpu_exit,
.owner = THIS_MODULE,
};

#ifdef MODULE
Expand Down
Loading

0 comments on commit 4eb5178

Please sign in to comment.