[PATCH/RFC] Change accelerometers to use ABS events rather than REL events.
neilb at suse.de
Wed Mar 11 01:49:57 CET 2009
On Tuesday March 10, andy at openmoko.com wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Somebody in the thread at some point said:
> | Does this have anything to do with the fact that the driver seems to
> | like enabling both interrupts at one. e.g.
> | __lis302dl_int_mode(lis->dev, 1, LIS302DL_INTMODE_FF_WU_12);
> | __lis302dl_int_mode(lis->dev, 2, LIS302DL_INTMODE_FF_WU_12);
> Yes it's because they're open-drain on A5 and physically tied together.
> ~ This ensures we don't get one interrupt accidentally asserting the
> shared interrupt line on A5 all the time, hiding the desired interrupt
> action on the other one.
> | This will presumably ensure that the two interrupt lines go high/low
> | at the same time. Is that important? I don't think it can be
> | important on the A6/A7, and my limit understanding for signal levels
> | suggest that it probably isn't important for that A5.
> | If it is important, we should probably fix __enable_wakeup as it
> | currently only enables interrupt 1, not 2.
> Either disabling one interrupt or having them both issue the same is a
> valid solution to A5 situation. On A6, we removed the pullup and have
> the one interrupt drive push-pull.
It's not clear to me that 'disabling' is an option.
The closest seems to be a setting called "GND" which presumably ties
the line to Ground. Seeing the interrupt is active-low, that would be
> | Either way, we should probably document this in the code, which I will
> | offer a patch for once I have a more complete understanding.
> The big point is that there is no way to route multiple interrupt
> sources to be summed into INT1 or INT2, as you might be expecting.
> Instead, you can only select one single source at a time. Since we
> route only INT1 on A6/A7, it means only one interrupt source is usable
> at one time, so you can listen for TAP or take samples, not both.
> But if you're taking samples, you can effectively poll for TAP. o it
> just needs some care.
OK, I get the important point now - I was missing it before.
While the two interrupt lines are configurable as to what is the
source for each, they are not completely configurable.
e.g. there is an option for "either WUP_FF_1 or WUP_FF_2" but there is
no option for "either WUP_FF_1 or WUP_CLICK". So to be able to catch
both those conditions you need both interrupt pins to be routed. And
on A6/A7 the second one isn't.
An nice challenge.
For wake-from-suspend we cannot do any tricks with polling. We have
to choose between wake-on-WUP_FF, or wake-on-CLICK.
Fortunately there are two accelerometers so we can get all the
functionality we are likely to want:
- program the first accelerometer (the one with axes parallel to
surfaces) to interrupt on WUP_CLICK
- program the second to interrupt on WUP_FF_1
When we can arrange to wake up on both taps and e.g. a shake. We
could even wake up on free-fall, but I'm not sure I see the value of
When the CPU is running we could take the same approach. Or we could
conceivably program WUP_FF_2 to have the same threshold as the first
click threshold. Then when it fires, set a timer for an appropriate
duration and poll the 'click' status after that duration.
It might not be worth the effort though.
Thanks for pointing that out for me.
I assume that both accelerometers are wired the same way on all
More information about the openmoko-kernel