diff mbox series

[2/2] dt-bindings: iio: adc: nxp,imx93-adc.yaml: Add calibration properties

Message ID 20240320100407.1639082-3-andrej.picej@norik.com
State Changes Requested
Headers show
Series i.MX93 ADC calibration settings | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dt-meta-schema fail build log

Commit Message

Andrej Picej March 20, 2024, 10:04 a.m. UTC
Document calibration properties and how to set them.

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Andrej Picej March 20, 2024, 12:05 p.m. UTC | #1
Hi Krzysztof,

On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:
> On 20/03/2024 11:04, Andrej Picej wrote:
>> Document calibration properties and how to set them.
> 
> Bindings are before users.

will change patch order when I send a v2.

> 
> Please use subject prefixes matching the subsystem. You can get them for
> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
> your patch is touching.
> There is no file extension in prefixes.

So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?

> 
>>
>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>> ---
>>   .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>> index dacc526dc695..64958be62a6a 100644
>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>> @@ -46,6 +46,21 @@ properties:
>>     "#io-channel-cells":
>>       const: 1
>>   
>> +  nxp,calib-avg-en:
>> +    description:
>> +      Enable or disable averaging of calibration time.
>> +    enum: [ 0, 1 ]
>> +
>> +  nxp,calib-nr-samples:
>> +    description:
>> +      Selects the number of averaging samples to be used during calibration.
>> +    enum: [ 16, 32, 128, 512 ]
>> +
>> +  nxp,calib-t-samples:
>> +    description:
>> +      Specifies the sample time of calibration conversions.
>> +    enum: [ 8, 16, 22, 32 ]
> 
> No, use existing, generic properties. Open other bindings for this.

You mean I should use generic properties for the ADC calibration 
settings? Is there already something in place? Because as I understand 
it, these calib-* values only effect the calibration process of the ADC.

> 
> Also, none of these were tested. I am not going to review such untested
> code.
> 
> It does not look like you tested the bindings, at least after quick
> look. Please run `make dt_binding_check` (see
> Documentation/devicetree/bindings/writing-schema.rst for instructions).
> Maybe you need to update your dtschema and yamllint.

You are right, I did not run the dt_binding_check, sorry for this, 
forgot that this existed. I see now I have to add the:
> $ref: /schemas/types.yaml#/definitions/uint32

Will fix in v2.

BR,
Andrej

> 
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski March 20, 2024, 12:15 p.m. UTC | #2
On 20/03/2024 13:05, Andrej Picej wrote:
> Hi Krzysztof,
> 
> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:
>> On 20/03/2024 11:04, Andrej Picej wrote:
>>> Document calibration properties and how to set them.
>>
>> Bindings are before users.
> 
> will change patch order when I send a v2.
> 
>>
>> Please use subject prefixes matching the subsystem. You can get them for
>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
>> your patch is touching.
>> There is no file extension in prefixes.
> 
> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?

Did you run the command I proposed? I don't see much of "/", but except
that looks good.

> 
>>
>>>
>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>> ---
>>>   .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>>>   1 file changed, 15 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>> index dacc526dc695..64958be62a6a 100644
>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>> @@ -46,6 +46,21 @@ properties:
>>>     "#io-channel-cells":
>>>       const: 1
>>>   
>>> +  nxp,calib-avg-en:
>>> +    description:
>>> +      Enable or disable averaging of calibration time.
>>> +    enum: [ 0, 1 ]
>>> +
>>> +  nxp,calib-nr-samples:
>>> +    description:
>>> +      Selects the number of averaging samples to be used during calibration.
>>> +    enum: [ 16, 32, 128, 512 ]
>>> +
>>> +  nxp,calib-t-samples:
>>> +    description:
>>> +      Specifies the sample time of calibration conversions.
>>> +    enum: [ 8, 16, 22, 32 ]
>>
>> No, use existing, generic properties. Open other bindings for this.
> 
> You mean I should use generic properties for the ADC calibration 
> settings? Is there already something in place? Because as I understand 
> it, these calib-* values only effect the calibration process of the ADC.

Please take a look at other devices and dtschema. We already have some
properties for this... but maybe they cannot be used?


Best regards,
Krzysztof
Rob Herring (Arm) March 20, 2024, 9:41 p.m. UTC | #3
On Wed, 20 Mar 2024 11:04:06 +0100, Andrej Picej wrote:
> Document calibration properties and how to set them.
> 
> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> ---
>  .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml: nxp,calib-avg-en: missing type definition
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml: nxp,calib-nr-samples: missing type definition
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml: nxp,calib-t-samples: missing type definition

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240320100407.1639082-3-andrej.picej@norik.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
kernel test robot March 22, 2024, 6:47 a.m. UTC | #4
Hi Andrej,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.8 next-20240322]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andrej-Picej/iio-adc-imx93-Make-calibration-properties-configurable/20240320-184314
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20240320100407.1639082-3-andrej.picej%40norik.com
patch subject: [PATCH 2/2] dt-bindings: iio: adc: nxp,imx93-adc.yaml: Add calibration properties
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240322/202403221438.trdG8I0x-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403221438.trdG8I0x-lkp@intel.com/

dtcheck warnings: (new ones prefixed by >>)
   Documentation/devicetree/bindings/net/snps,dwmac.yaml: mac-mode: missing type definition
>> Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml: nxp,calib-avg-en: missing type definition
>> Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml: nxp,calib-nr-samples: missing type definition
>> Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml: nxp,calib-t-samples: missing type definition
Andrej Picej March 22, 2024, 7:39 a.m. UTC | #5
On 20. 03. 24 13:15, Krzysztof Kozlowski wrote:
> On 20/03/2024 13:05, Andrej Picej wrote:
>> Hi Krzysztof,
>>
>> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:
>>> On 20/03/2024 11:04, Andrej Picej wrote:
>>>> Document calibration properties and how to set them.
>>>
>>> Bindings are before users.
>>
>> will change patch order when I send a v2.
>>
>>>
>>> Please use subject prefixes matching the subsystem. You can get them for
>>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
>>> your patch is touching.
>>> There is no file extension in prefixes.
>>
>> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?
> 
> Did you run the command I proposed? I don't see much of "/", but except
> that looks good.

Ok noted.

> 
>>
>>>
>>>>
>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>>> ---
>>>>    .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>>>>    1 file changed, 15 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>> index dacc526dc695..64958be62a6a 100644
>>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>> @@ -46,6 +46,21 @@ properties:
>>>>      "#io-channel-cells":
>>>>        const: 1
>>>>    
>>>> +  nxp,calib-avg-en:
>>>> +    description:
>>>> +      Enable or disable averaging of calibration time.
>>>> +    enum: [ 0, 1 ]
>>>> +
>>>> +  nxp,calib-nr-samples:
>>>> +    description:
>>>> +      Selects the number of averaging samples to be used during calibration.
>>>> +    enum: [ 16, 32, 128, 512 ]
>>>> +
>>>> +  nxp,calib-t-samples:
>>>> +    description:
>>>> +      Specifies the sample time of calibration conversions.
>>>> +    enum: [ 8, 16, 22, 32 ]
>>>
>>> No, use existing, generic properties. Open other bindings for this.
>>
>> You mean I should use generic properties for the ADC calibration
>> settings? Is there already something in place? Because as I understand
>> it, these calib-* values only effect the calibration process of the ADC.
> 
> Please take a look at other devices and dtschema. We already have some
> properties for this... but maybe they cannot be used?
> 

I did look into other ADC devices, grep across iio/adc, adc bindings 
folders and couldn't find anything closely related to what we are 
looking for. Could you please point me to the properties that you think 
should be used for this?

Thank you.
Andrej

