diff mbox

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

Message ID 20121121222619.GA9078@tweety (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Andreas Herrmann Nov. 21, 2012, 10:26 p.m. UTC
From: Katabami Kohei <katabami@lavabit.com>

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@vger.kernel.org # >= 3.4
Reported-by: Suloev Dmitry <suloevdmitry@gmail.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Katabami Kohei <katabami@lavabit.com>
Signed-off-by: Andreas Herrmann <herrmann.der.user@googlemail.com>
---
 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

Comments

Rafael Wysocki Nov. 22, 2012, 10:21 p.m. UTC | #1
On Wednesday, November 21, 2012 11:26:20 PM Andreas Herrmann wrote:
> From: Katabami Kohei <katabami@lavabit.com>
> 
> 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.

Rui, I need your ACK for this patch, if you agree with it.

Thanks,
Rafael


> Cc: stable@vger.kernel.org # >= 3.4
> Reported-by: Suloev Dmitry <suloevdmitry@gmail.com>
> Reviewed-by: Thomas Renninger <trenn@suse.de>
> Signed-off-by: Katabami Kohei <katabami@lavabit.com>
> Signed-off-by: Andreas Herrmann <herrmann.der.user@googlemail.com>
> ---
>  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"),
> +		},
> +	},
>  	{}
>  };
>  
>
diff mbox

Patch

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"),
+		},
+	},
 	{}
 };