[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a55d774e0908100914h6a42546fk47cdb207628ebe5e@mail.gmail.com>
Date: Mon, 10 Aug 2009 09:14:01 -0700
From: Brian Swetland <swetland@...gle.com>
To: avorontsov@...mvista.com
Cc: Pavel Machek <pavel@....cz>, Anton Vorontsov <cbou@...l.ru>,
David Woodhouse <dwmw2@...radead.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: power_supply class/framework question
On Mon, Aug 10, 2009 at 8:28 AM, Anton
Vorontsov<avorontsov@...mvista.com> wrote:
> On Mon, Aug 10, 2009 at 05:00:11PM +0200, Pavel Machek wrote:
>> > I'm working on cleaning up some code to more correctly use the power
>> > supply framework (have the battery driver receive notification from
>> > the wall/usb power supplies, etc), and ran into a slight snag. For
>> > mobile usb powered devices, we need to know how much current can
>> > safely be consumed by the charge circuit -- generally this is one of:
>> > none, <500mA or 1000mA, which correspond to "no power supply", "usb
>> > power supply", or "wall power supply".
>>
>> Actuallly, it is one of 'none', 100mA (min power USB has to supplly),
>> 500mA (max powe USB can supply by spec), 1A (wall).
>>
>> > I can use power_supply_am_i_supplied() to determine if I'm receiving
>> > power, but there's no way to determine either how much (if I have one
>> > power supply that indicates max current available) or which supply (if
>> > I define a separate "ac" and "usb" power supply).
>>
>> Should am_i_supplied() just return miliamps?
>
> Or enum power_supply_type, with the following priority:
> mains (wall), usb, battery?
Either of those would work, though in the case of USB, as Pavel
correctly points out, we'd need to differentiate between
non-enumerated and enumerated, so perhaps max available milliamps
would be best. Or USB could just not indicate that it's supplied
until after enumeration is successful.
Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists