Lines Matching +full:sensor +full:- +full:id
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
52 /* Inlet, Backside, U3 Heatsink sensor: MAX6690. */
65 int id; member
100 static MALLOC_DEFINE(M_MAX6690, "max6690", "Temp-Monitor MAX6690");
136 return (-1); in max6690_read()
154 if (strcmp(name, "temp-monitor") != 0 || in max6690_probe()
159 sc->sc_dev = dev; in max6690_probe()
160 sc->sc_addr = iicbus_get_addr(dev); in max6690_probe()
162 device_set_desc(dev, "Temp-Monitor MAX6690"); in max6690_probe()
169 * and we have allocated memory for sc->sc_sensors, we fill in the properties.
176 u_int id[8]; in max6690_fill_sensor_prop() local
184 /* Fill the sensor location property. */ in max6690_fill_sensor_prop()
185 prop_len = OF_getprop(child, "hwsensor-location", location, in max6690_fill_sensor_prop()
188 if (sc->sc_sensors != NULL) in max6690_fill_sensor_prop()
189 strcpy(sc->sc_sensors[i].therm.name, location + len); in max6690_fill_sensor_prop()
194 if (sc->sc_sensors == NULL) in max6690_fill_sensor_prop()
197 /* Fill the sensor id property. */ in max6690_fill_sensor_prop()
198 prop_len = OF_getprop(child, "hwsensor-id", id, sizeof(id)); in max6690_fill_sensor_prop()
200 sc->sc_sensors[j].id = (id[j] & 0xf); in max6690_fill_sensor_prop()
202 /* Fill the sensor zone property. */ in max6690_fill_sensor_prop()
203 prop_len = OF_getprop(child, "hwsensor-zone", id, sizeof(id)); in max6690_fill_sensor_prop()
205 sc->sc_sensors[j].therm.zone = id[j]; in max6690_fill_sensor_prop()
207 /* Set up remaining sensor properties */ in max6690_fill_sensor_prop()
209 sc->sc_sensors[j].dev = dev; in max6690_fill_sensor_prop()
217 if (strcmp(sc->sc_sensors[j].therm.name, "KODIAK DIODE") == 0) in max6690_fill_sensor_prop()
218 sc->sc_sensors[j].therm.target_temp = 640 + ZERO_C_TO_K; in max6690_fill_sensor_prop()
220 sc->sc_sensors[j].therm.target_temp = 400 + ZERO_C_TO_K; in max6690_fill_sensor_prop()
221 sc->sc_sensors[j].therm.max_temp = 850 + ZERO_C_TO_K; in max6690_fill_sensor_prop()
223 sc->sc_sensors[j].therm.read = in max6690_fill_sensor_prop()
236 sc->enum_hook.ich_func = max6690_start; in max6690_attach()
237 sc->enum_hook.ich_arg = dev; in max6690_attach()
242 * the master. The openpic on mac-io is controlling the htpic. in max6690_attach()
243 * This one gets attached after the mac-io probing and then the in max6690_attach()
247 if (config_intrhook_establish(&sc->enum_hook) != 0) in max6690_attach()
266 sc->sc_nsensors = 0; in max6690_start()
269 sc->sc_nsensors = max6690_fill_sensor_prop(dev); in max6690_start()
271 device_printf(dev, "%d sensors detected.\n", sc->sc_nsensors); in max6690_start()
273 if (sc->sc_nsensors == 0) in max6690_start()
276 sc->sc_sensors = malloc (sc->sc_nsensors * sizeof(struct max6690_sensor), in max6690_start()
281 SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor", in max6690_start()
282 CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "MAX6690 Sensor Information"); in max6690_start()
285 sc->sc_nsensors = max6690_fill_sensor_prop(dev); in max6690_start()
288 for (i = 0; i < sc->sc_nsensors; i++) in max6690_start()
289 pmac_thermal_sensor_register(&sc->sc_sensors[i].therm); in max6690_start()
292 for (i = 0; i < sc->sc_nsensors; i++) { in max6690_start()
293 for (j = 0; j < strlen(sc->sc_sensors[i].therm.name); j++) { in max6690_start()
295 tolower(sc->sc_sensors[i].therm.name[j]); in max6690_start()
301 sprintf(sysctl_desc,"%s %s", sc->sc_sensors[i].therm.name, in max6690_start()
305 "Sensor Information"); in max6690_start()
306 /* I use i to pass the sensor id. */ in max6690_start()
313 /* Dump sensor location & ID. */ in max6690_start()
316 for (i = 0; i < sc->sc_nsensors; i++) { in max6690_start()
317 device_printf(dev, "Location : %s ID: %d\n", in max6690_start()
318 sc->sc_sensors[i].therm.name, in max6690_start()
319 sc->sc_sensors[i].id); in max6690_start()
323 config_intrhook_disestablish(&sc->enum_hook); in max6690_start()
336 sc = device_get_softc(sens->dev); in max6690_sensor_read()
338 /* The internal sensor id's are even, the external are odd. */ in max6690_sensor_read()
339 if ((sens->id % 2) == 0) { in max6690_sensor_read()
347 err = max6690_read(sc->sc_dev, sc->sc_addr, reg_int, &integer); in max6690_sensor_read()
350 return (-1); in max6690_sensor_read()
352 err = max6690_read(sc->sc_dev, sc->sc_addr, reg_ext, &fraction); in max6690_sensor_read()
355 return (-1); in max6690_sensor_read()
378 sens = &sc->sc_sensors[arg2]; in max6690_sensor_sysctl()