aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ppc/syslib/mv64360_pic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/ppc/syslib/mv64360_pic.c b/arch/ppc/syslib/mv64360_pic.c
index 3f6d162f87cf..5104386601ed 100644
--- a/arch/ppc/syslib/mv64360_pic.c
+++ b/arch/ppc/syslib/mv64360_pic.c
@@ -380,7 +380,7 @@ mv64360_register_hdlrs(void)
380 /* Clear old errors and register CPU interface error intr handler */ 380 /* Clear old errors and register CPU interface error intr handler */
381 mv64x60_write(&bh, MV64x60_CPU_ERR_CAUSE, 0); 381 mv64x60_write(&bh, MV64x60_CPU_ERR_CAUSE, 0);
382 if ((rc = request_irq(MV64x60_IRQ_CPU_ERR + mv64360_irq_base, 382 if ((rc = request_irq(MV64x60_IRQ_CPU_ERR + mv64360_irq_base,
383 mv64360_cpu_error_int_handler, IRQF_DISABLED, CPU_INTR_STR, 0))) 383 mv64360_cpu_error_int_handler, IRQF_DISABLED, CPU_INTR_STR, NULL)))
384 printk(KERN_WARNING "Can't register cpu error handler: %d", rc); 384 printk(KERN_WARNING "Can't register cpu error handler: %d", rc);
385 385
386 mv64x60_write(&bh, MV64x60_CPU_ERR_MASK, 0); 386 mv64x60_write(&bh, MV64x60_CPU_ERR_MASK, 0);
@@ -389,7 +389,7 @@ mv64360_register_hdlrs(void)
389 /* Clear old errors and register internal SRAM error intr handler */ 389 /* Clear old errors and register internal SRAM error intr handler */
390 mv64x60_write(&bh, MV64360_SRAM_ERR_CAUSE, 0); 390 mv64x60_write(&bh, MV64360_SRAM_ERR_CAUSE, 0);
391 if ((rc = request_irq(MV64360_IRQ_SRAM_PAR_ERR + mv64360_irq_base, 391 if ((rc = request_irq(MV64360_IRQ_SRAM_PAR_ERR + mv64360_irq_base,
392 mv64360_sram_error_int_handler,IRQF_DISABLED,SRAM_INTR_STR, 0))) 392 mv64360_sram_error_int_handler,IRQF_DISABLED,SRAM_INTR_STR, NULL)))
393 printk(KERN_WARNING "Can't register SRAM error handler: %d",rc); 393 printk(KERN_WARNING "Can't register SRAM error handler: %d",rc);
394 394
395 /* Clear old errors and register PCI 0 error intr handler */ 395 /* Clear old errors and register PCI 0 error intr handler */
Jones <davej@redhat.com> 2009-02-24 22:47:31 -0500 [CPUFREQ] ondemand/conservative: sanitize sampling_rate restrictions' href='/cgit/cgit.cgi/litmus-rt.git/commit/drivers/cpufreq/cpufreq_ondemand.c?h=v2.6.37-rc4&id=112124ab0a9f507a0d7fdbb1e1ed2b9a24f8c4ea'>112124ab0a9f
cef9615a853e

112124ab0a9f
cef9615a853e
1c2562459fae
1da177e4c3f4
c4028958b6ec
0e625ac15312











c4028958b6ec

529af7a14f04
1da177e4c3f4

ccb2fe209dac

808009131046
32ee8c3e470d
2b03f891ad38
05ca0350e8ca



529af7a14f04
5a75c82828e7






1da177e4c3f4
245b2e70eabd
1da177e4c3f4


4ec223d02f4d
7d26e2d5e2da
5a75c82828e7
4ec223d02f4d
ffac80e925e5
1da177e4c3f4
2f8a835c7057
6810b548b251
05ca0350e8ca
32ee8c3e470d
32ee8c3e470d
e9d95bf7eb92
32ee8c3e470d
05ca0350e8ca

32ee8c3e470d
e9d95bf7eb92
9cbad61b41f0
05ca0350e8ca
1da177e4c3f4

808009131046

dac1c1a56279
ea48761519bd
3430502d3562
ea48761519bd
ccb2fe209dac
3430502d3562
ea48761519bd

ccb2fe209dac
ea48761519bd


