RE: [PATCH 08/13] Thermal: Introduce fair_share thermal governor
From: R, Durgadoss <hidden>
Date: 2012-08-21 05:59:27
Hi Eduardo,
quoted
+static long get_target_state(struct thermal_zone_device *tz, + struct thermal_cooling_device *cdev, int weight, int level) +{ + unsigned long max_state; + + cdev->ops->get_max_state(cdev, &max_state); + + return (long)(weight * level * max_state) / (100 * tz->trips); +} + +static void thermal_cdev_update(struct thermal_cooling_device *cdev) +{ + struct thermal_instance *instance; + unsigned long target = 0; + + mutex_lock(&cdev->lock); + + /* Make sure cdev enters the deepest cooling state */ + list_for_each_entry(instance, &cdev->thermal_instances,cdev_node) {quoted
+ if (instance->target > target) + target = instance->target; + } + + mutex_unlock(&cdev->lock); + + cdev->ops->set_cur_state(cdev, target); +}I believe Rui has already provided an arbitrator, can we reuse it here as well?
I thought about this. I was of the opinion a governor can choose to do arbitration in its own specific way. For example, The fair_share does not check 'cdev->updated' value whenever it tries to update the state of a cooling device. Thanks, Durga