LorDClockaN

ondemand suspend

Sep 3rd, 2011
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
  2. index bae85bf..1828d75 100644
  3. --- a/drivers/cpufreq/cpufreq_ondemand.c
  4. +++ b/drivers/cpufreq/cpufreq_ondemand.c
  5. @@ -38,6 +38,7 @@
  6. #define MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000)
  7. #define MIN_FREQUENCY_UP_THRESHOLD (11)
  8. #define MAX_FREQUENCY_UP_THRESHOLD (100)
  9. +#define DEF_SUSPEND_FREQ (998400)
  10.  
  11. /*
  12. * The polling frequency of this governor depends on the capability of
  13. @@ -53,7 +54,7 @@
  14.  
  15. static unsigned int min_sampling_rate;
  16.  
  17. -static unsigned int suspendfreq = 998400;
  18. +static unsigned int suspendfreq = DEF_SUSPEND_FREQ;
  19.  
  20. #define LATENCY_MULTIPLIER (1000)
  21. #define MIN_LATENCY_MULTIPLIER (100)
  22. @@ -147,12 +148,14 @@ static struct dbs_tuners {
  23. unsigned int sampling_down_factor;
  24. unsigned int powersave_bias;
  25. unsigned int io_is_busy;
  26. + unsigned int suspend_freq;
  27. } dbs_tuners_ins = {
  28. .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
  29. .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,
  30. .down_differential = DEF_FREQUENCY_DOWN_DIFFERENTIAL,
  31. .ignore_nice = 0,
  32. .powersave_bias = 100,
  33. + .suspend_freq = DEF_SUSPEND_FREQ,
  34. };
  35.  
  36. static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
  37. @@ -292,6 +295,8 @@ show_one(down_differential, down_differential);
  38. show_one(sampling_down_factor, sampling_down_factor);
  39. show_one(ignore_nice_load, ignore_nice);
  40. show_one(powersave_bias, powersave_bias);
  41. +show_one(suspend_freq, suspend_freq);
  42. +
  43.  
  44. static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b,
  45. const char *buf, size_t count)
  46. @@ -404,6 +409,8 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
  47. return count;
  48. }
  49.  
  50. +
  51. +
  52. static ssize_t store_down_differential(struct kobject *a, struct attribute *b,
  53. const char *buf, size_t count)
  54. {
  55. @@ -427,6 +434,29 @@ static ssize_t store_down_differential(struct kobject *a, struct attribute *b,
  56. return count;
  57. }
  58.  
  59. +static ssize_t store_suspend_freq(struct kobject *a, struct attribute *b,
  60. + const char *buf, size_t count)
  61. +{
  62. + unsigned int input;
  63. + int ret;
  64. + ret = sscanf(buf, "%u", &input);
  65. +
  66. + if (ret != 1)
  67. + return -EINVAL;
  68. +
  69. + if (input > 2016000)
  70. + input = 2016000;
  71. +
  72. + if (input < 122000)
  73. + input = 122000;
  74. +
  75. + mutex_lock(&dbs_mutex);
  76. + dbs_tuners_ins.suspend_freq = input;
  77. + mutex_unlock(&dbs_mutex);
  78. +
  79. + return count;
  80. +}
  81. +
  82. define_one_global_rw(sampling_rate);
  83. define_one_global_rw(io_is_busy);
  84. define_one_global_rw(up_threshold);
  85. @@ -434,6 +464,7 @@ define_one_global_rw(down_differential);
  86. define_one_global_rw(sampling_down_factor);
  87. define_one_global_rw(ignore_nice_load);
  88. define_one_global_rw(powersave_bias);
  89. +define_one_global_rw(suspend_freq);
  90.  
  91. static struct attribute *dbs_attributes[] = {
  92. &sampling_rate_min.attr,
  93. @@ -444,6 +475,7 @@ static struct attribute *dbs_attributes[] = {
  94. &ignore_nice_load.attr,
  95. &powersave_bias.attr,
  96. &io_is_busy.attr,
  97. + &suspend_freq.attr,
  98. NULL
  99. };
Advertisement
Add Comment
Please, Sign In to add comment