lkml.org 
[lkml]   [2013]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
From
Hi

On Sun, Nov 24, 2013 at 8:01 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> 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.
>

https://lists.ubuntu.com/archives/kernel-team/2013-January/025206.html

I found and equivalent scenario that I was trying to said

Michael


> --
> Pali Rohár
> pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2013-11-25 20:41    [W:0.094 / U:1.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site