aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2011-11-03 22:33:46 -0400
committerLen Brown <len.brown@intel.com>2011-11-06 20:48:42 -0500
commit362b646062b2073bd5c38efb42171d86e4f717e6 (patch)
tree6c98cdb7aa5d9be22e2b24ca06b822455ef4b9f5
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
ACPI: Export FADT pm_profile integer value to userspace
There are a lot userspace approaches to detect the usage of the platform (laptop, workstation, server, ...) and adjust kernel tunables accordingly (io/process scheduler, power management, ...). These approaches need constant maintaining and are ugly to implement (detect PCMCIA controller -> laptop, does not work on recent systems anymore, ...) On ACPI systems there is an easy and reliable way (if implemented in BIOS and most recent platforms have this value set). -> export it to userspace. Signed-off-by: Thomas Renninger <trenn@suse.de> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--Documentation/ABI/stable/sysfs-acpi-pmprofile22
-rw-r--r--drivers/acpi/sysfs.c14
2 files changed, 35 insertions, 1 deletions
diff --git a/Documentation/ABI/stable/sysfs-acpi-pmprofile b/Documentation/ABI/stable/sysfs-acpi-pmprofile
new file mode 100644
index 000000000000..964c7a8afb26
--- /dev/null
+++ b/Documentation/ABI/stable/sysfs-acpi-pmprofile
@@ -0,0 +1,22 @@
1What: /sys/firmware/acpi/pm_profile
2Date: 03-Nov-2011
3KernelVersion: v3.2
4Contact: linux-acpi@vger.kernel.org
5Description: The ACPI pm_profile sysfs interface exports the platform
6 power management (and performance) requirement expectations
7 as provided by BIOS. The integer value is directly passed as
8 retrieved from the FADT ACPI table.
9Values: For possible values see ACPI specification:
10 5.2.9 Fixed ACPI Description Table (FADT)
11 Field: Preferred_PM_Profile
12
13 Currently these values are defined by spec:
14 0 Unspecified
15 1 Desktop
16 2 Mobile
17 3 Workstation
18 4 Enterprise Server
19 5 SOHO Server
20 6 Appliance PC
21 7 Performance Server
22 >7 Reserved
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index c538d0ef10ff..9f66181c814e 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -706,11 +706,23 @@ static void __exit interrupt_stats_exit(void)
706 return; 706 return;
707} 707}
708 708
709static ssize_t
710acpi_show_profile(struct device *dev, struct device_attribute *attr,
711 char *buf)
712{
713 return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
714}
715
716static const struct device_attribute pm_profile_attr =
717 __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
718
709int __init acpi_sysfs_init(void) 719int __init acpi_sysfs_init(void)
710{ 720{
711 int result; 721 int result;
712 722
713 result = acpi_tables_sysfs_init(); 723 result = acpi_tables_sysfs_init();
714 724 if (result)
725 return result;
726 result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr);
715 return result; 727 return result;
716} 728}