Fix the deciKelvin to Celsius conversion in kernel.

After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by:	Rubicon Communications (Netgate)
This commit is contained in:
Luiz Otavio O Souza 2016-05-22 13:58:32 +00:00
parent 050c87f9a1
commit 9d6672e13b
15 changed files with 21 additions and 21 deletions

View File

@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
#define AXP209_TEMPMON_L(a) ((a) & 0xf)
#define AXP209_TEMPMON_MIN 1447 /* -144.7C */
#define AXP209_0C_TO_K 2732
#define AXP209_0C_TO_K 2731
struct axp209_softc {
uint32_t addr;

View File

@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$");
#define MSG_ERROR -999999999
#define MHZSTEP 100
#define HZSTEP (MHZ2HZ(MHZSTEP))
#define TZ_ZEROC 2732
#define TZ_ZEROC 2731
#define VC_LOCK(sc) do { \
sema_wait(&vc_sema); \

View File

@ -139,7 +139,7 @@ static struct oppt {
*/
static uint32_t imx6_ocotp_mhz_tab[] = {792, 852, 996, 1200};
#define TZ_ZEROC 2732 /* deci-Kelvin <-> deci-Celcius offset. */
#define TZ_ZEROC 2731 /* deci-Kelvin <-> deci-Celcius offset. */
uint32_t
imx6_anatop_read_4(bus_size_t offset)

View File

@ -80,7 +80,7 @@ ts_probe(device_t dev)
#define MV_TEMP_SENS_OFFS 10
#define MV_TEMP_SENS_MASK 0x1ff
#define MV_TEMP_SENS_READ_MAX 16
#define TZ_ZEROC 2732
#define TZ_ZEROC 2731
#define MV_TEMP_CONVERT(x) ((((322 - x) * 100000) / 13625) + TZ_ZEROC)
/*

View File

@ -498,7 +498,7 @@ acpi_asus_wmi_sysctl_get(struct acpi_asus_wmi_softc *sc, int dev_id)
switch(dev_id) {
case ASUS_WMI_DEVID_THERMAL_CTRL:
val = (val - 2732 + 5) / 10;
val = (val - 2731 + 5) / 10;
break;
case ASUS_WMI_DEVID_PROCESSOR_STATE:
case ASUS_WMI_DEVID_FAN_CTRL:

View File

@ -941,7 +941,7 @@ acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_ARGS)
temp[i] = -1;
else if (sc->thermal_updt_supported)
/* Temperature is reported in tenth of Kelvin */
temp[i] = (temp[i] - 2732 + 5) / 10;
temp[i] = (temp[i] - 2731 + 5) / 10;
}
error = sysctl_handle_opaque(oidp, &temp, 8*sizeof(int), req);

View File

@ -344,9 +344,9 @@ aibs_sysctl(SYSCTL_HANDLER_ARGS)
case AIBS_VOLT:
break;
case AIBS_TEMP:
v += 2732;
l += 2732;
h += 2732;
v += 2731;
l += 2731;
h += 2731;
break;
case AIBS_FAN:
break;

View File

@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
#define _COMPONENT ACPI_THERMAL
ACPI_MODULE_NAME("THERMAL")
#define TZ_ZEROC 2732
#define TZ_ZEROC 2731
#define TZ_KELVTOC(x) (((x) - TZ_ZEROC) / 10), abs(((x) - TZ_ZEROC) % 10)
#define TZ_NOTIFY_TEMPERATURE 0x80 /* Temperature changed. */

View File

@ -505,7 +505,7 @@ amdtemp_sysctl(SYSCTL_HANDLER_ARGS)
return (error);
}
#define AMDTEMP_ZERO_C_TO_K 2732
#define AMDTEMP_ZERO_C_TO_K 2731
static int32_t
amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)

View File

@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cputypes.h>
#include <machine/md_var.h>
#define TZ_ZEROC 2732
#define TZ_ZEROC 2731
#define THERM_STATUS_LOG 0x02
#define THERM_STATUS 0x01

View File

@ -73,6 +73,6 @@
#define DS3231_0250C 0x40
#define DS3231_MSB 0x8000
#define DS3231_NEG_BIT DS3231_MSB
#define TZ_ZEROC 2732
#define TZ_ZEROC 2731
#endif /* _DS3231REG_H_ */

View File

@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#define LM75_0125C 0x20
#define LM75_MSB 0x8000
#define LM75_NEG_BIT LM75_MSB
#define TZ_ZEROC 2732
#define TZ_ZEROC 2731
/* LM75 supported models. */
#define HWTYPE_LM75 1

View File

@ -29,7 +29,7 @@
#ifndef _POWERPC_POWERMAC_POWERMAC_THERMAL_H
#define _POWERPC_POWERMAC_POWERMAC_THERMAL_H
#define ZERO_C_TO_K 2732
#define ZERO_C_TO_K 2731
struct pmac_fan {
int min_rpm, max_rpm, default_rpm;

View File

@ -1110,7 +1110,7 @@ smu_sensor_read(struct smu_sensor *sens)
value <<= 1;
/* Convert from 16.16 fixed point degC into integer 0.1 K. */
value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732;
value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2731;
break;
case SMU_VOLTAGE_SENSOR:
value *= sc->sc_cpu_volt_scale;
@ -1245,8 +1245,8 @@ smu_attach_sensors(device_t dev, phandle_t sensroot)
if (sens->type == SMU_TEMP_SENSOR) {
/* Make up some numbers */
sens->therm.target_temp = 500 + 2732; /* 50 C */
sens->therm.max_temp = 900 + 2732; /* 90 C */
sens->therm.target_temp = 500 + 2731; /* 50 C */
sens->therm.max_temp = 900 + 2731; /* 90 C */
sens->therm.read =
(int (*)(struct pmac_therm *))smu_sensor_read;

View File

@ -184,8 +184,8 @@ smusat_attach(device_t dev)
if (sens->type == SMU_TEMP_SENSOR) {
/* Make up some numbers */
sens->therm.target_temp = 500 + 2732; /* 50 C */
sens->therm.max_temp = 900 + 2732; /* 90 C */
sens->therm.target_temp = 500 + 2731; /* 50 C */
sens->therm.max_temp = 900 + 2731; /* 90 C */
sens->therm.read =
(int (*)(struct pmac_therm *))smusat_sensor_read;
pmac_thermal_sensor_register(&sens->therm);
@ -248,7 +248,7 @@ smusat_sensor_read(struct smu_sensor *sens)
/* 16.16 */
value <<= 10;
/* From 16.16 to 0.1 C */
value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2732;
value = 10*(value >> 16) + ((10*(value & 0xffff)) >> 16) + 2731;
break;
case SMU_VOLTAGE_SENSOR:
/* 16.16 */