1ca3abdb6a4b
ea48761519bd
3430502d3562

54c9a35d9fae
3430502d3562
54c9a35d9fae
dac1c1a56279

808009131046






808009131046


05ca0350e8ca




b5ecf60fe6b1


05ca0350e8ca




245b2e70eabd

05ca0350e8ca







































5a75c82828e7

384be2b18a5f
5a75c82828e7



05ca0350e8ca



5a75c82828e7
05ca0350e8ca


1da177e4c3f4
0e625ac15312


1da177e4c3f4
4f4d1ad6ee69

cef9615a853e
1da177e4c3f4

0e625ac15312

1da177e4c3f4
cef9615a853e
1da177e4c3f4

32ee8c3e470d
0e625ac15312
1da177e4c3f4







0e625ac15312
1da177e4c3f4



1da177e4c3f4
001893cda2f2
05ca0350e8ca
1da177e4c3f4
0e625ac15312































1da177e4c3f4


ffac80e925e5
5a75c82828e7

1da177e4c3f4
3fc54d37ab64
cef9615a853e
3fc54d37ab64
1da177e4c3f4



0e625ac15312

1da177e4c3f4


ffac80e925e5
1da177e4c3f4
32ee8c3e470d
c29f14030981
1da177e4c3f4


5a75c82828e7
1da177e4c3f4
3fc54d37ab64
1da177e4c3f4



0e625ac15312

3d5ee9e55d13




32ee8c3e470d
ffac80e925e5
2b03f891ad38
3d5ee9e55d13

2b03f891ad38
3d5ee9e55d13
32ee8c3e470d
3fc54d37ab64
2b03f891ad38
3fc54d37ab64
3d5ee9e55d13



ccb2fe209dac
dac1c1a56279
ccb2fe209dac
245b2e70eabd
3430502d3562

1ca3abdb6a4b


3d5ee9e55d13
3fc54d37ab64
3d5ee9e55d13



0e625ac15312

05ca0350e8ca


















1da177e4c3f4
0e625ac15312
1da177e4c3f4


1da177e4c3f4
001893cda2f2
05ca0350e8ca
1da177e4c3f4
2b03f891ad38
1da177e4c3f4


1da177e4c3f4
001893cda2f2
05ca0350e8ca
1da177e4c3f4







0e625ac15312








































1da177e4c3f4

2f8a835c7057
1da177e4c3f4
c43aa3bd99a6
1da177e4c3f4



05ca0350e8ca
1da177e4c3f4
ea48761519bd
32ee8c3e470d
c29f14030981

ccb2fe209dac
c29f14030981

1da177e4c3f4
32ee8c3e470d


1da177e4c3f4

c43aa3bd99a6


835481d9bcd6
1da177e4c3f4
c43aa3bd99a6



1da177e4c3f4
245b2e70eabd
3430502d3562


c43aa3bd99a6



c43aa3bd99a6
ccb2fe209dac
c43aa3bd99a6
1da177e4c3f4
1ca3abdb6a4b
















3430502d3562
c43aa3bd99a6
c43aa3bd99a6









1da177e4c3f4

ccb2fe209dac
c43aa3bd99a6
c11420a61603
05ca0350e8ca











1da177e4c3f4



c29f14030981


1da177e4c3f4
c29f14030981




e9d95bf7eb92


c43aa3bd99a6
e9d95bf7eb92


dfde5d62ed9b
1dbf58881f30


05ca0350e8ca








ccb2fe209dac
1da177e4c3f4

c4028958b6ec
32ee8c3e470d
529af7a14f04




1ce28d6b1911

c4028958b6ec
1ce28d6b1911
5a75c82828e7
56463b78cdca
05ca0350e8ca
c4028958b6ec
05ca0350e8ca
c4028958b6ec
05ca0350e8ca
05ca0350e8ca

c4028958b6ec
05ca0350e8ca



2b03f891ad38
05ca0350e8ca
1ce28d6b1911
5a75c82828e7
32ee8c3e470d
1da177e4c3f4
529af7a14f04
1da177e4c3f4
1ce28d6b1911


2f8a835c7057
c4028958b6ec
28287033e124
529af7a14f04
2b03f891ad38
1da177e4c3f4

2cd7cbdf4bd0
1da177e4c3f4
b14893a62c73
1da177e4c3f4







