diff mbox series

dt-bindings: i2c: maxim,max96712: Require setting bus-type property

Message ID 20230331141032.3817866-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series dt-bindings: i2c: maxim,max96712: Require setting bus-type property | expand

Commit Message

Niklas Söderlund March 31, 2023, 2:10 p.m. UTC
The MAX96712 can support both CSI-2 C-PHY and D-PHY bus. Document the
supported bus-types and make the property mandatory.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
Hi,

This is done in conjunction with adding C-PHY support to the driver,
patches on list. The current driver only supports D-PHY so this was
assumed in the driver.

There is a single user of this binding, r8a779a0-falcon-csi-dsi.dtsi. A
separate patch to update that binding with a bus-type property is be
submitted.

Without the property present the driver fall-back to D-PHY (even with
the C-PHY work applied). So this change is backward compatible with old
versions of the only effected DTS file.
---
 .../devicetree/bindings/media/i2c/maxim,max96712.yaml      | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Geert Uytterhoeven March 31, 2023, 3:14 p.m. UTC | #1
Hi Niklas,

On Fri, Mar 31, 2023 at 4:15 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> The MAX96712 can support both CSI-2 C-PHY and D-PHY bus. Document the
> supported bus-types and make the property mandatory.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> @@ -65,9 +65,14 @@ properties:
>
>              properties:
>                data-lanes: true
> +              bus-type:
> +                enum:
> +                  - 1 # CSI-2 C-PHY
> +                  - 4 # CSI-2 D-PHY

Perhaps use/refer to the symbolic names, too?

Sounds like an opportunity for improvement for
Documentation/devicetree/bindings/media/video-interfaces.yaml, too.