> 
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski March 22, 2024, 8:14 a.m. UTC | #6
On 22/03/2024 08:39, Andrej Picej wrote:
> On 20. 03. 24 13:15, Krzysztof Kozlowski wrote:
>> On 20/03/2024 13:05, Andrej Picej wrote:
>>> Hi Krzysztof,
>>>
>>> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:
>>>> On 20/03/2024 11:04, Andrej Picej wrote:
>>>>> Document calibration properties and how to set them.
>>>>
>>>> Bindings are before users.
>>>
>>> will change patch order when I send a v2.
>>>
>>>>
>>>> Please use subject prefixes matching the subsystem. You can get them for
>>>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
>>>> your patch is touching.
>>>> There is no file extension in prefixes.
>>>
>>> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?
>>
>> Did you run the command I proposed? I don't see much of "/", but except
>> that looks good.
> 
> Ok noted.
> 
>>
>>>
>>>>
>>>>>
>>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>>>> ---
>>>>>    .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>>>>>    1 file changed, 15 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>> index dacc526dc695..64958be62a6a 100644
>>>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>> @@ -46,6 +46,21 @@ properties:
>>>>>      "#io-channel-cells":
>>>>>        const: 1
>>>>>    
>>>>> +  nxp,calib-avg-en:
>>>>> +    description:
>>>>> +      Enable or disable averaging of calibration time.
>>>>> +    enum: [ 0, 1 ]
>>>>> +
>>>>> +  nxp,calib-nr-samples:
>>>>> +    description:
>>>>> +      Selects the number of averaging samples to be used during calibration.
>>>>> +    enum: [ 16, 32, 128, 512 ]
>>>>> +
>>>>> +  nxp,calib-t-samples:
>>>>> +    description:
>>>>> +      Specifies the sample time of calibration conversions.
>>>>> +    enum: [ 8, 16, 22, 32 ]
>>>>
>>>> No, use existing, generic properties. Open other bindings for this.
>>>
>>> You mean I should use generic properties for the ADC calibration
>>> settings? Is there already something in place? Because as I understand
>>> it, these calib-* values only effect the calibration process of the ADC.
>>
>> Please take a look at other devices and dtschema. We already have some
>> properties for this... but maybe they cannot be used?
>>
> 
> I did look into other ADC devices, grep across iio/adc, adc bindings 
> folders and couldn't find anything closely related to what we are 
> looking for. Could you please point me to the properties that you think 
> should be used for this?

Indeed, there are few device specific like qcom,avg-samples. We have
though oversampling-ratio, settling-time-us and min-sample-time (which
is not that good because does not use unit suffix).

Then follow up questions:
 - nxp,calib-avg-en: Why is it a board-level decision? I would assume
this depends on user choice and what kind of input you have (which could
be board dependent or could be runtime decision).
 - nxp,calib-t-samples: what does it mean? Time is expressed in time
units, but there is nothing about units in the property name.

Best regards,
Krzysztof
Andrej Picej March 22, 2024, 9:58 a.m. UTC | #7
On 22. 03. 24 09:14, Krzysztof Kozlowski wrote:
> On 22/03/2024 08:39, Andrej Picej wrote:
>> On 20. 03. 24 13:15, Krzysztof Kozlowski wrote:
>>> On 20/03/2024 13:05, Andrej Picej wrote:
>>>> Hi Krzysztof,
>>>>
>>>> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:
>>>>> On 20/03/2024 11:04, Andrej Picej wrote:
>>>>>> Document calibration properties and how to set them.
>>>>>
>>>>> Bindings are before users.
>>>>
>>>> will change patch order when I send a v2.
>>>>
>>>>>
>>>>> Please use subject prefixes matching the subsystem. You can get them for
>>>>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
>>>>> your patch is touching.
>>>>> There is no file extension in prefixes.
>>>>
>>>> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?
>>>
>>> Did you run the command I proposed? I don't see much of "/", but except
>>> that looks good.
>>
>> Ok noted.
>>
>>>
>>>>
>>>>>
>>>>>>
>>>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>>>>> ---
>>>>>>     .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>>>>>>     1 file changed, 15 insertions(+)
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>>> index dacc526dc695..64958be62a6a 100644
>>>>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>>> @@ -46,6 +46,21 @@ properties:
>>>>>>       "#io-channel-cells":
>>>>>>         const: 1
>>>>>>     
>>>>>> +  nxp,calib-avg-en:
>>>>>> +    description:
>>>>>> +      Enable or disable averaging of calibration time.
>>>>>> +    enum: [ 0, 1 ]
>>>>>> +
>>>>>> +  nxp,calib-nr-samples:
>>>>>> +    description:
>>>>>> +      Selects the number of averaging samples to be used during calibration.
>>>>>> +    enum: [ 16, 32, 128, 512 ]
>>>>>> +
>>>>>> +  nxp,calib-t-samples:
>>>>>> +    description:
>>>>>> +      Specifies the sample time of calibration conversions.
>>>>>> +    enum: [ 8, 16, 22, 32 ]
>>>>>
>>>>> No, use existing, generic properties. Open other bindings for this.
>>>>
>>>> You mean I should use generic properties for the ADC calibration
>>>> settings? Is there already something in place? Because as I understand
>>>> it, these calib-* values only effect the calibration process of the ADC.
>>>
>>> Please take a look at other devices and dtschema. We already have some
>>> properties for this... but maybe they cannot be used?
>>>
>>
>> I did look into other ADC devices, grep across iio/adc, adc bindings
>> folders and couldn't find anything closely related to what we are
>> looking for. Could you please point me to the properties that you think
>> should be used for this?
> 
> Indeed, there are few device specific like qcom,avg-samples. We have
> though oversampling-ratio, settling-time-us and min-sample-time (which
> is not that good because does not use unit suffix).

