dt-bindings: iio: st-sensors: Add IIS2MDC magnetometer

Message ID 20240221175810.3581399-1-m.felsch@pengutronix.de
State New
Headers
Series dt-bindings: iio: st-sensors: Add IIS2MDC magnetometer |

Commit Message

Marco Felsch Feb. 21, 2024, 5:58 p.m. UTC
  Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Conor Dooley Feb. 21, 2024, 6:54 p.m. UTC | #1
On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:
> Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> index fff7e3d83a02..ee593c8bbb65 100644
> --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> @@ -64,6 +64,7 @@ properties:
>            - st,lsm9ds0-gyro
>        - description: STMicroelectronics Magnetometers
>          enum:
> +          - st,iis2mdc

Without a fallback compatible to the equivilent device, how does a
driver bind to this device?

Cheers,
Conor.

>            - st,lis2mdl
>            - st,lis3mdl-magn
>            - st,lsm303agr-magn
> -- 
> 2.39.2
>
  
Marco Felsch Feb. 21, 2024, 7:16 p.m. UTC | #2
On 24-02-21, Conor Dooley wrote:
> On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:
> > Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> >  Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > index fff7e3d83a02..ee593c8bbb65 100644
> > --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > @@ -64,6 +64,7 @@ properties:
> >            - st,lsm9ds0-gyro
> >        - description: STMicroelectronics Magnetometers
> >          enum:
> > +          - st,iis2mdc
> 
> Without a fallback compatible to the equivilent device, how does a
> driver bind to this device?

I skimed the datasheets and the driver already handles this binding
exactly the same as the st,lis2mdl, so my assumption is they do match.

Why do I you think we need a fallback compatible here?

Regards,
  Marco

> 
> Cheers,
> Conor.
> 
> >            - st,lis2mdl
> >            - st,lis3mdl-magn
> >            - st,lsm303agr-magn
> > -- 
> > 2.39.2
> >
  
Conor Dooley Feb. 21, 2024, 7:27 p.m. UTC | #3
On Wed, Feb 21, 2024 at 08:16:44PM +0100, Marco Felsch wrote:
> On 24-02-21, Conor Dooley wrote:
> > On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:
> > > Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.
> > > 
> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > ---
> > >  Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > index fff7e3d83a02..ee593c8bbb65 100644
> > > --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > @@ -64,6 +64,7 @@ properties:
> > >            - st,lsm9ds0-gyro
> > >        - description: STMicroelectronics Magnetometers
> > >          enum:
> > > +          - st,iis2mdc
> > 
> > Without a fallback compatible to the equivilent device, how does a
> > driver bind to this device?
> 
> I skimed the datasheets and the driver already handles this binding
> exactly the same as the st,lis2mdl, so my assumption is they do match.
> 
> Why do I you think we need a fallback compatible here?

I didn't look at the driver, there was no mention of the driver already
having (undocumented) support for it. Since there was no driver change
alongside this patch, I thought you'd need a fallback compatible to
allow the driver to match against a compatible it recognises.
Besides, having fallback compatibles is the norm when one device has the
same programming model as another.


Cheers,
Conor.
  
Marco Felsch Feb. 21, 2024, 7:45 p.m. UTC | #4
Hi Conor,

On 24-02-21, Conor Dooley wrote:
> On Wed, Feb 21, 2024 at 08:16:44PM +0100, Marco Felsch wrote:
> > On 24-02-21, Conor Dooley wrote:
> > > On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:
> > > > Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.
> > > > 
> > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > ---
> > > >  Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > index fff7e3d83a02..ee593c8bbb65 100644
> > > > --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > @@ -64,6 +64,7 @@ properties:
> > > >            - st,lsm9ds0-gyro
> > > >        - description: STMicroelectronics Magnetometers
> > > >          enum:
> > > > +          - st,iis2mdc
> > > 
> > > Without a fallback compatible to the equivilent device, how does a
> > > driver bind to this device?
> > 
> > I skimed the datasheets and the driver already handles this binding
> > exactly the same as the st,lis2mdl, so my assumption is they do match.
> > 
> > Why do I you think we need a fallback compatible here?
> 
> I didn't look at the driver, there was no mention of the driver already
> having (undocumented) support for it. Since there was no driver change
> alongside this patch, I thought you'd need a fallback compatible to
> allow the driver to match against a compatible it recognises.

