From patchwork Wed Jan 9 00:18:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 1949741 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9AE733FC5A for ; Wed, 9 Jan 2013 00:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756044Ab3AIATN (ORCPT ); Tue, 8 Jan 2013 19:19:13 -0500 Received: from mail-qa0-f52.google.com ([209.85.216.52]:42647 "EHLO mail-qa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755530Ab3AIATM (ORCPT ); Tue, 8 Jan 2013 19:19:12 -0500 Received: by mail-qa0-f52.google.com with SMTP id d13so245694qak.18 for ; Tue, 08 Jan 2013 16:19:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=HERftvdTl89BgOvbabdyppGyIU3IIsByPCCIPAqwiPc=; b=sOHf4p8FJR6y5v0fxOTq5yqBNBFdE6qWsxZu3W8h1Zn7SC8SEZ1P851MVPsp2D02cI VwLkxl/JIea11uSAg0f+SnwJWp6ElwONEt6WoTqWRxca9tIa297eTAPp9jjUR2K+7XSG Cd3Y0cE70zUo2nlYHvzmgDKwRzimxfmXLrsdMIGK+E2ErxtUBwUZjM/pBHhcvj47cKbP o0eRq3XnOjdOdv/GrtjpKPXdhAaElBGBKNFfn29Trnocbm7+6esLcEWgaqnGy5USKpKD yAnpfIBcXQDHOsjC8S3+VWjifjvGQo6uGnoJUnSSxQgnfQbMtjDLphlPfQqlogSBNtta Ra0w== X-Received: by 10.224.71.20 with SMTP id f20mr44314695qaj.71.1357690751593; Tue, 08 Jan 2013 16:19:11 -0800 (PST) Received: from localhost.localdomain (D32451F2.uspool.samsung.com. [211.36.81.242]) by mx.google.com with ESMTPS id v10sm22563953qaa.15.2013.01.08.16.19.09 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 16:19:10 -0800 (PST) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org, Zhang Rui Cc: linux-kernel@vger.kernel.org, durgadoss.r@intel.com Subject: [PATCH] Thermal: Fix to use read critical temperature when required Date: Tue, 8 Jan 2013 16:18:59 -0800 Message-Id: <1357690739-17009-1-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.5.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This patch modifies the code to use get_crit_temp instead of the normal get_trip_temp when critical threshold point is crossed or queried about. Signed-off-by: Amit Daniel Kachhap --- drivers/thermal/thermal_sys.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index ecdfc7d..0dc6403 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -345,7 +345,10 @@ static void handle_critical_trips(struct thermal_zone_device *tz, { long trip_temp; - tz->ops->get_trip_temp(tz, trip, &trip_temp); + if (tz->ops->get_crit_temp) + tz->ops->get_crit_temp(tz, &trip_temp); + else + tz->ops->get_trip_temp(tz, trip, &trip_temp); /* If we have not crossed the trip_temp, we do not care. */ if (tz->temperature < trip_temp) @@ -550,6 +553,7 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, struct thermal_zone_device *tz = to_thermal_zone(dev); int trip, ret; long temperature; + enum thermal_trip_type type; if (!tz->ops->get_trip_temp) return -EPERM; @@ -557,7 +561,14 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip)) return -EINVAL; - ret = tz->ops->get_trip_temp(tz, trip, &temperature); + ret = tz->ops->get_trip_type(tz, trip, &type); + if (ret) + return ret; + + if (type == THERMAL_TRIP_CRITICAL && tz->ops->get_crit_temp) + ret = tz->ops->get_crit_temp(tz, &temperature); + else + ret = tz->ops->get_trip_temp(tz, trip, &temperature); if (ret) return ret;