[5/7,v4] mfd: ab8500: augment DT bindings

Message ID 20191011071805.5554-6-linus.walleij@linaro.org
State Accepted
Commit a133f5bc82dd3657f8f529ad95534d8e471ddd7c
Headers show
Series
  • Untitled series #24045
Related show

Commit Message

Linus Walleij Oct. 11, 2019, 7:18 a.m.
As we migrate the AB8500 GPADC driver to use IIO, we need to augment
the bindings to account for defining the ADC channels in the device
tree.

Cc: devicetree@vger.kernel.org
Acked-by: Lee Jones <lee.jones@linaro.org>

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
ChangeLog v3->v4:
- Fix the nodenames from "foo_node" to "foo-node"
- Remove 0 prefix from @0n to @n
ChangeLog v2->v3:
- Change "adc-channel@" to "channel@" as per preferred notation.
- Add some full stops to the end of sentences.
- Reference the new ADC-specific documentation for channel specifier
  etc.
- Collect Lee's ACK.
- Rebased on v5.4-rc1
ChangeLog v1->v2:
- Rebased on v5.3-rc5
---
 .../devicetree/bindings/mfd/ab8500.txt        | 119 ++++++++++++++++++
 1 file changed, 119 insertions(+)

-- 
2.21.0

Comments

Rob Herring Oct. 11, 2019, 1:44 p.m. | #1
On Fri, Oct 11, 2019 at 09:18:03AM +0200, Linus Walleij wrote:
> As we migrate the AB8500 GPADC driver to use IIO, we need to augment

> the bindings to account for defining the ADC channels in the device

> tree.

> 

> Cc: devicetree@vger.kernel.org

> Acked-by: Lee Jones <lee.jones@linaro.org>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> ---

> ChangeLog v3->v4:

> - Fix the nodenames from "foo_node" to "foo-node"


You forgot to update the example. With that fixed,

Reviewed-by: Rob Herring <robh@kernel.org>


> - Remove 0 prefix from @0n to @n

> ChangeLog v2->v3:

> - Change "adc-channel@" to "channel@" as per preferred notation.

> - Add some full stops to the end of sentences.

> - Reference the new ADC-specific documentation for channel specifier

>   etc.

> - Collect Lee's ACK.

> - Rebased on v5.4-rc1

> ChangeLog v1->v2:

> - Rebased on v5.3-rc5

> ---

>  .../devicetree/bindings/mfd/ab8500.txt        | 119 ++++++++++++++++++

>  1 file changed, 119 insertions(+)
Jonathan Cameron Oct. 17, 2019, 9:22 p.m. | #2
On Fri, 11 Oct 2019 08:44:49 -0500
Rob Herring <robh@kernel.org> wrote:

> On Fri, Oct 11, 2019 at 09:18:03AM +0200, Linus Walleij wrote:

> > As we migrate the AB8500 GPADC driver to use IIO, we need to augment

> > the bindings to account for defining the ADC channels in the device

> > tree.

> > 

> > Cc: devicetree@vger.kernel.org

> > Acked-by: Lee Jones <lee.jones@linaro.org>

> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> > ---

> > ChangeLog v3->v4:

> > - Fix the nodenames from "foo_node" to "foo-node"  

> 

> You forgot to update the example. With that fixed,

Given the number of these, I'm not that comfortable just
fixing this up.  Linus could you do me a follow up patch tiding
up this detail.

