From patchwork Thu Jan 17 01:42:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 1993931 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 BB1B43FE4F for ; Thu, 17 Jan 2013 01:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757792Ab3AQBmn (ORCPT ); Wed, 16 Jan 2013 20:42:43 -0500 Received: from mail-ye0-f182.google.com ([209.85.213.182]:41625 "EHLO mail-ye0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756821Ab3AQBmm (ORCPT ); Wed, 16 Jan 2013 20:42:42 -0500 Received: by mail-ye0-f182.google.com with SMTP id q5so337034yen.27 for ; Wed, 16 Jan 2013 17:42:41 -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 :in-reply-to:references; bh=vZF9mGH87raCq9yleDXjLQqXc0a/CTrhLk7wLzYokI0=; b=iGkpf0Y7O3MxQzVHHtrPbHVmre0S2T4Wwx+TUEAJFu1n00gxdYJEIkFU3HvqAqId+h FNu0j7zRLBy9RhtYHLlf2EqKDsvhOuR6nqTTBG2N2zKpG6VzCpQ3dyoI08wycxEbVuho bSCanooPBvwWKgkH/R0WjeSTcBvXsMQLW3nzIVNiUP3Wim+Llrx+MrIk8QVy+rHx2CFv SqqGt7MGQ0xIB5TZF39ty8mZirjQUS2gCuF0Hgl/GA39UEc5Z5qWKVGdY4CNNGHans8W +26dOecTkfIj824cVj33DZSUGgW1jqDINxx2EZe8UvnhGhIr3qTHzIizCXh5W/vHyeal /yFg== X-Received: by 10.100.171.11 with SMTP id t11mr1070618ane.45.1358386961457; Wed, 16 Jan 2013 17:42:41 -0800 (PST) Received: from localhost.localdomain (D32451F2.uspool.samsung.com. [211.36.81.242]) by mx.google.com with ESMTPS id j39sm24148yhi.7.2013.01.16.17.42.38 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jan 2013 17:42:40 -0800 (PST) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org, Zhang Rui Cc: jonghwa3.lee@samsung.com, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, durgadoss.r@intel.com, joe@perches.com Subject: [PATCH V3 2/3] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt Date: Wed, 16 Jan 2013 17:42:18 -0800 Message-Id: <1358386938-13577-1-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Below fixes are done to support falling threshold interrupt, * Falling interrupt status macro corrected according to exynos5 data sheet. * The get trend function modified to calculate trip temperature correctly. * The clearing of interrupt status in the isr is now done after handling the event that caused the interrupt. Signed-off-by: Amit Daniel Kachhap --- Changes since V2, Incorporated Joe Perches review comments about coding guidelines. This path is based on thermal maintainer next tree. drivers/thermal/exynos_thermal.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index dcd13f7..f4dd68a 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c @@ -82,7 +82,7 @@ #define EXYNOS_TRIMINFO_RELOAD 0x1 #define EXYNOS_TMU_CLEAR_RISE_INT 0x111 -#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 16) +#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12) #define EXYNOS_MUX_ADDR_VALUE 6 #define EXYNOS_MUX_ADDR_SHIFT 20 #define EXYNOS_TMU_TRIP_MODE_SHIFT 13 @@ -373,7 +373,14 @@ static int exynos_get_temp(struct thermal_zone_device *thermal, static int exynos_get_trend(struct thermal_zone_device *thermal, int trip, enum thermal_trend *trend) { - if (thermal->temperature >= trip) + int ret; + unsigned long trip_temp; + + ret = exynos_get_trip_temp(thermal, trip, &trip_temp); + if (ret < 0) + return ret; + + if (thermal->temperature >= trip_temp) *trend = THERMAL_TREND_RAISING; else *trend = THERMAL_TREND_DROPPING; @@ -712,10 +719,9 @@ static void exynos_tmu_work(struct work_struct *work) struct exynos_tmu_data *data = container_of(work, struct exynos_tmu_data, irq_work); + exynos_report_trigger(); mutex_lock(&data->lock); clk_enable(data->clk); - - if (data->soc == SOC_ARCH_EXYNOS) writel(EXYNOS_TMU_CLEAR_RISE_INT | EXYNOS_TMU_CLEAR_FALL_INT, @@ -723,10 +729,9 @@ static void exynos_tmu_work(struct work_struct *work) else writel(EXYNOS4210_TMU_INTCLEAR_VAL, data->base + EXYNOS_TMU_REG_INTCLEAR); - clk_disable(data->clk); mutex_unlock(&data->lock); - exynos_report_trigger(); + enable_irq(data->irq); }