Lines Matching refs:state
32 #define EMC2305_PWM_STATE2DUTY(state, max_state, pwm_max) \
33 DIV_ROUND_CLOSEST((state) * (pwm_max), (max_state))
62 * struct emc2305_cdev_data - device-specific cooling device state
64 * @cur_state: cooling current state
65 * @last_hwmon_state: last cooling state updated by hwmon subsystem
66 * @last_thermal_state: last cooling state updated by thermal subsystem
93 * @max_state: maximum cooling state of the cooling device
156 static int emc2305_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state)
165 *state = data->cdev_data[cdev_idx].cur_state;
169 static int emc2305_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state)
172 *state = data->max_state;
176 static int __emc2305_set_cur_state(struct emc2305_data *data, int cdev_idx, unsigned long state)
182 state = max_t(unsigned long, state, data->cdev_data[cdev_idx].last_hwmon_state);
184 val = EMC2305_PWM_STATE2DUTY(state, data->max_state, EMC2305_FAN_MAX);
186 data->cdev_data[cdev_idx].cur_state = state;
206 static int emc2305_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
211 if (state > data->max_state)
218 /* Save thermal state. */
219 data->cdev_data[cdev_idx].last_thermal_state = state;
220 ret = __emc2305_set_cur_state(data, cdev_idx, state);
412 * Update PWM only in case requested state is not less than the
413 * last thermal state.