aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-04-30 22:36:01 -0400
committerLen Brown <len.brown@intel.com>2007-04-30 22:36:01 -0400
commit11ccc0f249cb01a129f54760b8ff087f242935d4 (patch)
tree4b84a6f554171e55d23ee9e76d386bd7a358a73d
parentde46c33745f5e2ad594c72f2cf5f490861b16ce1 (diff)
ACPI: thermal trip points are read-only
/proc/acpi/thermal_zone/*/trip_points displays what the kernel reads from the BIOS via ACPI. If you echo a string of ':' deliminted numbers to this file then it will change what it displays. But it shouldn't, since the kernel has no way to communicate these changes to ACPI thermal zones. ACPI thermal zone trip points are read-only. The kernel does have the opportunity to ask the BIOS to change the trip points with _SCP - Set Cooling Policy. Request Active Cooling Mode: # echo 0 > /proc/acpi/thermal_zone/*/cooling_policy Request Passive Cooling Mode: # echo 1 > /proc/acpi/thermal_zone/*/cooling_policy However, in practice it is quite rare for the BIOS to support the optional _SCP, and it is even more rare for the BIOS to export an _SCP that actually changes the trip points. Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/thermal.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 589b98b7b216..73b6fe7093e9 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -86,9 +86,6 @@ static int acpi_thermal_resume(struct acpi_device *device);
86static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); 86static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
87static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); 87static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
88static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); 88static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
89static ssize_t acpi_thermal_write_trip_points(struct file *,
90 const char __user *, size_t,
91 loff_t *);
92static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); 89static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
93static ssize_t acpi_thermal_write_cooling_mode(struct file *, 90static ssize_t acpi_thermal_write_cooling_mode(struct file *,
94 const char __user *, size_t, 91 const char __user *, size_t,
@@ -193,7 +190,6 @@ static const struct file_operations acpi_thermal_temp_fops = {
193static const struct file_operations acpi_thermal_trip_fops = { 190static const struct file_operations acpi_thermal_trip_fops = {
194 .open = acpi_thermal_trip_open_fs, 191 .open = acpi_thermal_trip_open_fs,
195 .read = seq_read, 192 .read = seq_read,
196 .write = acpi_thermal_write_trip_points,
197 .llseek = seq_lseek, 193 .llseek = seq_lseek,
198 .release = single_release, 194 .release = single_release,
199}; 195};
@@ -889,67 +885,6 @@ static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
889 return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); 885 return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data);
890} 886}
891 887
892static ssize_t
893acpi_thermal_write_trip_points(struct file *file,
894 const char __user * buffer,
895 size_t count, loff_t * ppos)
896{
897 struct seq_file *m = file->private_data;
898 struct acpi_thermal *tz = m->private;
899
900 char *limit_string;
901 int num, critical, hot, passive;
902 int *active;
903 int i = 0;
904
905
906 limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
907 if (!limit_string)
908 return -ENOMEM;
909
910 active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
911 if (!active) {
912 kfree(limit_string);
913 return -ENOMEM;
914 }
915
916 if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
917 count = -EINVAL;
918 goto end;
919 }
920
921 if (copy_from_user(limit_string, buffer, count)) {
922 count = -EFAULT;
923 goto end;
924 }
925
926 limit_string[count] = '\0';
927
928 num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
929 &critical, &hot, &passive,
930 &active[0], &active[1], &active[2], &active[3], &active[4],
931 &active[5], &active[6], &active[7], &active[8],
932 &active[9]);
933 if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) {
934 count = -EINVAL;
935 goto end;
936 }
937
938 tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical);
939 tz->trips.hot.temperature = CELSIUS_TO_KELVIN(hot);
940 tz->trips.passive.temperature = CELSIUS_TO_KELVIN(passive);
941 for (i = 0; i < num - 3; i++) {
942 if (!(tz->trips.active[i].flags.valid))
943 break;
944 tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]);
945 }
946
947 end:
948 kfree(active);
949 kfree(limit_string);
950 return count;
951}
952
953static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) 888static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
954{ 889{
955 struct acpi_thermal *tz = seq->private; 890 struct acpi_thermal *tz = seq->private;