aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/intel_pstate.c
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen@linux.intel.com>2015-01-28 18:03:28 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-01-29 19:52:17 -0500
commit0522424ecb333c0874c4e74bc053dd662bed40df (patch)
tree2d04b3435d5b078c906a52272723546a8bc45545 /drivers/cpufreq/intel_pstate.c
parentd01b1f48c5fd95901203bd830458eaf619ed6c47 (diff)
intel_pstate: Add num_pstates to sysfs
Add a sysfs interface to display the total number of supported pstates. This value is independent of whether turbo has been enabled or disabled. 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/cpufreq/intel_pstate.c')
-rw-r--r--drivers/cpufreq/intel_pstate.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index ed6dd7dac094..80ecc351d613 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -354,6 +354,17 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
354 return sprintf(buf, "%u\n", turbo_pct); 354 return sprintf(buf, "%u\n", turbo_pct);
355} 355}
356 356
357static ssize_t show_num_pstates(struct kobject *kobj,
358 struct attribute *attr, char *buf)
359{
360 struct cpudata *cpu;
361 int total;
362
363 cpu = all_cpu_data[0];
364 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
365 return sprintf(buf, "%u\n", total);
366}
367
357static ssize_t show_no_turbo(struct kobject *kobj, 368static ssize_t show_no_turbo(struct kobject *kobj,
358 struct attribute *attr, char *buf) 369 struct attribute *attr, char *buf)
359{ 370{
@@ -435,12 +446,14 @@ define_one_global_rw(no_turbo);
435define_one_global_rw(max_perf_pct); 446define_one_global_rw(max_perf_pct);
436define_one_global_rw(min_perf_pct); 447define_one_global_rw(min_perf_pct);
437define_one_global_ro(turbo_pct); 448define_one_global_ro(turbo_pct);
449define_one_global_ro(num_pstates);
438 450
439static struct attribute *intel_pstate_attributes[] = { 451static struct attribute *intel_pstate_attributes[] = {
440 &no_turbo.attr, 452 &no_turbo.attr,
441 &max_perf_pct.attr, 453 &max_perf_pct.attr,
442 &min_perf_pct.attr, 454 &min_perf_pct.attr,
443 &turbo_pct.attr, 455 &turbo_pct.attr,
456 &num_pstates.attr,
444 NULL 457 NULL
445}; 458};
446 459