I don't want to delay the immutable branch any longer and
would hope the bindings are stable enough that no one will
need this little update in their tree as well as mfd 
(or IIO if Lee doesn't pick up the immutable)

Thanks,

Jonathan

> 

> Reviewed-by: Rob Herring <robh@kernel.org>

> 

> > - Remove 0 prefix from @0n to @n

> > ChangeLog v2->v3:

> > - Change "adc-channel@" to "channel@" as per preferred notation.

> > - Add some full stops to the end of sentences.

> > - Reference the new ADC-specific documentation for channel specifier

> >   etc.

> > - Collect Lee's ACK.

> > - Rebased on v5.4-rc1

> > ChangeLog v1->v2:

> > - Rebased on v5.3-rc5

> > ---

> >  .../devicetree/bindings/mfd/ab8500.txt        | 119 ++++++++++++++++++

> >  1 file changed, 119 insertions(+)
Lee Jones Oct. 18, 2019, 7:29 a.m. | #3
On Thu, 17 Oct 2019, Jonathan Cameron wrote:

> On Fri, 11 Oct 2019 08:44:49 -0500

> Rob Herring <robh@kernel.org> wrote:

> 

> > On Fri, Oct 11, 2019 at 09:18:03AM +0200, Linus Walleij wrote:

> > > As we migrate the AB8500 GPADC driver to use IIO, we need to augment

> > > the bindings to account for defining the ADC channels in the device

> > > tree.

> > > 

> > > Cc: devicetree@vger.kernel.org

> > > Acked-by: Lee Jones <lee.jones@linaro.org>

> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

> > > ---

> > > ChangeLog v3->v4:

> > > - Fix the nodenames from "foo_node" to "foo-node"  

> > 

> > You forgot to update the example. With that fixed,

> Given the number of these, I'm not that comfortable just

> fixing this up.  Linus could you do me a follow up patch tiding

> up this detail.

> 

> I don't want to delay the immutable branch any longer and

> would hope the bindings are stable enough that no one will

> need this little update in their tree as well as mfd 

> (or IIO if Lee doesn't pick up the immutable)


Can you change the subject line to start with an uppercase char.

Else my OCD sense will go into overdrive! ;)

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Linus Walleij Oct. 18, 2019, 7:48 a.m. | #4
On Fri, Oct 18, 2019 at 9:30 AM Lee Jones <lee.jones@linaro.org> wrote:
> On Thu, 17 Oct 2019, Jonathan Cameron wrote:


> Can you change the subject line to start with an uppercase char.

>

> Else my OCD sense will go into overdrive! ;)


Jonathan: it's fine to rebase the immutable branch for this as long as no-one
has pulled it in I suppose.

Working on a binding example cleanup.

Yours,
Linus Walleij
Jonathan Cameron Oct. 18, 2019, 1:24 p.m. | #5
On Fri, 18 Oct 2019 09:48:49 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Fri, Oct 18, 2019 at 9:30 AM Lee Jones <lee.jones@linaro.org> wrote:

> > On Thu, 17 Oct 2019, Jonathan Cameron wrote:  

> 

> > Can you change the subject line to start with an uppercase char.

> >

> > Else my OCD sense will go into overdrive! ;)  

> 

> Jonathan: it's fine to rebase the immutable branch for this as long as no-one

> has pulled it in I suppose.


True enough.  I'll check the obvious branches and hope nothing else
gets through!

Jonathan


> 

> Working on a binding example cleanup.

> 

> Yours,

> Linus Walleij

Patch

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt
index cd9e90c5d171..b6bc30d7777e 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -69,6 +69,18 @@  Required child device properties:
 - compatible             : "stericsson,ab8500-[bm|btemp|charger|fg|gpadc|gpio|ponkey|
                                                pwm|regulator|rtc|sysctrl|usb]";
 
+  A few child devices require ADC channels from the GPADC node. Those follow the
+  standard bindings from iio/iio-bindings.txt and iio/adc/adc.txt
+
+  abx500-temp		 : io-channels "aux1" and "aux2" for measuring external
+			   temperatures.
+  ab8500-fg		 : io-channel "main_bat_v" for measuring main battery voltage,
+  ab8500-btemp		 : io-channels "btemp_ball" and "bat_ctrl" for measuring the
+			   battery voltage.
+  ab8500-charger	 : io-channels "main_charger_v", "main_charger_c", "vbus_v",
+			   "usb_charger_c" for measuring voltage and current of the
+			   different charging supplies.
+
 Optional child device properties:
 - interrupts             : contains the device IRQ(s) using the 2-cell format (see above)
 - interrupt-names        : contains names of IRQ resource in the order in which they were
