thermal: update read sensor times for performance [1/1]
authorHuan Biao <huan.biao@amlogic.com>
Fri, 5 Jul 2019 05:43:23 +0000 (13:43 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Tue, 9 Jul 2019 09:52:15 +0000 (02:52 -0700)
PD#SWPL-10836

Problem:
read sensor time too long

Solution:
read sensor once

Verify:
verified on t1 t962x2 x301

Change-Id: Iddf4c903ba8a3836666943adb5c02c5d287728df
Signed-off-by: Huan Biao <huan.biao@amlogic.com>
drivers/amlogic/thermal/meson_tsensor.c

index 1869983..a9e71ba 100644 (file)
@@ -53,7 +53,7 @@
 #define R1P1_TS_STAT8          (0x18 * 4)
 #define R1P1_TS_STAT9          (0x19 * 4)
 
-#define R1P1_TS_VALUE_CONT     0x10
+#define R1P1_TS_VALUE_CONT     0x1
 #define        R1P1_TRIM_INFO          0x0
 #define R1P1_TS_TEMP_MASK      0xfff
 #define R1P1_TS_IRQ_MASK       0xff
@@ -447,7 +447,14 @@ static int r1p1_tsensor_read(struct meson_tsensor_data *data)
                        value_all += (tvalue & 0xffff);
                }
        }
-       tvalue = value_all / cnt;
+       if (cnt) {
+               tvalue = value_all / cnt;
+               pr_debug("%s  vall: %u, cnt: %u\n",
+                               __func__, value_all, cnt);
+       } else {
+               pr_info("%s  valid cnt is 0\n", __func__);
+               tvalue = 0;
+       }
        return tvalue;
 }