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>
This commit is contained in:
Родитель
de46c33745
Коммит
11ccc0f249
|
@ -86,9 +86,6 @@ static int acpi_thermal_resume(struct acpi_device *device);
|
|||
static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
|
||||
static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
|
||||
static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
|
||||
static ssize_t acpi_thermal_write_trip_points(struct file *,
|
||||
const char __user *, size_t,
|
||||
loff_t *);
|
||||
static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
|
||||
static ssize_t acpi_thermal_write_cooling_mode(struct file *,
|
||||
const char __user *, size_t,
|
||||
|
@ -193,7 +190,6 @@ static const struct file_operations acpi_thermal_temp_fops = {
|
|||
static const struct file_operations acpi_thermal_trip_fops = {
|
||||
.open = acpi_thermal_trip_open_fs,
|
||||
.read = seq_read,
|
||||
.write = acpi_thermal_write_trip_points,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
@ -889,67 +885,6 @@ static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
|
|||
return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
acpi_thermal_write_trip_points(struct file *file,
|
||||
const char __user * buffer,
|
||||
size_t count, loff_t * ppos)
|
||||
{
|
||||
struct seq_file *m = file->private_data;
|
||||
struct acpi_thermal *tz = m->private;
|
||||
|
||||
char *limit_string;
|
||||
int num, critical, hot, passive;
|
||||
int *active;
|
||||
int i = 0;
|
||||
|
||||
|
||||
limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
|
||||
if (!limit_string)
|
||||
return -ENOMEM;
|
||||
|
||||
active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
|
||||
if (!active) {
|
||||
kfree(limit_string);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
|
||||
count = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (copy_from_user(limit_string, buffer, count)) {
|
||||
count = -EFAULT;
|
||||
goto end;
|
||||
}
|
||||
|
||||
limit_string[count] = '\0';
|
||||
|
||||
num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
|
||||
&critical, &hot, &passive,
|
||||
&active[0], &active[1], &active[2], &active[3], &active[4],
|
||||
&active[5], &active[6], &active[7], &active[8],
|
||||
&active[9]);
|
||||
if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) {
|
||||
count = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical);
|
||||
tz->trips.hot.temperature = CELSIUS_TO_KELVIN(hot);
|
||||
tz->trips.passive.temperature = CELSIUS_TO_KELVIN(passive);
|
||||
for (i = 0; i < num - 3; i++) {
|
||||
if (!(tz->trips.active[i].flags.valid))
|
||||
break;
|
||||
tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]);
|
||||
}
|
||||
|
||||
end:
|
||||
kfree(active);
|
||||
kfree(limit_string);
|
||||
return count;
|
||||
}
|
||||
|
||||
static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
|
||||
{
|
||||
struct acpi_thermal *tz = seq->private;
|
||||
|
|
Загрузка…
Ссылка в новой задаче