I explicitly did not mention the driver in the commit message else I
would have got a response like "dt-bindings have no dependency to
drivers" ;)

> Besides, having fallback compatibles is the norm when one device has the
> same programming model as another.

Not for this binding according the driver.

Regards,
  Marco

> 
> 
> Cheers,
> Conor.
>
  
Conor Dooley Feb. 21, 2024, 9:37 p.m. UTC | #5
On Wed, Feb 21, 2024 at 08:45:18PM +0100, Marco Felsch wrote:
> Hi Conor,
> 
> On 24-02-21, Conor Dooley wrote:
> > On Wed, Feb 21, 2024 at 08:16:44PM +0100, Marco Felsch wrote:
> > > On 24-02-21, Conor Dooley wrote:
> > > > On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:
> > > > > Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.
> > > > > 
> > > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > > ---
> > > > >  Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > > > 
> > > > > diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > > index fff7e3d83a02..ee593c8bbb65 100644
> > > > > --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > > +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > > @@ -64,6 +64,7 @@ properties:
> > > > >            - st,lsm9ds0-gyro
> > > > >        - description: STMicroelectronics Magnetometers
> > > > >          enum:
> > > > > +          - st,iis2mdc
> > > > 
> > > > Without a fallback compatible to the equivilent device, how does a
> > > > driver bind to this device?
> > > 
> > > I skimed the datasheets and the driver already handles this binding
> > > exactly the same as the st,lis2mdl, so my assumption is they do match.
> > > 
> > > Why do I you think we need a fallback compatible here?
> > 
> > I didn't look at the driver, there was no mention of the driver already
> > having (undocumented) support for it. Since there was no driver change
> > alongside this patch, I thought you'd need a fallback compatible to
> > allow the driver to match against a compatible it recognises.
> 
> I explicitly did not mention the driver in the commit message else I
> would have got a response like "dt-bindings have no dependency to
> drivers" ;)

Putting it under the --- line is always an option. Where there are
existing users but the compatible is just undocumented, this it's
helpful to do.

> > Besides, having fallback compatibles is the norm when one device has the
> > same programming model as another.
> 
> Not for this binding according the driver.

If they don't have the same programming model, then describing them as
"equivalent" wouldn't be correct. That said, they seem to use the same
sensor settings when alls said and done (see st_magn_sensors_settings),
so I think they are actually compatible even if the driver has separate
match data for each.

Cheers,
Conor.
  
Marco Felsch Feb. 22, 2024, 8:47 a.m. UTC | #6
On 24-02-21, Conor Dooley wrote:
> On Wed, Feb 21, 2024 at 08:45:18PM +0100, Marco Felsch wrote:
> > Hi Conor,
> > 
> > On 24-02-21, Conor Dooley wrote:
> > > On Wed, Feb 21, 2024 at 08:16:44PM +0100, Marco Felsch wrote:
> > > > On 24-02-21, Conor Dooley wrote:
> > > > > On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:
> > > > > > Add the iis2mdc magnetometer support which is equivalent to the lis2mdl.
> > > > > > 
> > > > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > > > ---
> > > > > >  Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
> > > > > >  1 file changed, 1 insertion(+)
> > > > > > 
> > > > > > diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > > > index fff7e3d83a02..ee593c8bbb65 100644
> > > > > > --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > > > +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> > > > > > @@ -64,6 +64,7 @@ properties:
> > > > > >            - st,lsm9ds0-gyro
> > > > > >        - description: STMicroelectronics Magnetometers
> > > > > >          enum:
> > > > > > +          - st,iis2mdc
> > > > > 
> > > > > Without a fallback compatible to the equivilent device, how does a
> > > > > driver bind to this device?
> > > > 
> > > > I skimed the datasheets and the driver already handles this binding
> > > > exactly the same as the st,lis2mdl, so my assumption is they do match.
> > > > 
> > > > Why do I you think we need a fallback compatible here?
> > > 
> > > I didn't look at the driver, there was no mention of the driver already
> > > having (undocumented) support for it. Since there was no driver change
> > > alongside this patch, I thought you'd need a fallback compatible to
> > > allow the driver to match against a compatible it recognises.
> > 
> > I explicitly did not mention the driver in the commit message else I
> > would have got a response like "dt-bindings have no dependency to
> > drivers" ;)
> 
> Putting it under the --- line is always an option. Where there are
> existing users but the compatible is just undocumented, this it's
> helpful to do.
> 
> > > Besides, having fallback compatibles is the norm when one device has the
> > > same programming model as another.
> > 
> > Not for this binding according the driver.
> 
> If they don't have the same programming model, then describing them as
> "equivalent" wouldn't be correct. That said, they seem to use the same
> sensor settings when alls said and done (see st_magn_sensors_settings),
> so I think they are actually compatible even if the driver has separate
> match data for each.

