mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
Merge branches 'pm-cpufreq', 'pm-cpuidle' and 'pm-devfreq'
* pm-cpufreq: cpufreq: conservative: Allow down_threshold to take values from 1 to 10 Revert "cpufreq: schedutil: Reduce frequencies slower" * pm-cpuidle: cpuidle: dt: Add missing 'of_node_put()' * pm-devfreq: PM / devfreq: exynos-ppmu: Staticize event list PM / devfreq: exynos-ppmu: Handle return value of clk_prepare_enable PM / devfreq: exynos-nocp: Handle return value of clk_prepare_enable
This commit is contained in:
commit
f63e4f7d41
12368 changed files with 1319582 additions and 285774 deletions
|
|
@ -34,6 +34,11 @@ struct cpufreq_acpi_io {
|
|||
unsigned int resume;
|
||||
};
|
||||
|
||||
struct cpufreq_acpi_req {
|
||||
unsigned int cpu;
|
||||
unsigned int state;
|
||||
};
|
||||
|
||||
static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
|
||||
|
||||
static struct cpufreq_driver acpi_cpufreq_driver;
|
||||
|
|
@ -83,8 +88,7 @@ processor_get_pstate (
|
|||
static unsigned
|
||||
extract_clock (
|
||||
struct cpufreq_acpi_io *data,
|
||||
unsigned value,
|
||||
unsigned int cpu)
|
||||
unsigned value)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
|
|
@ -98,60 +102,43 @@ extract_clock (
|
|||
}
|
||||
|
||||
|
||||
static unsigned int
|
||||
static long
|
||||
processor_get_freq (
|
||||
struct cpufreq_acpi_io *data,
|
||||
unsigned int cpu)
|
||||
void *arg)
|
||||
{
|
||||
int ret = 0;
|
||||
u32 value = 0;
|
||||
cpumask_t saved_mask;
|
||||
unsigned long clock_freq;
|
||||
struct cpufreq_acpi_req *req = arg;
|
||||
unsigned int cpu = req->cpu;
|
||||
struct cpufreq_acpi_io *data = acpi_io_data[cpu];
|
||||
u32 value;
|
||||
int ret;
|
||||
|
||||
pr_debug("processor_get_freq\n");
|
||||
|
||||
saved_mask = current->cpus_allowed;
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
if (smp_processor_id() != cpu)
|
||||
goto migrate_end;
|
||||
return -EAGAIN;
|
||||
|
||||
/* processor_get_pstate gets the instantaneous frequency */
|
||||
ret = processor_get_pstate(&value);
|
||||
|
||||
if (ret) {
|
||||
set_cpus_allowed_ptr(current, &saved_mask);
|
||||
pr_warn("get performance failed with error %d\n", ret);
|
||||
ret = 0;
|
||||
goto migrate_end;
|
||||
return ret;
|
||||
}
|
||||
clock_freq = extract_clock(data, value, cpu);
|
||||
ret = (clock_freq*1000);
|
||||
|
||||
migrate_end:
|
||||
set_cpus_allowed_ptr(current, &saved_mask);
|
||||
return ret;
|
||||
return 1000 * extract_clock(data, value);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static long
|
||||
processor_set_freq (
|
||||
struct cpufreq_acpi_io *data,
|
||||
struct cpufreq_policy *policy,
|
||||
int state)
|
||||
void *arg)
|
||||
{
|
||||
int ret = 0;
|
||||
u32 value = 0;
|
||||
cpumask_t saved_mask;
|
||||
int retval;
|
||||
struct cpufreq_acpi_req *req = arg;
|
||||
unsigned int cpu = req->cpu;
|
||||
struct cpufreq_acpi_io *data = acpi_io_data[cpu];
|
||||
int ret, state = req->state;
|
||||
u32 value;
|
||||
|
||||
pr_debug("processor_set_freq\n");
|
||||
|
||||
saved_mask = current->cpus_allowed;
|
||||
set_cpus_allowed_ptr(current, cpumask_of(policy->cpu));
|
||||
if (smp_processor_id() != policy->cpu) {
|
||||
retval = -EAGAIN;
|
||||
goto migrate_end;
|
||||
}
|
||||
if (smp_processor_id() != cpu)
|
||||
return -EAGAIN;
|
||||
|
||||
if (state == data->acpi_data.state) {
|
||||
if (unlikely(data->resume)) {
|
||||
|
|
@ -159,8 +146,7 @@ processor_set_freq (
|
|||
data->resume = 0;
|
||||
} else {
|
||||
pr_debug("Already at target state (P%d)\n", state);
|
||||
retval = 0;
|
||||
goto migrate_end;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +157,6 @@ processor_set_freq (
|
|||
* First we write the target state's 'control' value to the
|
||||
* control_register.
|
||||
*/
|
||||
|
||||
value = (u32) data->acpi_data.states[state].control;
|
||||
|
||||
pr_debug("Transitioning to state: 0x%08x\n", value);
|
||||
|
|
@ -179,17 +164,11 @@ processor_set_freq (
|
|||
ret = processor_set_pstate(value);
|
||||
if (ret) {
|
||||
pr_warn("Transition failed with error %d\n", ret);
|
||||
retval = -ENODEV;
|
||||
goto migrate_end;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
data->acpi_data.state = state;
|
||||
|
||||
retval = 0;
|
||||
|
||||
migrate_end:
|
||||
set_cpus_allowed_ptr(current, &saved_mask);
|
||||
return (retval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -197,11 +176,13 @@ static unsigned int
|
|||
acpi_cpufreq_get (
|
||||
unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_acpi_io *data = acpi_io_data[cpu];
|
||||
struct cpufreq_acpi_req req;
|
||||
long ret;
|
||||
|
||||
pr_debug("acpi_cpufreq_get\n");
|
||||
req.cpu = cpu;
|
||||
ret = work_on_cpu(cpu, processor_get_freq, &req);
|
||||
|
||||
return processor_get_freq(data, cpu);
|
||||
return ret > 0 ? (unsigned int) ret : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -210,7 +191,12 @@ acpi_cpufreq_target (
|
|||
struct cpufreq_policy *policy,
|
||||
unsigned int index)
|
||||
{
|
||||
return processor_set_freq(acpi_io_data[policy->cpu], policy, index);
|
||||
struct cpufreq_acpi_req req;
|
||||
|
||||
req.cpu = policy->cpu;
|
||||
req.state = index;
|
||||
|
||||
return work_on_cpu(req.cpu, processor_set_freq, &req);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -571,9 +571,10 @@ static inline void update_turbo_state(void)
|
|||
static int min_perf_pct_min(void)
|
||||
{
|
||||
struct cpudata *cpu = all_cpu_data[0];
|
||||
int turbo_pstate = cpu->pstate.turbo_pstate;
|
||||
|
||||
return DIV_ROUND_UP(cpu->pstate.min_pstate * 100,
|
||||
cpu->pstate.turbo_pstate);
|
||||
return turbo_pstate ?
|
||||
DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0;
|
||||
}
|
||||
|
||||
static s16 intel_pstate_get_epb(struct cpudata *cpu_data)
|
||||
|
|
|
|||
|
|
@ -51,19 +51,12 @@ static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
|
|||
static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
|
||||
unsigned int index)
|
||||
{
|
||||
unsigned int cpu = policy->cpu;
|
||||
cpumask_t cpus_allowed;
|
||||
unsigned int freq;
|
||||
|
||||
cpus_allowed = current->cpus_allowed;
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
|
||||
freq =
|
||||
((cpu_clock_freq / 1000) *
|
||||
loongson2_clockmod_table[index].driver_data) / 8;
|
||||
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
|
||||
/* setting the cpu frequency */
|
||||
clk_set_rate(policy->clk, freq * 1000);
|
||||
|
||||
|
|
|
|||
|
|
@ -1171,7 +1171,8 @@ static struct cpufreq_driver cpufreq_amd64_driver = {
|
|||
|
||||
static void __request_acpi_cpufreq(void)
|
||||
{
|
||||
const char *cur_drv, *drv = "acpi-cpufreq";
|
||||
const char drv[] = "acpi-cpufreq";
|
||||
const char *cur_drv;
|
||||
|
||||
cur_drv = cpufreq_get_current_driver();
|
||||
if (!cur_drv)
|
||||
|
|
|
|||
|
|
@ -30,11 +30,51 @@
|
|||
|
||||
static DEFINE_PER_CPU(struct clk, sh_cpuclk);
|
||||
|
||||
struct cpufreq_target {
|
||||
struct cpufreq_policy *policy;
|
||||
unsigned int freq;
|
||||
};
|
||||
|
||||
static unsigned int sh_cpufreq_get(unsigned int cpu)
|
||||
{
|
||||
return (clk_get_rate(&per_cpu(sh_cpuclk, cpu)) + 500) / 1000;
|
||||
}
|
||||
|
||||
static long __sh_cpufreq_target(void *arg)
|
||||
{
|
||||
struct cpufreq_target *target = arg;
|
||||
struct cpufreq_policy *policy = target->policy;
|
||||
int cpu = policy->cpu;
|
||||
struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
|
||||
struct cpufreq_freqs freqs;
|
||||
struct device *dev;
|
||||
long freq;
|
||||
|
||||
if (smp_processor_id() != cpu)
|
||||
return -ENODEV;
|
||||
|
||||
dev = get_cpu_device(cpu);
|
||||
|
||||
/* Convert target_freq from kHz to Hz */
|
||||
freq = clk_round_rate(cpuclk, target->freq * 1000);
|
||||
|
||||
if (freq < (policy->min * 1000) || freq > (policy->max * 1000))
|
||||
return -EINVAL;
|
||||
|
||||
dev_dbg(dev, "requested frequency %u Hz\n", target->freq * 1000);
|
||||
|
||||
freqs.old = sh_cpufreq_get(cpu);
|
||||
freqs.new = (freq + 500) / 1000;
|
||||
freqs.flags = 0;
|
||||
|
||||
cpufreq_freq_transition_begin(target->policy, &freqs);
|
||||
clk_set_rate(cpuclk, freq);
|
||||
cpufreq_freq_transition_end(target->policy, &freqs, 0);
|
||||
|
||||
dev_dbg(dev, "set frequency %lu Hz\n", freq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Here we notify other drivers of the proposed change and the final change.
|
||||
*/
|
||||
|
|
@ -42,40 +82,9 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
|
|||
unsigned int target_freq,
|
||||
unsigned int relation)
|
||||
{
|
||||
unsigned int cpu = policy->cpu;
|
||||
struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
|
||||
cpumask_t cpus_allowed;
|
||||
struct cpufreq_freqs freqs;
|
||||
struct device *dev;
|
||||
long freq;
|
||||
struct cpufreq_target data = { .policy = policy, .freq = target_freq };
|
||||
|
||||
cpus_allowed = current->cpus_allowed;
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
|
||||
BUG_ON(smp_processor_id() != cpu);
|
||||
|
||||
dev = get_cpu_device(cpu);
|
||||
|
||||
/* Convert target_freq from kHz to Hz */
|
||||
freq = clk_round_rate(cpuclk, target_freq * 1000);
|
||||
|
||||
if (freq < (policy->min * 1000) || freq > (policy->max * 1000))
|
||||
return -EINVAL;
|
||||
|
||||
dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000);
|
||||
|
||||
freqs.old = sh_cpufreq_get(cpu);
|
||||
freqs.new = (freq + 500) / 1000;
|
||||
freqs.flags = 0;
|
||||
|
||||
cpufreq_freq_transition_begin(policy, &freqs);
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
clk_set_rate(cpuclk, freq);
|
||||
cpufreq_freq_transition_end(policy, &freqs, 0);
|
||||
|
||||
dev_dbg(dev, "set frequency %lu Hz\n", freq);
|
||||
|
||||
return 0;
|
||||
return work_on_cpu(policy->cpu, __sh_cpufreq_target, &data);
|
||||
}
|
||||
|
||||
static int sh_cpufreq_verify(struct cpufreq_policy *policy)
|
||||
|
|
|
|||
|
|
@ -118,10 +118,6 @@ static void us2e_transition(unsigned long estar, unsigned long new_bits,
|
|||
unsigned long clock_tick,
|
||||
unsigned long old_divisor, unsigned long divisor)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
local_irq_save(flags);
|
||||
|
||||
estar &= ~ESTAR_MODE_DIV_MASK;
|
||||
|
||||
/* This is based upon the state transition diagram in the IIe manual. */
|
||||
|
|
@ -152,8 +148,6 @@ static void us2e_transition(unsigned long estar, unsigned long new_bits,
|
|||
} else {
|
||||
BUG();
|
||||
}
|
||||
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static unsigned long index_to_estar_mode(unsigned int index)
|
||||
|
|
@ -229,48 +223,51 @@ static unsigned long estar_to_divisor(unsigned long estar)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void __us2e_freq_get(void *arg)
|
||||
{
|
||||
unsigned long *estar = arg;
|
||||
|
||||
*estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
|
||||
}
|
||||
|
||||
static unsigned int us2e_freq_get(unsigned int cpu)
|
||||
{
|
||||
cpumask_t cpus_allowed;
|
||||
unsigned long clock_tick, estar;
|
||||
|
||||
cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
|
||||
clock_tick = sparc64_get_clock_tick(cpu) / 1000;
|
||||
estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
|
||||
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
if (smp_call_function_single(cpu, __us2e_freq_get, &estar, 1))
|
||||
return 0;
|
||||
|
||||
return clock_tick / estar_to_divisor(estar);
|
||||
}
|
||||
|
||||
static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index)
|
||||
static void __us2e_freq_target(void *arg)
|
||||
{
|
||||
unsigned int cpu = policy->cpu;
|
||||
unsigned int cpu = smp_processor_id();
|
||||
unsigned int *index = arg;
|
||||
unsigned long new_bits, new_freq;
|
||||
unsigned long clock_tick, divisor, old_divisor, estar;
|
||||
cpumask_t cpus_allowed;
|
||||
|
||||
cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
|
||||
new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000;
|
||||
new_bits = index_to_estar_mode(index);
|
||||
divisor = index_to_divisor(index);
|
||||
new_bits = index_to_estar_mode(*index);
|
||||
divisor = index_to_divisor(*index);
|
||||
new_freq /= divisor;
|
||||
|
||||
estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
|
||||
|
||||
old_divisor = estar_to_divisor(estar);
|
||||
|
||||
if (old_divisor != divisor)
|
||||
if (old_divisor != divisor) {
|
||||
us2e_transition(estar, new_bits, clock_tick * 1000,
|
||||
old_divisor, divisor);
|
||||
}
|
||||
}
|
||||
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index)
|
||||
{
|
||||
unsigned int cpu = policy->cpu;
|
||||
|
||||
return 0;
|
||||
return smp_call_function_single(cpu, __us2e_freq_target, &index, 1);
|
||||
}
|
||||
|
||||
static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
|
||||
|
|
|
|||
|
|
@ -35,22 +35,28 @@ static struct us3_freq_percpu_info *us3_freq_table;
|
|||
#define SAFARI_CFG_DIV_32 0x0000000080000000UL
|
||||
#define SAFARI_CFG_DIV_MASK 0x00000000C0000000UL
|
||||
|
||||
static unsigned long read_safari_cfg(void)
|
||||
static void read_safari_cfg(void *arg)
|
||||
{
|
||||
unsigned long ret;
|
||||
unsigned long ret, *val = arg;
|
||||
|
||||
__asm__ __volatile__("ldxa [%%g0] %1, %0"
|
||||
: "=&r" (ret)
|
||||
: "i" (ASI_SAFARI_CONFIG));
|
||||
return ret;
|
||||
*val = ret;
|
||||
}
|
||||
|
||||
static void write_safari_cfg(unsigned long val)
|
||||
static void update_safari_cfg(void *arg)
|
||||
{
|
||||
unsigned long reg, *new_bits = arg;
|
||||
|
||||
read_safari_cfg(®);
|
||||
reg &= ~SAFARI_CFG_DIV_MASK;
|
||||
reg |= *new_bits;
|
||||
|
||||
__asm__ __volatile__("stxa %0, [%%g0] %1\n\t"
|
||||
"membar #Sync"
|
||||
: /* no outputs */
|
||||
: "r" (val), "i" (ASI_SAFARI_CONFIG)
|
||||
: "r" (reg), "i" (ASI_SAFARI_CONFIG)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
|
|
@ -78,29 +84,17 @@ static unsigned long get_current_freq(unsigned int cpu, unsigned long safari_cfg
|
|||
|
||||
static unsigned int us3_freq_get(unsigned int cpu)
|
||||
{
|
||||
cpumask_t cpus_allowed;
|
||||
unsigned long reg;
|
||||
unsigned int ret;
|
||||
|
||||
cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
|
||||
reg = read_safari_cfg();
|
||||
ret = get_current_freq(cpu, reg);
|
||||
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
|
||||
return ret;
|
||||
if (smp_call_function_single(cpu, read_safari_cfg, ®, 1))
|
||||
return 0;
|
||||
return get_current_freq(cpu, reg);
|
||||
}
|
||||
|
||||
static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index)
|
||||
{
|
||||
unsigned int cpu = policy->cpu;
|
||||
unsigned long new_bits, new_freq, reg;
|
||||
cpumask_t cpus_allowed;
|
||||
|
||||
cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
|
||||
set_cpus_allowed_ptr(current, cpumask_of(cpu));
|
||||
unsigned long new_bits, new_freq;
|
||||
|
||||
new_freq = sparc64_get_clock_tick(cpu) / 1000;
|
||||
switch (index) {
|
||||
|
|
@ -121,15 +115,7 @@ static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
BUG();
|
||||
}
|
||||
|
||||
reg = read_safari_cfg();
|
||||
|
||||
reg &= ~SAFARI_CFG_DIV_MASK;
|
||||
reg |= new_bits;
|
||||
write_safari_cfg(reg);
|
||||
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
|
||||
return 0;
|
||||
return smp_call_function_single(cpu, update_safari_cfg, &new_bits, 1);
|
||||
}
|
||||
|
||||
static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ static void __exit speedstep_exit(void)
|
|||
cpufreq_unregister_driver(&speedstep_driver);
|
||||
}
|
||||
|
||||
module_param(smi_port, int, 0444);
|
||||
module_param_hw(smi_port, int, ioport, 0444);
|
||||
module_param(smi_cmd, int, 0444);
|
||||
module_param(smi_sig, uint, 0444);
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ use_defaults:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sti_cpufreq_fetch_syscon_regsiters(void)
|
||||
static int sti_cpufreq_fetch_syscon_registers(void)
|
||||
{
|
||||
struct device *dev = ddata.cpu;
|
||||
struct device_node *np = dev->of_node;
|
||||
|
|
@ -275,7 +275,7 @@ static int sti_cpufreq_init(void)
|
|||
goto skip_voltage_scaling;
|
||||
}
|
||||
|
||||
ret = sti_cpufreq_fetch_syscon_regsiters();
|
||||
ret = sti_cpufreq_fetch_syscon_registers();
|
||||
if (ret)
|
||||
goto skip_voltage_scaling;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue