[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201311242001.23126@pali>
Date: Sun, 24 Nov 2013 20:01:23 +0100
From: Pali Rohár <pali.rohar@...il.com>
To: Michael Trimarchi <michael@...rulasolutions.com>
Cc: Anton Vorontsov <anton@...msg.org>,
David Woodhouse <dwmw2@...radead.org>,
Tony Lindgren <tony@...mide.com>,
Russell King <linux@....linux.org.uk>,
linux-kernel@...r.kernel.org,
Linux OMAP Mailing List <linux-omap@...r.kernel.org>,
freemangordon@....bg, aaro.koskinen@....fi, pavel@....cz
Subject: Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
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@...il.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@...il.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@...il.com
Download attachment "signature.asc " of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists