aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen@linux.intel.com>2015-01-28 18:03:27 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-01-29 19:52:17 -0500
commitd01b1f48c5fd95901203bd830458eaf619ed6c47 (patch)
treedf29b42bb4495db5a24940b7a05c9cf888fb2150 /drivers
parent7ab0256e57ae4423fbfb6b6c1611578c634702c9 (diff)
intel_pstate: expose turbo range to sysfs
This patch adds "turbo_pct" to the intel_pstate sysfs interface. turbo_pct will display the percentage of the total supported pstates that are in the turbo range. This value is independent of whether turbo has been disabled or not. Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/intel_pstate.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 7d9f822f2031..ed6dd7dac094 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -338,6 +338,22 @@ static void __init intel_pstate_debug_expose_params(void)
338 return sprintf(buf, "%u\n", limits.object); \ 338 return sprintf(buf, "%u\n", limits.object); \
339 } 339 }
340 340
341static ssize_t show_turbo_pct(struct kobject *kobj,
342 struct attribute *attr, char *buf)
343{
344 struct cpudata *cpu;
345 int total, no_turbo, turbo_pct;
346 uint32_t turbo_fp;
347
348 cpu = all_cpu_data[0];
349
350 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
351 no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1;
352 turbo_fp = div_fp(int_tofp(no_turbo), int_tofp(total));
353 turbo_pct = 100 - fp_toint(mul_fp(turbo_fp, int_tofp(100)));
354 return sprintf(buf, "%u\n", turbo_pct);
355}
356
341static ssize_t show_no_turbo(struct kobject *kobj, 357static ssize_t show_no_turbo(struct kobject *kobj,
342 struct attribute *attr, char *buf) 358 struct attribute *attr, char *buf)
343{ 359{
@@ -418,11 +434,13 @@ show_one(min_perf_pct, min_perf_pct);
418define_one_global_rw(no_turbo); 434define_one_global_rw(no_turbo);
419define_one_global_rw(max_perf_pct); 435define_one_global_rw(max_perf_pct);
420define_one_global_rw(min_perf_pct); 436define_one_global_rw(min_perf_pct);
437define_one_global_ro(turbo_pct);
421 438
422static struct attribute *intel_pstate_attributes[] = { 439static struct attribute *intel_pstate_attributes[] = {
423 &no_turbo.attr, 440 &no_turbo.attr,
424 &max_perf_pct.attr, 441 &max_perf_pct.attr,
425 &min_perf_pct.attr, 442 &min_perf_pct.attr,
443 &turbo_pct.attr,
426 NULL 444 NULL
427}; 445};
428 446