[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2045208.arlEGZ66vS@vostro.rjw.lan>
Date: Fri, 26 Apr 2013 14:07:45 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Zhang Rui <rui.zhang@...el.com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
linux-acpi@...r.kernel.org, lenb@...nel.org,
eduardo.valentin@...com
Subject: Re: [PATCH] ACPI thermal: do not always return THERMAL_TREND_RAISING for active trip points
On Friday, April 26, 2013 05:19:53 PM Zhang Rui wrote:
> Commit 4ae46befb49d4173122e0afa995c4e93d01948a2
> introduces a regression that the fan is always on
> even if the system is in idle state.
>
> My original idea in that commit is that:
> when the current temperature is above the trip point,
> keep the fan on, even if the temperature is dropping.
> when the current temperature is below the trip point,
> turn on the fan when the temperature is raising,
> turn off the fan when the temperature is dropping.
>
> But this is what the code actually does:
> when the current temperature is above the trip point,
> the fan keeps on.
> when the current temperature is below the trip point,
> the fan is always on because thermal_get_trend()
> in driver/acpi/thermal.c returns THERMAL_TREND_RAISING.
> Thus the fan keeps running even if the system is idle.
>
> Fix this in drivers/acpi/thermal.c.
>
> https://bugzilla.kernel.org/show_bug.cgi?id=56591
> https://bugzilla.kernel.org/show_bug.cgi?id=56601
> https://bugzilla.kernel.org/show_bug.cgi?id=50041#c45
>
> Patch should be applied to 3.7 stable kernel and later.
>
> Signed-off-by: Zhang Rui <rui.zhang@...el.com>
> Tested-by: Matthias <morpheusxyz123@...oo.de>
> Tested-by: Ville Syrjälä <syrjala@....fi>
> Cc: <stable@...r.kernel.org> # v3.7+
Applied.
Thanks,
Rafael
> ---
> drivers/acpi/thermal.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 8470771..a33821c 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -723,9 +723,19 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
> return -EINVAL;
>
> if (type == THERMAL_TRIP_ACTIVE) {
> - /* aggressive active cooling */
> - *trend = THERMAL_TREND_RAISING;
> - return 0;
> + unsigned long trip_temp;
> + unsigned long temp = KELVIN_TO_MILLICELSIUS(tz->temperature,
> + tz->kelvin_offset);
> + if (thermal_get_trip_temp(thermal, trip, &trip_temp))
> + return -EINVAL;
> +
> + if (temp > trip_temp) {
> + *trend = THERMAL_TREND_RAISING;
> + return 0;
> + } else {
> + /* Fall back on default trend */
> + return -EINVAL;
> + }
> }
>
> /*
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists