From patchwork Mon Nov 11 09:45:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 1192842 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="ky2RNKPR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47BQvb1Bvqz9sPc for ; Mon, 11 Nov 2019 20:44:41 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 09BA8C21CB1; Mon, 11 Nov 2019 09:44:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 737BCC21C29; Mon, 11 Nov 2019 09:44:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CC4DAC21C29; Mon, 11 Nov 2019 09:44:31 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lists.denx.de (Postfix) with ESMTPS id 4031CC21BE5 for ; Mon, 11 Nov 2019 09:44:31 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xAB9iT46109693 for ; Mon, 11 Nov 2019 03:44:29 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1573465469; bh=xnHX4mZevnlumZ4K1L9J9AYKc9E/heUOZ1Bo98b6Eos=; h=From:To:CC:Subject:Date; b=ky2RNKPR75PHYQJBzSEQJOrqB4bLeLYOmSi98yJx/j1DV15icV4Ve5NElWZHgDINW 7PU8OUMbjTGJ2ESil4thWpvrGTKTMsQ05KvQBuqBonNMSSQok64XbHTeTOP0SbZsCx ql0JVm3ENpSKjYDB93u2RWnaoHk0C4Kpw08dgzQw= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xAB9iTh5114906 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 11 Nov 2019 03:44:29 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 11 Nov 2019 03:44:12 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 11 Nov 2019 03:44:12 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id xAB9iRg7099311; Mon, 11 Nov 2019 03:44:28 -0600 From: Faiz Abbas To: Date: Mon, 11 Nov 2019 15:15:30 +0530 Message-ID: <20191111094530.2742-1-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH] thermal: ti-bandgap: Fix adc value datatype X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The CORE_TEMP_SENSOR_MPU register gives a raw adc value which needs to be indexed into a lookup table to get the actual temperature. Fix the naming and datatype of the adc value variable. Signed-off-by: Faiz Abbas --- drivers/thermal/ti-bandgap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/ti-bandgap.c b/drivers/thermal/ti-bandgap.c index b490391e96..8b332f116c 100644 --- a/drivers/thermal/ti-bandgap.c +++ b/drivers/thermal/ti-bandgap.c @@ -26,7 +26,7 @@ struct ti_bandgap { ulong base; - int temperature; /* in mili degree celsius */ + uint adc_val; }; /* @@ -162,8 +162,8 @@ static int ti_bandgap_get_temp(struct udevice *dev, int *temp) { struct ti_bandgap *bgp = dev_get_priv(dev); - bgp->temperature = 0x3ff & readl(bgp->base + CTRL_CORE_TEMP_SENSOR_MPU); - *temp = dra752_adc_to_temp[bgp->temperature - DRA752_ADC_START_VALUE]; + bgp->adc_val = 0x3ff & readl(bgp->base + CTRL_CORE_TEMP_SENSOR_MPU); + *temp = dra752_adc_to_temp[bgp->adc_val - DRA752_ADC_START_VALUE]; return 0; }