From patchwork Mon Apr 14 05:38:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 3976411 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E0C3A9F336 for ; Mon, 14 Apr 2014 05:40:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2370201B9 for ; Mon, 14 Apr 2014 05:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD0A92014A for ; Mon, 14 Apr 2014 05:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750905AbaDNFjH (ORCPT ); Mon, 14 Apr 2014 01:39:07 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:59343 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbaDNFjF (ORCPT ); Mon, 14 Apr 2014 01:39:05 -0400 Received: by mail-pd0-f180.google.com with SMTP id v10so7718664pde.11 for ; Sun, 13 Apr 2014 22:39:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hMtIcicSiUoHEfoScwzXY/eXUAQRJHcYdieJgneyZKg=; b=N1eAgdj9qobCgQP+Dqyr+u/bHate39XV7Bs1eGICqbt5YcTahBcBzuDiy2cKw5GZzt DpYFntzKKjWRhKKrGmZyoshN4ZzXczE5ofcQbJfYRsFbhl1WR3BHAk+eFGG/SQF7c7Bv t1qcfo97s8vpP0G1K95R9C2AqBEs83GtZWAB+HEb9+AcnUM8r4IDmx7uqPlkZGWxk1Uo 9aSCb7WlS7amrYduGB0lBs/211Hgj73hmMKDxqaCQwQQN5YrnWWJ5sEk+EDSbuor40/R mXSzsA1D2l57zwPDoyR/jkzYWMWZV/hUXZNY3txVxHf5TRqyz5qYEcv5EcT9j4t8CLoD fmHg== X-Gm-Message-State: ALoCoQmDJLSpkAMxqYTWL66ub14ReR9LAw6xE0J6B2JmWsxEGnAgp4Z4zvISrKUOUs2/dUZXTKrt X-Received: by 10.66.160.34 with SMTP id xh2mr41835437pab.109.1397453944435; Sun, 13 Apr 2014 22:39:04 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id de5sm31283339pbc.66.2014.04.13.22.39.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Apr 2014 22:39:03 -0700 (PDT) From: Tushar Behera To: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org Cc: rui.zhang@intel.com, eduardo.valentin@ti.com Subject: [PATCH] thermal: samsung: Only update available threshold limits Date: Mon, 14 Apr 2014 11:08:15 +0530 Message-Id: <1397453895-6688-1-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the threshold limits are updated in 2 stages, once for all software trigger levels and again for hardware trip point. While updating the software trigger levels, it overwrites the threshold limit for hardware trip point thereby forcing the Exynos core to issue an emergency shutdown. Updating only the required fields in threshold register fixes this issue. Signed-off-by: Tushar Behera Acked-by: Amit Daniel Kachhap --- Based on v3.15-rc1. drivers/thermal/samsung/exynos_tmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 0d96a51..ffccc89 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -225,6 +225,8 @@ skip_calib_data: trigger_levs++; } + rising_threshold = readl(data->base + reg->threshold_th0); + if (data->soc == SOC_ARCH_EXYNOS4210) { /* Write temperature code for threshold */ threshold_code = temp_to_code(data, pdata->threshold); @@ -249,6 +251,7 @@ skip_calib_data: ret = threshold_code; goto out; } + rising_threshold &= ~(0xff << 8 * i); rising_threshold |= threshold_code << 8 * i; if (pdata->threshold_falling) { threshold_code = temp_to_code(data, @@ -281,6 +284,7 @@ skip_calib_data: } if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { /* 1-4 level to be assigned in th0 reg */ + rising_threshold &= ~(0xff << 8 * i); rising_threshold |= threshold_code << 8 * i; writel(rising_threshold, data->base + reg->threshold_th0);