devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dannenberg <dannenberg@ti.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Laurentiu Palcu <laurentiu.palcu@intel.com>,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 13/13] dt: power: bq24257-charger: Cover additional devices
Date: Wed, 2 Sep 2015 20:47:41 -0500	[thread overview]
Message-ID: <20150903014741.GA25605@borg> (raw)
In-Reply-To: <55E7A2E8.2060306@samsung.com>

On Thu, Sep 03, 2015 at 10:31:20AM +0900, Krzysztof Kozlowski wrote:
> > Yes that's right. Some of the chargers can check the USB D+/D- lines to
> > determine what kind of charger is attached (DCP, CDP, SDP, other) - see
> > bq24257 device datasheet for more info:
> > http://www.ti.com/product/bq24257
> > 
> > And this feature is being used in the original driver Laurentiu
> > developed. However this detection mechanism (or any detection mechanism
> > in general) may not always be appropriate hence the new property to
> > disable it and manually provide an input current limit of how much can
> > be drawn from the charger. Plus it's needed for devices that don't have
> > the D+/D- detection feature.
> 
> Thanks for explanation. How about leaving only "ti,in-limit-current"
> (get rid of "ti,in-ilimit-autoset-disable"). If it is present then the
> autodetection/autoset would be disabled.

I had it separated out to make the DT declarations more explicit (so one
would immediately "see" that autoset is disabled) but other than that
there is no reason why this couldn't get folded together. Will change.

> > Yes I was thinking about this but then went with something that closely
> > reflects the device datasheets to maximize correlation. Removing the 'v'
> > would make it look cleaner and more universal and I suppose it's not to
> > far of a stretch for someone to associate "ti,ovp-voltag" with the VOVP
> > bit field in the devices register map. So let's change it.
> 
> Thanks. Bindings don't have to follow naming convention of company's
> datasheet.

Ok.

> > Yes that's right. Somebody might chose to do so because they don't want
> > to sacrifice the extra pin. And I need to accommodate for devices that
> > don't have a PG pin so the logic behind this had to be implemented
> > anyways. I just made it accessible. What about I work on improving that
> > explanation hopefully to make it less confusing.
> 
> I still don't get why you need extra "ti,pg-gpio-disable" property. It
> could work like this:
> 1. Get rid of "ti,pg-gpio-disable" and make "pg-gpio" optional.
> 2. If it is present, use it.
> 3. If it is not present, use software based approach (the same as
> setting "ti,pg-gpio-disable" previously).
> 
> Would that work?

