Lines Matching refs:fan
80 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_release() local
82 kref_put(&fan->fcu_priv->ref, wf_fcu_release); in wf_fcu_fan_release()
83 kfree(fan); in wf_fcu_fan_release()
146 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_set_rpm() local
147 struct wf_fcu_priv *pv = fan->fcu_priv; in wf_fcu_fan_set_rpm()
151 if (value < fan->min) in wf_fcu_fan_set_rpm()
152 value = fan->min; in wf_fcu_fan_set_rpm()
153 if (value > fan->max) in wf_fcu_fan_set_rpm()
154 value = fan->max; in wf_fcu_fan_set_rpm()
156 fan->target = value; in wf_fcu_fan_set_rpm()
160 rc = wf_fcu_write_reg(pv, 0x10 + (fan->id * 2), buf, 2); in wf_fcu_fan_set_rpm()
168 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_get_rpm() local
169 struct wf_fcu_priv *pv = fan->fcu_priv; in wf_fcu_fan_get_rpm()
178 if ((failure & (1 << fan->id)) != 0) in wf_fcu_fan_get_rpm()
183 if ((active & (1 << fan->id)) == 0) in wf_fcu_fan_get_rpm()
192 rc = wf_fcu_read_reg(pv, reg_base + (fan->id * 2), buf, 2); in wf_fcu_fan_get_rpm()
203 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_set_pwm() local
204 struct wf_fcu_priv *pv = fan->fcu_priv; in wf_fcu_fan_set_pwm()
208 if (value < fan->min) in wf_fcu_fan_set_pwm()
209 value = fan->min; in wf_fcu_fan_set_pwm()
210 if (value > fan->max) in wf_fcu_fan_set_pwm()
211 value = fan->max; in wf_fcu_fan_set_pwm()
213 fan->target = value; in wf_fcu_fan_set_pwm()
217 rc = wf_fcu_write_reg(pv, 0x30 + (fan->id * 2), buf, 1); in wf_fcu_fan_set_pwm()
225 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_get_pwm() local
226 struct wf_fcu_priv *pv = fan->fcu_priv; in wf_fcu_fan_get_pwm()
235 if ((failure & (1 << fan->id)) != 0) in wf_fcu_fan_get_pwm()
240 if ((active & (1 << fan->id)) == 0) in wf_fcu_fan_get_pwm()
243 rc = wf_fcu_read_reg(pv, 0x30 + (fan->id * 2), buf, 1); in wf_fcu_fan_get_pwm()
254 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_min() local
256 return fan->min; in wf_fcu_fan_min()
261 struct wf_fcu_fan *fan = ct->priv; in wf_fcu_fan_max() local
263 return fan->max; in wf_fcu_fan_max()
284 static void wf_fcu_get_pump_minmax(struct wf_fcu_fan *fan) in wf_fcu_get_pump_minmax() argument
312 fan->min = pump_min; in wf_fcu_get_pump_minmax()
313 fan->max = pump_max; in wf_fcu_get_pump_minmax()
316 fan->ctrl.name, pump_min, pump_max); in wf_fcu_get_pump_minmax()
319 static void wf_fcu_get_rpmfan_minmax(struct wf_fcu_fan *fan) in wf_fcu_get_rpmfan_minmax() argument
321 struct wf_fcu_priv *pv = fan->fcu_priv; in wf_fcu_get_rpmfan_minmax()
326 fan->min = 2400 >> pv->rpm_shift; in wf_fcu_get_rpmfan_minmax()
327 fan->max = 56000 >> pv->rpm_shift; in wf_fcu_get_rpmfan_minmax()
330 if (mpu0 && !strcmp(fan->ctrl.name, "cpu-front-fan-0")) { in wf_fcu_get_rpmfan_minmax()
331 fan->min = max(fan->min, (s32)mpu0->rminn_intake_fan); in wf_fcu_get_rpmfan_minmax()
332 fan->max = min(fan->max, (s32)mpu0->rmaxn_intake_fan); in wf_fcu_get_rpmfan_minmax()
335 if (mpu1 && !strcmp(fan->ctrl.name, "cpu-front-fan-1")) { in wf_fcu_get_rpmfan_minmax()
336 fan->min = max(fan->min, (s32)mpu1->rminn_intake_fan); in wf_fcu_get_rpmfan_minmax()
337 fan->max = min(fan->max, (s32)mpu1->rmaxn_intake_fan); in wf_fcu_get_rpmfan_minmax()
340 if (mpu0 && !strcmp(fan->ctrl.name, "cpu-rear-fan-0")) { in wf_fcu_get_rpmfan_minmax()
341 fan->min = max(fan->min, (s32)mpu0->rminn_exhaust_fan); in wf_fcu_get_rpmfan_minmax()
342 fan->max = min(fan->max, (s32)mpu0->rmaxn_exhaust_fan); in wf_fcu_get_rpmfan_minmax()
345 if (mpu1 && !strcmp(fan->ctrl.name, "cpu-rear-fan-1")) { in wf_fcu_get_rpmfan_minmax()
346 fan->min = max(fan->min, (s32)mpu1->rminn_exhaust_fan); in wf_fcu_get_rpmfan_minmax()
347 fan->max = min(fan->max, (s32)mpu1->rmaxn_exhaust_fan); in wf_fcu_get_rpmfan_minmax()
351 if (!strncmp(fan->ctrl.name, "cpu-fan", 7)) { in wf_fcu_get_rpmfan_minmax()
352 fan->min = max(fan->min, (s32)mpu0->rminn_intake_fan); in wf_fcu_get_rpmfan_minmax()
353 fan->max = min(fan->max, (s32)mpu0->rmaxn_intake_fan); in wf_fcu_get_rpmfan_minmax()
358 fan->ctrl.name, fan->min, fan->max); in wf_fcu_get_rpmfan_minmax()
364 struct wf_fcu_fan *fan; in wf_fcu_add_fan() local
366 fan = kzalloc(sizeof(*fan), GFP_KERNEL); in wf_fcu_add_fan()
367 if (!fan) in wf_fcu_add_fan()
369 fan->fcu_priv = pv; in wf_fcu_add_fan()
370 fan->id = id; in wf_fcu_add_fan()
371 fan->ctrl.name = name; in wf_fcu_add_fan()
372 fan->ctrl.priv = fan; in wf_fcu_add_fan()
379 wf_fcu_get_pump_minmax(fan); in wf_fcu_add_fan()
381 wf_fcu_get_rpmfan_minmax(fan); in wf_fcu_add_fan()
382 fan->ctrl.type = WF_CONTROL_RPM_FAN; in wf_fcu_add_fan()
383 fan->ctrl.ops = &wf_fcu_fan_rpm_ops; in wf_fcu_add_fan()
385 fan->min = 10; in wf_fcu_add_fan()
386 fan->max = 100; in wf_fcu_add_fan()
387 fan->ctrl.type = WF_CONTROL_PWM_FAN; in wf_fcu_add_fan()
388 fan->ctrl.ops = &wf_fcu_fan_pwm_ops; in wf_fcu_add_fan()
391 if (wf_register_control(&fan->ctrl)) { in wf_fcu_add_fan()
393 kfree(fan); in wf_fcu_add_fan()
396 list_add(&fan->link, &pv->fan_list); in wf_fcu_add_fan()
566 struct wf_fcu_fan *fan; in wf_fcu_remove() local
569 fan = list_first_entry(&pv->fan_list, struct wf_fcu_fan, link); in wf_fcu_remove()
570 list_del(&fan->link); in wf_fcu_remove()
571 wf_unregister_control(&fan->ctrl); in wf_fcu_remove()