This is because general active cooling devices, like fans,
may have multiple speeds, which can be mapped to different cooling states.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>
Reviewed-by: Valentin, Eduardo <eduardo.valentin@ti.com>
enum thermal_trip_type trip_type;
struct thermal_cooling_device_instance *instance;
struct thermal_cooling_device *cdev;
enum thermal_trip_type trip_type;
struct thermal_cooling_device_instance *instance;
struct thermal_cooling_device *cdev;
+ unsigned long cur_state, max_state;
+ cdev->ops->get_cur_state(cdev, &cur_state);
+ cdev->ops->get_max_state(cdev, &max_state);
+
- cdev->ops->set_cur_state(cdev, 1);
+ cur_state = cur_state < max_state ?
+ (cur_state + 1) : max_state;
- cdev->ops->set_cur_state(cdev, 0);
+ cur_state = cur_state > 0 ?
+ (cur_state - 1) : 0;
+
+ cdev->ops->set_cur_state(cdev, cur_state);
}
break;
case THERMAL_TRIP_PASSIVE:
}
break;
case THERMAL_TRIP_PASSIVE: