summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorPunit Agrawal <punit.agrawal@arm.com>2015-03-03 11:43:03 +0100
committerEduardo Valentin <edubezval@gmail.com>2015-05-05 06:27:53 +0200
commit35e946447f22d722e06702f4f040f7b108cafbbe (patch)
tree7bc81f7ac621f8af0d3e4dcd200cf2e139af4b2b /drivers/thermal
parentthermal: x86_pkg_temp: drop const for thermal_zone_parameters (diff)
downloadlinux-35e946447f22d722e06702f4f040f7b108cafbbe.tar.xz
linux-35e946447f22d722e06702f4f040f7b108cafbbe.zip
thermal: core: Add Kconfig option to enable writable trips
Add a Kconfig option to allow system integrators to control whether userspace tools can change trip temperatures. This option overrides the thermal zone setup in the driver code and must be enabled for platform specified writable trips to come into effect. The original behaviour of requiring root privileges to change trip temperatures remains unchanged. Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Punit Agrawal <punit.agrawal@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/Kconfig11
-rw-r--r--drivers/thermal/thermal_core.c3
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index a1b43eab0a70..46bdecf260e5 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -42,6 +42,17 @@ config THERMAL_OF
Say 'Y' here if you need to build thermal infrastructure
based on device tree.
+config THERMAL_WRITABLE_TRIPS
+ bool "Enable writable trip points"
+ help
+ This option allows the system integrator to choose whether
+ trip temperatures can be changed from userspace. The
+ writable trips need to be specified when setting up the
+ thermal zone but the choice here takes precedence.
+
+ Say 'Y' here if you would like to allow userspace tools to
+ change trip temperatures.
+
choice
prompt "Default Thermal governor"
default THERMAL_DEFAULT_GOV_STEP_WISE
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index b389bc2ec0fa..78bb9aa9d4e4 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1539,7 +1539,8 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
tz->trip_temp_attrs[indx].name;
tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO;
tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show;
- if (mask & (1 << indx)) {
+ if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS) &&
+ mask & (1 << indx)) {
tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR;
tz->trip_temp_attrs[indx].attr.store =
trip_point_temp_store;