[PATCH] acpi: Read temperature before trip points for HP Compaq 6715b and 6715s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Katabami Kohei <katabami@xxxxxxxxxxx>

For HP Compaq 6715b and 6715s, temperature has to be read before
trip points. This fixes bug #43284 which is introduced by:

commit 9bcb8118965ab4631a65ee0726e6518f75cda6c5
Author: Matthew Garrett <mjg <at> redhat.com>
Date:   Wed Feb 1 10:26:54 2012 -0500

  ACPI: Evaluate thermal trip points before reading temperature

The patch is originally written by Jason Vas Dias:
http://thread.gmane.org/gmane.linux.kernel/1324409/focus=1324503

Katabami cleaned it up.

Cc: stable@xxxxxxxxxxxxxxx # >= 3.4
Reported-by: Suloev Dmitry <suloevdmitry@xxxxxxxxx>
Reviewed-by: Thomas Renninger <trenn@xxxxxxx>
Signed-off-by: Katabami Kohei <katabami@xxxxxxxxxxx>
Signed-off-by: Andreas Herrmann <herrmann.der.user@xxxxxxxxxxxxxx>
---
 drivers/acpi/thermal.c |   56 +++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 48 insertions(+), 8 deletions(-)

Hi Len,

I didn't find Katabami's patch in your git tree. Please apply this
patch as soon as possible as in fact it's fixing a regression that was
introduced with Matthew's change.

The corresponding bug report is
http://bugzilla.kernel.org/show_bug.cgi?id=43284

I've rebased the patch on v3.7-rc6-46-g45e7715 and also added a stable
tag.


Thanks,

Andreas

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 804204d..5efb9de 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -96,6 +96,8 @@ static int psv;
 module_param(psv, int, 0644);
 MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
 
+static int temp_before_trip;
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static void acpi_thermal_notify(struct acpi_device *device, u32 event);
@@ -992,15 +994,32 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
 	if (!tz)
 		return -EINVAL;
 
-	/* Get trip points [_CRT, _PSV, etc.] (required) */
-	result = acpi_thermal_get_trip_points(tz);
-	if (result)
-		return result;
+	if (temp_before_trip) {
+		/*
+		 * some hardwares need temperature before trip points
+		 * can be obtained
+		 */
 
-	/* Get temperature [_TMP] (required) */
-	result = acpi_thermal_get_temperature(tz);
-	if (result)
-		return result;
+		/* Get temperature [_TMP] (required) */
+		result = acpi_thermal_get_temperature(tz);
+		if (result)
+			return result;
+
+		/* Get trip points [_CRT, _PSV, etc.] (required) */
+		result = acpi_thermal_get_trip_points(tz);
+		if (result)
+			return result;
+	} else {
+		/* Get trip points [_CRT, _PSV, etc.] (required) */
+		result = acpi_thermal_get_trip_points(tz);
+		if (result)
+			return result;
+
+		/* Get temperature [_TMP] (required) */
+		result = acpi_thermal_get_temperature(tz);
+		if (result)
+			return result;
+		}
 
 	/* Set the cooling mode [_SCP] to active cooling (default) */
 	result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
@@ -1164,6 +1183,15 @@ static int thermal_psv(const struct dmi_system_id *d) {
 	return 0;
 }
 
+static int thermal_temp_before_trip(const struct dmi_system_id *d)
+{
+
+	printk(KERN_NOTICE "ACPI: %s detected: getting temperature before trip point initialisation\n",
+	       d->ident);
+	temp_before_trip = 1;
+	return 0;
+}
+
 static struct dmi_system_id thermal_dmi_table[] __initdata = {
 	/*
 	 * Award BIOS on this AOpen makes thermal control almost worthless.
@@ -1201,6 +1229,18 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
 		DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
 		},
 	},
+	/*
+	 * Some HP Compaq require temperature before trip points
+	 * https://bugzilla.kernel.org/show_bug.cgi?id=43284
+	 */
+	{
+	 .callback = thermal_temp_before_trip,
+	 .ident = "HP Compaq 6715b or 6715s",
+	 .matches = {
+		     DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+		     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715"),
+		},
+	},
 	{}
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux