staticint
nvkm_fan_update(struct nvkm_fan *fan, bool immediate, int target)
{ struct nvkm_therm *therm = fan->parent; struct nvkm_subdev *subdev = &therm->subdev; struct nvkm_timer *tmr = subdev->device->timer; unsignedlong flags; int ret = 0; int duty;
/* update target fan speed, restricting to allowed range */
spin_lock_irqsave(&fan->lock, flags); if (target < 0)
target = fan->percent;
target = max_t(u8, target, fan->bios.min_duty);
target = min_t(u8, target, fan->bios.max_duty); if (fan->percent != target) {
nvkm_debug(subdev, "FAN target: %d\n", target);
fan->percent = target;
}
/* check that we're not already at the target duty cycle */
duty = fan->get(therm); if (duty == target) {
spin_unlock_irqrestore(&fan->lock, flags); return0;
}
/* smooth out the fanspeed increase/decrease */ if (!immediate && duty >= 0) { /* the constant "3" is a rough approximation taken from *nvidia'sbehaviour. *itismeanttobumpthefanspeedmoreincrementally
*/ if (duty < target)
duty = min(duty + 3, target); elseif (duty > target)
duty = max(duty - 3, target);
} else {
duty = target;
}
nvkm_debug(subdev, "FAN update: %d\n", duty);
ret = fan->set(therm, duty); if (ret) {
spin_unlock_irqrestore(&fan->lock, flags); return ret;
}
/* fan speed updated, drop the fan lock before grabbing the *alarm-schedulinglockandriskingadeadlock
*/
spin_unlock_irqrestore(&fan->lock, flags);
/* schedule next fan update, if not at target speed already */ if (target != duty) {
u16 bump_period = fan->bios.bump_period;
u16 slow_down_period = fan->bios.slow_down_period;
u64 delay;
/* attempt to locate a drivable fan, and determine control method */
ret = nvkm_gpio_find(gpio, 0, DCB_GPIO_FAN, 0xff, &func); if (ret == 0) { /* FIXME: is this really the place to perform such checks ? */ if (func.line != 16 && func.log[0] & DCB_GPIO_LOG_DIR_IN) {
nvkm_debug(subdev, "GPIO_FAN is in input mode\n");
ret = -EINVAL;
} else {
ret = nvkm_fanpwm_create(therm, &func); if (ret != 0)
ret = nvkm_fantog_create(therm, &func);
}
}
/* no controllable fan found, create a dummy fan module */ if (ret != 0) {
ret = nvkm_fannil_create(therm); if (ret) return ret;
}
/* read the current speed, it is useful when resuming */
therm->fan->percent = nvkm_therm_fan_get(therm);
/* attempt to detect a tachometer connection */
ret = nvkm_gpio_find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff,
&therm->fan->tach); if (ret)
therm->fan->tach.func = DCB_GPIO_UNUSED;
/* other random init... */
nvkm_therm_fan_set_defaults(therm);
nvbios_perf_fan_parse(bios, &therm->fan->perf); if (!nvbios_fan_parse(bios, &therm->fan->bios)) {
nvkm_debug(subdev, "parsing the fan table failed\n"); if (nvbios_therm_fan_parse(bios, &therm->fan->bios))
nvkm_error(subdev, "parsing both fan tables failed\n");
}
nvkm_therm_fan_safety_checks(therm); return0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-10-06)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.