lkml.org 
[lkml]   [2020]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v4 08/16] thermal: sun8i: add TEMP_CALIB_MASK for calibration data in sun50i_h6_ths_calibrate
    Date
    From: Yangtao Li <frank@allwinnertech.com>

    For sun50i_h6_ths_calibrate(), the data read from nvmem needs a round of
    calculation. On the other hand, the newer SOC may store other data in
    the space other than 12bit sensor data. Add mask operation to read data
    to avoid conversion error.

    Signed-off-by: Yangtao Li <frank@allwinnertech.com>
    Reviewed-by: Yangtao Li <tiny.windzz@gmail.com>
    ---
    drivers/thermal/sun8i_thermal.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
    index 74d73be16496..f423d44b9290 100644
    --- a/drivers/thermal/sun8i_thermal.c
    +++ b/drivers/thermal/sun8i_thermal.c
    @@ -244,7 +244,7 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev,
    ft_temp = (caldata[0] & FT_TEMP_MASK) * 100;

    for (i = 0; i < tmdev->chip->sensor_num; i++) {
    - int sensor_reg = caldata[i + 1];
    + int sensor_reg = caldata[i + 1] & TEMP_CALIB_MASK;
    int cdata, offset;
    int sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg);

    --
    2.24.0
    \
     
     \ /
      Last update: 2020-07-14 09:13    [W:4.129 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site