smusat.c (231770) | smusat.c (300421) |
---|---|
1/*- 2 * Copyright (c) 2010 Nathan Whitehorn 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 Nathan Whitehorn 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/smusat.c 231770 2012-02-15 16:59:24Z nwhitehorn $"); | 29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/smusat.c 300421 2016-05-22 13:58:32Z loos $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/module.h> 34#include <sys/bus.h> 35#include <sys/conf.h> 36#include <sys/cpu.h> 37#include <sys/ctype.h> --- 141 unchanged lines hidden (view full) --- 179 sprintf(sysctl_desc,"%s (%s)", sens->therm.name, units); 180 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, 181 sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 182 sc->sc_nsensors, smusat_sensor_sysctl, 183 (sens->type == SMU_TEMP_SENSOR) ? "IK" : "I", sysctl_desc); 184 185 if (sens->type == SMU_TEMP_SENSOR) { 186 /* Make up some numbers */ | 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/module.h> 34#include <sys/bus.h> 35#include <sys/conf.h> 36#include <sys/cpu.h> 37#include <sys/ctype.h> --- 141 unchanged lines hidden (view full) --- 179 sprintf(sysctl_desc,"%s (%s)", sens->therm.name, units); 180 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, 181 sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 182 sc->sc_nsensors, smusat_sensor_sysctl, 183 (sens->type == SMU_TEMP_SENSOR) ? "IK" : "I", sysctl_desc); 184 185 if (sens->type == SMU_TEMP_SENSOR) { 186 /* Make up some numbers */ |
187 sens->therm.target_temp = 500 + 2732; /* 50 C */ 188 sens->therm.max_temp = 900 + 2732; /* 90 C */ | 187 sens->therm.target_temp = 500 + 2731; /* 50 C */ 188 sens->therm.max_temp = 900 + 2731; /* 90 C */ |
189 sens->therm.read = 190 (int (*)(struct pmac_therm *))smusat_sensor_read; 191 pmac_thermal_sensor_register(&sens->therm); 192 } 193 194 sens++; 195 sc->sc_nsensors++; 196 } --- 46 unchanged lines hidden (view full) --- 243 return (-EINVAL); 244 } 245 246 switch (sens->type) { 247 case SMU_TEMP_SENSOR: 248 /* 16.16 */ 249 value <<= 10; 250 /* From 16.16 to 0.1 C */ | 189 sens->therm.read = 190 (int (*)(struct pmac_therm *))smusat_sensor_read; 191 pmac_thermal_sensor_register(&sens->therm); 192 } 193 194 sens++; 195 sc->sc_nsensors++; 196 } --- 46 unchanged lines hidden (view full) --- 243 return (-EINVAL); 244 } 245 246 switch (sens->type) { 247 case SMU_TEMP_SENSOR: 248 /* 16.16 */ 249 value <<= 10; 250 /* From 16.16 to 0.1 C */ |
251 value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; | 251 value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2731; |
252 break; 253 case SMU_VOLTAGE_SENSOR: 254 /* 16.16 */ 255 value <<= 4; 256 /* Kill the .16 */ 257 value >>= 16; 258 break; 259 case SMU_CURRENT_SENSOR: --- 34 unchanged lines hidden --- | 252 break; 253 case SMU_VOLTAGE_SENSOR: 254 /* 16.16 */ 255 value <<= 4; 256 /* Kill the .16 */ 257 value >>= 16; 258 break; 259 case SMU_CURRENT_SENSOR: --- 34 unchanged lines hidden --- |