Ok, these are examples but I think I should not use them, since these 
are i.MX93 ADC specific settings, which are used for configuration of 
calibration process, and are not related to the standard conversion 
process during runtime. Calibration process is the first step that 
should be done after every power-on reset.

> 
> Then follow up questions:
>   - nxp,calib-avg-en: Why is it a board-level decision? I would assume
> this depends on user choice and what kind of input you have (which could
> be board dependent or could be runtime decision).

Not really sure I get your question, so please elaborate if I missed the 
point.
This is a user choice, to enable or disable the averaging function in 
calibration, but this is a board-level decision, probably relates on 
external ADC regulators and input connections. The same options are used 
for every ADC channel and this can not be a runtime decision, since 
calibration is done before the ADC is even registered.

>   - nxp,calib-t-samples: what does it mean? Time is expressed in time
> units, but there is nothing about units in the property name.
> 

You are right, basically this is "time" in cycles of AD_CLK. I should at 
least add that to the property description.

Best regards,
Andrej Picej
Jonathan Cameron March 24, 2024, 1:54 p.m. UTC | #8
On Fri, 22 Mar 2024 10:58:54 +0100
Andrej Picej <andrej.picej@norik.com> wrote:

> On 22. 03. 24 09:14, Krzysztof Kozlowski wrote:
> > On 22/03/2024 08:39, Andrej Picej wrote:  
> >> On 20. 03. 24 13:15, Krzysztof Kozlowski wrote:  
> >>> On 20/03/2024 13:05, Andrej Picej wrote:  
> >>>> Hi Krzysztof,
> >>>>
> >>>> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:  
> >>>>> On 20/03/2024 11:04, Andrej Picej wrote:  
> >>>>>> Document calibration properties and how to set them.  
> >>>>>
> >>>>> Bindings are before users.  
> >>>>
> >>>> will change patch order when I send a v2.
> >>>>  
> >>>>>
> >>>>> Please use subject prefixes matching the subsystem. You can get them for
> >>>>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
> >>>>> your patch is touching.
> >>>>> There is no file extension in prefixes.  
> >>>>
> >>>> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?  
> >>>
> >>> Did you run the command I proposed? I don't see much of "/", but except
> >>> that looks good.  
> >>
> >> Ok noted.
> >>  
> >>>  
> >>>>  
> >>>>>  
> >>>>>>
> >>>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> >>>>>> ---
> >>>>>>     .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
> >>>>>>     1 file changed, 15 insertions(+)
> >>>>>>
> >>>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
> >>>>>> index dacc526dc695..64958be62a6a 100644
> >>>>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
> >>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
> >>>>>> @@ -46,6 +46,21 @@ properties:
> >>>>>>       "#io-channel-cells":
> >>>>>>         const: 1
> >>>>>>     
> >>>>>> +  nxp,calib-avg-en:
> >>>>>> +    description:
> >>>>>> +      Enable or disable averaging of calibration time.
> >>>>>> +    enum: [ 0, 1 ]
> >>>>>> +
> >>>>>> +  nxp,calib-nr-samples:
> >>>>>> +    description:
> >>>>>> +      Selects the number of averaging samples to be used during calibration.
> >>>>>> +    enum: [ 16, 32, 128, 512 ]
> >>>>>> +
> >>>>>> +  nxp,calib-t-samples:
> >>>>>> +    description:
> >>>>>> +      Specifies the sample time of calibration conversions.
> >>>>>> +    enum: [ 8, 16, 22, 32 ]  
> >>>>>
> >>>>> No, use existing, generic properties. Open other bindings for this.  
> >>>>
> >>>> You mean I should use generic properties for the ADC calibration
> >>>> settings? Is there already something in place? Because as I understand
> >>>> it, these calib-* values only effect the calibration process of the ADC.  
> >>>
> >>> Please take a look at other devices and dtschema. We already have some
> >>> properties for this... but maybe they cannot be used?
> >>>  
> >>
> >> I did look into other ADC devices, grep across iio/adc, adc bindings
> >> folders and couldn't find anything closely related to what we are
> >> looking for. Could you please point me to the properties that you think
> >> should be used for this?  
> > 
> > Indeed, there are few device specific like qcom,avg-samples. We have
> > though oversampling-ratio, settling-time-us and min-sample-time (which
> > is not that good because does not use unit suffix).  
> 
> Ok, these are examples but I think I should not use them, since these 
> are i.MX93 ADC specific settings, which are used for configuration of 
> calibration process, and are not related to the standard conversion 
> process during runtime. Calibration process is the first step that 
> should be done after every power-on reset.
> 
> > 
> > Then follow up questions:
> >   - nxp,calib-avg-en: Why is it a board-level decision? I would assume
> > this depends on user choice and what kind of input you have (which could
> > be board dependent or could be runtime decision).  
> 
> Not really sure I get your question, so please elaborate if I missed the 
> point.
> This is a user choice, to enable or disable the averaging function in 
> calibration, but this is a board-level decision, probably relates on 
> external ADC regulators and input connections. The same options are used 
> for every ADC channel and this can not be a runtime decision, since 
> calibration is done before the ADC is even registered.

I'll raise this question in reply to the cover letter or patch 1 where
it is perhaps more appropriate, but I'd really like to know more about why
these are useful at all. 

> 
> >   - nxp,calib-t-samples: what does it mean? Time is expressed in time
> > units, but there is nothing about units in the property name.
> >   
> 
> You are right, basically this is "time" in cycles of AD_CLK. I should at 
> least add that to the property description.
> 
> Best regards,
> Andrej Picej
Krzysztof Kozlowski March 25, 2024, 9:58 a.m. UTC | #9
On 22/03/2024 10:58, Andrej Picej wrote:
> On 22. 03. 24 09:14, Krzysztof Kozlowski wrote:
>> On 22/03/2024 08:39, Andrej Picej wrote:
>>> On 20. 03. 24 13:15, Krzysztof Kozlowski wrote:
>>>> On 20/03/2024 13:05, Andrej Picej wrote:
>>>>> Hi Krzysztof,
>>>>>
>>>>> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:
>>>>>> On 20/03/2024 11:04, Andrej Picej wrote:
>>>>>>> Document calibration properties and how to set them.
>>>>>>
>>>>>> Bindings are before users.
>>>>>
>>>>> will change patch order when I send a v2.
>>>>>
>>>>>>
>>>>>> Please use subject prefixes matching the subsystem. You can get them for
>>>>>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
>>>>>> your patch is touching.
>>>>>> There is no file extension in prefixes.
>>>>>
>>>>> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?
>>>>
>>>> Did you run the command I proposed? I don't see much of "/", but except
>>>> that looks good.
>>>
>>> Ok noted.
>>>
>>>>
>>>>>
>>>>>>
>>>>>>>
>>>>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>>>>>> ---
>>>>>>>     .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
>>>>>>>     1 file changed, 15 insertions(+)
>>>>>>>
>>>>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>>>> index dacc526dc695..64958be62a6a 100644
>>>>>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
>>>>>>> @@ -46,6 +46,21 @@ properties:
>>>>>>>       "#io-channel-cells":
>>>>>>>         const: 1
>>>>>>>     
>>>>>>> +  nxp,calib-avg-en:
>>>>>>> +    description:
>>>>>>> +      Enable or disable averaging of calibration time.
>>>>>>> +    enum: [ 0, 1 ]
>>>>>>> +
>>>>>>> +  nxp,calib-nr-samples:
>>>>>>> +    description:
>>>>>>> +      Selects the number of averaging samples to be used during calibration.
>>>>>>> +    enum: [ 16, 32, 128, 512 ]
>>>>>>> +
>>>>>>> +  nxp,calib-t-samples:
>>>>>>> +    description:
>>>>>>> +      Specifies the sample time of calibration conversions.
>>>>>>> +    enum: [ 8, 16, 22, 32 ]
>>>>>>
>>>>>> No, use existing, generic properties. Open other bindings for this.
>>>>>
>>>>> You mean I should use generic properties for the ADC calibration
>>>>> settings? Is there already something in place? Because as I understand
>>>>> it, these calib-* values only effect the calibration process of the ADC.
>>>>
>>>> Please take a look at other devices and dtschema. We already have some
>>>> properties for this... but maybe they cannot be used?
>>>>
>>>
>>> I did look into other ADC devices, grep across iio/adc, adc bindings
>>> folders and couldn't find anything closely related to what we are
>>> looking for. Could you please point me to the properties that you think
>>> should be used for this?
>>
>> Indeed, there are few device specific like qcom,avg-samples. We have
>> though oversampling-ratio, settling-time-us and min-sample-time (which
>> is not that good because does not use unit suffix).
> 
> Ok, these are examples but I think I should not use them, since these 
> are i.MX93 ADC specific settings, which are used for configuration of 


No vendor prefix, so they rather should be generic, not imx93
specific... But this the binding for imx93, so I don't understand your
statement.

> calibration process, and are not related to the standard conversion 
> process during runtime. Calibration process is the first step that 
> should be done after every power-on reset.
> 
>>
>> Then follow up questions:
>>   - nxp,calib-avg-en: Why is it a board-level decision? I would assume
>> this depends on user choice and what kind of input you have (which could
>> be board dependent or could be runtime decision).
> 
> Not really sure I get your question, so please elaborate if I missed the 
> point.
> This is a user choice, to enable or disable the averaging function in 
> calibration, but this is a board-level decision, probably relates on 
> external ADC regulators and input connections. The same options are used 
> for every ADC channel and this can not be a runtime decision, since 
> calibration is done before the ADC is even registered.

You now mix how Linux driver behaves with hardware. Why you cannot
recalibrate later, e.g. when something else is being connected to the
exposed pins?

Best regards,
Krzysztof
Jonathan Cameron March 25, 2024, 2:38 p.m. UTC | #10
On Mon, 25 Mar 2024 10:58:51 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 22/03/2024 10:58, Andrej Picej wrote:
> > On 22. 03. 24 09:14, Krzysztof Kozlowski wrote:  
> >> On 22/03/2024 08:39, Andrej Picej wrote:  
> >>> On 20. 03. 24 13:15, Krzysztof Kozlowski wrote:  
> >>>> On 20/03/2024 13:05, Andrej Picej wrote:  
> >>>>> Hi Krzysztof,
> >>>>>
> >>>>> On 20. 03. 24 11:26, Krzysztof Kozlowski wrote:  
> >>>>>> On 20/03/2024 11:04, Andrej Picej wrote:  
> >>>>>>> Document calibration properties and how to set them.  
> >>>>>>
> >>>>>> Bindings are before users.  
> >>>>>
> >>>>> will change patch order when I send a v2.
> >>>>>  
> >>>>>>
> >>>>>> Please use subject prefixes matching the subsystem. You can get them for
> >>>>>> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
> >>>>>> your patch is touching.
> >>>>>> There is no file extension in prefixes.  
> >>>>>
> >>>>> So: dt-bindings: iio/adc: nxp,imx93-adc: Add calibration properties?  
> >>>>
> >>>> Did you run the command I proposed? I don't see much of "/", but except
> >>>> that looks good.  
> >>>
> >>> Ok noted.
> >>>  
> >>>>  
> >>>>>  
> >>>>>>  
> >>>>>>>
> >>>>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> >>>>>>> ---
> >>>>>>>     .../bindings/iio/adc/nxp,imx93-adc.yaml           | 15 +++++++++++++++
> >>>>>>>     1 file changed, 15 insertions(+)
> >>>>>>>
> >>>>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
> >>>>>>> index dacc526dc695..64958be62a6a 100644
> >>>>>>> --- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
> >>>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
> >>>>>>> @@ -46,6 +46,21 @@ properties:
> >>>>>>>       "#io-channel-cells":
> >>>>>>>         const: 1
> >>>>>>>     
> >>>>>>> +  nxp,calib-avg-en:
> >>>>>>> +    description:
> >>>>>>> +      Enable or disable averaging of calibration time.
> >>>>>>> +    enum: [ 0, 1 ]
> >>>>>>> +
> >>>>>>> +  nxp,calib-nr-samples:
> >>>>>>> +    description:
> >>>>>>> +      Selects the number of averaging samples to be used during calibration.
> >>>>>>> +    enum: [ 16, 32, 128, 512 ]
> >>>>>>> +
> >>>>>>> +  nxp,calib-t-samples:
> >>>>>>> +    description:
> >>>>>>> +      Specifies the sample time of calibration conversions.
> >>>>>>> +    enum: [ 8, 16, 22, 32 ]  
> >>>>>>
> >>>>>> No, use existing, generic properties. Open other bindings for this.  
> >>>>>
> >>>>> You mean I should use generic properties for the ADC calibration
> >>>>> settings? Is there already something in place? Because as I understand
> >>>>> it, these calib-* values only effect the calibration process of the ADC.  
> >>>>
> >>>> Please take a look at other devices and dtschema. We already have some
> >>>> properties for this... but maybe they cannot be used?
> >>>>  
> >>>
> >>> I did look into other ADC devices, grep across iio/adc, adc bindings
> >>> folders and couldn't find anything closely related to what we are
> >>> looking for. Could you please point me to the properties that you think
> >>> should be used for this?  
> >>
> >> Indeed, there are few device specific like qcom,avg-samples. We have
> >> though oversampling-ratio, settling-time-us and min-sample-time (which
> >> is not that good because does not use unit suffix).  
> > 
> > Ok, these are examples but I think I should not use them, since these 
> > are i.MX93 ADC specific settings, which are used for configuration of   
> 
> 
> No vendor prefix, so they rather should be generic, not imx93
> specific... But this the binding for imx93, so I don't understand your
> statement.

Based on my current understanding what we have here is not remotely
generic, so standard properties don't make sense (though naming the
nxp ones in a consistent fashion with other bindings is useful)

I'm not entirely convinced there is a strong argument to support them at all
though.  Still thinking / gathering info on that.

> 
> > calibration process, and are not related to the standard conversion 
> > process during runtime. Calibration process is the first step that 
> > should be done after every power-on reset.
> >   
> >>
> >> Then follow up questions:
> >>   - nxp,calib-avg-en: Why is it a board-level decision? I would assume
> >> this depends on user choice and what kind of input you have (which could
> >> be board dependent or could be runtime decision).  
> > 
> > Not really sure I get your question, so please elaborate if I missed the 
> > point.
> > This is a user choice, to enable or disable the averaging function in 
> > calibration, but this is a board-level decision, probably relates on 
> > external ADC regulators and input connections. The same options are used 
> > for every ADC channel and this can not be a runtime decision, since 
> > calibration is done before the ADC is even registered.  
> 
> You now mix how Linux driver behaves with hardware. Why you cannot
> recalibrate later, e.g. when something else is being connected to the
> exposed pins?

Generally we don't make strong efforts to support dev board use cases where
the components wired tend to change.  So normally this isn't too much of
a concern.  Previously, we've tried to support this stuff and it always
ends up as a mess because of the crazy range of things that can be wired.

Jonathan

> 
> Best regards,
> Krzysztof
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
index dacc526dc695..64958be62a6a 100644
--- a/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
@@ -46,6 +46,21 @@  properties:
   "#io-channel-cells":
     const: 1
 
+  nxp,calib-avg-en:
+    description:
+      Enable or disable averaging of calibration time.
+    enum: [ 0, 1 ]
+
+  nxp,calib-nr-samples:
+    description:
+      Selects the number of averaging samples to be used during calibration.
+    enum: [ 16, 32, 128, 512 ]
+
+  nxp,calib-t-samples:
+    description:
+      Specifies the sample time of calibration conversions.
+    enum: [ 8, 16, 22, 32 ]
+
 required:
   - compatible
   - reg