From: bonbons@linux-vserver.org (Bruno Prémont)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC Patch 1/4] mfd: AXP20x: Add power supply bindings documentation
Date: Mon, 3 Nov 2014 21:02:44 +0100	[thread overview]
Message-ID: <20141103210244.1425e0c7@neptune.home> (raw)
In-Reply-To: <20141021191905.GR21108@lukather>
Hi Maxime,
On Tue, 21 October 2014 Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
> On Tue, Oct 21, 2014 at 06:09:16PM +0200, Bruno Pr?mont wrote:
> > On Tue, 21 October 2014 Lee Jones <lee.jones@linaro.org> wrote:
> > > On Mon, 20 Oct 2014, Bruno Pr?mont wrote:
> > > > ---
> > > > Note: the OCV values seem to have some defaults build into the
> > > > PMIC though may need adjustment if the used battery has a different
> > > > open circuit voltage curve.
> > > > As far as understood (these values are set in vendor driver but not
> > > > mentioned in chip documentation) they represent charge percentage
> > > > for some predefined voltages.
> > > > 
> > > > If prefixing these values with "x-power," is preferred the following
> > > > patch should becomes a dependency:
> > > >   http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/267606.html
> > > > and users in patch 2/4, 4/4 need adjusting.
> > > > 
> > > > 
> > > >  Documentation/devicetree/bindings/mfd/axp20x.txt |   20 +
> > > >  1 files changed, 20 insertions(+), 0 deletion(-)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> > > > index cc9e01b..8ea681c 100644
> > > > --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> > > > +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> > > > @@ -28,6 +28,20 @@ Required properties:
> > > >  		      (range: 750-1875). Default: 1.5MHz
> > > >  
> > > >  Optional properties for DCDCs:
> > > > +- backup: Settings for backup/RTC battery charger
> > > > +	  (Voltage in ?V, current in ?A)
> > > > +	  If not present, charger will be left untouched
> > > > +- battery.ocv: OCV capacity curve points (16 data values)
> > > > +- battery.resistance: internal battery resistance in m?
> > > > +                      (defaults to 100m?)
> > > > +- battery.capacity: Battery capacity in mAh
> > > > +		    If this attribute is missing, charger will be disabled
> > > > +		    unless there is a battery connected.
> > > > +- battery.temp_sensor: Description of temperautre sensor, 3 values
> > > > +		       - driver current (20?A, 40?A, 60?A or 80?A)
> > > > +		       - low temperature warning level (in ?V)
> > > > +		       - high temperature warning level (in ?V)
> > > > +		       If missing, temperature sensor gets disabled
> > > >  - x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
> > > >  			  Default: AUTO mode
> > > >  
> > > > @@ -49,6 +63,12 @@ axp209: pmic at 34 {
> > > >  	ldo3in-supply = <&axp_ipsout_reg>;
> > > >  	ldo5in-supply = <&axp_ipsout_reg>;
> > > >  
> > > > +	backup = <3000000 200>;
> > > > +	battery.ocv = <0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0>;
> > > > +	battery.resistance = <0>;
> > > > +	battery.capacity = <2000>;
> > > > +	battery.temp_sensor = <20 1000000 4000000>;
> > > 
> > > Since when do we use '.'s in property names?
> > 
> > I've not found guidelines on this, but whatever is the right way to
> > name them, I'm open for suggestions.
> 
> You can take a look at the ePAPR specs. Even if it's quite outdated,
> it still puts you in the right mindset.
There seems to be some kind of e-mail wall in front of this document.
> That being said, since they are driver-specific properties, they
> should be prefixed by the vendor name (here x-powers).
> 
> And I think they all belong in a sub-node, just like what's been done
> for the regulators.
Doing something like this?:
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -126,9 +126,11 @@
                                interrupt-controller;
                                #interrupt-cells = <1>;
 
-                               backup = <3000000 200>;
-                               battery.resistance = <100>;
-                               battery.capacity = <2000>;
+                               x-powers,backup = <3000000 200>;
+                               battery: battery at 0 {
+                                       x-powers,resistance = <100>;
+                                       x-powers,capacity = <2000>;
+                               };
                        };
                };
What are the rules to define the label after the colon?
Looking at the existing nodes it's either some address or a number...
and then the following in driver code (also adjusting the other
property names accessed)?:
@@ -678,11 +677,11 @@ static int axp20x_battery_config(struct platform_device *pdev,
        if (ret)
                return ret;
 
-       np = of_node_get(axp20x->dev->of_node);
+       np = of_find_node_by_name(axp20x->dev->of_node, "battery");
        if (!np)
                return -ENODEV;
 
-       ret = of_property_read_u32_array(np, "battery.ocv", ocv, 16);
+       ret = of_property_read_u32_array(np, "x-powers,ocv", ocv, 16);
        for (i = 0; ret == 0 && i < ARRAY_SIZE(ocv); i++)
                if (ocv[i] > 100) {
                        dev_warn(&pdev->dev, "OCV[%d] %u > 100\n", i, ocv[i]);
Bruno
next prev parent reply	other threads:[~2014-11-03 20:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141020215954.7f1d5502@neptune.home>
2014-10-20 20:33 ` [RFC Patch 1/4] mfd: AXP20x: Add power supply bindings documentation Bruno Prémont
2014-10-21 10:15   ` Lee Jones
2014-10-21 16:09     ` Bruno Prémont
2014-10-21 19:19       ` Maxime Ripard
2014-11-03 20:02         ` Bruno Prémont [this message]
2014-11-04 14:31           ` Maxime Ripard
2014-11-04 21:08             ` Bruno Prémont
2014-11-05 14:48               ` Maxime Ripard
2014-11-05 14:55                 ` [linux-sunxi] " Koen Kooi
     [not found]           ` <553e634f-ce75-4409-883c-acbfe773e950@googlegroups.com>
2014-11-04 21:21             ` Bruno Prémont
2014-10-21 20:10   ` Maxime Ripard
2014-10-20 20:33 ` [RFC Patch 2/4] mfd: AXP20x: Add power supply sub-driver Bruno Prémont
2014-10-21 20:27   ` Maxime Ripard
2014-10-22  6:30     ` Bruno Prémont
2014-10-23  9:29       ` Maxime Ripard
     [not found]   ` <20141023201235.3b94cc82@smutje.local>
2014-11-03 20:14     ` Bruno Prémont
2014-10-20 20:33 ` [RFC Patch 3/4] mfd: AXP20x: Add power supply defconfig entries Bruno Prémont
2014-10-20 20:33 ` [RFC Patch 4/4] mfd: AXP20x: Add backup battery DTS entry for Cubietruck Bruno Prémont
2014-10-20 20:19 [RFC Patch 0/4] mfd: AXP20x: Add power supply sub-driver Bruno Prémont
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=20141103210244.1425e0c7@neptune.home \
    --to=bonbons@linux-vserver.org \
    --cc=linux-arm-kernel@lists.infradead.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).