[1/3] dt-bindings: iio: imu: mpu6050: Add level shifter

Message ID 20230924222559.2038721-2-andreas@kemnade.info
State New
Headers
Series ARM: omap: omap4-embt2ws: Add IMU on control unit |

Commit Message

Andreas Kemnade Sept. 24, 2023, 10:25 p.m. UTC
  Found in ancient platform data struct:
level_shifter: 0: VLogic, 1: VDD

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Rob Herring Sept. 24, 2023, 11:33 p.m. UTC | #1
On Mon, 25 Sep 2023 00:25:57 +0200, Andreas Kemnade wrote:
> Found in ancient platform data struct:
> level_shifter: 0: VLogic, 1: VDD
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
>  1 file changed, 2 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/imu/invensense,mpu6050.yaml: properties:invensense,level-shifter: True is not of type 'object'
	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml: properties:invensense,level-shifter: More than one condition true in oneOf schema:
	{'description': 'Vendor specific properties must have a type and '
	                'description unless they have a defined, common '
	                'suffix.',
	 'oneOf': [{'additionalProperties': False,
	            'description': 'A vendor boolean property can use "type: '
	                           'boolean"',
	            'properties': {'deprecated': True,
	                           'description': True,
	                           'type': {'const': 'boolean'}},
	            'required': ['type', 'description']},
	           {'additionalProperties': False,
	            'description': 'A vendor string property with exact values '
	                           'has an implicit type',
	            'oneOf': [{'required': ['enum']}, {'required': ['const']}],
	            'properties': {'const': {'type': 'string'},
	                           'deprecated': True,
	                           'description': True,
	                           'enum': {'items': {'type': 'string'}}},
	            'required': ['description']},
	           {'description': 'A vendor property needs a $ref to '
	                           'types.yaml',
	            'oneOf': [{'required': ['$ref']}, {'required': ['allOf']}],
	            'properties': {'$ref': {'pattern': 'types.yaml#/definitions/'},
	                           'allOf': {'items': [{'properties': {'$ref': {'pattern': 'types.yaml#/definitions/'}},
	                                                'required': ['$ref']}]}},
	            'required': ['description']},
	           {'description': 'A vendor property can have a $ref to a a '
	                           '$defs schema',
	            'properties': {'$ref': {'pattern': '^#/(definitions|\\$defs)/'}},
	            'required': ['$ref']}],
	 'type': 'object'}
	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230924222559.2038721-2-andreas@kemnade.info

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 Sept. 24, 2023, 11:39 p.m. UTC | #2
Hi Andreas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on robh/for-next linus/master v6.6-rc3 next-20230921]
[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/Andreas-Kemnade/dt-bindings-iio-imu-mpu6050-Add-level-shifter/20230925-062804
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20230924222559.2038721-2-andreas%40kemnade.info
patch subject: [PATCH 1/3] dt-bindings: iio: imu: mpu6050: Add level shifter
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230925/202309250753.7v7FAzek-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/202309250753.7v7FAzek-lkp@intel.com/

dtcheck warnings: (new ones prefixed by >>)
>> Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml: properties:invensense,level-shifter: True is not of type 'object'
   	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
   	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
>> Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml: properties:invensense,level-shifter: More than one condition true in oneOf schema:
   	{'description': 'Vendor specific properties must have a type and '
   	                'description unless they have a defined, common '
   	                'suffix.',
   	 'oneOf': [{'additionalProperties': False,
   	            'description': 'A vendor boolean property can use "type: '
   	                           'boolean"',
   	            'properties': {'deprecated': True,
   	                           'description': True,
   	                           'type': {'const': 'boolean'}},
   	            'required': ['type', 'description']},
  
Krzysztof Kozlowski Sept. 25, 2023, 6:54 a.m. UTC | #3
On 25/09/2023 00:25, Andreas Kemnade wrote:
> Found in ancient platform data struct:
> level_shifter: 0: VLogic, 1: VDD
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> index 1db6952ddca5e..6aae2272fa15c 100644
> --- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> @@ -48,6 +48,8 @@ properties:
>  
>    mount-matrix: true
>  
> +  invensense,level-shifter: true

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.

Best regards,
Krzysztof
  
Andreas Kemnade Sept. 25, 2023, 11:02 a.m. UTC | #4
On Mon, 25 Sep 2023 11:28:52 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Mon, 25 Sep 2023 08:54:08 +0200
> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> 
> > On 25/09/2023 00:25, Andreas Kemnade wrote:  
> > > Found in ancient platform data struct:
> > > level_shifter: 0: VLogic, 1: VDD
> > > 
> > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > > ---
> > >  .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> > > index 1db6952ddca5e..6aae2272fa15c 100644
> > > --- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> > > @@ -48,6 +48,8 @@ properties:
> > >  
> > >    mount-matrix: true
> > >  
> > > +  invensense,level-shifter: true    
> > 
> > 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.
> > 
> > Best regards,
> > Krzysztof
> > 
> >   
> 
> Also this one isn't obvious - give it a description in the binding doc.
> 
> I'm not sure of the arguement for calling it level shift in general.
> 
I have no more descrption than the old source (see the citation from there)
https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-9150-Register-Map.pdf

does not list it. But that bit is needed to get things to work what also does the
vendor kernel do.

What could be a better descrption?

Regards,
Andreas
  
Krzysztof Kozlowski Sept. 25, 2023, 12:24 p.m. UTC | #5
On 25/09/2023 13:02, Andreas Kemnade wrote:
> On Mon, 25 Sep 2023 11:28:52 +0100
> Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> 
>> On Mon, 25 Sep 2023 08:54:08 +0200
>> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
>>
>>> On 25/09/2023 00:25, Andreas Kemnade wrote:  
>>>> Found in ancient platform data struct:
>>>> level_shifter: 0: VLogic, 1: VDD
>>>>
>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
>>>> ---
>>>>  .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
>>>> index 1db6952ddca5e..6aae2272fa15c 100644
>>>> --- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
>>>> +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
>>>> @@ -48,6 +48,8 @@ properties:
>>>>  
>>>>    mount-matrix: true
>>>>  
>>>> +  invensense,level-shifter: true    
>>>
>>> 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.
>>>
>>> Best regards,
>>> Krzysztof
>>>
>>>   
>>
>> Also this one isn't obvious - give it a description in the binding doc.
>>
>> I'm not sure of the arguement for calling it level shift in general.
>>
> I have no more descrption than the old source (see the citation from there)
> https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-9150-Register-Map.pdf

I could not find any reference to level shift in this manual. To which
page and part do you refer?

> 
> does not list it. But that bit is needed to get things to work what also does the
> vendor kernel do.
> 
> What could be a better descrption?

I don't know, but something reasonable to you should be put there.

Best regards,
Krzysztof
  
Jean-Baptiste Maneyrol Sept. 25, 2023, 2:25 p.m. UTC | #6
Hello,

these are very old unsupported chips, thus this is not something that can be easily found. Even after doing some archaeology.

But when looking at register maps, it should only be used with MPU-9150 and not MPU-9250. I would feel much more comfortable to restrict this fix to MPU-9150 only (by testing chip_type against INV_MPU9150).

Thanks,
JB


From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Sent: Monday, September 25, 2023 15:21
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Andreas Kemnade <andreas@kemnade.info>; jic23@kernel.org <jic23@kernel.org>; lars@metafoo.de <lars@metafoo.de>; robh+dt@kernel.org <robh+dt@kernel.org>; krzysztof.kozlowski+dt@linaro.org <krzysztof.kozlowski+dt@linaro.org>; conor+dt@kernel.org <conor+dt@kernel.org>; bcousson@baylibre.com <bcousson@baylibre.com>; tony@atomide.com <tony@atomide.com>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; chenhuiz@axis.com <chenhuiz@axis.com>; andy.shevchenko@gmail.com <andy.shevchenko@gmail.com>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; devicetree@vger.kernel.org <devicetree@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; linux-omap@vger.kernel.org <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 1/3] dt-bindings: iio: imu: mpu6050: Add level shifter 
 
On Mon, 25 Sep 2023 14: 24: 32 +0200 Krzysztof Kozlowski <krzysztof. kozlowski@ linaro. org> wrote: > On 25/09/2023 13: 02, Andreas Kemnade wrote: > > On Mon, 25 Sep 2023 11: 28: 52 +0100 > > Jonathan Cameron <Jonathan. Cameron@ Huawei. com> 
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender 
This message came from outside your organization. 
 
ZjQcmQRYFpfptBannerEnd
On Mon, 25 Sep 2023 14:24:32 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 25/09/2023 13:02, Andreas Kemnade wrote:
> > On Mon, 25 Sep 2023 11:28:52 +0100
> > Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> >   
> >> On Mon, 25 Sep 2023 08:54:08 +0200
> >> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> >>  
> >>> On 25/09/2023 00:25, Andreas Kemnade wrote:    
> >>>> Found in ancient platform data struct:
> >>>> level_shifter: 0: VLogic, 1: VDD
> >>>>
> >>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> >>>> ---
> >>>>  .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
> >>>>  1 file changed, 2 insertions(+)
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> >>>> index 1db6952ddca5e..6aae2272fa15c 100644
> >>>> --- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> >>>> +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> >>>> @@ -48,6 +48,8 @@ properties:
> >>>>  
> >>>>    mount-matrix: true
> >>>>  
> >>>> +  invensense,level-shifter: true      
> >>>
> >>> 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.
> >>>
> >>> Best regards,
> >>> Krzysztof
> >>>
> >>>     
> >>
> >> Also this one isn't obvious - give it a description in the binding doc.
> >>
> >> I'm not sure of the arguement for calling it level shift in general.
> >>  
> > I have no more descrption than the old source (see the citation from there)
> > https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-9150-Register-Map.pdf  
> 
> I could not find any reference to level shift in this manual. To which
> page and part do you refer?
> 
> > 
> > does not list it. But that bit is needed to get things to work what also does the
> > vendor kernel do.
> > 
> > What could be a better descrption?  
> 
> I don't know, but something reasonable to you should be put there.

The text you have in the commit log seems better than nothing.
I suspect it's internally wiring VDD to VDDIO. Normally people just
connect both power supplies to same supply if they want to do that,
but maybe there was a chip variant that didn't have enough pins?

If you have the device, can you see it actually matches the packaging
types in the manual?

Jonathan

> 
> Best regards,
> Krzysztof
> 
>
  
Andreas Kemnade Sept. 25, 2023, 6:02 p.m. UTC | #7
On Mon, 25 Sep 2023 14:21:57 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Mon, 25 Sep 2023 14:24:32 +0200
> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> 
> > On 25/09/2023 13:02, Andreas Kemnade wrote:  
> > > On Mon, 25 Sep 2023 11:28:52 +0100
> > > Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> > >     
> > >> On Mon, 25 Sep 2023 08:54:08 +0200
> > >> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> > >>    
> > >>> On 25/09/2023 00:25, Andreas Kemnade wrote:      
> > >>>> Found in ancient platform data struct:
> > >>>> level_shifter: 0: VLogic, 1: VDD
> > >>>>
> > >>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > >>>> ---
> > >>>>  .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml         | 2 ++
> > >>>>  1 file changed, 2 insertions(+)
> > >>>>
> > >>>> diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> > >>>> index 1db6952ddca5e..6aae2272fa15c 100644
> > >>>> --- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> > >>>> +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
> > >>>> @@ -48,6 +48,8 @@ properties:
> > >>>>  
> > >>>>    mount-matrix: true
> > >>>>  
> > >>>> +  invensense,level-shifter: true        
> > >>>
> > >>> 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.
> > >>>
> > >>> Best regards,
> > >>> Krzysztof
> > >>>
> > >>>       
> > >>
> > >> Also this one isn't obvious - give it a description in the binding doc.
> > >>
> > >> I'm not sure of the arguement for calling it level shift in general.
> > >>    
> > > I have no more descrption than the old source (see the citation from there)
citation = line from ancient pdata struct comment cited in the commit message.

> > > https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-9150-Register-Map.pdf    
> > 
> > I could not find any reference to level shift in this manual. To which
> > page and part do you refer?
> >
> > > 
> > > does not list it. But that bit is needed to get things to work what also does the
> > > vendor kernel do.
> > > 
> > > What could be a better descrption?    
> > 
> > I don't know, but something reasonable to you should be put there.  
> 
> The text you have in the commit log seems better than nothing.
> I suspect it's internally wiring VDD to VDDIO. Normally people just
> connect both power supplies to same supply if they want to do that,
> but maybe there was a chip variant that didn't have enough pins?
> 
> If you have the device, can you see it actually matches the packaging
> types in the manual?
> 
packaging matches. It is just as usual. I think VLogic (=VDDIO) would be 1.8V
while VDD needs to be something higher, so I guess here it might be 3.3V.
There are some slight hints about level shifting here:
https://product.tdk.com/system/files/dam/doc/product/sensor/mortion-inertial/imu/data_sheet/mpu-9150-datasheet.pdf
page 37. The aux i2c bus seem to run at levels till VDD. But here, there
seems to be nothing at the aux i2c bus besides that internal magnetometer.

Regards,
Andreas
  

Patch

diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
index 1db6952ddca5e..6aae2272fa15c 100644
--- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
@@ -48,6 +48,8 @@  properties:
 
   mount-matrix: true
 
+  invensense,level-shifter: true
+
   i2c-gate:
     $ref: /schemas/i2c/i2c-controller.yaml
     unevaluatedProperties: false