All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Laurentiu Palcu
	<laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Andreas Dannenberg <dannenberg-l0cyMroinI0@public.gmane.org>,
	Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Dmitry Eremin-Solenikov
	<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Ramakrishna Pallala
	<ramakrishna.pallala-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 01/10] dt: power: bq24257-charger: Cover additional devices
Date: Tue, 15 Sep 2015 21:51:25 +0900	[thread overview]
Message-ID: <CAJKOXPcTiPKbWuRN+s1ndQ2M2awc9M8BOJ=k3u6vMJ3x7XHObQ@mail.gmail.com> (raw)
In-Reply-To: <20150915090537.GB3166@lpalcu-desk>

2015-09-15 18:05 GMT+09:00 Laurentiu Palcu <laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>:
> On Tue, Sep 15, 2015 at 04:56:52PM +0900, Krzysztof Kozlowski wrote:
>> On 14.09.2015 22:54, Andreas Dannenberg wrote:
>> > On Mon, Sep 14, 2015 at 03:11:32PM +0900, Krzysztof Kozlowski wrote:
>> >>
>> >> Now I spotted the difference in this binding from previous emails.
>> >> Previously you made it as a boolean property. Now it is a integer
>> >> property for a boolean value. It is unusual. If you expect a need (or a
>> >> possibility of need) of:
>> >> 1. extending,
>> >> 2. overriding,
>> >> 3. using similar (extended) property in different drivers,
>> >> then it should be a real value, like:
>> >>
>> >> 1. ti,safety-timer: integer, in seconds
>> >
>> > Hi Krzysztof,
>> >
>> > I thought about this as well because the device actually allows
>> > configuring different safety timer intervals (currently not exposed) and
>> > it appears that the "2x enable" could be factored in there however it's
>> > not as easy as it seems.  The "2x enable" is a dedicated HW feature
>> > that's only being used in some states of the devices and with that does
>> > not generally extend the safety timer under all conditions.
>>
>> Right, I read also the datasheet which explains it.
>>
>> >
>> >> 2. ti,safety-timer-ratio/multiplier: integer, supported values are: 0
>> >> (use default) or 2 (slow down by factor of 2)
>> >>
>> >> It is unusual and not obvious to use a integer value for boolean strict
>> >> property. With current solution you can actually only override it.
>> >
>> > Yes that was the sole reason behind using integer instead of boolean.
>> > The boolean "character" of this property was left intact because of the
>> > direct mapping to a device HW feature (see below).
>>
>> DT serves a purpose of providing information allowing the kernel to use
>> and configure the hardware. DT binding does not have to map device
>> property. In the same time having a device property does not mean you
>> create a DT binding.
>>
>> If such requirement of mapping property to a HW feature was valid then
>> each driver would expose each register in DT. Sometimes platform data
>> did this... but DT is not pdata.
>> You're using such argument also below but this argument is not sufficient.
>>
>> Sufficient argument would be: this property is necessary to configure
>> the hardware in different board configurations (so on different boards
>> it will have different values).
>>
>> Example of device features not matching to DeviceTree:
>>  - configuration changing over time:
>> /sys/class/power/ds2760-battery.*/charge_full
>>
>>  - various timers:
>> /sys/class/power_supply/max14577-charger/device/fast_charge_timer
>>
>>  - various thresholds:
>> /sys/class/power_supply/max77693-charger/device/top_off_threshold_current
>>
>> These are strictly HW features (they map to a bit in register) but they
>> are not related to configuring device for specific board. They serve for
>> user-space to use the devices in different ways.
>>
>> In this case - the 2XTMR_EN - I assume that for certain batteries or
>> boards you want to extend the time of charging in case of special
>> conditions?
>
> FWIW, I don't see any real benefit in manually changing the 2X timer at
> all. The default setting is decent enough. The chip will automatically
> switch to 2X timer in certain conditions: for example, when the
> temperature threshold is exceeded and the charge current is
> automatically lowered. This makes sense since it'll take the battery
> more time to charge at a lower current.
>
> It would probably make more sense to add a DT property to change the
> 'Safety Timer Time Limit' device property (which can be 0.75hrs, 6hrs,
> 9hrs or totally disabled) than the 2XTMR.
>
> I omitted both when I originally added support for this chip since the
> 6hrs default safety timer seemed more than enough to charge a nowadays
> battery, even at 500mA (provided by a standard USB port). But, future
> batteries might (and probably will) have higher capacities and will take
> longer to charge.

>From my past mistakes I found that if binding is not necessary and it
is not used (e.g. every DTS have the same value) then it will be
easier not to add it. Bindings mean ABI so if you make a mistake then
you will have to leave with it. Usually it is easier to add new
bindings when they are needed.

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-09-15 12:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 20:26 [PATCH v3 00/10] power: bq24257: Add support for bq24250/bq24251 Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 01/10] dt: power: bq24257-charger: Cover additional devices Andreas Dannenberg
2015-09-14  6:11   ` Krzysztof Kozlowski
2015-09-14 13:54     ` Andreas Dannenberg
2015-09-15  7:56       ` Krzysztof Kozlowski
2015-09-15  9:05         ` Laurentiu Palcu
2015-09-15 12:51           ` Krzysztof Kozlowski [this message]
2015-09-15 13:57           ` Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 03/10] power: bq24257: Add bit definition for temp sense enable Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 04/10] power: bq24257: Allow manual setting of input current limit Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 05/10] power: bq24257: Add SW-based approach for Power Good determination Andreas Dannenberg
     [not found] ` <1442003202-1430-1-git-send-email-dannenberg-l0cyMroinI0@public.gmane.org>
2015-09-11 20:26   ` [PATCH v3 02/10] power: bq24257: Add basic support for bq24250/bq24251 Andreas Dannenberg
2015-09-11 20:26   ` [PATCH v3 06/10] power: bq24257: Add over voltage protection setting support Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 07/10] power: bq24257: Add input DPM voltage threshold " Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 08/10] power: bq24257: Allow input current limit sysfs access Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 09/10] power: bq24257: Add various device-specific sysfs properties Andreas Dannenberg
2015-09-11 20:26 ` [PATCH v3 10/10] power: bq24257: Add platform data based initialization Andreas Dannenberg

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='CAJKOXPcTiPKbWuRN+s1ndQ2M2awc9M8BOJ=k3u6vMJ3x7XHObQ@mail.gmail.com' \
    --to=k.kozlowski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=dannenberg-l0cyMroinI0@public.gmane.org \
    --cc=dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ramakrishna.pallala-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.