Home | History | Annotate | Download | only in dev

Lines Matching defs:fan

295 	struct smu_fan *fan;
306 fan = &sc->sc_fans[sc->sc_num_fans];
307 fan->sc = sc;
309 memset(fan->location, 0, sizeof(fan->location));
310 OF_getprop(node, "location", fan->location,
311 sizeof(fan->location));
313 if (OF_getprop(node, "reg", &fan->reg,
314 sizeof(fan->reg)) <= 0)
317 if (OF_getprop(node, "zone", &fan->zone ,
318 sizeof(fan->zone)) <= 0)
323 if (strcmp(type, "fan-rpm-control") == 0)
324 fan->rpm_ctl = 1;
326 fan->rpm_ctl = 0;
328 if (OF_getprop(node, "min-value", &fan->min_rpm,
329 sizeof(fan->min_rpm)) <= 0)
330 fan->min_rpm = 0;
332 if (OF_getprop(node, "max-value", &fan->max_rpm,
333 sizeof(fan->max_rpm)) <= 0)
334 fan->max_rpm = 0xffff;
336 if (OF_getprop(node, "unmanage-value", &fan->default_rpm,
337 sizeof(fan->default_rpm)) <= 0)
338 fan->default_rpm = fan->max_rpm;
340 DPRINTF("fan: location %s reg %x zone %d rpm_ctl %d "
342 fan->location, fan->reg, fan->zone, fan->rpm_ctl,
343 fan->min_rpm, fan->max_rpm, fan->default_rpm);
345 fan->wanted_rpm = fan->default_rpm;
346 fan->fault = 0;
353 fan = &sc->sc_fans[i];
354 smu_fan_set_rpm(sc, i, fan->default_rpm);
355 smu_fan_update_rpm(fan);
406 struct smu_fan *fan;
415 fan = &sc->sc_fans[i];
420 "%s", fan->location);
652 smu_fan_update_rpm(struct smu_fan *fan)
654 struct smu_softc *sc = fan->sc;
661 cmd.data[1] = fan->reg;
665 fan->last_update = time_uptime;
666 fan->current_rpm = (cmd.data[0] << 8) | cmd.data[1];
674 fan->last_update = time_uptime;
675 fan->current_rpm = (cmd.data[1 + fan->reg * 2] << 8) |
676 cmd.data[2 + fan->reg * 2];
679 diff = abs(fan->current_rpm - fan->wanted_rpm);
680 if (diff > fan->max_rpm >> 3) {
681 fan->fault++;
682 } else fan->fault = 0;
690 struct smu_fan *fan = &sc->sc_fans[which];
694 if (time_uptime - fan->last_update > 1) {
695 ret = smu_fan_update_rpm(fan);
700 return fan->current_rpm;
707 struct smu_fan *fan = &sc->sc_fans[which];
711 DPRINTF("%s: fan %s rpm %d\n", __func__, fan->location, rpm);
713 rpm = uimax(fan->min_rpm, rpm);
714 rpm = uimin(fan->max_rpm, rpm);
716 fan->wanted_rpm = rpm;
721 cmd.data[1] = fan->reg;
729 cmd.data[0] = fan->rpm_ctl ? 0x00 : 0x10;
730 cmd.data[1] = 1 << fan->reg;
731 cmd.data[2] = cmd.data[2 + fan->reg * 2] = (rpm >> 8) & 0xff;
732 cmd.data[3] = cmd.data[3 + fan->reg * 2] = rpm & 0xff;
904 "fan control");