Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0522424e authored by Kristen Carlson Accardi's avatar Kristen Carlson Accardi Committed by Rafael J. Wysocki
Browse files

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: default avatarKristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent d01b1f48
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,10 @@ controlling P state selection. These files have been added to
      is supported by hardware that is in the turbo range.  This number
      is supported by hardware that is in the turbo range.  This number
      is independent of whether turbo has been disabled or not.
      is independent of whether turbo has been disabled or not.


      num_pstates: displays the number of pstates that are supported
      by hardware.  This number is independent of whether turbo has
      been disabled or not.

For contemporary Intel processors, the frequency is controlled by the
For contemporary Intel processors, the frequency is controlled by the
processor itself and the P-states exposed to software are related to
processor itself and the P-states exposed to software are related to
performance levels.  The idea that frequency can be set to a single
performance levels.  The idea that frequency can be set to a single
+13 −0
Original line number Original line Diff line number Diff line
@@ -354,6 +354,17 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
	return sprintf(buf, "%u\n", turbo_pct);
	return sprintf(buf, "%u\n", turbo_pct);
}
}


static ssize_t show_num_pstates(struct kobject *kobj,
				struct attribute *attr, char *buf)
{
	struct cpudata *cpu;
	int total;

	cpu = all_cpu_data[0];
	total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
	return sprintf(buf, "%u\n", total);
}

static ssize_t show_no_turbo(struct kobject *kobj,
static ssize_t show_no_turbo(struct kobject *kobj,
			     struct attribute *attr, char *buf)
			     struct attribute *attr, char *buf)
{
{
@@ -435,12 +446,14 @@ define_one_global_rw(no_turbo);
define_one_global_rw(max_perf_pct);
define_one_global_rw(max_perf_pct);
define_one_global_rw(min_perf_pct);
define_one_global_rw(min_perf_pct);
define_one_global_ro(turbo_pct);
define_one_global_ro(turbo_pct);
define_one_global_ro(num_pstates);


static struct attribute *intel_pstate_attributes[] = {
static struct attribute *intel_pstate_attributes[] = {
	&no_turbo.attr,
	&no_turbo.attr,
	&max_perf_pct.attr,
	&max_perf_pct.attr,
	&min_perf_pct.attr,
	&min_perf_pct.attr,
	&turbo_pct.attr,
	&turbo_pct.attr,
	&num_pstates.attr,
	NULL
	NULL
};
};