Lines Matching refs:fan
32 nvkm_fan_update(struct nvkm_fan *fan, bool immediate, int target) in nvkm_fan_update() argument
34 struct nvkm_therm *therm = fan->parent; in nvkm_fan_update()
42 spin_lock_irqsave(&fan->lock, flags); in nvkm_fan_update()
44 target = fan->percent; in nvkm_fan_update()
45 target = max_t(u8, target, fan->bios.min_duty); in nvkm_fan_update()
46 target = min_t(u8, target, fan->bios.max_duty); in nvkm_fan_update()
47 if (fan->percent != target) { in nvkm_fan_update()
49 fan->percent = target; in nvkm_fan_update()
53 duty = fan->get(therm); in nvkm_fan_update()
55 spin_unlock_irqrestore(&fan->lock, flags); in nvkm_fan_update()
74 ret = fan->set(therm, duty); in nvkm_fan_update()
76 spin_unlock_irqrestore(&fan->lock, flags); in nvkm_fan_update()
83 spin_unlock_irqrestore(&fan->lock, flags); in nvkm_fan_update()
87 u16 bump_period = fan->bios.bump_period; in nvkm_fan_update()
88 u16 slow_down_period = fan->bios.slow_down_period; in nvkm_fan_update()
98 nvkm_timer_alarm(tmr, delay * 1000 * 1000, &fan->alarm); in nvkm_fan_update()
107 struct nvkm_fan *fan = container_of(alarm, struct nvkm_fan, alarm); in nvkm_fan_alarm() local
108 nvkm_fan_update(fan, false, -1); in nvkm_fan_alarm()
114 return therm->fan->get(therm); in nvkm_therm_fan_get()
120 return nvkm_fan_update(therm->fan, immediate, percent); in nvkm_therm_fan_set()
135 if (therm->fan->tach.func == DCB_GPIO_UNUSED) in nvkm_therm_fan_sense()
143 prev = nvkm_gpio_get(gpio, 0, therm->fan->tach.func, in nvkm_therm_fan_sense()
144 therm->fan->tach.line); in nvkm_therm_fan_sense()
149 cur = nvkm_gpio_get(gpio, 0, therm->fan->tach.func, in nvkm_therm_fan_sense()
150 therm->fan->tach.line); in nvkm_therm_fan_sense()
186 therm->fan->bios.pwm_freq = 0; in nvkm_therm_fan_set_defaults()
187 therm->fan->bios.min_duty = 0; in nvkm_therm_fan_set_defaults()
188 therm->fan->bios.max_duty = 100; in nvkm_therm_fan_set_defaults()
189 therm->fan->bios.bump_period = 500; in nvkm_therm_fan_set_defaults()
190 therm->fan->bios.slow_down_period = 2000; in nvkm_therm_fan_set_defaults()
191 therm->fan->bios.linear_min_temp = 40; in nvkm_therm_fan_set_defaults()
192 therm->fan->bios.linear_max_temp = 85; in nvkm_therm_fan_set_defaults()
198 if (therm->fan->bios.min_duty > 100) in nvkm_therm_fan_safety_checks()
199 therm->fan->bios.min_duty = 100; in nvkm_therm_fan_safety_checks()
200 if (therm->fan->bios.max_duty > 100) in nvkm_therm_fan_safety_checks()
201 therm->fan->bios.max_duty = 100; in nvkm_therm_fan_safety_checks()
203 if (therm->fan->bios.min_duty > therm->fan->bios.max_duty) in nvkm_therm_fan_safety_checks()
204 therm->fan->bios.min_duty = therm->fan->bios.max_duty; in nvkm_therm_fan_safety_checks()
218 nvkm_timer_alarm(tmr, 0, &therm->fan->alarm); in nvkm_therm_fan_fini()
253 nvkm_debug(subdev, "FAN control: %s\n", therm->fan->type); in nvkm_therm_fan_ctor()
256 therm->fan->percent = nvkm_therm_fan_get(therm); in nvkm_therm_fan_ctor()
260 &therm->fan->tach); in nvkm_therm_fan_ctor()
262 therm->fan->tach.func = DCB_GPIO_UNUSED; in nvkm_therm_fan_ctor()
265 therm->fan->parent = therm; in nvkm_therm_fan_ctor()
266 nvkm_alarm_init(&therm->fan->alarm, nvkm_fan_alarm); in nvkm_therm_fan_ctor()
267 spin_lock_init(&therm->fan->lock); in nvkm_therm_fan_ctor()
271 nvbios_perf_fan_parse(bios, &therm->fan->perf); in nvkm_therm_fan_ctor()
272 if (!nvbios_fan_parse(bios, &therm->fan->bios)) { in nvkm_therm_fan_ctor()
274 if (nvbios_therm_fan_parse(bios, &therm->fan->bios)) in nvkm_therm_fan_ctor()