diff mbox series

[v2,07/15] Documentation: ABI: testing: mt6370: Add ADC sysfs guideline

Message ID 20220613111146.25221-8-peterwu.pub@gmail.com (mailing list archive)
State Superseded
Headers show
Series Add Mediatek MT6370 PMIC support | expand

Commit Message

ChiaEn Wu June 13, 2022, 11:11 a.m. UTC
From: ChiaEn Wu <chiaen_wu@richtek.com>

Add ABI documentation for mt6370 non-standard ADC sysfs interfaces.

Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
---
 .../ABI/testing/sysfs-bus-iio-adc-mt6370      | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370

Comments

Jonathan Cameron June 18, 2022, 3:48 p.m. UTC | #1
On Mon, 13 Jun 2022 19:11:38 +0800
ChiaEn Wu <peterwu.pub@gmail.com> wrote:

> From: ChiaEn Wu <chiaen_wu@richtek.com>
> 
> Add ABI documentation for mt6370 non-standard ADC sysfs interfaces.
> 
> Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
> ---
>  .../ABI/testing/sysfs-bus-iio-adc-mt6370      | 36 +++++++++++++++++++
>  1 file changed, 36 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370 b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> new file mode 100644
> index 000000000000..039b3381176a
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> @@ -0,0 +1,36 @@
> +What:		/sys/bus/iio/devices/iio:deviceX/in_voltage0_raw

Unfortunately the kernel documentation build scripts do no support duplicating
standard ABI for particular devices so as to provide more information.
Hence you can't have anything in this file.


> +KernelVersion:	5.18
> +Contact:	chiaen_wu@richtek.com
> +Description:
> +		Indicated MT6370 VBUS ADC with lower accuracy(+-75mA)
Curious though, voltage with a mA accuracy range?
This scale should be presented directly to userspace anyway so no need
for this doc.

> +		higher measure range(1~22V)
> +		Calculating with scale returns voltage in uV

No. All channels return in mV. That's the ABI requirement as
in sysfs-bus-iio and we cannot vary if for particular drivers.  If we did
no generic tooling would work.

> +
> +What:		/sys/bus/iio/devices/iio:deviceX/in_voltage1_raw
> +KernelVersion:	5.18
> +Contact:	chiaen_wu@richtek.com
> +Description:
> +		Indicated MT6370 VBUS ADC with higher accuracy(+-30mA)
> +		lower measure range(1~9.76V)
> +		Calculating with scale offset returns voltage in uV
> +
> +What:		/sys/bus/iio/devices/iio:deviceX/in_voltage4_raw
> +KernelVersion:	5.18
> +Contact:	chiaen_wu@richtek.com
> +Description:
> +		Indicated MT6370 TS_BAT ADC
> +		Calculating with scale returns voltage in uV
> +
> +What:		/sys/bus/iio/devices/iio:deviceX/in_voltage7_raw
> +KernelVersion:	5.18
> +Contact:	chiaen_wu@richtek.com
> +Description:
> +		Indicated MT6370 CHG_VDDP ADC
> +		Calculating with scale returns voltage in mV
> +
> +What:		/sys/bus/iio/devices/iio:deviceX/in_temp8_raw
> +KernelVersion:	5.18
> +Contact:	chiaen_wu@richtek.com
> +Description:
> +		Indicated MT6370 IC junction temperature
> +		Calculating with scale and offset returns temperature in degree
ChiaEn Wu June 20, 2022, 6 a.m. UTC | #2
Hi Jonathan,

Thanks for your helpful comments, and I have some questions want to
ask you below.

Jonathan Cameron <jic23@kernel.org> 於 2022年6月18日 週六 晚上11:39寫道:
>
> On Mon, 13 Jun 2022 19:11:38 +0800
> ChiaEn Wu <peterwu.pub@gmail.com> wrote:
>
> > From: ChiaEn Wu <chiaen_wu@richtek.com>
> >
> > Add ABI documentation for mt6370 non-standard ADC sysfs interfaces.
> >
> > Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
> > ---
> >  .../ABI/testing/sysfs-bus-iio-adc-mt6370      | 36 +++++++++++++++++++
> >  1 file changed, 36 insertions(+)
> >  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> >
> > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370 b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > new file mode 100644
> > index 000000000000..039b3381176a
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > @@ -0,0 +1,36 @@
> > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage0_raw
>
> Unfortunately the kernel documentation build scripts do no support duplicating
> standard ABI for particular devices so as to provide more information.
> Hence you can't have anything in this file.
>

I want to confirm with you again,
because my ABI file duplicates with standard sysfs-bus-iio (voltage,
current, and temperature channels),
Should I just remove this ABI file and modify the code of mt6370-adc
to meet your expectations??

>
> > +KernelVersion:       5.18
> > +Contact:     chiaen_wu@richtek.com
> > +Description:
> > +             Indicated MT6370 VBUS ADC with lower accuracy(+-75mA)
> Curious though, voltage with a mA accuracy range?

Yes, this description is based on the data sheet.

> This scale should be presented directly to userspace anyway so no need
> for this doc.
>
> > +             higher measure range(1~22V)
> > +             Calculating with scale returns voltage in uV
>
> No. All channels return in mV. That's the ABI requirement as
> in sysfs-bus-iio and we cannot vary if for particular drivers.  If we did
> no generic tooling would work.

Ok, I got it!

>
> > +
> > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage1_raw
> > +KernelVersion:       5.18
> > +Contact:     chiaen_wu@richtek.com
> > +Description:
> > +             Indicated MT6370 VBUS ADC with higher accuracy(+-30mA)
> > +             lower measure range(1~9.76V)
> > +             Calculating with scale offset returns voltage in uV
> > +
> > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage4_raw
> > +KernelVersion:       5.18
> > +Contact:     chiaen_wu@richtek.com
> > +Description:
> > +             Indicated MT6370 TS_BAT ADC
> > +             Calculating with scale returns voltage in uV
> > +
> > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage7_raw
> > +KernelVersion:       5.18
> > +Contact:     chiaen_wu@richtek.com
> > +Description:
> > +             Indicated MT6370 CHG_VDDP ADC
> > +             Calculating with scale returns voltage in mV
> > +
> > +What:                /sys/bus/iio/devices/iio:deviceX/in_temp8_raw
> > +KernelVersion:       5.18
> > +Contact:     chiaen_wu@richtek.com
> > +Description:
> > +             Indicated MT6370 IC junction temperature
> > +             Calculating with scale and offset returns temperature in degree

Shall I modify the scale of temperature to milli degrees in
mt6370-adc.c and remove this item??

>

Best regards,
ChiaEn Wu
Jonathan Cameron June 20, 2022, 6:35 p.m. UTC | #3
On Mon, 20 Jun 2022 14:00:43 +0800
ChiaEn Wu <peterwu.pub@gmail.com> wrote:

> Hi Jonathan,
> 
> Thanks for your helpful comments, and I have some questions want to
> ask you below.
> 
> Jonathan Cameron <jic23@kernel.org> 於 2022年6月18日 週六 晚上11:39寫道:
> >
> > On Mon, 13 Jun 2022 19:11:38 +0800
> > ChiaEn Wu <peterwu.pub@gmail.com> wrote:
> >  
> > > From: ChiaEn Wu <chiaen_wu@richtek.com>
> > >
> > > Add ABI documentation for mt6370 non-standard ADC sysfs interfaces.
> > >
> > > Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
> > > ---
> > >  .../ABI/testing/sysfs-bus-iio-adc-mt6370      | 36 +++++++++++++++++++
> > >  1 file changed, 36 insertions(+)
> > >  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > >
> > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370 b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > > new file mode 100644
> > > index 000000000000..039b3381176a
> > > --- /dev/null
> > > +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > > @@ -0,0 +1,36 @@
> > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage0_raw  
> >
> > Unfortunately the kernel documentation build scripts do no support duplicating
> > standard ABI for particular devices so as to provide more information.
> > Hence you can't have anything in this file.
> >  
> 
> I want to confirm with you again,
> because my ABI file duplicates with standard sysfs-bus-iio (voltage,
> current, and temperature channels),
> Should I just remove this ABI file and modify the code of mt6370-adc
> to meet your expectations??

yes.

> 
> >  
> > > +KernelVersion:       5.18
> > > +Contact:     chiaen_wu@richtek.com
> > > +Description:
> > > +             Indicated MT6370 VBUS ADC with lower accuracy(+-75mA)  
> > Curious though, voltage with a mA accuracy range?  
> 
> Yes, this description is based on the data sheet.

Weird :) 

> 
> > This scale should be presented directly to userspace anyway so no need
> > for this doc.
> >  
> > > +             higher measure range(1~22V)
> > > +             Calculating with scale returns voltage in uV  
> >
> > No. All channels return in mV. That's the ABI requirement as
> > in sysfs-bus-iio and we cannot vary if for particular drivers.  If we did
> > no generic tooling would work.  
> 
> Ok, I got it!
> 
> >  
> > > +
> > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage1_raw
> > > +KernelVersion:       5.18
> > > +Contact:     chiaen_wu@richtek.com
> > > +Description:
> > > +             Indicated MT6370 VBUS ADC with higher accuracy(+-30mA)
> > > +             lower measure range(1~9.76V)
> > > +             Calculating with scale offset returns voltage in uV
> > > +
> > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage4_raw
> > > +KernelVersion:       5.18
> > > +Contact:     chiaen_wu@richtek.com
> > > +Description:
> > > +             Indicated MT6370 TS_BAT ADC
> > > +             Calculating with scale returns voltage in uV
> > > +
> > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage7_raw
> > > +KernelVersion:       5.18
> > > +Contact:     chiaen_wu@richtek.com
> > > +Description:
> > > +             Indicated MT6370 CHG_VDDP ADC
> > > +             Calculating with scale returns voltage in mV
> > > +
> > > +What:                /sys/bus/iio/devices/iio:deviceX/in_temp8_raw
> > > +KernelVersion:       5.18
> > > +Contact:     chiaen_wu@richtek.com
> > > +Description:
> > > +             Indicated MT6370 IC junction temperature
> > > +             Calculating with scale and offset returns temperature in degree  
> 
> Shall I modify the scale of temperature to milli degrees in
> mt6370-adc.c and remove this item??

yes.

Thanks,

Jonathan

> 
> >  
> 
> Best regards,
> ChiaEn Wu
ChiaEn Wu June 21, 2022, 2:42 a.m. UTC | #4
Hi Jonathan,

Thanks for your reply!

Jonathan Cameron <jic23@kernel.org> 於 2022年6月21日 週二 凌晨2:35寫道:

>
> On Mon, 20 Jun 2022 14:00:43 +0800
> ChiaEn Wu <peterwu.pub@gmail.com> wrote:
>
> > Hi Jonathan,
> >
> > Thanks for your helpful comments, and I have some questions want to
> > ask you below.
> >
> > Jonathan Cameron <jic23@kernel.org> 於 2022年6月18日 週六 晚上11:39寫道:
> > >
> > > On Mon, 13 Jun 2022 19:11:38 +0800
> > > ChiaEn Wu <peterwu.pub@gmail.com> wrote:
> > >
> > > > From: ChiaEn Wu <chiaen_wu@richtek.com>
> > > >
> > > > Add ABI documentation for mt6370 non-standard ADC sysfs interfaces.
> > > >
> > > > Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
> > > > ---
> > > >  .../ABI/testing/sysfs-bus-iio-adc-mt6370      | 36 +++++++++++++++++++
> > > >  1 file changed, 36 insertions(+)
> > > >  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > > >
> > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370 b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > > > new file mode 100644
> > > > index 000000000000..039b3381176a
> > > > --- /dev/null
> > > > +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
> > > > @@ -0,0 +1,36 @@
> > > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage0_raw
> > >
> > > Unfortunately the kernel documentation build scripts do no support duplicating
> > > standard ABI for particular devices so as to provide more information.
> > > Hence you can't have anything in this file.
> > >
> >
> > I want to confirm with you again,
> > because my ABI file duplicates with standard sysfs-bus-iio (voltage,
> > current, and temperature channels),
> > Should I just remove this ABI file and modify the code of mt6370-adc
> > to meet your expectations??
>
> yes.

OK! I got it! I will refine the code in the next patch!

