From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liam Breck Subject: Re: [PATCH v4 2/8] devicetree: power: add battery state machine documentation Date: Sun, 29 Jan 2017 18:46:10 -0800 Message-ID: References: <20170122071404.9654-3-matt@ranostay.consulting> <20170122222212.27086-1-liam@networkimprov.net> <20170129180619.di5ul4owkzjveoct@earth> <20170130023934.l5s7jwaozcjovqhc@earth> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <20170130023934.l5s7jwaozcjovqhc@earth> Sender: linux-pm-owner@vger.kernel.org To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, Tony Lindgren , Matt Ranostay , Rob Herring List-Id: devicetree@vger.kernel.org On Sun, Jan 29, 2017 at 6:39 PM, Sebastian Reichel wrote: > Hi, > > On Sun, Jan 29, 2017 at 03:32:10PM -0800, Liam Breck wrote: >> On Sun, Jan 29, 2017 at 10:06 AM, Sebastian Reichel wrote: >> > On Sun, Jan 22, 2017 at 02:22:12PM -0800, Liam Breck wrote: >> ... >> >> +Batteries must be referenced by chargers and/or fuel-gauges >> >> +using a phandle. The phandle's property should be named >> >> +"monitored-battery". >> >> + >> >> +Example: >> >> + >> >> + bat: battery { >> >> + compatible = "fixed-battery"; >> >> + terminate-microvolt = <3700000>; >> >> + design-microwatt-hours = <5290000>; >> >> + design-microamp-hours = <1430000>; >> >> + }; >> >> + >> >> + charger: charger@0 { >> >> + .... >> >> + monitored-battery = <&bat>; >> >> + ... >> >> + }; >> >> + >> >> + fuel_gauge: fuel_gauge@0 { >> >> + .... >> >> + monitored-battery = <&bat>; >> >> + ... >> >> + }; >> > >> > The charger stuff does does not integrate well with >> > pre-existing support for power-supplies property >> > described in >> > Documentation/devicetree/bindings/power/supply/power_supply.txt >> > >> > I think the proper chain would be: >> > >> > bat: battery { >> > compatible = "fixed-battery"; >> > terminate-microvolt = <3700000>; >> > design-microwatt-hours = <5290000>; >> > design-microamp-hours = <1430000>; >> > }; >> > >> > fuel_gauge: fuel_gauge@0 { >> > ... >> > monitored-battery = <&bat>; >> > power-supplies = <&charger>; >> > ... >> > }; >> > >> > charger: charger@0 { >> > ... >> > }; >> > >> > I added the power-supplies node to the fuel-gauge instead of the battery, >> > since fuel-gauge + fixed-battery is basically a smart battery. >> >> BQ24190 charger will need other params from a battery node. How does >> it get them in this scenario? > > It should be able to get all required properties from the bq27xxx. > Otherwise supporting smart batteries is impossible. What properties > do you need? These two, at a minimum: - precharge-microamps: maximum charge current during precharge phase (typically 20% of battery capacity) - termination-microamps: a charge cycle terminates when the battery voltage is above recharge threshold, and the current is below this setting (typically 10% of battery capacity) Sorry, I'm not seeing how the charger will obtain these from the fuel gauge. Could you clarify with a code snippet?