mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Merge branch 'pm-cpufreq'
* pm-cpufreq:
cpufreq: Make cpufreq_generic_init() return void
cpufreq: imx-cpufreq-dt: Add i.MX8MN support
cpufreq: Add QoS requests for userspace constraints
cpufreq: intel_pstate: Reuse refresh_frequency_limits()
cpufreq: Register notifiers with the PM QoS framework
PM / QoS: Add support for MIN/MAX frequency constraints
PM / QOS: Pass request type to dev_pm_qos_read_value()
PM / QOS: Rename __dev_pm_qos_read_value() and dev_pm_qos_raw_read_value()
PM / QOS: Pass request type to dev_pm_qos_{add|remove}_notifier()
This commit is contained in:
commit
918e162e6a
29 changed files with 378 additions and 184 deletions
|
|
@ -131,23 +131,18 @@ static int bmips_cpufreq_exit(struct cpufreq_policy *policy)
|
|||
static int bmips_cpufreq_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpufreq_frequency_table *freq_table;
|
||||
int ret;
|
||||
|
||||
freq_table = bmips_cpufreq_get_freq_table(policy);
|
||||
if (IS_ERR(freq_table)) {
|
||||
ret = PTR_ERR(freq_table);
|
||||
pr_err("%s: couldn't determine frequency table (%d).\n",
|
||||
BMIPS_CPUFREQ_NAME, ret);
|
||||
return ret;
|
||||
pr_err("%s: couldn't determine frequency table (%ld).\n",
|
||||
BMIPS_CPUFREQ_NAME, PTR_ERR(freq_table));
|
||||
return PTR_ERR(freq_table);
|
||||
}
|
||||
|
||||
ret = cpufreq_generic_init(policy, freq_table, TRANSITION_LATENCY);
|
||||
if (ret)
|
||||
bmips_cpufreq_exit(policy);
|
||||
else
|
||||
pr_info("%s: registered\n", BMIPS_CPUFREQ_NAME);
|
||||
cpufreq_generic_init(policy, freq_table, TRANSITION_LATENCY);
|
||||
pr_info("%s: registered\n", BMIPS_CPUFREQ_NAME);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver bmips_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/kernel_stat.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
|
|
@ -158,7 +159,7 @@ EXPORT_SYMBOL_GPL(arch_set_freq_scale);
|
|||
* - set policies transition latency
|
||||
* - policy->cpus with all possible CPUs
|
||||
*/
|
||||
int cpufreq_generic_init(struct cpufreq_policy *policy,
|
||||
void cpufreq_generic_init(struct cpufreq_policy *policy,
|
||||
struct cpufreq_frequency_table *table,
|
||||
unsigned int transition_latency)
|
||||
{
|
||||
|
|
@ -170,8 +171,6 @@ int cpufreq_generic_init(struct cpufreq_policy *policy,
|
|||
* share the clock and voltage and clock.
|
||||
*/
|
||||
cpumask_setall(policy->cpus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpufreq_generic_init);
|
||||
|
||||
|
|
@ -714,23 +713,15 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf)
|
|||
static ssize_t store_##file_name \
|
||||
(struct cpufreq_policy *policy, const char *buf, size_t count) \
|
||||
{ \
|
||||
int ret, temp; \
|
||||
struct cpufreq_policy new_policy; \
|
||||
unsigned long val; \
|
||||
int ret; \
|
||||
\
|
||||
memcpy(&new_policy, policy, sizeof(*policy)); \
|
||||
new_policy.min = policy->user_policy.min; \
|
||||
new_policy.max = policy->user_policy.max; \
|
||||
\
|
||||
ret = sscanf(buf, "%u", &new_policy.object); \
|
||||
ret = sscanf(buf, "%lu", &val); \
|
||||
if (ret != 1) \
|
||||
return -EINVAL; \
|
||||
\
|
||||
temp = new_policy.object; \
|
||||
ret = cpufreq_set_policy(policy, &new_policy); \
|
||||
if (!ret) \
|
||||
policy->user_policy.object = temp; \
|
||||
\
|
||||
return ret ? ret : count; \
|
||||
ret = dev_pm_qos_update_request(policy->object##_freq_req, val);\
|
||||
return ret >= 0 ? count : ret; \
|
||||
}
|
||||
|
||||
store_one(scaling_min_freq, min);
|
||||
|
|
@ -996,7 +987,7 @@ static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu)
|
|||
{
|
||||
struct device *dev = get_cpu_device(cpu);
|
||||
|
||||
if (!dev)
|
||||
if (unlikely(!dev))
|
||||
return;
|
||||
|
||||
if (cpumask_test_and_set_cpu(cpu, policy->real_cpus))
|
||||
|
|
@ -1112,17 +1103,18 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void refresh_frequency_limits(struct cpufreq_policy *policy)
|
||||
void refresh_frequency_limits(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpufreq_policy new_policy = *policy;
|
||||
struct cpufreq_policy new_policy;
|
||||
|
||||
pr_debug("updating policy for CPU %u\n", policy->cpu);
|
||||
if (!policy_is_inactive(policy)) {
|
||||
new_policy = *policy;
|
||||
pr_debug("updating policy for CPU %u\n", policy->cpu);
|
||||
|
||||
new_policy.min = policy->user_policy.min;
|
||||
new_policy.max = policy->user_policy.max;
|
||||
|
||||
cpufreq_set_policy(policy, &new_policy);
|
||||
cpufreq_set_policy(policy, &new_policy);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(refresh_frequency_limits);
|
||||
|
||||
static void handle_update(struct work_struct *work)
|
||||
{
|
||||
|
|
@ -1130,60 +1122,27 @@ static void handle_update(struct work_struct *work)
|
|||
container_of(work, struct cpufreq_policy, update);
|
||||
|
||||
pr_debug("handle_update for cpu %u called\n", policy->cpu);
|
||||
down_write(&policy->rwsem);
|
||||
refresh_frequency_limits(policy);
|
||||
up_write(&policy->rwsem);
|
||||
}
|
||||
|
||||
static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
||||
static int cpufreq_notifier_min(struct notifier_block *nb, unsigned long freq,
|
||||
void *data)
|
||||
{
|
||||
struct cpufreq_policy *policy;
|
||||
int ret;
|
||||
struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_min);
|
||||
|
||||
policy = kzalloc(sizeof(*policy), GFP_KERNEL);
|
||||
if (!policy)
|
||||
return NULL;
|
||||
schedule_work(&policy->update);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
|
||||
goto err_free_policy;
|
||||
static int cpufreq_notifier_max(struct notifier_block *nb, unsigned long freq,
|
||||
void *data)
|
||||
{
|
||||
struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_max);
|
||||
|
||||
if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
|
||||
goto err_free_cpumask;
|
||||
|
||||
if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL))
|
||||
goto err_free_rcpumask;
|
||||
|
||||
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
|
||||
cpufreq_global_kobject, "policy%u", cpu);
|
||||
if (ret) {
|
||||
pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret);
|
||||
/*
|
||||
* The entire policy object will be freed below, but the extra
|
||||
* memory allocated for the kobject name needs to be freed by
|
||||
* releasing the kobject.
|
||||
*/
|
||||
kobject_put(&policy->kobj);
|
||||
goto err_free_real_cpus;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&policy->policy_list);
|
||||
init_rwsem(&policy->rwsem);
|
||||
spin_lock_init(&policy->transition_lock);
|
||||
init_waitqueue_head(&policy->transition_wait);
|
||||
init_completion(&policy->kobj_unregister);
|
||||
INIT_WORK(&policy->update, handle_update);
|
||||
|
||||
policy->cpu = cpu;
|
||||
return policy;
|
||||
|
||||
err_free_real_cpus:
|
||||
free_cpumask_var(policy->real_cpus);
|
||||
err_free_rcpumask:
|
||||
free_cpumask_var(policy->related_cpus);
|
||||
err_free_cpumask:
|
||||
free_cpumask_var(policy->cpus);
|
||||
err_free_policy:
|
||||
kfree(policy);
|
||||
|
||||
return NULL;
|
||||
schedule_work(&policy->update);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy)
|
||||
|
|
@ -1208,8 +1167,90 @@ static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy)
|
|||
pr_debug("wait complete\n");
|
||||
}
|
||||
|
||||
static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *policy;
|
||||
struct device *dev = get_cpu_device(cpu);
|
||||
int ret;
|
||||
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
policy = kzalloc(sizeof(*policy), GFP_KERNEL);
|
||||
if (!policy)
|
||||
return NULL;
|
||||
|
||||
if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
|
||||
goto err_free_policy;
|
||||
|
||||
if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
|
||||
goto err_free_cpumask;
|
||||
|
||||
if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL))
|
||||
goto err_free_rcpumask;
|
||||
|
||||
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
|
||||
cpufreq_global_kobject, "policy%u", cpu);
|
||||
if (ret) {
|
||||
dev_err(dev, "%s: failed to init policy->kobj: %d\n", __func__, ret);
|
||||
/*
|
||||
* The entire policy object will be freed below, but the extra
|
||||
* memory allocated for the kobject name needs to be freed by
|
||||
* releasing the kobject.
|
||||
*/
|
||||
kobject_put(&policy->kobj);
|
||||
goto err_free_real_cpus;
|
||||
}
|
||||
|
||||
policy->nb_min.notifier_call = cpufreq_notifier_min;
|
||||
policy->nb_max.notifier_call = cpufreq_notifier_max;
|
||||
|
||||
ret = dev_pm_qos_add_notifier(dev, &policy->nb_min,
|
||||
DEV_PM_QOS_MIN_FREQUENCY);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to register MIN QoS notifier: %d (%*pbl)\n",
|
||||
ret, cpumask_pr_args(policy->cpus));
|
||||
goto err_kobj_remove;
|
||||
}
|
||||
|
||||
ret = dev_pm_qos_add_notifier(dev, &policy->nb_max,
|
||||
DEV_PM_QOS_MAX_FREQUENCY);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to register MAX QoS notifier: %d (%*pbl)\n",
|
||||
ret, cpumask_pr_args(policy->cpus));
|
||||
goto err_min_qos_notifier;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&policy->policy_list);
|
||||
init_rwsem(&policy->rwsem);
|
||||
spin_lock_init(&policy->transition_lock);
|
||||
init_waitqueue_head(&policy->transition_wait);
|
||||
init_completion(&policy->kobj_unregister);
|
||||
INIT_WORK(&policy->update, handle_update);
|
||||
|
||||
policy->cpu = cpu;
|
||||
return policy;
|
||||
|
||||
err_min_qos_notifier:
|
||||
dev_pm_qos_remove_notifier(dev, &policy->nb_min,
|
||||
DEV_PM_QOS_MIN_FREQUENCY);
|
||||
err_kobj_remove:
|
||||
cpufreq_policy_put_kobj(policy);
|
||||
err_free_real_cpus:
|
||||
free_cpumask_var(policy->real_cpus);
|
||||
err_free_rcpumask:
|
||||
free_cpumask_var(policy->related_cpus);
|
||||
err_free_cpumask:
|
||||
free_cpumask_var(policy->cpus);
|
||||
err_free_policy:
|
||||
kfree(policy);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void cpufreq_policy_free(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct device *dev = get_cpu_device(policy->cpu);
|
||||
unsigned long flags;
|
||||
int cpu;
|
||||
|
||||
|
|
@ -1221,6 +1262,14 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
|
|||
per_cpu(cpufreq_cpu_data, cpu) = NULL;
|
||||
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
|
||||
|
||||
dev_pm_qos_remove_notifier(dev, &policy->nb_max,
|
||||
DEV_PM_QOS_MAX_FREQUENCY);
|
||||
dev_pm_qos_remove_notifier(dev, &policy->nb_min,
|
||||
DEV_PM_QOS_MIN_FREQUENCY);
|
||||
dev_pm_qos_remove_request(policy->max_freq_req);
|
||||
dev_pm_qos_remove_request(policy->min_freq_req);
|
||||
kfree(policy->min_freq_req);
|
||||
|
||||
cpufreq_policy_put_kobj(policy);
|
||||
free_cpumask_var(policy->real_cpus);
|
||||
free_cpumask_var(policy->related_cpus);
|
||||
|
|
@ -1298,16 +1347,50 @@ static int cpufreq_online(unsigned int cpu)
|
|||
cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
|
||||
|
||||
if (new_policy) {
|
||||
policy->user_policy.min = policy->min;
|
||||
policy->user_policy.max = policy->max;
|
||||
struct device *dev = get_cpu_device(cpu);
|
||||
|
||||
for_each_cpu(j, policy->related_cpus) {
|
||||
per_cpu(cpufreq_cpu_data, j) = policy;
|
||||
add_cpu_dev_symlink(policy, j);
|
||||
}
|
||||
} else {
|
||||
policy->min = policy->user_policy.min;
|
||||
policy->max = policy->user_policy.max;
|
||||
|
||||
policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req),
|
||||
GFP_KERNEL);
|
||||
if (!policy->min_freq_req)
|
||||
goto out_destroy_policy;
|
||||
|
||||
ret = dev_pm_qos_add_request(dev, policy->min_freq_req,
|
||||
DEV_PM_QOS_MIN_FREQUENCY,
|
||||
policy->min);
|
||||
if (ret < 0) {
|
||||
/*
|
||||
* So we don't call dev_pm_qos_remove_request() for an
|
||||
* uninitialized request.
|
||||
*/
|
||||
kfree(policy->min_freq_req);
|
||||
policy->min_freq_req = NULL;
|
||||
|
||||
dev_err(dev, "Failed to add min-freq constraint (%d)\n",
|
||||
ret);
|
||||
goto out_destroy_policy;
|
||||
}
|
||||
|
||||
/*
|
||||
* This must be initialized right here to avoid calling
|
||||
* dev_pm_qos_remove_request() on uninitialized request in case
|
||||
* of errors.
|
||||
*/
|
||||
policy->max_freq_req = policy->min_freq_req + 1;
|
||||
|
||||
ret = dev_pm_qos_add_request(dev, policy->max_freq_req,
|
||||
DEV_PM_QOS_MAX_FREQUENCY,
|
||||
policy->max);
|
||||
if (ret < 0) {
|
||||
policy->max_freq_req = NULL;
|
||||
dev_err(dev, "Failed to add max-freq constraint (%d)\n",
|
||||
ret);
|
||||
goto out_destroy_policy;
|
||||
}
|
||||
}
|
||||
|
||||
if (cpufreq_driver->get && has_target()) {
|
||||
|
|
@ -2280,6 +2363,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy,
|
|||
struct cpufreq_policy *new_policy)
|
||||
{
|
||||
struct cpufreq_governor *old_gov;
|
||||
struct device *cpu_dev = get_cpu_device(policy->cpu);
|
||||
int ret;
|
||||
|
||||
pr_debug("setting new policy for CPU %u: %u - %u kHz\n",
|
||||
|
|
@ -2288,17 +2372,21 @@ int cpufreq_set_policy(struct cpufreq_policy *policy,
|
|||
memcpy(&new_policy->cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo));
|
||||
|
||||
/*
|
||||
* This check works well when we store new min/max freq attributes,
|
||||
* because new_policy is a copy of policy with one field updated.
|
||||
*/
|
||||
if (new_policy->min > new_policy->max)
|
||||
return -EINVAL;
|
||||
* PM QoS framework collects all the requests from users and provide us
|
||||
* the final aggregated value here.
|
||||
*/
|
||||
new_policy->min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY);
|
||||
new_policy->max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY);
|
||||
|
||||
/* verify the cpu speed can be set within this limit */
|
||||
ret = cpufreq_driver->verify(new_policy);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* The notifier-chain shall be removed once all the users of
|
||||
* CPUFREQ_ADJUST are moved to use the QoS framework.
|
||||
*/
|
||||
/* adjust if necessary - all reasons */
|
||||
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
|
||||
CPUFREQ_ADJUST, new_policy);
|
||||
|
|
@ -2377,10 +2465,9 @@ int cpufreq_set_policy(struct cpufreq_policy *policy,
|
|||
* @cpu: CPU to re-evaluate the policy for.
|
||||
*
|
||||
* Update the current frequency for the cpufreq policy of @cpu and use
|
||||
* cpufreq_set_policy() to re-apply the min and max limits saved in the
|
||||
* user_policy sub-structure of that policy, which triggers the evaluation
|
||||
* of policy notifiers and the cpufreq driver's ->verify() callback for the
|
||||
* policy in question, among other things.
|
||||
* cpufreq_set_policy() to re-apply the min and max limits, which triggers the
|
||||
* evaluation of policy notifiers and the cpufreq driver's ->verify() callback
|
||||
* for the policy in question, among other things.
|
||||
*/
|
||||
void cpufreq_update_policy(unsigned int cpu)
|
||||
{
|
||||
|
|
@ -2440,10 +2527,9 @@ static int cpufreq_boost_set_sw(int state)
|
|||
break;
|
||||
}
|
||||
|
||||
down_write(&policy->rwsem);
|
||||
policy->user_policy.max = policy->max;
|
||||
cpufreq_governor_limits(policy);
|
||||
up_write(&policy->rwsem);
|
||||
ret = dev_pm_qos_update_request(policy->max_freq_req, policy->max);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ static int davinci_cpu_init(struct cpufreq_policy *policy)
|
|||
* Setting the latency to 2000 us to accommodate addition of drivers
|
||||
* to pre/post change notification list.
|
||||
*/
|
||||
return cpufreq_generic_init(policy, freq_table, 2000 * 1000);
|
||||
cpufreq_generic_init(policy, freq_table, 2000 * 1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver davinci_driver = {
|
||||
|
|
|
|||
|
|
@ -44,10 +44,11 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
|
|||
* According to datasheet minimum speed grading is not supported for
|
||||
* consumer parts so clamp to 1 to avoid warning for "no OPPs"
|
||||
*
|
||||
* Applies to 8mq and 8mm.
|
||||
* Applies to i.MX8M series SoCs.
|
||||
*/
|
||||
if (mkt_segment == 0 && speed_grade == 0 && (
|
||||
of_machine_is_compatible("fsl,imx8mm") ||
|
||||
of_machine_is_compatible("fsl,imx8mn") ||
|
||||
of_machine_is_compatible("fsl,imx8mq")))
|
||||
speed_grade = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -190,14 +190,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
|
||||
static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
int ret;
|
||||
|
||||
policy->clk = clks[ARM].clk;
|
||||
ret = cpufreq_generic_init(policy, freq_table, transition_latency);
|
||||
cpufreq_generic_init(policy, freq_table, transition_latency);
|
||||
policy->suspend_freq = max_freq;
|
||||
dev_pm_opp_of_register_em(policy->cpus);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver imx6q_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -898,7 +898,6 @@ static void intel_pstate_update_policies(void)
|
|||
static void intel_pstate_update_max_freq(unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu);
|
||||
struct cpufreq_policy new_policy;
|
||||
struct cpudata *cpudata;
|
||||
|
||||
if (!policy)
|
||||
|
|
@ -908,11 +907,7 @@ static void intel_pstate_update_max_freq(unsigned int cpu)
|
|||
policy->cpuinfo.max_freq = global.turbo_disabled_mf ?
|
||||
cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
|
||||
|
||||
memcpy(&new_policy, policy, sizeof(*policy));
|
||||
new_policy.max = min(policy->user_policy.max, policy->cpuinfo.max_freq);
|
||||
new_policy.min = min(policy->user_policy.min, new_policy.max);
|
||||
|
||||
cpufreq_set_policy(policy, &new_policy);
|
||||
refresh_frequency_limits(policy);
|
||||
|
||||
cpufreq_cpu_release(policy);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,
|
|||
/* Module init and exit code */
|
||||
static int kirkwood_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_generic_init(policy, kirkwood_freq_table, 5000);
|
||||
cpufreq_generic_init(policy, kirkwood_freq_table, 5000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver kirkwood_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static int ls1x_cpufreq_init(struct cpufreq_policy *policy)
|
|||
struct device *cpu_dev = get_cpu_device(policy->cpu);
|
||||
struct cpufreq_frequency_table *freq_tbl;
|
||||
unsigned int pll_freq, freq;
|
||||
int steps, i, ret;
|
||||
int steps, i;
|
||||
|
||||
pll_freq = clk_get_rate(cpufreq->pll_clk) / 1000;
|
||||
|
||||
|
|
@ -103,11 +103,9 @@ static int ls1x_cpufreq_init(struct cpufreq_policy *policy)
|
|||
freq_tbl[i].frequency = CPUFREQ_TABLE_END;
|
||||
|
||||
policy->clk = cpufreq->clk;
|
||||
ret = cpufreq_generic_init(policy, freq_tbl, 0);
|
||||
if (ret)
|
||||
kfree(freq_tbl);
|
||||
cpufreq_generic_init(policy, freq_tbl, 0);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ls1x_cpufreq_exit(struct cpufreq_policy *policy)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
}
|
||||
|
||||
policy->clk = cpuclk;
|
||||
return cpufreq_generic_init(policy, &loongson2_clockmod_table[0], 0);
|
||||
cpufreq_generic_init(policy, &loongson2_clockmod_table[0], 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int loongson2_cpufreq_exit(struct cpufreq_policy *policy)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ static unsigned int maple_cpufreq_get_speed(unsigned int cpu)
|
|||
|
||||
static int maple_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_generic_init(policy, maple_cpu_freqs, 12000);
|
||||
cpufreq_generic_init(policy, maple_cpu_freqs, 12000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver maple_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -122,23 +122,18 @@ static int omap_cpu_init(struct cpufreq_policy *policy)
|
|||
dev_err(mpu_dev,
|
||||
"%s: cpu%d: failed creating freq table[%d]\n",
|
||||
__func__, policy->cpu, result);
|
||||
goto fail;
|
||||
clk_put(policy->clk);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
atomic_inc_return(&freq_table_users);
|
||||
|
||||
/* FIXME: what's the actual transition time? */
|
||||
result = cpufreq_generic_init(policy, freq_table, 300 * 1000);
|
||||
if (!result) {
|
||||
dev_pm_opp_of_register_em(policy->cpus);
|
||||
return 0;
|
||||
}
|
||||
cpufreq_generic_init(policy, freq_table, 300 * 1000);
|
||||
dev_pm_opp_of_register_em(policy->cpus);
|
||||
|
||||
freq_table_free();
|
||||
fail:
|
||||
clk_put(policy->clk);
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap_cpu_exit(struct cpufreq_policy *policy)
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
policy->cur = pas_freqs[cur_astate].frequency;
|
||||
ppc_proc_freq = policy->cur * 1000ul;
|
||||
|
||||
return cpufreq_generic_init(policy, pas_freqs, get_gizmo_latency());
|
||||
cpufreq_generic_init(policy, pas_freqs, get_gizmo_latency());
|
||||
return 0;
|
||||
|
||||
out_unmap_sdcpwr:
|
||||
iounmap(sdcpwr_mapbase);
|
||||
|
|
|
|||
|
|
@ -372,7 +372,8 @@ static int pmac_cpufreq_target( struct cpufreq_policy *policy,
|
|||
|
||||
static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_generic_init(policy, pmac_cpu_freqs, transition_latency);
|
||||
cpufreq_generic_init(policy, pmac_cpu_freqs, transition_latency);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 read_gpio(struct device_node *np)
|
||||
|
|
|
|||
|
|
@ -321,7 +321,8 @@ static unsigned int g5_cpufreq_get_speed(unsigned int cpu)
|
|||
|
||||
static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_generic_init(policy, g5_cpu_freqs, transition_latency);
|
||||
cpufreq_generic_init(policy, g5_cpu_freqs, transition_latency);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver g5_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -447,21 +447,16 @@ static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
|
|||
/* Datasheet says PLL stabalisation time must be at least 300us,
|
||||
* so but add some fudge. (reference in LOCKCON0 register description)
|
||||
*/
|
||||
ret = cpufreq_generic_init(policy, s3c_freq->freq_table,
|
||||
cpufreq_generic_init(policy, s3c_freq->freq_table,
|
||||
(500 * 1000) + s3c_freq->regulator_latency);
|
||||
if (ret)
|
||||
goto err_freq_table;
|
||||
|
||||
register_reboot_notifier(&s3c2416_cpufreq_reboot_notifier);
|
||||
|
||||
return 0;
|
||||
|
||||
err_freq_table:
|
||||
#ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE
|
||||
regulator_put(s3c_freq->vddarm);
|
||||
err_vddarm:
|
||||
#endif
|
||||
clk_put(s3c_freq->armclk);
|
||||
#endif
|
||||
err_armclk:
|
||||
clk_put(s3c_freq->hclk);
|
||||
err_hclk:
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ out:
|
|||
|
||||
static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
int ret;
|
||||
struct cpufreq_frequency_table *freq;
|
||||
|
||||
if (policy->cpu != 0)
|
||||
|
|
@ -165,8 +164,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
|
|||
#ifdef CONFIG_REGULATOR
|
||||
vddarm = regulator_get(NULL, "vddarm");
|
||||
if (IS_ERR(vddarm)) {
|
||||
ret = PTR_ERR(vddarm);
|
||||
pr_err("Failed to obtain VDDARM: %d\n", ret);
|
||||
pr_err("Failed to obtain VDDARM: %ld\n", PTR_ERR(vddarm));
|
||||
pr_err("Only frequency scaling available\n");
|
||||
vddarm = NULL;
|
||||
} else {
|
||||
|
|
@ -196,16 +194,9 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
|
|||
* the PLLs, which we don't currently) is ~300us worst case,
|
||||
* but add some fudge.
|
||||
*/
|
||||
ret = cpufreq_generic_init(policy, s3c64xx_freq_table,
|
||||
cpufreq_generic_init(policy, s3c64xx_freq_table,
|
||||
(500 * 1000) + regulator_latency);
|
||||
if (ret != 0) {
|
||||
pr_err("Failed to configure frequency table: %d\n",
|
||||
ret);
|
||||
regulator_put(vddarm);
|
||||
clk_put(policy->clk);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver s3c64xx_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -541,7 +541,8 @@ static int s5pv210_cpu_init(struct cpufreq_policy *policy)
|
|||
s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk);
|
||||
|
||||
policy->suspend_freq = SLEEP_FREQ;
|
||||
return cpufreq_generic_init(policy, s5pv210_freq_table, 40000);
|
||||
cpufreq_generic_init(policy, s5pv210_freq_table, 40000);
|
||||
return 0;
|
||||
|
||||
out_dmc1:
|
||||
clk_put(dmc0_clk);
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ static int sa1100_target(struct cpufreq_policy *policy, unsigned int ppcr)
|
|||
|
||||
static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_generic_init(policy, sa11x0_freq_table, 0);
|
||||
cpufreq_generic_init(policy, sa11x0_freq_table, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver sa1100_driver __refdata = {
|
||||
|
|
|
|||
|
|
@ -303,7 +303,8 @@ static int sa1110_target(struct cpufreq_policy *policy, unsigned int ppcr)
|
|||
|
||||
static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_generic_init(policy, sa11x0_freq_table, 0);
|
||||
cpufreq_generic_init(policy, sa11x0_freq_table, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* sa1110_driver needs __refdata because it must remain after init registers
|
||||
|
|
|
|||
|
|
@ -153,8 +153,9 @@ static int spear_cpufreq_target(struct cpufreq_policy *policy,
|
|||
static int spear_cpufreq_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
policy->clk = spear_cpufreq.clk;
|
||||
return cpufreq_generic_init(policy, spear_cpufreq.freq_tbl,
|
||||
cpufreq_generic_init(policy, spear_cpufreq.freq_tbl,
|
||||
spear_cpufreq.transition_latency);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver spear_cpufreq_driver = {
|
||||
|
|
|
|||
|
|
@ -118,17 +118,11 @@ static int tegra_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
static int tegra_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct tegra20_cpufreq *cpufreq = cpufreq_get_driver_data();
|
||||
int ret;
|
||||
|
||||
clk_prepare_enable(cpufreq->cpu_clk);
|
||||
|
||||
/* FIXME: what's the actual transition time? */
|
||||
ret = cpufreq_generic_init(policy, freq_table, 300 * 1000);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(cpufreq->cpu_clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cpufreq_generic_init(policy, freq_table, 300 * 1000);
|
||||
policy->clk = cpufreq->cpu_clk;
|
||||
policy->suspend_freq = freq_table[0].frequency;
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue