2023-05-10 12:21:13

by Jonathan McDowell

[permalink] [raw]
Subject: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature

This adds a DT node to hook up the internal temperature ADC to the
iio-hwmon driver. The various voltage + current ADCs are consumed and
exposed by their respective drivers, but this is not and is always
available. Naming chosen to match the axp20x_ prefix the power sensors
use.

Signed-off-by: Jonathan McDowell <[email protected]>
---
arch/arm/boot/dts/axp209.dtsi | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi
index ca240cd6f6c3..469d0f7d5185 100644
--- a/arch/arm/boot/dts/axp209.dtsi
+++ b/arch/arm/boot/dts/axp209.dtsi
@@ -48,6 +48,13 @@
* http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf
*/

+/ {
+ pmic-temp {
+ compatible = "iio-hwmon";
+ io-channels = <&axp_adc 4>; /* Internal temperature */
+ };
+};
+
&axp209 {
compatible = "x-powers,axp209";
interrupt-controller;
--
2.39.2



2023-05-11 16:20:38

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature

Dne sreda, 10. maj 2023 ob 14:02:28 CEST je Jonathan McDowell napisal(a):
> This adds a DT node to hook up the internal temperature ADC to the
> iio-hwmon driver. The various voltage + current ADCs are consumed and
> exposed by their respective drivers, but this is not and is always
> available. Naming chosen to match the axp20x_ prefix the power sensors
> use.

Sorry for maybe obvious thing, but where are other ADC channels exposed?

Best regards,
Jernej

>
> Signed-off-by: Jonathan McDowell <[email protected]>
> ---
> arch/arm/boot/dts/axp209.dtsi | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi
> index ca240cd6f6c3..469d0f7d5185 100644
> --- a/arch/arm/boot/dts/axp209.dtsi
> +++ b/arch/arm/boot/dts/axp209.dtsi
> @@ -48,6 +48,13 @@
> * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf
> */
>
> +/ {
> + pmic-temp {
> + compatible = "iio-hwmon";
> + io-channels = <&axp_adc 4>; /* Internal temperature */
> + };
> +};
> +
> &axp209 {
> compatible = "x-powers,axp209";
> interrupt-controller;





2023-05-12 10:33:14

by Jonathan McDowell

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature

On Thu, May 11, 2023 at 06:11:49PM +0200, Jernej Škrabec wrote:
> Dne sreda, 10. maj 2023 ob 14:02:28 CEST je Jonathan McDowell napisal(a):
> > This adds a DT node to hook up the internal temperature ADC to the
> > iio-hwmon driver. The various voltage + current ADCs are consumed and
> > exposed by their respective drivers, but this is not and is always
> > available. Naming chosen to match the axp20x_ prefix the power sensors
> > use.
>
> Sorry for maybe obvious thing, but where are other ADC channels exposed?

In the associated power drivers; e.g. axp20x_ac_power, axp20x_usb_power
+ axp20x_battery. The internal temperature is the only one that
logically belongs to the chip as a whole rather than one of the
subfunctions.

root@chip:~# sensors
axp20x_battery-isa-0000
Adapter: ISA adapter
in0: 0.00 V
curr1: 0.00 A

pmic_temp-isa-0000
Adapter: ISA adapter
temp1: +42.5°C

axp20x_ac-isa-0000
Adapter: ISA adapter
in0: 0.00 V
curr1: 0.00 A

axp20x_usb-isa-0000
Adapter: ISA adapter
in0: 4.93 V (min = +4.00 V)
curr1: 330.00 mA (max = +0.00 A)

> > Signed-off-by: Jonathan McDowell <[email protected]>
> > ---
> > arch/arm/boot/dts/axp209.dtsi | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi
> > index ca240cd6f6c3..469d0f7d5185 100644
> > --- a/arch/arm/boot/dts/axp209.dtsi
> > +++ b/arch/arm/boot/dts/axp209.dtsi
> > @@ -48,6 +48,13 @@
> > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf
> > */
> >
> > +/ {
> > + pmic-temp {
> > + compatible = "iio-hwmon";
> > + io-channels = <&axp_adc 4>; /* Internal temperature */
> > + };
> > +};
> > +
> > &axp209 {
> > compatible = "x-powers,axp209";
> > interrupt-controller;

J.

--
/-\ | Synonym: word used when you can't
|@/ Debian GNU/Linux Developer | spell the one you want
\- |

2023-05-12 16:47:47

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature

Dne petek, 12. maj 2023 ob 12:30:32 CEST je Jonathan McDowell napisal(a):
> On Thu, May 11, 2023 at 06:11:49PM +0200, Jernej Škrabec wrote:
> > Dne sreda, 10. maj 2023 ob 14:02:28 CEST je Jonathan McDowell napisal(a):
> > > This adds a DT node to hook up the internal temperature ADC to the
> > > iio-hwmon driver. The various voltage + current ADCs are consumed and
> > > exposed by their respective drivers, but this is not and is always
> > > available. Naming chosen to match the axp20x_ prefix the power sensors
> > > use.
> >
> > Sorry for maybe obvious thing, but where are other ADC channels exposed?
>
> In the associated power drivers; e.g. axp20x_ac_power, axp20x_usb_power
> + axp20x_battery. The internal temperature is the only one that
> logically belongs to the chip as a whole rather than one of the
> subfunctions.
>
> root@chip:~# sensors
> axp20x_battery-isa-0000
> Adapter: ISA adapter
> in0: 0.00 V
> curr1: 0.00 A
>
> pmic_temp-isa-0000
> Adapter: ISA adapter
> temp1: +42.5°C
>
> axp20x_ac-isa-0000
> Adapter: ISA adapter
> in0: 0.00 V
> curr1: 0.00 A
>
> axp20x_usb-isa-0000
> Adapter: ISA adapter
> in0: 4.93 V (min = +4.00 V)
> curr1: 330.00 mA (max = +0.00 A)

Right.

Reviewed-by: Jernej Skrabec <[email protected]>

Best regards,
Jernej

>
> > > Signed-off-by: Jonathan McDowell <[email protected]>
> > > ---
> > >
> > > arch/arm/boot/dts/axp209.dtsi | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/arch/arm/boot/dts/axp209.dtsi
> > > b/arch/arm/boot/dts/axp209.dtsi
> > > index ca240cd6f6c3..469d0f7d5185 100644
> > > --- a/arch/arm/boot/dts/axp209.dtsi
> > > +++ b/arch/arm/boot/dts/axp209.dtsi
> > > @@ -48,6 +48,13 @@
> > >
> > > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf
> > > */
> > >
> > > +/ {
> > > + pmic-temp {
> > > + compatible = "iio-hwmon";
> > > + io-channels = <&axp_adc 4>; /* Internal temperature */
> > > + };
> > > +};
> > > +
> > >
> > > &axp209 {
> > >
> > > compatible = "x-powers,axp209";
> > > interrupt-controller;
>
> J.