I told you that I have checked the driver and skimed the datasheets and
came to the exact same conclusion.

Regards,
  Marco


> 
> Cheers,
> Conor.
  
Conor Dooley Feb. 22, 2024, 10:29 a.m. UTC | #7
On Thu, Feb 22, 2024 at 09:47:17AM +0100, Marco Felsch wrote:
> On 24-02-21, Conor Dooley wrote:
> > On Wed, Feb 21, 2024 at 08:45:18PM +0100, Marco Felsch wrote:
> > > On 24-02-21, Conor Dooley wrote:
> > > > On Wed, Feb 21, 2024 at 08:16:44PM +0100, Marco Felsch wrote:
> > > > > On 24-02-21, Conor Dooley wrote:
> > > > > > On Wed, Feb 21, 2024 at 06:58:10PM +0100, Marco Felsch wrote:

> > > > Besides, having fallback compatibles is the norm when one device has the
> > > > same programming model as another.
> > > 
> > > Not for this binding according the driver.
> > 
> > If they don't have the same programming model, then describing them as
> > "equivalent" wouldn't be correct. That said, they seem to use the same
> > sensor settings when alls said and done (see st_magn_sensors_settings),
> > so I think they are actually compatible even if the driver has separate
> > match data for each.
> 
> I told you that I have checked the driver and skimed the datasheets and
> came to the exact same conclusion.

Did you tell me that? I did't see it.

Anyway, I think what happened is that I interpreted "Not for this
binding according the driver" as a comment about the programming model
being different, but you meant it in reference to the fallback. Since
they do have the same programming model the fallback is appropriate,
even if the driver knows about the iis2mdc compatible.
I'd squash in the following, similar to what was done for the
st,iis328dq that was added recently:

diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
index ee593c8bbb65..ee6c3800436d 100644
--- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
+++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
@@ -64,7 +64,6 @@ properties:
           - st,lsm9ds0-gyro
       - description: STMicroelectronics Magnetometers
         enum:
-          - st,iis2mdc
           - st,lis2mdl
           - st,lis3mdl-magn
           - st,lsm303agr-magn
@@ -73,6 +72,9 @@ properties:
           - st,lsm303dlhc-magn
           - st,lsm303dlm-magn
           - st,lsm9ds1-magn
+      - items:
+          - const: st,iis2mdc
+          - const: st,lis2mdl
       - description: STMicroelectronics Pressure Sensors
         enum:
           - st,lps001wp-press
  

Patch

diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
index fff7e3d83a02..ee593c8bbb65 100644
--- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
+++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml
@@ -64,6 +64,7 @@  properties:
           - st,lsm9ds0-gyro
       - description: STMicroelectronics Magnetometers
         enum:
+          - st,iis2mdc
           - st,lis2mdl
           - st,lis3mdl-magn
           - st,lsm303agr-magn