Skip to content

Commit bfc57bd

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal/sysfs: Update governors when the 'weight' has changed
Support governors update when the thermal instance's weight has changed. This allows to adjust internal state for the governor. Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> [ rjw: Add two empty code lines aroung the locking ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 879c9dc commit bfc57bd

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/thermal/thermal_sysfs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,12 @@ ssize_t weight_store(struct device *dev, struct device_attribute *attr,
939939

940940
/* Don't race with governors using the 'weight' value */
941941
mutex_lock(&instance->tz->lock);
942+
942943
instance->weight = weight;
944+
945+
thermal_governor_update_tz(instance->tz,
946+
THERMAL_INSTANCE_WEIGHT_CHANGED);
947+
943948
mutex_unlock(&instance->tz->lock);
944949

945950
return count;

include/linux/thermal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum thermal_notify_event {
5353
THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */
5454
THERMAL_TZ_BIND_CDEV, /* Cooling dev is bind to the thermal zone */
5555
THERMAL_TZ_UNBIND_CDEV, /* Cooling dev is unbind from the thermal zone */
56+
THERMAL_INSTANCE_WEIGHT_CHANGED, /* Thermal instance weight changed */
5657
};
5758

5859
/**

0 commit comments

Comments
 (0)