smu.c (297793) | smu.c (300421) |
---|---|
1/*- 2 * Copyright (c) 2009 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) 2009 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/smu.c 297793 2016-04-10 23:07:00Z pfg $"); | 29__FBSDID("$FreeBSD: head/sys/powerpc/powermac/smu.c 300421 2016-05-22 13:58:32Z loos $"); |
30 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/systm.h> 34#include <sys/module.h> 35#include <sys/conf.h> 36#include <sys/cpu.h> 37#include <sys/clock.h> --- 1067 unchanged lines hidden (view full) --- 1105 switch (sens->type) { 1106 case SMU_TEMP_SENSOR: 1107 value *= sc->sc_cpu_diode_scale; 1108 value >>= 3; 1109 value += ((int64_t)sc->sc_cpu_diode_offset) << 9; 1110 value <<= 1; 1111 1112 /* Convert from 16.16 fixed point degC into integer 0.1 K. */ | 30 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/systm.h> 34#include <sys/module.h> 35#include <sys/conf.h> 36#include <sys/cpu.h> 37#include <sys/clock.h> --- 1067 unchanged lines hidden (view full) --- 1105 switch (sens->type) { 1106 case SMU_TEMP_SENSOR: 1107 value *= sc->sc_cpu_diode_scale; 1108 value >>= 3; 1109 value += ((int64_t)sc->sc_cpu_diode_offset) << 9; 1110 value <<= 1; 1111 1112 /* Convert from 16.16 fixed point degC into integer 0.1 K. */ |
1113 value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732; | 1113 value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2731; |
1114 break; 1115 case SMU_VOLTAGE_SENSOR: 1116 value *= sc->sc_cpu_volt_scale; 1117 value += sc->sc_cpu_volt_offset; 1118 value <<= 4; 1119 1120 /* Convert from 16.16 fixed point V into mV. */ 1121 value *= 15625; --- 118 unchanged lines hidden (view full) --- 1240 1241 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, 1242 sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, 1243 dev, sc->sc_nsensors, smu_sensor_sysctl, 1244 (sens->type == SMU_TEMP_SENSOR) ? "IK" : "I", sysctl_desc); 1245 1246 if (sens->type == SMU_TEMP_SENSOR) { 1247 /* Make up some numbers */ | 1114 break; 1115 case SMU_VOLTAGE_SENSOR: 1116 value *= sc->sc_cpu_volt_scale; 1117 value += sc->sc_cpu_volt_offset; 1118 value <<= 4; 1119 1120 /* Convert from 16.16 fixed point V into mV. */ 1121 value *= 15625; --- 118 unchanged lines hidden (view full) --- 1240 1241 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, 1242 sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, 1243 dev, sc->sc_nsensors, smu_sensor_sysctl, 1244 (sens->type == SMU_TEMP_SENSOR) ? "IK" : "I", sysctl_desc); 1245 1246 if (sens->type == SMU_TEMP_SENSOR) { 1247 /* Make up some numbers */ |
1248 sens->therm.target_temp = 500 + 2732; /* 50 C */ 1249 sens->therm.max_temp = 900 + 2732; /* 90 C */ | 1248 sens->therm.target_temp = 500 + 2731; /* 50 C */ 1249 sens->therm.max_temp = 900 + 2731; /* 90 C */ |
1250 1251 sens->therm.read = 1252 (int (*)(struct pmac_therm *))smu_sensor_read; 1253 pmac_thermal_sensor_register(&sens->therm); 1254 } 1255 1256 sens++; 1257 sc->sc_nsensors++; --- 322 unchanged lines hidden --- | 1250 1251 sens->therm.read = 1252 (int (*)(struct pmac_therm *))smu_sensor_read; 1253 pmac_thermal_sensor_register(&sens->therm); 1254 } 1255 1256 sens++; 1257 sc->sc_nsensors++; --- 322 unchanged lines hidden --- |