Lines Matching +full:fan +full:- +full:0
1 /*-
55 struct pmac_fan fan; member
69 static int adm1030_set(struct adm1030_softc *fan, int pwm);
76 {0, 0},
85 DRIVER_MODULE(adm1030, iicbus, adm1030_driver, 0, 0);
91 int try = 0; in adm1030_write_byte()
94 {addr, IIC_M_WR, 0, buf} in adm1030_write_byte()
97 msg[0].len = 2; in adm1030_write_byte()
98 buf[0] = reg; in adm1030_write_byte()
103 if (iicbus_transfer(dev, msg, 1) == 0) in adm1030_write_byte()
104 return (0); in adm1030_write_byte()
108 return (-1); in adm1030_write_byte()
129 if (strcmp(name, "fan") != 0 || strcmp(compatible, "adm1030") != 0) in adm1030_probe()
133 if (OF_getprop(handle, "platform-getTemp", &thermostat, sizeof(thermostat)) < 0) in adm1030_probe()
137 sc->sc_dev = dev; in adm1030_probe()
138 sc->sc_addr = iicbus_get_addr(dev); in adm1030_probe()
140 device_set_desc(dev, "G4 MDD Fan driver"); in adm1030_probe()
142 return (0); in adm1030_probe()
154 sc->enum_hook.ich_func = adm1030_start; in adm1030_attach()
155 sc->enum_hook.ich_arg = dev; in adm1030_attach()
162 if (config_intrhook_establish(&sc->enum_hook) != 0) in adm1030_attach()
169 0, adm1030_sysctl, "I", "Fan PWM Rate"); in adm1030_attach()
171 return (0); in adm1030_attach()
184 adm1030_write_byte(sc->sc_dev, sc->sc_addr, 0x1, 0x1); in adm1030_start()
185 adm1030_write_byte(sc->sc_dev, sc->sc_addr, 0x0, 0x95); in adm1030_start()
186 adm1030_write_byte(sc->sc_dev, sc->sc_addr, 0x23, 0x91); in adm1030_start()
189 sc->fan.min_rpm = 0; in adm1030_start()
190 sc->fan.max_rpm = 0x0F; in adm1030_start()
191 sc->fan.default_rpm = 2; in adm1030_start()
193 strcpy(sc->fan.name, "MDD Case fan"); in adm1030_start()
194 sc->fan.zone = 0; in adm1030_start()
195 sc->fan.read = NULL; in adm1030_start()
196 sc->fan.set = (int (*)(struct pmac_fan *, int))adm1030_set; in adm1030_start()
197 config_intrhook_disestablish(&sc->enum_hook); in adm1030_start()
199 pmac_thermal_fan_register(&sc->fan); in adm1030_start()
202 static int adm1030_set(struct adm1030_softc *fan, int pwm) in adm1030_set() argument
204 /* Clamp the PWM to 0-0xF, one nibble. */ in adm1030_set()
205 if (pwm > 0xF) in adm1030_set()
206 pwm = 0xF; in adm1030_set()
207 if (pwm < 0) in adm1030_set()
208 pwm = 0; in adm1030_set()
210 if (adm1030_write_byte(fan->sc_dev, fan->sc_addr, 0x22, pwm) < 0) in adm1030_set()
211 return (-1); in adm1030_set()
213 fan->sc_pwm = pwm; in adm1030_set()
214 return (0); in adm1030_set()
227 pwm = sc->sc_pwm; in adm1030_sysctl()
229 error = sysctl_handle_int(oidp, &pwm, 0, req); in adm1030_sysctl()
231 if (error || !req->newptr) in adm1030_sysctl()