From patchwork Wed Mar 1 10:29:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 9598125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB79A604DC for ; Wed, 1 Mar 2017 10:35:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D96C28518 for ; Wed, 1 Mar 2017 10:35:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2186D2853C; Wed, 1 Mar 2017 10:35:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B81FE28518 for ; Wed, 1 Mar 2017 10:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SASdI9hyoP7sChklVavX0MJu8sTOsBquarRFnjONe5s=; b=K4tfpXFv8HsREE czn8GvaMEnaisQbxS0cBjHvRYWnSDnVjGSb8NZg6IKl3pNzeQMwengPI+rdtEZlQcHGu0rrJpe/Gc V4STV+tpTk8ovqcAvFtRsIRxAW8+2IM/nJ3Xnc1zZjvSw1YC9HcvapG5jtzE42TosSQjpTsF0lIzu M2qUgJEL4CWc7LGW3fJE2HmzKwf4KzrK73aR1MEfSbMvmrg7j9qCL7bP/CCqNUO7rnLRXDCz6sRwR 8gE9Jxq9Eg4yWUmbhsuln56c6r6dasFIuMVTMFdpN366vFXlmE3Y1YtbyzMnnFLgWcPv3lcvhy8P9 XfCGKzsYnH/bFFStEylA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cj1bc-0000a1-0n; Wed, 01 Mar 2017 10:35:36 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cj1Y9-0006R6-Ln for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Mar 2017 10:32:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Xz13prVh3+v4QAp15IYlxl/wL+TQY8YhXTyl1cygk4g=; b=YdZSzlE3jOlPlkyWDvsMMMPYB w0JbqbMCOnkjzFHkMyXluLW/ok+2z/CZuzwf3qwm3YaAZtx+hHWmvSMjK6nfx0LbqFELsgIH9KSh9 xe4l0N0KJK+CU7a5TIlrdTJmuFaQCrMAwR5vsKiOqdzFojYO9+jCGXdMQNf9NAY+ZNWvD3UZCIfp0 zJG9dSJiQ81udH4OwCLwgu3GleIDkbU+Uj7CXyEeRRX31uUxLD3vDPtJlTgVmbaCUGsxYIKBXi2dR 381eejTcQpL0J5kT12VwvG83g5SMznZtlhuIlw942IuA8nFWuAE3Su1iyzHJEcYOMWxb2cMNjPR2o 5cdyDkyIA==; Received: from fllnx209.ext.ti.com ([198.47.19.16]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cj1Y4-0002CM-SA for linux-arm-kernel@lists.infradead.org; Wed, 01 Mar 2017 10:31:58 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v21AUVSf025237; Wed, 1 Mar 2017 04:30:31 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1488364231; bh=06urhJy8JrkqnUwXiHoAr5OdAYorvDU1YJ4GD+zs1Lo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dXuB3BGhob//f7AuGDufB19JzmvYvqvVS/ZWfMHaOfxuAMxA4MJcyhuIa6U0KzezE mGMJqfFwjoCC2iibtqJQ+QZQZq9Dyha20CpCGsfF9kCBP6ckeNu1vwHn4feUE2g5fg CVHi5yVUD2xNHXB53/x5QusxyFFv5SeE4qKkWNow= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v21AUQ0R026624; Wed, 1 Mar 2017 04:30:26 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Wed, 1 Mar 2017 04:30:25 -0600 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v21AU5Zh020471; Wed, 1 Mar 2017 04:30:22 -0600 From: Keerthy To: , Subject: [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT Date: Wed, 1 Mar 2017 15:59:48 +0530 Message-ID: <1488364190-23488-6-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488364190-23488-1-git-send-email-j-keerthy@ti.com> References: <1488364190-23488-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170301_103157_124142_2BE2455F X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, j-keerthy@ti.com, linux-kernel@vger.kernel.org, t-kristo@ti.com, robh+dt@kernel.org, rui.zhang@intel.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently slope and offset values for calculating the hot spot temperature of a thermal zone is being taken directly from driver data. So try fetching it from device tree if not present only then take it from driver data. Signed-off-by: Keerthy --- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 0586bd0..6d9399f 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -96,8 +96,14 @@ static inline int __ti_thermal_get_temp(void *devdata, int *temp) return ret; /* Default constants */ - slope = s->slope; - constant = s->constant; + slope = thermal_zone_get_slope(data->ti_thermal); + constant = thermal_zone_get_offset(data->ti_thermal); + + if (slope == 1 && constant == 0) { + /* In case of default values fallback to driver data */ + slope = s->slope; + constant = s->constant; + } pcb_tz = data->pcb_tz; /* In case pcb zone is available, use the extrapolation rule with it */