[PATCH] interface for configuring freefall/wakeup interrupts for the accelerometers

Simon Kagstrom simon.kagstrom at gmail.com
Fri Aug 15 13:39:08 CEST 2008

On Fri, 15 Aug 2008 12:01:32 +0100
Andy Green <andy at openmoko.com> wrote:

> BTW ./scripts/checkpatch.pl is your friend... I added a patch on top
> to clean them which I posted.  It's worth eyeballing to see which
> style bits you need to look out for.

OK, sorry. I use eclipse, and I'll look through the options to see if I
can get it to work better. Emacs had a very convenient
show-trailing-whitespace option, but I've not found this in eclipse
yet. It's wonderful when it comes to navigating through the code though.

> About the wake, I don't have time to study it right now but I would
> guess the accel is either still generating "sample ready" interrupt
> somehow at sleep time, or it has signalled one during suspend that
> didn't get serviced yet (because interrupts are off maybe).

(I understand that you have more important tasks to look at!)

The funny thing is that if I enable wake on proble and don't touch the
device on suspend/resume (see below), it also wakes up immediately. But
here the device is still in power down mode. I really don't see how
this could happen.

I've played around with various things, and setting the interrupt to
trigger on rising edge, i.e.,

	set_irq_type(lis->spi_dev->irq, IRQT_RISING);

allows suspension, but probably just because I don't get any interrupts
at all.

It looks like a Sherlock-type problem to me. :-)

// Simon

diff --git a/drivers/input/misc/lis302dl.c b/drivers/input/misc/lis302dl.c
index 3dcb57a..c088073 100644
--- a/drivers/input/misc/lis302dl.c
+++ b/drivers/input/misc/lis302dl.c
@@ -654,6 +654,7 @@ static int __devinit lis302dl_probe(struct spi_device *spi)
                goto bail_inp_reg;
+       enable_irq_wake(lis->spi_dev->irq);
        return 0;
@@ -701,7 +702,7 @@ static int lis302dl_suspend(struct spi_device *spi, pm_message_t state)
        u_int8_t tmp;
        /* determine if we want to wake up from the accel. */
-       if (lis->flags & LIS302DL_F_WUP_FF ||
+       if (1 || lis->flags & LIS302DL_F_WUP_FF ||
                lis->flags & LIS302DL_F_WUP_CLICK) {
                printk(KERN_ERR "Not powering down lis302dl!\n");
                return 0;
@@ -766,7 +767,7 @@ static int lis302dl_resume(struct spi_device *spi)
        struct lis302dl_info *lis = dev_get_drvdata(&spi->dev);
        unsigned long flags;
-       if (lis->flags & LIS302DL_F_WUP_FF ||
+       if (1 || lis->flags & LIS302DL_F_WUP_FF ||
                lis->flags & LIS302DL_F_WUP_CLICK) {
                printk(KERN_ERR "Not powering up lis302dl!\n");
                return 0;

More information about the openmoko-kernel mailing list