[PATCH 3/3] fix-lis302dl-/ threshold behaviour

Simon Kagstrom simon.kagstrom at gmail.com
Tue Feb 3 15:26:04 CET 2009

On Tue, 03 Feb 2009 13:55:39 +0000
Andy Green <andy at openmoko.com> wrote:

> Well, with some more patches cleaning things up, I find the threshold
> stuff acts strangely for me.
> If I pick the device up after setting threshold 100, I get some
> samples then nothing.  If I continuously shake the device, I get
> nothing until I stop shaking it, then nothing again while I hold it
> still.

I think they reported it to generate data while lying still on the
table and not while moving around and also that it went away with

> I wonder if this is the meaning of the "high pass filter" being on the
> threshold path?

Perhaps you are right. Maybe HP filter isn't our friend after all.
Looking into the application notes, perhaps the problem is with control
register 2 during setup where we set LIS302DL_CTRL2_HPFF1. We could try
to simply unset this during configuration and see what happens.

Patch attached below, but it's untested since I don't have the device
at hand right now. Should be for the andy-tracking top.

I think I tried that before, but it could be worth a shot.

> It's not what I would have expected from the threshold action, is this
> what its performance has been like up until now?  I can see why people
> may be reporting this behaviour as inverted if so.
> When I disable the highpass on the path, a nonzero threshold crashes
> the GTA02 dead, presumably because the level interrupt is stuck
> asserted for some reason.

OK, it never locked up for me without it - but that was before the
level-triggered interrupts as well.

// Simon

Don't enable HP filter when configuring threshold.

From: Simon Kagstrom <simon.kagstrom at gmail.com>

Don't enable HP filter when configuring data collection with a threshold.

Signed-off-by: Simon Kagstrom <simon.kagstrom at gmail.com>

 drivers/input/misc/lis302dl.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/input/misc/lis302dl.c b/drivers/input/misc/lis302dl.c
index 424abbc..9ad62bb 100644
--- a/drivers/input/misc/lis302dl.c
+++ b/drivers/input/misc/lis302dl.c
@@ -166,15 +166,13 @@ static void __enable_data_collection(struct lis302dl_info *lis)
 	/* make sure we're powered up and generate data ready */
 	__reg_set_bit_mask(lis, LIS302DL_REG_CTRL1, ctrl1, ctrl1);
+        __reg_write(lis, LIS302DL_REG_CTRL2, 0);
 	/* If the threshold is zero, let the device generated an interrupt
 	 * on each datum */
 	if (lis->threshold == 0) {
-		__reg_write(lis, LIS302DL_REG_CTRL2, 0);
 		__lis302dl_int_mode(lis->dev, 1, LIS302DL_INTMODE_DATA_READY);
 		__lis302dl_int_mode(lis->dev, 2, LIS302DL_INTMODE_DATA_READY);
 	} else {
-		__reg_write(lis, LIS302DL_REG_CTRL2,
-				LIS302DL_CTRL2_HPFF1);
 		__reg_write(lis, LIS302DL_REG_FF_WU_THS_1,
 				__mg_to_threshold(lis, lis->threshold));
 		__reg_write(lis, LIS302DL_REG_FF_WU_DURATION_1,

More information about the openmoko-kernel mailing list