Similar to the earlier comment - the idea was to have it more explicit.
Plus, the original driver would hard-fail when the "pg-gpio" pin is not
provided (since it was essential for that driver's ability to function).
If I change to automatically fallback to the SW solution such an error
case would in theory not be 100% backward compatible. I could however
more clearly indicate/log which method is being used (dev_info) so
somebody rummaging through the logs would still see it. Will simplify.

> > When I looked through the Kernel headers I found the boolean property
> > parse function and figured that's probably what I should be using. But
> > as I was implementing it I had similar concerns to what you mentioned.
> > If it's general practice to prefer the value based properties I'll be
> > happy to change that.
> 
> Usually the boolean is a good choice but here you used it for a
> numerical property. You are preparing a generic TI bindings so it is
> wise to think about other future drivers. Would they have other values
> for timer factor? Would you want to set it in common board DTSI and
> override it in some one specific child DTS?

Thanks again for the additional comments and the pointers.

Regards,

--
Andreas Dannenberg
Texas Instruments Inc


> 
> Best regards,
> Krzysztof
> 
> > 
> >>
> >> Also please look at existing bindings:
> >> $ git grep "ti," Documentation/devicetree/bindings/power
> >> Maybe you could reuse some? Each of these existing and new bindings
> >> are made generic (not device specific) so they should be reused.
> > 
> > Already spent time with existing bqXXXXX drivers to see if I can recycle
> > properties. Will give it another run-through to make sure there is
> > maximum re-use.
> > 
> > Thanks,
> > 
> > --
> > Andreas Dannenberg
> > Texas Instruments Inc
> > 
> >>
> >> Best regards,
> >> Krzysztof
> >>
> >>> +- interrupt-parent: Should be the phandle for the interrupt controller. Use in
> >>> +    conjunction with "interrupts" and only in case "stat-gpio" is not used.
> >>> +- interrupts: Interrupt mapping for GPIO IRQ (configure for both edges). Use in
> >>> +    conjunction with "interrupt-parent" and only in case "stat-gpio" is not
> >>> +    used.
> >>>
> >>>  Example:
> >>>
> >>>  bq24257 {
> >>>         compatible = "ti,bq24257";
> >>>         reg = <0x6a>;
> >>> +       stat-gpio = <&gpio1 16 GPIO_ACTIVE_HIGH>;
> >>> +       pg-gpio = <&gpio1 28 GPIO_ACTIVE_HIGH>;
> >>>
> >>>         ti,battery-regulation-voltage = <4200000>;
> >>>         ti,charge-current = <1000000>;
> >>>         ti,termination-current = <50000>;
> >>>  };
> >>> +
> >>> +Example:
> >>> +
> >>> +bq24250 {
> >>> +       compatible = "ti,bq24250";
> >>> +       reg = <0x6a>;
> >>> +       interrupt-parent = <&gpio1>;
> >>> +       interrupts = <16 IRQ_TYPE_EDGE_BOTH>;
> >>> +
> >>> +       ti,battery-regulation-voltage = <4200000>;
> >>> +       ti,charge-current = <500000>;
> >>> +       ti,termination-current = <50000>;
> >>> +       ti,in-limit-current = <900000>;
> >>> +       ti,vovp-voltage = <9500000>;
> >>> +       ti,vindpm-voltage = <4440000>;
> >>> +};
> >>> --
> >>> 1.9.1
> >>>
> > 
> 

  reply	other threads:[~2015-09-03  1:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  2:10 [PATCH 00/13] power: bq24257: Add support for bq24250/bq24251 Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 01/13] power: bq24257: Add bit definition for temp sense enable Andreas Dannenberg
2015-09-01 19:42   ` Andrew F. Davis
2015-09-01  2:10 ` [PATCH 02/13] power: bq24257: Add dead battery reporting Andreas Dannenberg
2015-09-01 19:33   ` Andrew F. Davis
2015-09-01 21:04     ` Andreas Dannenberg
2015-09-01 21:16       ` Andrew F. Davis
2015-09-04 13:28         ` Laurentiu Palcu
2015-09-04 15:08           ` Andreas Dannenberg
     [not found] ` <1441073435-12349-1-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-01  2:10   ` [PATCH 03/13] power: bq24257: Add basic support for bq24250/bq24251 Andreas Dannenberg
2015-09-01 19:48     ` Andrew F. Davis
2015-09-01 21:24       ` Andreas Dannenberg
     [not found]     ` <1441073435-12349-4-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-02  8:19       ` Laurentiu Palcu
2015-09-02 14:16         ` Andreas Dannenberg
2015-09-02  8:07   ` [PATCH 00/13] power: bq24257: Add " Laurentiu Palcu
2015-09-02 14:09     ` Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 04/13] power: bq24257: Allow manual setting of input current limit Andreas Dannenberg
2015-09-01 19:59   ` Andrew F. Davis
2015-09-02  8:23   ` Laurentiu Palcu
2015-09-01  2:10 ` [PATCH 05/13] power: bq24257: Add SW-based approach for Power Good determination Andreas Dannenberg
2015-09-01 20:01   ` Andrew F. Davis
     [not found]   ` <1441073435-12349-6-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-02  8:29     ` Laurentiu Palcu
2015-09-01  2:10 ` [PATCH 06/13] power: bq24257: Add over voltage protection setting support Andreas Dannenberg
2015-09-01 20:10   ` Andrew F. Davis
2015-09-01  2:10 ` [PATCH 07/13] power: bq24257: Add VINDPM voltage threshold " Andreas Dannenberg
2015-09-01 20:48   ` Andrew F. Davis
2015-09-01  2:10 ` [PATCH 08/13] power: bq24257: Extend scope of mutex protection Andreas Dannenberg
2015-09-01 20:34   ` Andrew F. Davis
2015-09-01 22:15     ` Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 09/13] power: bq24257: Add charge type setting support Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 10/13] power: bq24257: Add in_ilimit " Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 11/13] power: bq24257: Add various device-specific sysfs properties Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 12/13] power: bq24257: Add platform data based initialization Andreas Dannenberg
2015-09-01  2:10 ` [PATCH 13/13] dt: power: bq24257-charger: Cover additional devices Andreas Dannenberg
     [not found]   ` <1441073435-12349-14-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-02  5:24     ` Krzysztof Kozlowski
2015-09-02 14:03       ` Andreas Dannenberg
2015-09-03  1:31         ` Krzysztof Kozlowski
2015-09-03  1:47           ` Andreas Dannenberg [this message]
2015-09-03  1:57             ` Krzysztof Kozlowski
2015-09-03 16:09               ` Andreas Dannenberg
2015-09-03 23:50                 ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150903014741.GA25605@borg \
    --to=dannenberg@ti.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=k.kozlowski@samsung.com \
    --cc=laurentiu.palcu@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).