svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

Luiz Otavio O Souza loos at FreeBSD.org
Sun May 22 13:58:35 UTC 2016


Author: loos
Date: Sun May 22 13:58:32 2016
New Revision: 300421
URL: https://svnweb.freebsd.org/changeset/base/300421

Log:
  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)

Modified:
  head/sys/arm/allwinner/axp209.c
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
  head/sys/arm/freescale/imx/imx6_anatop.c
  head/sys/arm/mv/mv_ts.c
  head/sys/dev/acpi_support/acpi_asus_wmi.c
  head/sys/dev/acpi_support/acpi_ibm.c
  head/sys/dev/acpi_support/atk0110.c
  head/sys/dev/acpica/acpi_thermal.c
  head/sys/dev/amdtemp/amdtemp.c
  head/sys/dev/coretemp/coretemp.c
  head/sys/dev/iicbus/ds3231reg.h
  head/sys/dev/iicbus/lm75.c
  head/sys/powerpc/powermac/powermac_thermal.h
  head/sys/powerpc/powermac/smu.c
  head/sys/powerpc/powermac/smusat.c

Modified: head/sys/arm/allwinner/axp209.c
==============================================================================
--- head/sys/arm/allwinner/axp209.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/arm/allwinner/axp209.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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;

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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);		\

Modified: head/sys/arm/freescale/imx/imx6_anatop.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_anatop.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/arm/freescale/imx/imx6_anatop.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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)

Modified: head/sys/arm/mv/mv_ts.c
==============================================================================
--- head/sys/arm/mv/mv_ts.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/arm/mv/mv_ts.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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)
 
 /*

Modified: head/sys/dev/acpi_support/acpi_asus_wmi.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_asus_wmi.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/acpi_support/acpi_asus_wmi.c	Sun May 22 13:58:32 2016	(r300421)
@@ -498,7 +498,7 @@ acpi_asus_wmi_sysctl_get(struct acpi_asu
 
 	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:

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_ibm.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/acpi_support/acpi_ibm.c	Sun May 22 13:58:32 2016	(r300421)
@@ -941,7 +941,7 @@ acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_A
 			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);

Modified: head/sys/dev/acpi_support/atk0110.c
==============================================================================
--- head/sys/dev/acpi_support/atk0110.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/acpi_support/atk0110.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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;

Modified: head/sys/dev/acpica/acpi_thermal.c
==============================================================================
--- head/sys/dev/acpica/acpi_thermal.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/acpica/acpi_thermal.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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. */

Modified: head/sys/dev/amdtemp/amdtemp.c
==============================================================================
--- head/sys/dev/amdtemp/amdtemp.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/amdtemp/amdtemp.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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)

Modified: head/sys/dev/coretemp/coretemp.c
==============================================================================
--- head/sys/dev/coretemp/coretemp.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/coretemp/coretemp.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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

Modified: head/sys/dev/iicbus/ds3231reg.h
==============================================================================
--- head/sys/dev/iicbus/ds3231reg.h	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/iicbus/ds3231reg.h	Sun May 22 13:58:32 2016	(r300421)
@@ -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_ */

Modified: head/sys/dev/iicbus/lm75.c
==============================================================================
--- head/sys/dev/iicbus/lm75.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/dev/iicbus/lm75.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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

Modified: head/sys/powerpc/powermac/powermac_thermal.h
==============================================================================
--- head/sys/powerpc/powermac/powermac_thermal.h	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/powerpc/powermac/powermac_thermal.h	Sun May 22 13:58:32 2016	(r300421)
@@ -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;

Modified: head/sys/powerpc/powermac/smu.c
==============================================================================
--- head/sys/powerpc/powermac/smu.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/powerpc/powermac/smu.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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
 
 		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;

Modified: head/sys/powerpc/powermac/smusat.c
==============================================================================
--- head/sys/powerpc/powermac/smusat.c	Sun May 22 13:32:45 2016	(r300420)
+++ head/sys/powerpc/powermac/smusat.c	Sun May 22 13:58:32 2016	(r300421)
@@ -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 *se
 		/* 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 */


More information about the svn-src-all mailing list