1 --- kernel-maemo-2.6.28.orig/arch/arm/mach-omap2/omap3-opp.h
2 +++ kernel-maemo-2.6.28/arch/arm/mach-omap2/omap3-opp.h
4 #include <mach/omap-pm.h>
7 +#define S1150M 1150000000
8 +#define S1100M 1100000000
9 +#define S1000M 1000000000
10 +#define S950M 950000000
11 +#define S900M 900000000
12 +#define S850M 850000000
13 +#define S805M 805000000
14 +#define S750M 750000000
15 +#define S700M 700000000
16 #define S600M 600000000
17 #define S550M 550000000
18 #define S500M 500000000
19 #define S250M 250000000
20 -#define S125M 125000000
21 +#define S125M 124999000
24 +#define S520M 520000000
25 #define S430M 430000000
26 #define S400M 400000000
27 #define S360M 360000000
30 #define S166M 166000000
32 -static struct omap_opp omap3_mpu_rate_table[] = {
35 - {0, VDD1_OPP1, 0x1E},
37 - {S250M, VDD1_OPP2, 0x26},
39 - {S500M, VDD1_OPP3, 0x30},
41 - {S550M, VDD1_OPP4, 0x36},
43 - {S600M, VDD1_OPP5, 0x3C},
46 -static struct omap_opp omap3_l3_rate_table[] = {
49 - {0, VDD2_OPP1, 0x1E},
51 - {S83M, VDD2_OPP2, 0x24},
53 - {S166M, VDD2_OPP3, 0x2C},
56 -static struct omap_opp omap3_dsp_rate_table[] = {
59 - {S90M, VDD1_OPP1, 0x1E},
61 - {S180M, VDD1_OPP2, 0x26},
63 - {S360M, VDD1_OPP3, 0x30},
65 - {S400M, VDD1_OPP4, 0x36},
67 - {S430M, VDD1_OPP5, 0x3C},
69 +extern struct omap_opp omap3_mpu_rate_table[];
70 +extern struct omap_opp omap3_dsp_rate_table[];
71 +extern struct omap_opp omap3_l3_rate_table[];
74 --- kernel-maemo-2.6.28.orig/arch/arm/plat-omap/include/mach/omap34xx.h
75 +++ kernel-maemo-2.6.28/arch/arm/plat-omap/include/mach/omap34xx.h
79 #define MIN_VDD1_OPP VDD1_OPP1
80 -#define MAX_VDD1_OPP VDD1_OPP5
81 +/*#define MAX_VDD1_OPP VDD1_OPP5*/
82 +#define MAX_VDD1_OPP 15
83 #define MIN_VDD2_OPP VDD2_OPP1
84 #define MAX_VDD2_OPP VDD2_OPP3
86 --- kernel-maemo-2.6.28.orig/arch/arm/mach-omap2/smartreflex.c
87 +++ kernel-maemo-2.6.28/arch/arm/mach-omap2/smartreflex.c
89 sr->req_opp_no = target_opp_no;
91 if (sr->srid == SR1) {
92 - switch (target_opp_no) {
93 + switch (min(target_opp_no-1,5)) {
95 nvalue_reciprocal = sr->opp5_nvalue;
98 nvalue_reciprocal = sr->opp2_nvalue;
102 nvalue_reciprocal = sr->opp1_nvalue;
106 (ERRCONFIG_VPBOUNDINTEN | ERRCONFIG_VPBOUNDINTST));
108 if (sr->srid == SR1) {
109 + /*printk(KERN_NOTICE "OPP%d setting voltage %d\n",
110 + target_opp_no,mpu_opps[target_opp_no].vsel);*/
111 errminlimit = (target_opp_no > SR_MAX_LOW_OPP) ?
112 SR1_ERRMINLIMIT_HIGHOPP : SR1_ERRMINLIMIT_LOWOPP;
115 current_opp_no = get_opp_no(current_opp);
117 if (vdd == PRCM_VDD1) {
118 + /*printk(KERN_DEBUG "OPP%d bypass setting voltage %d\n",
119 + target_opp_no,target_vsel);*/
120 t2_smps_steps = abs(target_vsel - current_vsel);
121 errorgain = (target_opp_no > SR_MAX_LOW_OPP) ?
122 PRM_VP1_CONFIG_ERRORGAIN_HIGHOPP :
123 --- kernel-maemo-2.6.28.orig/arch/arm/plat-omap/cpu-omap.c
124 +++ kernel-maemo-2.6.28/arch/arm/plat-omap/cpu-omap.c
125 @@ -148,10 +148,13 @@
126 VERY_HI_RATE) / 1000;
129 - clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);
130 + /*clk_set_rate(mpu_clk, policy->cpuinfo.max_freq * 1000);*/
131 + clk_set_rate(mpu_clk, 600000 * 1000); /*N900 hack: set default max to 600MHz */
133 - policy->min = policy->cpuinfo.min_freq;
134 - policy->max = policy->cpuinfo.max_freq;
135 + /*policy->min = policy->cpuinfo.min_freq;*/
136 + /*policy->max = policy->cpuinfo.max_freq;*/
137 + policy->min = 250000;
138 + policy->max = 600000; /*N900 hack: set default to 250-600MHz */
139 policy->cur = omap_getspeed(0);
141 policy->cpuinfo.transition_latency = 300 * 1000;
142 --- kernel-maemo-2.6.28.orig/arch/arm/mach-omap2/smartreflex.h
143 +++ kernel-maemo-2.6.28/arch/arm/mach-omap2/smartreflex.h
145 /* XXX: end remove/move */
147 /* SR_MAX_LOW_OPP: the highest of the "low OPPs", 1 and 2. */
148 -#define SR_MAX_LOW_OPP 2
149 +#define SR_MAX_LOW_OPP 3
151 /* XXX: find more appropriate place for these once DVFS is in place */
152 extern u32 current_vdd1_opp;
153 --- kernel-maemo-2.6.28.orig/drivers/cpufreq/cpufreq.c
154 +++ kernel-maemo-2.6.28/drivers/cpufreq/cpufreq.c
157 * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access
159 -#define store_one(file_name, object) \
160 +#define store_one(file_name, object,ignore) \
161 static ssize_t store_##file_name \
162 (struct cpufreq_policy *policy, const char *buf, size_t count) \
164 @@ -479,15 +479,16 @@
165 ret = sscanf (buf, "%u", &new_policy.object); \
169 - ret = __cpufreq_set_policy(policy, &new_policy); \
170 + printk(KERN_DEBUG "cpufreq: request %u -> %u\n",policy->object,new_policy.object); \
171 + if (new_policy.object != ignore && new_policy.object >= 100000) \
172 + ret = __cpufreq_set_policy(policy, &new_policy); \
173 policy->user_policy.object = policy->object; \
175 return ret ? ret : count; \
178 -store_one(scaling_min_freq,min);
179 -store_one(scaling_max_freq,max);
180 +store_one(scaling_min_freq,min,0);
181 +store_one(scaling_max_freq,max,600000);
184 * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware
185 --- kernel-maemo-2.6.28.orig/arch/arm/mach-omap2/pm.c
186 +++ kernel-maemo-2.6.28/arch/arm/mach-omap2/pm.c
188 #include "prm-regbits-34xx.h"
190 #include "smartreflex.h"
191 +#include "resource34xx_mutex.h"
192 +#include "omap3-opp.h"
194 +struct omap_opp omap3_mpu_rate_table[] = {
211 + {S1000M, 13, 0x3C},
212 + {S1100M, 14, 0x48},
213 + {S1150M, 15, 0x48},
216 +struct omap_opp omap3_l3_rate_table[] = {
219 + {0, VDD2_OPP1, 0x1E},
221 + {S83M, VDD2_OPP2, 0x24},
223 + {S166M, VDD2_OPP3, 0x2C},
226 +struct omap_opp omap3_dsp_rate_table[] = {
239 + {S430M, 9, 0x3C},/*800MHz*/
248 unsigned short enable_dyn_sleep;
249 unsigned short clocks_off_while_idle;
254 +static ssize_t omap_vdd1_opps_vsel_show(struct kobject *kobj,
255 + struct kobj_attribute *attr, char *buf)
259 + for(i=1;i<=MAX_VDD1_OPP;i++)
260 + b+=sprintf(b, "%hu ", mpu_opps[i].vsel);
261 + b+=sprintf(b, "\n");
265 +static ssize_t omap_vdd1_opps_vsel_store(struct kobject *kobj,
266 + struct kobj_attribute *attr,
267 + const char *buf, size_t n)
272 + if (sscanf(buf, "%hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu",
273 + &value[0], &value[1], &value[2], &value[3],
274 + &value[4], &value[5], &value[6], &value[7],
275 + &value[8], &value[9], &value[10], &value[11],
276 + &value[12], &value[13], &value[14], &value[15]
277 + ) != MAX_VDD1_OPP) {
278 + printk(KERN_ERR "vdd1_opps_vsel: Invalid value\n");
282 + mutex_lock(&dvfs_mutex);
284 + for(i=1;i<=MAX_VDD1_OPP;i++) {
285 + if(value[i-1]<0x49) {
286 + mpu_opps[i].vsel = value[i-1];
290 + mutex_unlock(&dvfs_mutex);
295 +static struct kobj_attribute vdd1_opps_vsel = {
297 + .name = __stringify(vdd1_opps_vsel),
300 + .show = omap_vdd1_opps_vsel_show,
301 + .store = omap_vdd1_opps_vsel_store,
304 +static ssize_t omap_dsp_opps_rate_show(struct kobject *kobj,
305 + struct kobj_attribute *attr, char *buf)
309 + for(i=1;i<=MAX_VDD1_OPP;i++)
310 + b+=sprintf(b, "%lu ", dsp_opps[i].rate);
311 + b+=sprintf(b, "\n");
315 +static ssize_t omap_dsp_opps_rate_store(struct kobject *kobj,
316 + struct kobj_attribute *attr,
317 + const char *buf, size_t n)
319 + unsigned long value[16];
322 + if (sscanf(buf, "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
323 + &value[0], &value[1], &value[2], &value[3],
324 + &value[4], &value[5], &value[6], &value[7],
325 + &value[8], &value[9], &value[10], &value[11],
326 + &value[12], &value[13], &value[14], &value[15]
327 + ) != MAX_VDD1_OPP) {
328 + printk(KERN_ERR "dsp_opps_rate: Invalid value\n");
332 + mutex_lock(&dvfs_mutex);
334 + for(i=1;i<=MAX_VDD1_OPP;i++) {
335 + if(value[i-1]<=600000) {
336 + dsp_opps[i].rate = value[i-1];
340 + mutex_unlock(&dvfs_mutex);
345 +static struct kobj_attribute dsp_opps_rate = {
347 + .name = __stringify(dsp_opps_rate),
350 + .show = omap_dsp_opps_rate_show,
351 + .store = omap_dsp_opps_rate_store,
356 static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
360 printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
363 + error = sysfs_create_file(power_kobj, &vdd1_opps_vsel.attr);
365 + printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
368 + error = sysfs_create_file(power_kobj, &dsp_opps_rate.attr);
370 + printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
374 #ifdef CONFIG_OMAP_PM_SRF
375 error = sysfs_create_file(power_kobj,
376 &vdd1_opp_attr.attr);