linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/7 v3] mfd: ab8500: augment DT bindings
@ 2019-09-03 15:06 Linus Walleij
  2019-09-03 18:00 ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2019-09-03 15:06 UTC (permalink / raw)
  To: Lee Jones, Jonathan Cameron, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler
  Cc: Mboumba Cedric Madianga, Linus Walleij, devicetree

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 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.
ChangeLog v1->v2:
- Rebased on v5.3-rc5
---
 .../devicetree/bindings/mfd/ab8500.txt        | 119 ++++++++++++++++++
 1 file changed, 119 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt
index cd9e90c5d171..ff517e5d7ee0 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@01 {
+			reg = <0x01>;
+		};
+		btemp_ball: channel@02 {
+			reg = <0x02>;
+		};
+		main_charger_v: channel@03 {
+			reg = <0x03>;
+		};
+		acc_detect1: channel@04 {
+			reg = <0x04>;
+		};
+		acc_detect2: channel@05 {
+			reg = <0x05>;
+		};
+		adc_aux1: channel@06 {
+			reg = <0x06>;
+		};
+		adc_aux2: channel@07 {
+			reg = <0x07>;
+		};
+		main_batt_v: channel@08 {
+			reg = <0x08>;
+		};
+		vbus_v: channel@09 {
+			reg = <0x09>;
+		};
+		main_charger_c: channel@0a {
+			reg = <0x0a>;
+		};
+		usb_charger_c: channel@0b {
+			reg = <0x0b>;
+		};
+		bk_bat_v: channel@0c {
+			reg = <0x0c>;
+		};
+		die_temp: channel@0d {
+			reg = <0x0d>;
+		};
+		usb_id: channel@0e {
+			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
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 5/7 v3] mfd: ab8500: augment DT bindings
  2019-09-03 15:06 [PATCH 5/7 v3] mfd: ab8500: augment DT bindings Linus Walleij
@ 2019-09-03 18:00 ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-09-03 18:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lee Jones, Jonathan Cameron, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler,
	Mboumba Cedric Madianga, devicetree

On Tue, Sep 03, 2019 at 05:06:12PM +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 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.
> ChangeLog v1->v2:
> - Rebased on v5.3-rc5

Must have missed the DT list...

> ---
>  .../devicetree/bindings/mfd/ab8500.txt        | 119 ++++++++++++++++++
>  1 file changed, 119 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt
> index cd9e90c5d171..ff517e5d7ee0 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.

s/_/-/ for node names.

> +
>  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@01 {

Drop leading 0s. dtc should give you warnings for this.

> +			reg = <0x01>;
> +		};

I guess these nodes aren't new, but why do you need them other than 
defining how many ADC channels.

> +		btemp_ball: channel@02 {
> +			reg = <0x02>;
> +		};
> +		main_charger_v: channel@03 {
> +			reg = <0x03>;
> +		};
> +		acc_detect1: channel@04 {
> +			reg = <0x04>;
> +		};
> +		acc_detect2: channel@05 {
> +			reg = <0x05>;
> +		};
> +		adc_aux1: channel@06 {
> +			reg = <0x06>;
> +		};
> +		adc_aux2: channel@07 {
> +			reg = <0x07>;
> +		};
> +		main_batt_v: channel@08 {
> +			reg = <0x08>;
> +		};
> +		vbus_v: channel@09 {
> +			reg = <0x09>;
> +		};
> +		main_charger_c: channel@0a {
> +			reg = <0x0a>;
> +		};
> +		usb_charger_c: channel@0b {
> +			reg = <0x0b>;
> +		};
> +		bk_bat_v: channel@0c {
> +			reg = <0x0c>;
> +		};
> +		die_temp: channel@0d {
> +			reg = <0x0d>;
> +		};
> +		usb_id: channel@0e {
> +			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
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 5/7 v3] mfd: ab8500: augment DT bindings
  2019-10-10 18:39   ` Rob Herring
@ 2019-10-11  7:07     ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2019-10-11  7:07 UTC (permalink / raw)
  To: Rob Herring
  Cc: Lee Jones, Jonathan Cameron, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler,
	Mboumba Cedric Madianga,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Thu, Oct 10, 2019 at 8:39 PM Rob Herring <robh@kernel.org> wrote:
> On Wed, Oct 02, 2019 at 12:13:54AM +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 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
>
> Humm, this is the 2nd v3. Can you address my comments in the 1st v3 you
> sent[1].

Sorry for the sloppiness. I blame it on the weather and some
organizational stress. I'll fix it up and send a proper v4.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 5/7 v3] mfd: ab8500: augment DT bindings
  2019-10-01 22:13 ` [PATCH 5/7 v3] mfd: ab8500: augment DT bindings Linus Walleij
  2019-10-06 10:57   ` Jonathan Cameron
@ 2019-10-10 18:39   ` Rob Herring
  2019-10-11  7:07     ` Linus Walleij
  1 sibling, 1 reply; 6+ messages in thread
From: Rob Herring @ 2019-10-10 18:39 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lee Jones, Jonathan Cameron, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler,
	Mboumba Cedric Madianga, devicetree

On Wed, Oct 02, 2019 at 12:13:54AM +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 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

Humm, this is the 2nd v3. Can you address my comments in the 1st v3 you 
sent[1].

> ChangeLog v1->v2:
> - Rebased on v5.3-rc5
> ---
>  .../devicetree/bindings/mfd/ab8500.txt        | 119 ++++++++++++++++++
>  1 file changed, 119 insertions(+)


[1] https://lore.kernel.org/linux-iio/20190903180034.GA20595@bogus/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 5/7 v3] mfd: ab8500: augment DT bindings
  2019-10-01 22:13 ` [PATCH 5/7 v3] mfd: ab8500: augment DT bindings Linus Walleij
