From: Huan Biao Date: Fri, 5 Jul 2019 05:43:23 +0000 (+0800) Subject: thermal: update read sensor times for performance [1/1] X-Git-Tag: hardkernel-4.9.236-104~973 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=135498c51c0a40b65520f48f522888ddcbdfe37f;p=platform%2Fkernel%2Flinux-amlogic.git thermal: update read sensor times for performance [1/1] 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 --- diff --git a/drivers/amlogic/thermal/meson_tsensor.c b/drivers/amlogic/thermal/meson_tsensor.c index 1869983..a9e71ba 100644 --- a/drivers/amlogic/thermal/meson_tsensor.c +++ b/drivers/amlogic/thermal/meson_tsensor.c @@ -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; }