@@ -102,8 +114,115 @@  ab8500 {
                               39 0x4>;
                 interrupt-names = "HW_CONV_END", "SW_CONV_END";
                 vddadc-supply = <&ab8500_ldo_tvout_reg>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		#io-channel-cells = <1>;
+
+		/* GPADC channels */
+		bat_ctrl: channel@1 {
+			reg = <0x01>;
+		};
+		btemp_ball: channel@2 {
+			reg = <0x02>;
+		};
+		main_charger_v: channel@3 {
+			reg = <0x03>;
+		};
+		acc_detect1: channel@4 {
+			reg = <0x04>;
+		};
+		acc_detect2: channel@5 {
+			reg = <0x05>;
+		};
+		adc_aux1: channel@6 {
+			reg = <0x06>;
+		};
+		adc_aux2: channel@7 {
+			reg = <0x07>;
+		};
+		main_batt_v: channel@8 {
+			reg = <0x08>;
+		};
+		vbus_v: channel@9 {
+			reg = <0x09>;
+		};
+		main_charger_c: channel@a {
+			reg = <0x0a>;
+		};
+		usb_charger_c: channel@b {
+			reg = <0x0b>;
+		};
+		bk_bat_v: channel@c {
+			reg = <0x0c>;
+		};
+		die_temp: channel@d {
+			reg = <0x0d>;
+		};
+		usb_id: channel@e {
+			reg = <0x0e>;
+		};
+		xtal_temp: channel@12 {
+			reg = <0x12>;
+		};
+		vbat_true_meas: channel@13 {
+			reg = <0x13>;
+		};
+		bat_ctrl_and_ibat: channel@1c {
+			reg = <0x1c>;
+		};
+		vbat_meas_and_ibat: channel@1d {
+			reg = <0x1d>;
+		};
+		vbat_true_meas_and_ibat: channel@1e {
+			reg = <0x1e>;
+		};
+		bat_temp_and_ibat: channel@1f {
+			reg = <0x1f>;
+		};
         };
 
+	ab8500_temp {
+		compatible = "stericsson,abx500-temp";
+		io-channels = <&gpadc 0x06>,
+			      <&gpadc 0x07>;
+		io-channel-name = "aux1", "aux2";
+	};
+
+	ab8500_battery: ab8500_battery {
+		stericsson,battery-type = "LIPO";
+		thermistor-on-batctrl;
+	};
+
+	ab8500_fg {
+		compatible = "stericsson,ab8500-fg";
+		battery	   = <&ab8500_battery>;
+		io-channels = <&gpadc 0x08>;
+		io-channel-name = "main_bat_v";
+	};
+
+	ab8500_btemp {
+		compatible = "stericsson,ab8500-btemp";
+		battery	   = <&ab8500_battery>;
+		io-channels = <&gpadc 0x02>,
+			      <&gpadc 0x01>;
+		io-channel-name = "btemp_ball",
+				"bat_ctrl";
+	};
+
+	ab8500_charger {
+		compatible	= "stericsson,ab8500-charger";
+		battery		= <&ab8500_battery>;
+		vddadc-supply	= <&ab8500_ldo_tvout_reg>;
+		io-channels = <&gpadc 0x03>,
+			      <&gpadc 0x0a>,
+			      <&gpadc 0x09>,
+			      <&gpadc 0x0b>;
+		io-channel-name = "main_charger_v",
+				"main_charger_c",
+				"vbus_v",
+				"usb_charger_c";
+	};
+
         ab8500-usb {
                 compatible = "stericsson,ab8500-usb";
                 interrupts = < 90 0x4