914f7c31b0be
1da177e4c3f4
245b2e70eabd
1da177e4c3f4


ffac80e925e5
1da177e4c3f4

3fc54d37ab64
914f7c31b0be
0e625ac15312
914f7c31b0be
914f7c31b0be



5a75c82828e7
835481d9bcd6
1da177e4c3f4
245b2e70eabd
1da177e4c3f4
32ee8c3e470d
3430502d3562

1ca3abdb6a4b



1da177e4c3f4
529af7a14f04
5a75c82828e7
1da177e4c3f4





0e625ac15312







1da177e4c3f4
df8b59be0976


cef9615a853e





1da177e4c3f4
3fc54d37ab64
7d26e2d5e2da
0e625ac15312
7d26e2d5e2da
1da177e4c3f4


2cd7cbdf4bd0
7d26e2d5e2da

0e625ac15312
5a75c82828e7
1da177e4c3f4
3fc54d37ab64
0e625ac15312


1da177e4c3f4



5a75c82828e7
1da177e4c3f4
ffac80e925e5
2b03f891ad38
1da177e4c3f4
ffac80e925e5
2b03f891ad38
5a75c82828e7
1da177e4c3f4




1da177e4c3f4

888a794cacd8
808009131046
4f6e6b9f97b0

808009131046
4f6e6b9f97b0

808009131046




cef9615a853e









808009131046
888a794cacd8
56463b78cdca




888a794cacd8




1da177e4c3f4



1c2562459fae
56463b78cdca
1da177e4c3f4


ffac80e925e5


2b03f891ad38
ffac80e925e5
1da177e4c3f4
6915719b36a9


1da177e4c3f4
6915719b36a9
1da177e4c3f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773













                                                                            
                       
                          
                      

                              
                        


                          
                        





                                                                    
                                                    
                                                    

                                                    
                                                       
                                                    

                                                     

                                                                      
                                                                        

                                                                         




                                                                                
                                                   
 

                                      
                                                      
                                                     
                                                                  
 
                                                   











                                                              

                    
                                         

                       

                                  
                                  
                                          
                                 



                                                   
                






                                                                      
  
                                                              


                                                                      
  
                                                                       
                                                                 
   
                               
 
                                              
 
                          
                                   
                                  
                                       
                                 

                                    
                                                   
                                                             
                         
                            

  

                                                                          
 
                              
                                  
                              
 
                                                                 

                                                              
 


                                                                             
                                                                          
 

                                                            
                                                                     
 
                                                        

 






                                                                                


                         




                                                                         


                                                                        




                                                           

                                                                   







































                                                                               

                                                     
                                                                         



                                                                



                                              
                                                    


         
                                                                     


                                                                        
 

                                                                          
                                         

 

                                                                        
 
                                                       

 
                                         
                                         







                                                                         
                                                                        



                                                                         
                                     
                                        
                                         
 































                                                                          


                           
                                        

                               
 
                               
                                                                     
                                 



                     

                                                                         


                           
                                        
 
                                                             
                                                             


                               
                               
                                            
                                 



                     

                                                                             




                           
 
                                        
                     

                               
                      
                          
 
                               
                                                                      
                                         



                                           
                                                  
                                
                                                
                                                        

                                                                          


                                                                            
         
                                 



                     

                                                                           


















                                              
                              
                                   


                                                
                            
                                
                              
 
                                             


                                
                           
                               
                             







                                                








































                                                                         

                                                               
                                                               
 
                                   



                                      
                                   
                                           
 
          

                                                                      
                                                        

                                                                                
          


                                                                    

           


                                                  
                                       
                                                  



                                                         
 
                                                          


                                                                     



                                                                       
                                                                       
                                                           
                                                          
 
















                                                                              
                                                                  
                                 









                                                                 

         
                                          
                                                                        
                                                                          











                                                                             



                                          


                                                                        
 




                                                                         


                                                                              
                                       


                                                                   
 


                                                








                                                                           
         

 
                                                  
 




                                                                     

                                                                   
 
                                 
                                           
 
                                        
                                                  
                                             
                                               
                                        

                                                        
                                                               



                                                             
                                                               
         
                                                                         
                                             
 
 
                                                                  
 


                                                                   
 
                                                  
                                                                    
                                                                           
                       

 
                                                                  
 
                                                  







                                                              
               
 
                                                       


                               
                                                         

                                       
                                       
 
                                                                            
                         



                                                 
                             
                                               
                                                          
                                                                  
                                                        
 

                                                                            



                                                                          
                 
                                         
                                                      





                                                                   







                                                                       
                                                                             


                                                                            





                                                                          
                 
                                         
 
                                                        
                                              


                              
                                              

                                       
                                                                       
                                                           
                             
                                         


                                                                  



                                
                                                        
                                                                 
                                                                          
                                                                 
                                                                      
                                                                          
                                                                 
                                                          




                      

                                            
                
                         

                            
 

                                                     




                                                                              









                                                                               
         
 




                                                                  




                                                               



                                             
                                                           
                                        


 


                                                                         
                                                               
                      
 


                                           
                                  
      
                                  
