Lines Matching refs:therm

39 	struct nvkm_therm *therm = fan->parent;
40 struct nvkm_subdev *subdev = &therm->subdev;
60 duty = fan->get(therm);
83 ret = fan->set(therm, duty);
121 nvkm_therm_fan_get(struct nvkm_therm *therm)
123 return therm->fan->get(therm);
127 nvkm_therm_fan_set(struct nvkm_therm *therm, bool immediate, int percent)
129 return nvkm_fan_update(therm->fan, immediate, percent);
133 nvkm_therm_fan_sense(struct nvkm_therm *therm)
135 struct nvkm_device *device = therm->subdev.device;
141 if (therm->func->fan_sense)
142 return therm->func->fan_sense(therm);
144 if (therm->fan->tach.func == DCB_GPIO_UNUSED)
152 prev = nvkm_gpio_get(gpio, 0, therm->fan->tach.func,
153 therm->fan->tach.line);
158 cur = nvkm_gpio_get(gpio, 0, therm->fan->tach.func,
159 therm->fan->tach.line);
178 nvkm_therm_fan_user_get(struct nvkm_therm *therm)
180 return nvkm_therm_fan_get(therm);
184 nvkm_therm_fan_user_set(struct nvkm_therm *therm, int percent)
186 if (therm->mode != NVKM_THERM_CTRL_MANUAL)
189 return nvkm_therm_fan_set(therm, true, percent);
193 nvkm_therm_fan_set_defaults(struct nvkm_therm *therm)
195 therm->fan->bios.pwm_freq = 0;
196 therm->fan->bios.min_duty = 0;
197 therm->fan->bios.max_duty = 100;
198 therm->fan->bios.bump_period = 500;
199 therm->fan->bios.slow_down_period = 2000;
200 therm->fan->bios.linear_min_temp = 40;
201 therm->fan->bios.linear_max_temp = 85;
205 nvkm_therm_fan_safety_checks(struct nvkm_therm *therm)
207 if (therm->fan->bios.min_duty > 100)
208 therm->fan->bios.min_duty = 100;
209 if (therm->fan->bios.max_duty > 100)
210 therm->fan->bios.max_duty = 100;
212 if (therm->fan->bios.min_duty > therm->fan->bios.max_duty)
213 therm->fan->bios.min_duty = therm->fan->bios.max_duty;
217 nvkm_therm_fan_init(struct nvkm_therm *therm)
223 nvkm_therm_fan_fini(struct nvkm_therm *therm, bool suspend)
225 struct nvkm_timer *tmr = therm->subdev.device->timer;
227 nvkm_timer_alarm(tmr, 0, &therm->fan->alarm);
232 nvkm_therm_fan_dtor(struct nvkm_therm *therm)
234 if (therm->fan->dtor)
235 therm->fan->dtor(therm->fan);
236 spin_lock_destroy(&therm->fan->lock);
240 nvkm_therm_fan_ctor(struct nvkm_therm *therm)
242 struct nvkm_subdev *subdev = &therm->subdev;
257 ret = nvkm_fanpwm_create(therm, &func);
259 ret = nvkm_fantog_create(therm, &func);
265 ret = nvkm_fannil_create(therm);
270 nvkm_debug(subdev, "FAN control: %s\n", therm->fan->type);
273 therm->fan->percent = nvkm_therm_fan_get(therm);
277 &therm->fan->tach);
279 therm->fan->tach.func = DCB_GPIO_UNUSED;
282 therm->fan->parent = therm;
283 nvkm_alarm_init(&therm->fan->alarm, nvkm_fan_alarm);
284 spin_lock_init(&therm->fan->lock);
287 nvkm_therm_fan_set_defaults(therm);
288 nvbios_perf_fan_parse(bios, &therm->fan->perf);
289 if (!nvbios_fan_parse(bios, &therm->fan->bios)) {
291 if (nvbios_therm_fan_parse(bios, &therm->fan->bios))
294 nvkm_therm_fan_safety_checks(therm);