>
>              required:
>                - data-lanes
> +              - bus-type
>
>      required:
>        - port@4
> @@ -82,6 +87,7 @@ additionalProperties: false
>  examples:
>    - |
>      #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/media/video-interfaces.h>
>
>      i2c@e6508000 {
>              #address-cells = <1>;
> @@ -101,6 +107,7 @@ examples:
>                              port@4 {
>                                      reg = <4>;
>                                      max96712_out0: endpoint {
> +                                            bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
>                                              clock-lanes = <0>;
>                                              data-lanes = <1 2 3 4>;
>                                              remote-endpoint = <&csi40_in>;

Gr{oetje,eeting}s,

                        Geert
Niklas Söderlund March 31, 2023, 3:39 p.m. UTC | #2
Hi Geert,

On 2023-03-31 17:14:42 +0200, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Fri, Mar 31, 2023 at 4:15 PM Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > The MAX96712 can support both CSI-2 C-PHY and D-PHY bus. Document the
> > supported bus-types and make the property mandatory.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Thanks for your patch!
> 
> > --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> > +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> > @@ -65,9 +65,14 @@ properties:
> >
> >              properties:
> >                data-lanes: true
> > +              bus-type:
> > +                enum:
> > +                  - 1 # CSI-2 C-PHY
> > +                  - 4 # CSI-2 D-PHY
> 
> Perhaps use/refer to the symbolic names, too?

I tired that, but dt_binding_check complained.

$ cat Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
...
  bus-type:
    enum:
      - MEDIA_BUS_TYPE_CSI2_CPHY
      - MEDIA_BUS_TYPE_CSI2_DPHY
...

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
...
.../obj/Documentation/devicetree/bindings/media/i2c/maxim,max96712.example.dtb: 
gmsl-deserializer@49: ports:port@4:endpoint:bus-type:0: [4] is not one of ['MEDIA_BUS_TYPE_CSI2_CPHY', 'MEDIA_BUS_TYPE_CSI2_DPHY']

Or did I misunderstand you? I checked other bindings and the numerical 
values where used in all media/i2c bindings.

> 
> Sounds like an opportunity for improvement for
> Documentation/devicetree/bindings/media/video-interfaces.yaml, too.
> 
> >
> >              required:
> >                - data-lanes
> > +              - bus-type
> >
> >      required:
> >        - port@4
> > @@ -82,6 +87,7 @@ additionalProperties: false
> >  examples:
> >    - |
> >      #include <dt-bindings/gpio/gpio.h>
> > +    #include <dt-bindings/media/video-interfaces.h>
> >
> >      i2c@e6508000 {
> >              #address-cells = <1>;
> > @@ -101,6 +107,7 @@ examples:
> >                              port@4 {
> >                                      reg = <4>;
> >                                      max96712_out0: endpoint {
> > +                                            bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
> >                                              clock-lanes = <0>;
> >                                              data-lanes = <1 2 3 4>;
> >                                              remote-endpoint = <&csi40_in>;
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
Geert Uytterhoeven March 31, 2023, 3:41 p.m. UTC | #3
Hi Niklas,

On Fri, Mar 31, 2023 at 5:39 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> On 2023-03-31 17:14:42 +0200, Geert Uytterhoeven wrote:
> > On Fri, Mar 31, 2023 at 4:15 PM Niklas Söderlund
> > <niklas.soderlund+renesas@ragnatech.se> wrote:
> > > The MAX96712 can support both CSI-2 C-PHY and D-PHY bus. Document the
> > > supported bus-types and make the property mandatory.
> > >
> > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >
> > Thanks for your patch!
> >
> > > --- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> > > +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> > > @@ -65,9 +65,14 @@ properties:
> > >
> > >              properties:
> > >                data-lanes: true
> > > +              bus-type:
> > > +                enum:
> > > +                  - 1 # CSI-2 C-PHY
> > > +                  - 4 # CSI-2 D-PHY
> >
> > Perhaps use/refer to the symbolic names, too?
>
> I tired that, but dt_binding_check complained.
>
> $ cat Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> ...
>   bus-type:
>     enum:
>       - MEDIA_BUS_TYPE_CSI2_CPHY
>       - MEDIA_BUS_TYPE_CSI2_DPHY
> ...
>
> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
> ...
> .../obj/Documentation/devicetree/bindings/media/i2c/maxim,max96712.example.dtb:
> gmsl-deserializer@49: ports:port@4:endpoint:bus-type:0: [4] is not one of ['MEDIA_BUS_TYPE_CSI2_CPHY', 'MEDIA_BUS_TYPE_CSI2_DPHY']
>
> Or did I misunderstand you? I checked other bindings and the numerical
> values where used in all media/i2c bindings.

Yeah, I don't think you can do it that way.
But this should work:

     - 1 # MEDIA_BUS_TYPE_CSI2_CPHY
     - 4 # MEDIA_BUS_TYPE_CSI2_DPHY

Gr{oetje,eeting}s,

                        Geert
Krzysztof Kozlowski April 2, 2023, 11:29 a.m. UTC | #4
On 31/03/2023 16:10, Niklas Söderlund wrote:
> The MAX96712 can support both CSI-2 C-PHY and D-PHY bus. Document the
> supported bus-types and make the property mandatory.

Why making it mandatory? Commit msg should focus on "why" because "what"
is easy to see.

> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> Hi,
> 
> This is done in conjunction with adding C-PHY support to the driver,
> patches on list. The current driver only supports D-PHY so this was
> assumed in the driver.
> 
> There is a single user of this binding, r8a779a0-falcon-csi-dsi.dtsi. A
> separate patch to update that binding with a bus-type property is be
> submitted.
> 
> Without the property present the driver fall-back to D-PHY (even with
> the C-PHY work applied). So this change is backward compatible with old
> versions of the only effected DTS file.
> ---

Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC.  It might happen, that command when run on an older
kernel, gives you outdated entries.  Therefore please be sure you base
your patches on recent Linux kernel.

>  .../devicetree/bindings/media/i2c/maxim,max96712.yaml      | 7 +++++++
>  1 file changed, 7 insertions(+)


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
index 444f24838d3d..fccbf287ff79 100644
--- a/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml
@@ -65,9 +65,14 @@  properties:
 
             properties:
               data-lanes: true
+              bus-type:
+                enum:
+                  - 1 # CSI-2 C-PHY
+                  - 4 # CSI-2 D-PHY
 
             required:
               - data-lanes
+              - bus-type
 
     required:
       - port@4
@@ -82,6 +87,7 @@  additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
 
     i2c@e6508000 {
             #address-cells = <1>;
@@ -101,6 +107,7 @@  examples:
                             port@4 {
                                     reg = <4>;
                                     max96712_out0: endpoint {
+                                            bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
                                             clock-lanes = <0>;
                                             data-lanes = <1 2 3 4>;
                                             remote-endpoint = <&csi40_in>;