diff options
author | Andy Green <andy@openmoko.com> | 2008-11-19 17:09:34 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:34 +0000 |
commit | 6b5297122074ac393720b826fb534a2a4ad25772 (patch) | |
tree | 8a069dbf63d6001201db542d882eb3078cc713d9 /drivers/input | |
parent | cd399d1273d3e3a3a3827ec70eaf23eacae61d74 (diff) |
fix-lis302dl-suspend-gpio.patch
Add platform stuff to deal with going in and out of suspend
so the motion sensor IO is not driving high into unpowered sensors
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/lis302dl.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/input/misc/lis302dl.c b/drivers/input/misc/lis302dl.c index 36bdcf79b02..2be816a2ebb 100644 --- a/drivers/input/misc/lis302dl.c +++ b/drivers/input/misc/lis302dl.c @@ -428,6 +428,15 @@ static int lis302dl_suspend(struct spi_device *spi, pm_message_t state) disable_irq(lis->spi_dev->irq); local_save_flags(flags); + /* + * When we share SPI over multiple sensors, there is a race here + * that one or more sensors will lose. In that case, the shared + * SPI bus GPIO will be in sleep mode and partially pulled down. So + * we explicitly put our IO into "wake" mode here before the final + * traffic to the sensor. + */ + (lis->pdata->lis302dl_suspend_io)(lis, 1); + /* save registers */ lis->regs[LIS302DL_REG_CTRL1] = reg_read(lis, LIS302DL_REG_CTRL1); lis->regs[LIS302DL_REG_CTRL2] = reg_read(lis, LIS302DL_REG_CTRL2); @@ -467,6 +476,9 @@ static int lis302dl_suspend(struct spi_device *spi, pm_message_t state) reg_write(lis, LIS302DL_REG_CTRL1, tmp); } + /* place our IO to the device in sleep-compatible states */ + (lis->pdata->lis302dl_suspend_io)(lis, 0); + local_irq_restore(flags); return 0; @@ -479,6 +491,9 @@ static int lis302dl_resume(struct spi_device *spi) local_save_flags(flags); + /* get our IO to the device back in operational states */ + (lis->pdata->lis302dl_suspend_io)(lis, 1); + /* restore registers after resume */ reg_write(lis, LIS302DL_REG_CTRL1, lis->regs[LIS302DL_REG_CTRL1]); reg_write(lis, LIS302DL_REG_CTRL2, lis->regs[LIS302DL_REG_CTRL2]); |