diff mbox series

[U-Boot] thermal: ti-bandgap: Fix adc value datatype

Message ID 20191111094530.2742-1-faiz_abbas@ti.com
State Accepted, archived
Commit 2695584a5c279a1c2b6245466b66cd3735f1f00f
Delegated to: Lokesh Vutla
Headers show
Series [U-Boot] thermal: ti-bandgap: Fix adc value datatype | expand

Commit Message

Faiz Abbas Nov. 11, 2019, 9:45 a.m. UTC
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 <faiz_abbas@ti.com>
---
 drivers/thermal/ti-bandgap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Lokesh Vutla Jan. 20, 2020, 5:55 a.m. UTC | #1
On 11/11/19 3:15 PM, Faiz Abbas wrote:
> 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 <faiz_abbas@ti.com>

Merged into u-boot-ti.

Thanks and regards,
Lokesh
diff mbox series

Patch

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;
 }