lkml.org 
[lkml]   [2011]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3] input: add driver support for Sharp gp2ap002a00f proximity sensor
On 19:29 Tue 15 Nov     , Dmitry Torokhov wrote:
> On Tue, Nov 15, 2011 at 01:53:52PM +0100, oskar.andero@sonyericsson.com wrote:
> > On 10:43 Tue 15 Nov , Dmitry Torokhov wrote:
> > > On Tue, Nov 15, 2011 at 10:26:00AM +0100, oskar.andero@sonyericsson.com wrote:
> > > > From: Courtney Cavin <courtney.cavin@sonyericsson.com>
> > > > +
> > > > +#ifdef CONFIG_PM_SLEEP
> > > > +static int gp2a_suspend(struct device *dev)
> > > > +{
> > > > + struct i2c_client *client = to_i2c_client(dev);
> > > > + struct gp2a_data *dt = i2c_get_clientdata(client);
> > > > + int error;
> > > > +
> > > > + mutex_lock(&dt->device->mutex);
> > > > +
> > > > + if (dt->device->users) {
> > > > + if (device_may_wakeup(&client->dev)) {
> > > > + enable_irq_wake(client->irq);
> > >
> > > I think this part should happen regardless of whether device has users,
> > > only non wakeup source case needs it.
> >
> > Hmm.. why would one want to enable irq_wake when there are no users?
> > Wouldn't this cause the device to wakeup at every irq and report an
> > switch event that no one listens to?
>
> You are suspending the system and want to have this device as a wakeup
> source. Note: not wake up _device_ at every IRQ but wake up the whole
> _system_ when device generates an IRQ while system is asleep.
> It does not matter whether there are users for the events; you
> want the system to wake up.
>
> At least this is the usual semantics.

I see you point. However, the way we use the proximity sensor we can only wake up
the system when we have an application that is actually interested in the change.
This is for power save reasons.
If we use the "usual semantic", we would wake up the system at every proximity
detection regardlessly. For instance, I wouldn't want to wake up a cell phone laying
on the desk when I put my hand over it. That would hurt the battery time.

-Oskar


\
 
 \ /
  Last update: 2011-11-16 11:39    [W:0.101 / U:1.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site