lkml.org 
[lkml]   [2011]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/1] input: add driver for Bosch Sensortec's BMA150 accelerometer
On Fri, Jul 22, 2011 at 11:45:21AM +0200, Eric Andersson wrote:
> Hi Dmitry,
>
> Thanks for reviewing!
>
> > > +static int bma150_open(struct bma150_data *bma150)
> > > +{
> > > +#ifdef CONFIG_PM_RUNTIME
> > > + return pm_runtime_get_sync(&bma150->client->dev);
> > > +#else
> > > + return bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
> >
> > Hmm, this is kind of weird. I'd expect you want to try waking up the
> > parent in both cases (if no runtime pm then call to pm_runtime_get_sync
> > is basically a noop) and then wake up your device.
>
> I am not sure what you mean? Are you suggesting something like:
> bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
> return pm_runtime_get_sync(&bma150->client->dev);
>
> That would cause multiple bma150_set_mode() calls since
> pm_runtime_get_sync() will trigger one if needed.
>

Right... It looks like instead of calling pm_runtime_get_sync() we need
to do something like this:

static int bma150_open(struct bma150_data *bma150)
{
int error;

error = pm_runtime_set_active(&bma150->client->dev);
if (error)
return error;

return bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
}

and opposite in bma150_close().

Thanks.

--
Dmitry


\
 
 \ /
  Last update: 2011-07-26 04:43    [W:0.118 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site