mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2026-01-27 12:35:36 +01:00
LF-14924 thermal: imx91: change the register DATA0 read value type
Read the temperature returns "Resource temporarily unavailable" when it's below 0 degree. Because the register DATA0 is a 16-bit signed value, but the origin code converted directly unsigned 32-bit into a signed 32-bit value. This patch adds a new 16-bit signed variable and uses readw to replace readl. Signed-off-by: Yanan Yang <yanan.yang@nxp.com> Signed-off-by: Joy Zou <joy.zou@nxp.com> Reviewed-by: Ye Li <ye.li@nxp.com> Acked-by: Jason Liu <jason.hui.liu@nxp.com>
This commit is contained in:
parent
316c686548
commit
8835cd9bec
|
|
@ -106,6 +106,7 @@ static int imx91_tmu_get_temp(struct thermal_zone_device *tz, int *temp)
|
|||
struct imx91_tmu *tmu = sensor->priv;
|
||||
u32 val;
|
||||
int ret;
|
||||
int16_t data;
|
||||
|
||||
ret = readl_relaxed_poll_timeout(tmu->base + STAT0, val,
|
||||
val & STAT0_DRDY0_IF_MASK, 1000,
|
||||
|
|
@ -113,8 +114,8 @@ static int imx91_tmu_get_temp(struct thermal_zone_device *tz, int *temp)
|
|||
if (ret)
|
||||
return -EAGAIN;
|
||||
|
||||
val = readl_relaxed(tmu->base + DATA0) & 0xffffU;
|
||||
*temp = (int)val * 1000LL / 64LL;
|
||||
data = readw_relaxed(tmu->base + DATA0);
|
||||
*temp = data * 1000 / 64;
|
||||
if (*temp < TMU_TEMP_LOW_LIMIT || *temp > TMU_TEMP_HIGH_LIMIT)
|
||||
return -EAGAIN;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user