/*
 *  drivers/cpufreq/cpufreq_ondemand.c
 *
 *  Copyright (C)  2001 Russell King
 *            (C)  2003 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>.
 *                      Jun Nakajima <jun.nakajima@intel.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/cpu.h>
#include <linux/jiffies.h>
#include <linux/kernel_stat.h>
#include <linux/mutex.h>
#include <linux/hrtimer.h>
#include <linux/tick.h>
#include <linux/ktime.h>
#include <linux/sched.h>

/*
 * dbs is used in this file as a shortform for demandbased switching
 * It helps to keep variable names smaller, simpler
 */

#define DEF_FREQUENCY_DOWN_DIFFERENTIAL		(10)
#define DEF_FREQUENCY_UP_THRESHOLD		(80)
#define MICRO_FREQUENCY_DOWN_DIFFERENTIAL	(3)
#define MICRO_FREQUENCY_UP_THRESHOLD		(95)
#define MICRO_FREQUENCY_MIN_SAMPLE_RATE		(10000)
#define MIN_FREQUENCY_UP_THRESHOLD		(11)
#define MAX_FREQUENCY_UP_THRESHOLD		(100)

/*
 * The polling frequency of this governor depends on the capability of
 * the processor. Default polling frequency is 1000 times the transition
 * latency of the processor. The governor will work on any processor with
 * transition latency <= 10mS, using appropriate sampling
 * rate.
 * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL)
 * this governor will not work.
 * All times here are in uS.
 */
#define MIN_SAMPLING_RATE_RATIO			(2)

static unsigned int min_sampling_rate;

#define LATENCY_MULTIPLIER			(1000)
#define MIN_LATENCY_MULTIPLIER			(100)
#define TRANSITION_LATENCY_LIMIT		(10 * 1000 * 1000)

static void do_dbs_timer(struct work_struct *work);
static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
				unsigned int event);

#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
static
#endif
struct cpufreq_governor cpufreq_gov_ondemand = {
       .name                   = "ondemand",
       .governor               = cpufreq_governor_dbs,
       .max_transition_latency = TRANSITION_LATENCY_LIMIT,
       .owner                  = THIS_MODULE,
};

/* Sampling types */
enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE};

struct cpu_dbs_info_s {
	cputime64_t prev_cpu_idle;
	cputime64_t prev_cpu_wall;
	cputime64_t prev_cpu_nice;
	struct cpufreq_policy *cur_policy;
	struct delayed_work work;
	struct cpufreq_frequency_table *freq_table;
	unsigned int freq_lo;
	unsigned int freq_lo_jiffies;
	unsigned int freq_hi_jiffies;
	int cpu;
	unsigned int sample_type:1;
	/*
	 * percpu mutex that serializes governor limit change with
	 * do_dbs_timer invocation. We do not want do_dbs_timer to run
	 * when user is changing the governor or limits.
	 */
	struct mutex timer_mutex;
};
static DEFINE_PER_CPU(struct cpu_dbs_info_s, od_cpu_dbs_info);

static unsigned int dbs_enable;	/* number of CPUs using this policy */

/*
 * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on
 * different CPUs. It protects dbs_enable in governor start/stop.
 */
static DEFINE_MUTEX(dbs_mutex);

static struct workqueue_struct	*kondemand_wq;

