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: 3976431 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AF9E4C0DA2 for ; Mon, 14 Apr 2014 05:40:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E42C3201B4 for ; Mon, 14 Apr 2014 05:40:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B53A2014A for ; Mon, 14 Apr 2014 05:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751239AbaDNFjH (ORCPT ); Mon, 14 Apr 2014 01:39:07 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:37471 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbaDNFjF (ORCPT ); Mon, 14 Apr 2014 01:39:05 -0400 Received: by mail-pd0-f181.google.com with SMTP id p10so7654595pdj.12 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=dVeZ7jmT7ba+0ifK6dUZai1ahOu+JifBuQYVNNUFBwK+Wo2wVGEmcRqz1G5eOpcMuF 2RnI4QGti4eCHm05KG7ifNUE1SUfm07QpWyva7CT5hCezIS2ZKdGmKEM5eDHjeMYmd4W rPngG8L3MTbVruKyjEMdQ9aVtSimnw3PpME8UNeY2bweu7zmovUv/YToNE3Pf3NPLQL1 91usmdKPfUUzcHBVR4orKnSfQitI80x0L/r3JJb23bC785wroDszSXp7L6JYK/Lk4Ucq 6QtIoIiR9aHnFZB62ZWAuU00WDQ6WTiysNTusKEyda9Zv+A/9uWopr7mjmE8hgOd/UPk AMyw== X-Gm-Message-State: ALoCoQkkfMLF9keMhOri399wlmsf2rKYZykBWFwMZakNnSy4ULweD9AmAnARyoiJhNpcXQ/Eyhhz 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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);