@ 2019-10-06 10:57   ` Jonathan Cameron
  2019-10-10 18:39   ` Rob Herring
  1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2019-10-06 10:57 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lee Jones, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Mboumba Cedric Madianga, devicetree,
	Rob Herring, Mark Rutland

On Wed,  2 Oct 2019 00:13:54 +0200
Linus Walleij <linus.walleij@linaro.org> 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>

This looks good now as far as our generic channel bindings go.
I'd like to leave it a little longer for Rob or Mark to have the chance
to comment before taking it though.

Good to have these in yaml at some point as well :)
I know we haven't done many of the older IIO bindings yet though
so I can't really talk.

Thanks,

Jonathan

> ---
> 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(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt
> index cd9e90c5d171..ff517e5d7ee0 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@01 {
> +			reg = <0x01>;
> +		};
> +		btemp_ball: channel@02 {
> +			reg = <0x02>;
> +		};
> +		main_charger_v: channel@03 {
> +			reg = <0x03>;
> +		};
> +		acc_detect1: channel@04 {
> +			reg = <0x04>;
> +		};
> +		acc_detect2: channel@05 {
> +			reg = <0x05>;
> +		};
> +		adc_aux1: channel@06 {
> +			reg = <0x06>;
> +		};
> +		adc_aux2: channel@07 {
> +			reg = <0x07>;
> +		};
> +		main_batt_v: channel@08 {
> +			reg = <0x08>;
> +		};
> +		vbus_v: channel@09 {
> +			reg = <0x09>;
> +		};
> +		main_charger_c: channel@0a {
> +			reg = <0x0a>;
> +		};
> +		usb_charger_c: channel@0b {
> +			reg = <0x0b>;
> +		};
> +		bk_bat_v: channel@0c {
> +			reg = <0x0c>;
> +		};
> +		die_temp: channel@0d {
> +			reg = <0x0d>;
> +		};
> +		usb_id: channel@0e {
> +			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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/7 v3] mfd: ab8500: augment DT bindings
  2019-10-01 22:13 [PATCH 0/7 v3] AB8500 GPADC MFD to IIO conversion Linus Walleij
@ 2019-10-01 22:13 ` Linus Walleij
  2019-10-06 10:57   ` Jonathan Cameron
  2019-10-10 18:39   ` Rob Herring
  0 siblings, 2 replies; 6+ messages in thread
From: Linus Walleij @ 2019-10-01 22:13 UTC (permalink / raw)
  To: Lee Jones, Jonathan Cameron, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler
  Cc: Mboumba Cedric Madianga, Linus Walleij, devicetree

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 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(+)

diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt
index cd9e90c5d171..ff517e5d7ee0 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@01 {
+			reg = <0x01>;
+		};
+		btemp_ball: channel@02 {
+			reg = <0x02>;
+		};
+		main_charger_v: channel@03 {
+			reg = <0x03>;
+		};
+		acc_detect1: channel@04 {
+			reg = <0x04>;
+		};
+		acc_detect2: channel@05 {
+			reg = <0x05>;
+		};
+		adc_aux1: channel@06 {
+			reg = <0x06>;
+		};
+		adc_aux2: channel@07 {
+			reg = <0x07>;
+		};
+		main_batt_v: channel@08 {
+			reg = <0x08>;
+		};
+		vbus_v: channel@09 {
+			reg = <0x09>;
+		};
+		main_charger_c: channel@0a {
+			reg = <0x0a>;
+		};
+		usb_charger_c: channel@0b {
+			reg = <0x0b>;
+		};
+		bk_bat_v: channel@0c {
+			reg = <0x0c>;
+		};
+		die_temp: channel@0d {
+			reg = <0x0d>;
+		};
+		usb_id: channel@0e {
+			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
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-11  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 15:06 [PATCH 5/7 v3] mfd: ab8500: augment DT bindings Linus Walleij
2019-09-03 18:00 ` Rob Herring
2019-10-01 22:13 [PATCH 0/7 v3] AB8500 GPADC MFD to IIO conversion Linus Walleij
2019-10-01 22:13 ` [PATCH 5/7 v3] mfd: ab8500: augment DT bindings Linus Walleij
2019-10-06 10:57   ` Jonathan Cameron
2019-10-10 18:39   ` Rob Herring
2019-10-11  7:07     ` Linus Walleij

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).