From patchwork Sun Jan 6 23:50:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 1938291 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 74C5F3FED4 for ; Mon, 7 Jan 2013 00:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222Ab3AGAPD (ORCPT ); Sun, 6 Jan 2013 19:15:03 -0500 Received: from mail-yh0-f43.google.com ([209.85.213.43]:33614 "EHLO mail-yh0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753217Ab3AGAPD (ORCPT ); Sun, 6 Jan 2013 19:15:03 -0500 Received: by mail-yh0-f43.google.com with SMTP id 27so1044363yhr.30 for ; Sun, 06 Jan 2013 16:15:02 -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=iKeUAZo4USLhFw97/tF+jlwMaUS2K8aCDjpyO03Jesw=; b=QcnFSlobkuAo5npl1GHUrm1ptqPyDwuaGbp8YDnvgj8xqlBEBMYjXbV+VGv+RQLG5R aMsyAk4Nq4nzKnxIQpbcj5tepC/tShJUnIs3cjhkwHDT6dmKdC7apV+C7kc9WxKIds73 zL4+7k0M3vJSa7VPAt3Rps+aXY9S+WX/9WoGjAXbXegRLL0/2t6phJ7Vhd8X6uyP88Lt 5wlIlNgoW/tmZwjjJXcELCg6eOuSNrZZLIoPndgetVx9L7mCCkb1sPCngaZkuSosRWtE lTHqPmQ7Q5lBNHrfyqdUvUZtZ6BE0TEWkL4n9+/Fv82uGvN5sUsGZ15cH7DmSPjBu93K TGmQ== X-Received: by 10.236.122.238 with SMTP id t74mr28826409yhh.96.1357516269714; Sun, 06 Jan 2013 15:51:09 -0800 (PST) Received: from localhost.localdomain (D32451F2.uspool.samsung.com. [211.36.81.242]) by mx.google.com with ESMTPS id w1sm57375790anl.5.2013.01.06.15.51.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Jan 2013 15:51:08 -0800 (PST) From: Amit Daniel Kachhap To: linux-pm@lists.linux-foundation.org, linux-pm@vger.kernel.org, Zhang Rui Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5 RESEND] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt Date: Sun, 6 Jan 2013 15:50:48 -0800 Message-Id: <1357516248-31350-1-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1353937640-9939-3-git-send-email-amit.kachhap@linaro.org> References: <1353937640-9939-3-git-send-email-amit.kachhap@linaro.org> 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 --- drivers/thermal/exynos_thermal.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index dcd13f7..0d17d41 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,12 +373,19 @@ 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 = 0; + 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; - return 0; + return ret; } /* Operation callback functions for thermal zone */ static struct thermal_zone_device_ops const exynos_dev_ops = { @@ -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); }