>
> >
> > >
> > > > +KernelVersion:       5.18
> > > > +Contact:     chiaen_wu@richtek.com
> > > > +Description:
> > > > +             Indicated MT6370 VBUS ADC with lower accuracy(+-75mA)
> > > Curious though, voltage with a mA accuracy range?
> >
> > Yes, this description is based on the data sheet.
>
> Weird :)

First, I want to apologize to you because I rechecked the datasheet
and asked the hardware engineer,
the conclusion is I wrote the wrong unit...
The correction is that the accuracy of vbusdiv5 is +-75"mV", not "mA",
and another one, vbusdiv2, is +-30mV.
I sincerely apologize for this mistake and for any inconvenience...

>
> >
> > > This scale should be presented directly to userspace anyway so no need
> > > for this doc.
> > >
> > > > +             higher measure range(1~22V)
> > > > +             Calculating with scale returns voltage in uV
> > >
> > > No. All channels return in mV. That's the ABI requirement as
> > > in sysfs-bus-iio and we cannot vary if for particular drivers.  If we did
> > > no generic tooling would work.
> >
> > Ok, I got it!
> >
> > >
> > > > +
> > > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage1_raw
> > > > +KernelVersion:       5.18
> > > > +Contact:     chiaen_wu@richtek.com
> > > > +Description:
> > > > +             Indicated MT6370 VBUS ADC with higher accuracy(+-30mA)
> > > > +             lower measure range(1~9.76V)
> > > > +             Calculating with scale offset returns voltage in uV
> > > > +
> > > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage4_raw
> > > > +KernelVersion:       5.18
> > > > +Contact:     chiaen_wu@richtek.com
> > > > +Description:
> > > > +             Indicated MT6370 TS_BAT ADC
> > > > +             Calculating with scale returns voltage in uV
> > > > +
> > > > +What:                /sys/bus/iio/devices/iio:deviceX/in_voltage7_raw
> > > > +KernelVersion:       5.18
> > > > +Contact:     chiaen_wu@richtek.com
> > > > +Description:
> > > > +             Indicated MT6370 CHG_VDDP ADC
> > > > +             Calculating with scale returns voltage in mV
> > > > +
> > > > +What:                /sys/bus/iio/devices/iio:deviceX/in_temp8_raw
> > > > +KernelVersion:       5.18
> > > > +Contact:     chiaen_wu@richtek.com
> > > > +Description:
> > > > +             Indicated MT6370 IC junction temperature
> > > > +             Calculating with scale and offset returns temperature in degree
> >
> > Shall I modify the scale of temperature to milli degrees in
> > mt6370-adc.c and remove this item??
>
> yes.
>
> Thanks,
>
> Jonathan
>
> >
> > >
> >
> > Best regards,
> > ChiaEn Wu
>

Best regards,
ChiaEn Wu
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370 b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
new file mode 100644
index 000000000000..039b3381176a
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-mt6370
@@ -0,0 +1,36 @@ 
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltage0_raw
+KernelVersion:	5.18
+Contact:	chiaen_wu@richtek.com
+Description:
+		Indicated MT6370 VBUS ADC with lower accuracy(+-75mA)
+		higher measure range(1~22V)
+		Calculating with scale returns voltage in uV
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltage1_raw
+KernelVersion:	5.18
+Contact:	chiaen_wu@richtek.com
+Description:
+		Indicated MT6370 VBUS ADC with higher accuracy(+-30mA)
+		lower measure range(1~9.76V)
+		Calculating with scale offset returns voltage in uV
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltage4_raw
+KernelVersion:	5.18
+Contact:	chiaen_wu@richtek.com
+Description:
+		Indicated MT6370 TS_BAT ADC
+		Calculating with scale returns voltage in uV
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_voltage7_raw
+KernelVersion:	5.18
+Contact:	chiaen_wu@richtek.com
+Description:
+		Indicated MT6370 CHG_VDDP ADC
+		Calculating with scale returns voltage in mV
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_temp8_raw
+KernelVersion:	5.18
+Contact:	chiaen_wu@richtek.com
+Description:
+		Indicated MT6370 IC junction temperature
+		Calculating with scale and offset returns temperature in degree