diff options
| -rw-r--r-- | drivers/cpufreq/db8500-cpufreq.c | 36 | ||||
| -rw-r--r-- | drivers/cpufreq/e_powersaver.c | 135 | ||||
| -rw-r--r-- | drivers/cpufreq/exynos4210-cpufreq.c | 129 |
3 files changed, 268 insertions, 32 deletions
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/db8500-cpufreq.c index 8e89dcf9d94d..edaa987621ea 100644 --- a/drivers/cpufreq/db8500-cpufreq.c +++ b/drivers/cpufreq/db8500-cpufreq.c | |||
| @@ -18,24 +18,29 @@ | |||
| 18 | static struct cpufreq_frequency_table freq_table[] = { | 18 | static struct cpufreq_frequency_table freq_table[] = { |
| 19 | [0] = { | 19 | [0] = { |
| 20 | .index = 0, | 20 | .index = 0, |
| 21 | .frequency = 300000, | 21 | .frequency = 200000, |
| 22 | }, | 22 | }, |
| 23 | [1] = { | 23 | [1] = { |
| 24 | .index = 1, | 24 | .index = 1, |
| 25 | .frequency = 600000, | 25 | .frequency = 300000, |
| 26 | }, | 26 | }, |
| 27 | [2] = { | 27 | [2] = { |
| 28 | /* Used for MAX_OPP, if available */ | ||
| 29 | .index = 2, | 28 | .index = 2, |
| 30 | .frequency = CPUFREQ_TABLE_END, | 29 | .frequency = 600000, |
| 31 | }, | 30 | }, |
| 32 | [3] = { | 31 | [3] = { |
| 32 | /* Used for MAX_OPP, if available */ | ||
| 33 | .index = 3, | 33 | .index = 3, |
| 34 | .frequency = CPUFREQ_TABLE_END, | 34 | .frequency = CPUFREQ_TABLE_END, |
| 35 | }, | 35 | }, |
| 36 | [4] = { | ||
| 37 | .index = 4, | ||
| 38 | .frequency = CPUFREQ_TABLE_END, | ||
| 39 | }, | ||
| 36 | }; | 40 | }; |
| 37 | 41 | ||
| 38 | static enum arm_opp idx2opp[] = { | 42 | static enum arm_opp idx2opp[] = { |
| 43 | ARM_EXTCLK, | ||
| 39 | ARM_50_OPP, | 44 | ARM_50_OPP, |
| 40 | ARM_100_OPP, | 45 | ARM_100_OPP, |
| 41 | ARM_MAX_OPP | 46 | ARM_MAX_OPP |
| @@ -72,13 +77,13 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
| 72 | 77 | ||
| 73 | freqs.old = policy->cur; | 78 | freqs.old = policy->cur; |
| 74 | freqs.new = freq_table[idx].frequency; | 79 | freqs.new = freq_table[idx].frequency; |
| 75 | freqs.cpu = policy->cpu; | ||
| 76 | 80 | ||
| 77 | if (freqs.old == freqs.new) | 81 | if (freqs.old == freqs.new) |
| 78 | return 0; | 82 | return 0; |
| 79 | 83 | ||
| 80 | /* pre-change notification */ | 84 | /* pre-change notification */ |
| 81 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 85 | for_each_cpu(freqs.cpu, policy->cpus) |
| 86 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
| 82 | 87 | ||
| 83 | /* request the PRCM unit for opp change */ | 88 | /* request the PRCM unit for opp change */ |
| 84 | if (prcmu_set_arm_opp(idx2opp[idx])) { | 89 | if (prcmu_set_arm_opp(idx2opp[idx])) { |
| @@ -87,7 +92,8 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
| 87 | } | 92 | } |
| 88 | 93 | ||
| 89 | /* post change notification */ | 94 | /* post change notification */ |
| 90 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 95 | for_each_cpu(freqs.cpu, policy->cpus) |
| 96 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
| 91 | 97 | ||
| 92 | return 0; | 98 | return 0; |
| 93 | } | 99 | } |
| @@ -104,16 +110,18 @@ static unsigned int db8500_cpufreq_getspeed(unsigned int cpu) | |||
| 104 | static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | 110 | static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) |
| 105 | { | 111 | { |
| 106 | int res; | 112 | int res; |
| 107 | int i; | ||
| 108 | 113 | ||
| 109 | BUILD_BUG_ON(ARRAY_SIZE(idx2opp) + 1 != ARRAY_SIZE(freq_table)); | 114 | BUILD_BUG_ON(ARRAY_SIZE(idx2opp) + 1 != ARRAY_SIZE(freq_table)); |
| 110 | 115 | ||
| 111 | if (cpu_is_u8500v2() && !prcmu_is_u8400()) { | 116 | if (!prcmu_is_u8400()) { |
| 112 | freq_table[0].frequency = 400000; | 117 | freq_table[1].frequency = 400000; |
| 113 | freq_table[1].frequency = 800000; | 118 | freq_table[2].frequency = 800000; |
| 114 | if (prcmu_has_arm_maxopp()) | 119 | if (prcmu_has_arm_maxopp()) |
| 115 | freq_table[2].frequency = 1000000; | 120 | freq_table[3].frequency = 1000000; |
| 116 | } | 121 | } |
| 122 | pr_info("db8500-cpufreq : Available frequencies:\n"); | ||
| 123 | while (freq_table[i].frequency != CPUFREQ_TABLE_END) | ||
| 124 | pr_info(" %d Mhz\n", freq_table[i++].frequency/1000); | ||
| 117 | 125 | ||
| 118 | /* get policy fields based on the table */ | 126 | /* get policy fields based on the table */ |
| 119 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); | 127 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); |
| @@ -127,10 +135,6 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | |||
| 127 | policy->min = policy->cpuinfo.min_freq; | 135 | policy->min = policy->cpuinfo.min_freq; |
| 128 | policy->max = policy->cpuinfo.max_freq; | 136 | policy->max = policy->cpuinfo.max_freq; |
| 129 | policy->cur = db8500_cpufreq_getspeed(policy->cpu); | 137 | policy->cur = db8500_cpufreq_getspeed(policy->cpu); |
| 130 | |||
| 131 | for (i = 0; freq_table[i].frequency != policy->cur; i++) | ||
| 132 | ; | ||
| 133 | |||
| 134 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 138 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
| 135 | 139 | ||
| 136 | /* | 140 | /* |
diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index 35a257dd4bb7..4bd6815d317b 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c | |||
| @@ -19,6 +19,11 @@ | |||
| 19 | #include <asm/msr.h> | 19 | #include <asm/msr.h> |
| 20 | #include <asm/tsc.h> | 20 | #include <asm/tsc.h> |
| 21 | 21 | ||
| 22 | #if defined CONFIG_ACPI_PROCESSOR || defined CONFIG_ACPI_PROCESSOR_MODULE | ||
| 23 | #include <linux/acpi.h> | ||
| 24 | #include <acpi/processor.h> | ||
| 25 | #endif | ||
| 26 | |||
| 22 | #define EPS_BRAND_C7M 0 | 27 | #define EPS_BRAND_C7M 0 |
| 23 | #define EPS_BRAND_C7 1 | 28 | #define EPS_BRAND_C7 1 |
| 24 | #define EPS_BRAND_EDEN 2 | 29 | #define EPS_BRAND_EDEN 2 |
| @@ -27,11 +32,59 @@ | |||
| 27 | 32 | ||
| 28 | struct eps_cpu_data { | 33 | struct eps_cpu_data { |
| 29 | u32 fsb; | 34 | u32 fsb; |
| 35 | #if defined CONFIG_ACPI_PROCESSOR || defined CONFIG_ACPI_PROCESSOR_MODULE | ||
| 36 | u32 bios_limit; | ||
| 37 | #endif | ||
| 30 | struct cpufreq_frequency_table freq_table[]; | 38 | struct cpufreq_frequency_table freq_table[]; |
| 31 | }; | 39 | }; |
| 32 | 40 | ||
| 33 | static struct eps_cpu_data *eps_cpu[NR_CPUS]; | 41 | static struct eps_cpu_data *eps_cpu[NR_CPUS]; |
| 34 | 42 | ||
| 43 | /* Module parameters */ | ||
| 44 | static int freq_failsafe_off; | ||
| 45 | static int voltage_failsafe_off; | ||
| 46 | static int set_max_voltage; | ||
| 47 | |||
| 48 | #if defined CONFIG_ACPI_PROCESSOR || defined CONFIG_ACPI_PROCESSOR_MODULE | ||
| 49 | static int ignore_acpi_limit; | ||
| 50 | |||
| 51 | static struct acpi_processor_performance *eps_acpi_cpu_perf; | ||
| 52 | |||
| 53 | /* Minimum necessary to get acpi_processor_get_bios_limit() working */ | ||
| 54 | static int eps_acpi_init(void) | ||
| 55 | { | ||
| 56 | eps_acpi_cpu_perf = kzalloc(sizeof(struct acpi_processor_performance), | ||
| 57 | GFP_KERNEL); | ||
| 58 | if (!eps_acpi_cpu_perf) | ||
| 59 | return -ENOMEM; | ||
| 60 | |||
| 61 | if (!zalloc_cpumask_var(&eps_acpi_cpu_perf->shared_cpu_map, | ||
| 62 | GFP_KERNEL)) { | ||
| 63 | kfree(eps_acpi_cpu_perf); | ||
| 64 | eps_acpi_cpu_perf = NULL; | ||
| 65 | return -ENOMEM; | ||
| 66 | } | ||
| 67 | |||
| 68 | if (acpi_processor_register_performance(eps_acpi_cpu_perf, 0)) { | ||
| 69 | free_cpumask_var(eps_acpi_cpu_perf->shared_cpu_map); | ||
| 70 | kfree(eps_acpi_cpu_perf); | ||
| 71 | eps_acpi_cpu_perf = NULL; | ||
| 72 | return -EIO; | ||
| 73 | } | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | static int eps_acpi_exit(struct cpufreq_policy *policy) | ||
| 78 | { | ||
| 79 | if (eps_acpi_cpu_perf) { | ||
| 80 | acpi_processor_unregister_performance(eps_acpi_cpu_perf, 0); | ||
| 81 | free_cpumask_var(eps_acpi_cpu_perf->shared_cpu_map); | ||
| 82 | kfree(eps_acpi_cpu_perf); | ||
| 83 | eps_acpi_cpu_perf = NULL; | ||
| 84 | } | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | #endif | ||
| 35 | |||