static struct dbs_tuners {
	unsigned int sampling_rate;
	unsigned int up_threshold;
	unsigned int down_differential;
	unsigned int ignore_nice;
	unsigned int powersave_bias;
} dbs_tuners_ins = {
	.up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
	.down_differential = DEF_FREQUENCY_DOWN_DIFFERENTIAL,
	.ignore_nice = 0,
	.powersave_bias = 0,
};

static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
							cputime64_t *wall)
{
	cputime64_t idle_time;
	cputime64_t cur_wall_time;
	cputime64_t busy_time;

	cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
	busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user,
			kstat_cpu(cpu).cpustat.system);

	busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq);
	busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq);
	busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal);
	busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.nice);

	idle_time = cputime64_sub(cur_wall_time, busy_time);
	if (wall)
		*wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);

	return (cputime64_t)jiffies_to_usecs(idle_time);
}

static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
{
	u64 idle_time = get_cpu_idle_time_us(cpu, wall);

	if (idle_time == -1ULL)
		return get_cpu_idle_time_jiffy(cpu, wall);

	return idle_time;
}

/*
 * Find right freq to be set now with powersave_bias on.
 * Returns the freq_hi to be used right now and will set freq_hi_jiffies,
 * freq_lo, and freq_lo_jiffies in percpu area for averaging freqs.
 */
static unsigned int powersave_bias_target(struct cpufreq_policy *policy,
					  unsigned int freq_next,
					  unsigned int relation)
{
	unsigned int freq_req, freq_reduc, freq_avg;
	unsigned int freq_hi, freq_lo;
	unsigned int index = 0;
	unsigned int jiffies_total, jiffies_hi, jiffies_lo;
	struct cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info,
						   policy->cpu);

	if (!dbs_info->freq_table) {
		dbs_info->freq_lo = 0;
		dbs_info->freq_lo_jiffies = 0;
		return freq_next;
	}

	cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_next,
			relation, &index);
	freq_req = dbs_info->freq_table[index].frequency;
	freq_reduc = freq_req * dbs_tuners_ins.powersave_bias / 1000;
	freq_avg = freq_req - freq_reduc;

	/* Find freq bounds for freq_avg in freq_table */
	index = 0;
	cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_avg,
			CPUFREQ_RELATION_H, &index);
	freq_lo = dbs_info->freq_table[index].frequency;
	index = 0;
	cpufreq_frequency_table_target(policy, dbs_info->freq_table, freq_avg,
			CPUFREQ_RELATION_L, &index);
	freq_hi = dbs_info->freq_table[index].frequency;

	/* Find out how long we have to be in hi and lo freqs */
	if (freq_hi == freq_lo) {
		dbs_info->freq_lo = 0;
		dbs_info->freq_lo_jiffies = 0;
		return freq_lo;
	}
	jiffies_total = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
	jiffies_hi = (freq_avg - freq_lo) * jiffies_total;
	jiffies_hi += ((freq_hi - freq_lo) / 2);
	jiffies_hi /= (freq_hi - freq_lo);
	jiffies_lo = jiffies_total - jiffies_hi;
	dbs_info->freq_lo = freq_lo;
	dbs_info->freq_lo_jiffies = jiffies_lo;
	dbs_info->freq_hi_jiffies = jiffies_hi;
	return freq_hi;
}

static void ondemand_powersave_bias_init_cpu(int cpu)
{
	struct cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
	dbs_info->freq_table = cpufreq_frequency_get_table(cpu);
	dbs_info->freq_lo = 0;
}

static void ondemand_powersave_bias_init(void)
{
	int i;
	for_each_online_cpu(i) {
		ondemand_powersave_bias_init_cpu(i);
	}
}

/************************** sysfs interface ************************/

static ssize_t show_sampling_rate_max(struct kobject *kobj,
				      struct attribute *attr, char *buf)
{
	printk_once(KERN_INFO "CPUFREQ: ondemand sampling_rate_max "
	       "sysfs file is deprecated - used by: %s\n", current->comm);
	return sprintf(buf, "%u\n", -1U);
}

static ssize_t show_sampling_rate_min(struct kobject *kobj,
				      struct attribute *attr, char *buf)
{
	return sprintf(buf, "%u\n", min_sampling_rate);
}

#define define_one_ro(_name)		\
static struct global_attr _name =	\
__ATTR(_name, 0444, show_##_name, NULL)