google_battery: logging temperture difference when detecting gap
Bug: 262461194
Change-Id: I66499095c61effc2c4e45a2baa917586a013a8b0
Signed-off-by: Jenny Ho <[email protected]>
diff --git a/google_battery.c b/google_battery.c
index 306d058..1ddae73 100644
--- a/google_battery.c
+++ b/google_battery.c
@@ -7578,6 +7578,7 @@
#define TEMP_FILTER_DEFAULT_INTERVAL_MS 30000
#define TEMP_FILTER_FAST_INTERVAL_MS 3000
#define TEMP_FILTER_RESUME_DELAY_MS 1500
+#define TEMP_FILTER_LOG_DIFF 50
static void batt_init_temp_filter(struct batt_drv *batt_drv)
{
struct batt_temp_filter *temp_filter = &batt_drv->temp_filter;
@@ -7645,6 +7646,13 @@
if (err != 0)
goto done;
+ /* logging if big difference */
+ if (abs(val.intval - temp_filter->sample[temp_filter->last_idx]) > TEMP_FILTER_LOG_DIFF)
+ pr_info("temperture filter: [%d, %d, %d, %d, %d] val:%d idx:%d interval=%dms\n",
+ temp_filter->sample[0], temp_filter->sample[1], temp_filter->sample[2],
+ temp_filter->sample[3], temp_filter->sample[4], val.intval,
+ temp_filter->last_idx, interval);
+
mutex_lock(&temp_filter->lock);
if (temp_filter->force_update) {
temp_filter->force_update = false;
@@ -7657,6 +7665,9 @@
mutex_unlock(&temp_filter->lock);
done:
+ pr_debug("temperture filter: [%d, %d, %d, %d, %d] interval=%dms\n",
+ temp_filter->sample[0], temp_filter->sample[1], temp_filter->sample[2],
+ temp_filter->sample[3], temp_filter->sample[4], interval);
mod_delayed_work(system_wq, &temp_filter->work, msecs_to_jiffies(interval));
}