From 22c8b4f1409097c073a0f894406c8bb9525bfb68 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 16 Sep 2013 18:56:32 +0530 Subject: cpufreq: sa11x0: Expose frequency table This patch exposes sa11x0's frequency table to cpufreq core. It always existed but not as an array frequencies and not in the format cpufreq core wants it to. Also it was present in the unit of 100kHz earlier which is made consistent with cpufreq core now, i.e. kHz. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/sa1100-cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/cpufreq/sa1100-cpufreq.c') diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index cff18e87ca58..1323a6986f7e 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -224,7 +224,8 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.min_freq = 59000; policy->cpuinfo.max_freq = 287000; policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; - return 0; + + return cpufreq_table_validate_and_show(policy, sa11x0_freq_table); } static struct cpufreq_driver sa1100_driver __refdata = { -- cgit v1.2.3 From 53862f7a0b75f3d8e7445b864aa45cfa4aa49570 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 16 Sep 2013 18:56:33 +0530 Subject: cpufreq: sa11x0: let cpufreq core initialize struct policy fields Many fields of struct policy are filled by cpufreq core when we call cpufreq_table_validate_and_show() and so cpufreq driver doesn't need to set them anymore. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/sa1100-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/cpufreq/sa1100-cpufreq.c') diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index 1323a6986f7e..37fce2f15711 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -220,9 +220,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) { if (policy->cpu != 0) return -EINVAL; - policy->cur = policy->min = policy->max = sa11x0_getspeed(0); - policy->cpuinfo.min_freq = 59000; - policy->cpuinfo.max_freq = 287000; + policy->cur = sa11x0_getspeed(0); policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; return cpufreq_table_validate_and_show(policy, sa11x0_freq_table); -- cgit v1.2.3 From dd9f263956727320a2bcba8ffae7e9ab4a5be8a6 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Thu, 3 Oct 2013 20:28:23 +0530 Subject: cpufreq: sa11x0: Use generic cpufreq routines Most of the CPUFreq drivers do similar things in .exit() and .verify() routines and .attr. So its better if we have generic routines for them which can be used by cpufreq drivers then. This patch uses these generic routines in the sa11x0 driver. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/sa1100-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/cpufreq/sa1100-cpufreq.c') diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index 37fce2f15711..80a4fde0021f 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -228,7 +228,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver sa1100_driver __refdata = { .flags = CPUFREQ_STICKY, - .verify = sa11x0_verify_speed, + .verify = cpufreq_generic_frequency_table_verify, .target = sa1100_target, .get = sa11x0_getspeed, .init = sa1100_cpu_init, -- cgit v1.2.3 From b256888fd0c3d5cd109798a0d32d47f665339695 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Thu, 3 Oct 2013 20:29:00 +0530 Subject: cpufreq: sa11x0: don't initialize part of policy set by core Many common initializations of struct policy are moved to core now and hence this driver doesn't need to do it. This patch removes such code. Most recent of those changes is to call ->get() in the core after calling ->init(). Cc: Russell King Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/sa1100-cpufreq.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/cpufreq/sa1100-cpufreq.c') diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index 80a4fde0021f..a1d1bb72bac4 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -220,7 +220,6 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) { if (policy->cpu != 0) return -EINVAL; - policy->cur = sa11x0_getspeed(0); policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; return cpufreq_table_validate_and_show(policy, sa11x0_freq_table); -- cgit v1.2.3 From 9b30367bbf3353a7dfc34ed800b7ff03cb35252b Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Thu, 3 Oct 2013 20:42:09 +0530 Subject: cpufreq: sa11x0: use cpufreq_generic_init() Use generic cpufreq_generic_init() routine instead of replicating the same code here. Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/sa1100-cpufreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/cpufreq/sa1100-cpufreq.c') diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index a1d1bb72bac4..b282cea47e62 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -218,11 +218,7 @@ static int sa1100_target(struct cpufreq_policy *policy, static int __init sa1100_cpu_init(struct cpufreq_policy *policy) { - if (policy->cpu != 0) - return -EINVAL; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; - - return cpufreq_table_validate_and_show(policy, sa11x0_freq_table); + return cpufreq_generic_init(policy, sa11x0_freq_table, CPUFREQ_ETERNAL); } static struct cpufreq_driver sa1100_driver __refdata = { -- cgit v1.2.3