lkml.org 
[lkml]   [2013]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
Date
On Sunday 24 November 2013 18:18:03 Michael Trimarchi wrote:
> Hi
>
> On Tue, Nov 19, 2013 at 11:18 AM, Pali Rohár
<pali.rohar@gmail.com> wrote:
> > This patch removing set_mode_hook function from board data
> > and replacing it with new string variable of notifier power
> > supply device. After this change it is possible to add DT
> > support because driver does not need specific board
> > function anymore. Only static data and name of power supply
> > device is required.
> >
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > ---
> >
> > drivers/power/bq2415x_charger.c | 77
> > +++++++++++++++++++++++++--------
> > include/linux/power/bq2415x_charger.h | 48
> > +++----------------- 2 files changed, 65 insertions(+), 60
> > deletions(-)
> >
...
> >
> > - struct bq2415x_device *bq = data;
> > + struct bq2415x_device *bq =
> > + container_of(nb, struct bq2415x_device, nb);
> > + struct power_supply *psy = v;
> > + enum bq2415x_mode mode;
> > + union power_supply_propval prop;
> > + int ret;
> > + int mA;
> >
> > - if (!bq)
> > - return;
> > + if (val != PSY_EVENT_PROP_CHANGED)
> > + return NOTIFY_OK;
> > +
> > + if (strcmp(psy->name, bq->init_data.notify_device)
> > != 0) + return NOTIFY_OK;
> > +
> > + dev_dbg(bq->dev, "notifier call was called\n");
> > +
> > + ret = psy->get_property(psy,
> > POWER_SUPPLY_PROP_CURRENT_MAX, &prop); + if (ret !=
> > 0)
> > + return NOTIFY_OK;
>
> So you can read this value without any type of synchronization
> with the power_supply_core
> and sysfs implementation?
>
>
> Michael
>

I do not see reason why I cannot use it. When isp1704 driver send
PSY_EVENT_PROP_CHANGED then property
POWER_SUPPLY_PROP_CURRENT_MAX is already updated and can be read
by get_property function.

--
Pali Rohár
pali.rohar@gmail.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-11-24 20:41    [W:0.143 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site