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: 9598257 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 6F8C560547 for ; Wed, 1 Mar 2017 11:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AAA927FAC for ; Wed, 1 Mar 2017 11:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F37728405; Wed, 1 Mar 2017 11:09:49 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57D67284DD for ; Wed, 1 Mar 2017 11:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752383AbdCAKvw (ORCPT ); Wed, 1 Mar 2017 05:51:52 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:9127 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbdCAKvZ (ORCPT ); Wed, 1 Mar 2017 05:51:25 -0500 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: , CC: , , , , , , , 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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 */