summaryrefslogtreecommitdiff
path: root/drivers/misc/m4sensorhub_pedometer.c
diff options
context:
space:
mode:
authorViditha Hanumanthareddy <ngjq36@motorola.com>2014-10-14 15:28:28 -0500
committerViditha Hanumanthareddy <ngjq36@motorola.com>2014-10-14 19:59:15 -0500
commitb58b2974bd6dd26084de1e9de5594d31789aaeba (patch)
tree800f6181c88bf44b0e83fb81cdf3243b9878c6d4 /drivers/misc/m4sensorhub_pedometer.c
parentc77eb6f95b26797df86c7cb2b81434dd4c9a89fb (diff)
downloadolio-linux-3.10-b58b2974bd6dd26084de1e9de5594d31789aaeba.tar.xz
olio-linux-3.10-b58b2974bd6dd26084de1e9de5594d31789aaeba.zip
IKXCLOCK-4197: Fix for high daily steps.
Change-Id: Idb5751c5672d01e02adf13c2f33e25e7d20ce037
Diffstat (limited to 'drivers/misc/m4sensorhub_pedometer.c')
-rw-r--r--drivers/misc/m4sensorhub_pedometer.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/drivers/misc/m4sensorhub_pedometer.c b/drivers/misc/m4sensorhub_pedometer.c
index 8d1accffbdf..9a990f014be 100644
--- a/drivers/misc/m4sensorhub_pedometer.c
+++ b/drivers/misc/m4sensorhub_pedometer.c
@@ -170,15 +170,25 @@ static int m4ped_read_report_data(struct iio_dev *iio,
(dat.healthy_minutes < dd->last_dat.healthy_minutes) ||
(dat.calories < dd->last_dat.calories) ||
(dat.calories_normr < dd->last_dat.calories_normr)) {
- dd->base_dat.total_distance = dd->iiodat.total_distance;
- dd->base_dat.total_steps = dd->iiodat.total_steps;
- dd->base_dat.healthy_minutes = dd->iiodat.healthy_minutes;
- dd->base_dat.calories = dd->iiodat.calories;
- dd->base_dat.calories_normr = dd->iiodat.calories_normr;
- m4ped_err("%s: Set pedometer bases = %d %d %d %d %d", __func__,
- dd->base_dat.total_distance, dd->base_dat.total_steps,
- dd->base_dat.healthy_minutes, dd->base_dat.calories,
- dd->base_dat.calories_normr);
+ m4ped_err("%s: Error: Current = %u %u %u %u %u "
+ "Last = %u %u %u %u %u, Base = %u %u %u %u %u\n",
+ __func__, dat.total_distance,
+ dat.total_steps, dat.healthy_minutes,
+ dat.calories, dat.calories_normr,
+ dd->last_dat.total_distance,
+ dd->last_dat.total_steps,
+ dd->last_dat.healthy_minutes, dd->last_dat.calories,
+ dd->last_dat.calories_normr,
+ dd->base_dat.total_distance,
+ dd->base_dat.total_steps,
+ dd->base_dat.healthy_minutes, dd->base_dat.calories,
+ dd->base_dat.calories_normr);
+ m4ped_err("%s: iio = %u %u %u %u %u\n", __func__,
+ dd->iiodat.total_distance,
+ dd->iiodat.total_steps,
+ dd->iiodat.healthy_minutes, dd->iiodat.calories,
+ dd->iiodat.calories_normr);
+ goto m4ped_read_fail;
}
dd->last_dat.total_distance = dat.total_distance;
@@ -667,6 +677,19 @@ static void m4ped_panic_restore(struct m4sensorhub_data *m4sensorhub,
goto m4ped_panic_restore_fail;
}
}
+ /* Update base and reset last */
+ dd->base_dat.total_distance = dd->iiodat.total_distance;
+ dd->base_dat.total_steps = dd->iiodat.total_steps;
+ dd->base_dat.healthy_minutes = dd->iiodat.healthy_minutes;
+ dd->base_dat.calories = dd->iiodat.calories;
+ dd->base_dat.calories_normr = dd->iiodat.calories_normr;
+
+ dd->last_dat.total_distance = 0;
+ dd->last_dat.total_steps = 0;
+ dd->last_dat.healthy_minutes = 0;
+ dd->last_dat.calories = 0;
+ dd->last_dat.calories_normr = 0;
+
cancel_delayed_work(&(dd->m4ped_work));
if (dd->samplerate > 0)
queue_delayed_work(system_freezable_wq, &(dd->m4ped_work),