[1/2] dt-bindings: media: i2c: add galaxycore,gc2145 DVP bus support

Message ID 20240217220308.594883-2-andrej.skvortzov@gmail.com
State New
Headers
Series media: gc2145: add basic dvp bus support |

Commit Message

Andrey Skvortsov Feb. 17, 2024, 10:03 p.m. UTC
  Don't require link-frequencies like it's done for ov5640, that
supports both CSI-2 and DVP. And v4l2_fwnode_endpoint_alloc_parse
ignores link-frequencies property for DVP endpoint. It's used only for
CSI-2 endpoints

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
---
 .../bindings/media/i2c/galaxycore,gc2145.yaml | 33 +++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)
  

Comments

Krzysztof Kozlowski Feb. 20, 2024, 10:04 a.m. UTC | #1
On 17/02/2024 23:03, Andrey Skvortsov wrote:
> Don't require link-frequencies like it's done for ov5640, that
> supports both CSI-2 and DVP. And v4l2_fwnode_endpoint_alloc_parse
> ignores link-frequencies property for DVP endpoint. It's used only for
> CSI-2 endpoints
> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> ---

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
  
Sakari Ailus Feb. 20, 2024, 10:46 a.m. UTC | #2
Hi Andrey,

Thanks for the patchset.

On Sun, Feb 18, 2024 at 01:03:07AM +0300, Andrey Skvortsov wrote:
> Don't require link-frequencies like it's done for ov5640, that
> supports both CSI-2 and DVP. And v4l2_fwnode_endpoint_alloc_parse
> ignores link-frequencies property for DVP endpoint. It's used only for
> CSI-2 endpoints
> 
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> ---
>  .../bindings/media/i2c/galaxycore,gc2145.yaml | 33 +++++++++++++++++--
>  1 file changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> index 1726ecca4c77..fb376b9d0f2a 100644
> --- a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> +++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> @@ -61,9 +61,6 @@ properties:
>          properties:
>            link-frequencies: true
>  
> -        required:
> -          - link-frequencies

That seems like a bad idea to me.

While for parallel interface it may not be often important, for CSI-2 it
should stay.

> -
>      required:
>        - endpoint
>  
> @@ -110,4 +107,34 @@ examples:
>          };
>      };
>  
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        camera@3c {
> +            compatible = "galaxycore,gc2145";
> +            reg = <0x3c>;
> +            clocks = <&clk_ext_camera>;
> +            iovdd-supply = <&scmi_v3v3_sw>;
> +            avdd-supply = <&scmi_v3v3_sw>;
> +            dvdd-supply = <&scmi_v3v3_sw>;
> +            powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
> +            reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
> +
> +            port {
> +                endpoint {
> +                    remote-endpoint = <&parallel_from_gc2145>;
> +                    bus-width = <8>;
> +                    hsync-active = <1>;
> +                    vsync-active = <1>;
> +                    data-active = <1>;
> +                    pclk-sample = <1>;

Are there defaults for these if there are no such properties?

> +                };
> +            };
> +        };
> +    };
> +
>  ...
  
Sakari Ailus Feb. 20, 2024, 10:47 a.m. UTC | #3
On Tue, Feb 20, 2024 at 10:46:23AM +0000, Sakari Ailus wrote:
> Hi Andrey,
> 
> Thanks for the patchset.
> 
> On Sun, Feb 18, 2024 at 01:03:07AM +0300, Andrey Skvortsov wrote:
> > Don't require link-frequencies like it's done for ov5640, that
> > supports both CSI-2 and DVP. And v4l2_fwnode_endpoint_alloc_parse
> > ignores link-frequencies property for DVP endpoint. It's used only for
> > CSI-2 endpoints
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > ---
> >  .../bindings/media/i2c/galaxycore,gc2145.yaml | 33 +++++++++++++++++--
> >  1 file changed, 30 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > index 1726ecca4c77..fb376b9d0f2a 100644
> > --- a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > +++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > @@ -61,9 +61,6 @@ properties:
> >          properties:
> >            link-frequencies: true
> >  
> > -        required:
> > -          - link-frequencies
> 
> That seems like a bad idea to me.
> 
> While for parallel interface it may not be often important, for CSI-2 it
> should stay.

You're also missing the bus-type property which should default to CSI-2
D-PHY.
  
Andrey Skvortsov Feb. 22, 2024, 5:33 a.m. UTC | #4
Hi Sakari,

On 24-02-20 10:47, Sakari Ailus wrote:
> On Tue, Feb 20, 2024 at 10:46:23AM +0000, Sakari Ailus wrote:
> > Hi Andrey,
> > 
> > Thanks for the patchset.
> > 
> > On Sun, Feb 18, 2024 at 01:03:07AM +0300, Andrey Skvortsov wrote:
> > > Don't require link-frequencies like it's done for ov5640, that
> > > supports both CSI-2 and DVP. And v4l2_fwnode_endpoint_alloc_parse
> > > ignores link-frequencies property for DVP endpoint. It's used only for
> > > CSI-2 endpoints
> > > 
> > > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > > ---
> > >  .../bindings/media/i2c/galaxycore,gc2145.yaml | 33 +++++++++++++++++--
> > >  1 file changed, 30 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > > index 1726ecca4c77..fb376b9d0f2a 100644
> > > --- a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > > +++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > > @@ -61,9 +61,6 @@ properties:
> > >          properties:
> > >            link-frequencies: true
> > >  
> > > -        required:
> > > -          - link-frequencies
> > 
> > That seems like a bad idea to me.
> > 
> > While for parallel interface it may not be often important, for CSI-2 it
> > should stay.
> 
> You're also missing the bus-type property which should default to CSI-2
> D-PHY.

I'll add this type and make link-frequencies required based on that
for CSI-2 bus.
  
Andrey Skvortsov Feb. 22, 2024, 5:52 a.m. UTC | #5
On 24-02-20 10:46, Sakari Ailus wrote:
> Hi Andrey,
> 
> Thanks for the patchset.
> 
> On Sun, Feb 18, 2024 at 01:03:07AM +0300, Andrey Skvortsov wrote:
> > Don't require link-frequencies like it's done for ov5640, that
> > supports both CSI-2 and DVP. And v4l2_fwnode_endpoint_alloc_parse
> > ignores link-frequencies property for DVP endpoint. It's used only for
> > CSI-2 endpoints
> > 
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> > ---
> >  .../bindings/media/i2c/galaxycore,gc2145.yaml | 33 +++++++++++++++++--
> >  1 file changed, 30 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > index 1726ecca4c77..fb376b9d0f2a 100644
> > --- a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > +++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
> > @@ -61,9 +61,6 @@ properties:
> >          properties:
> >            link-frequencies: true
> >  
> > -        required:
> > -          - link-frequencies
> 
> That seems like a bad idea to me.
> 
> While for parallel interface it may not be often important, for CSI-2 it
> should stay.

I'll add this type and make link-frequencies required based on that
for CSI-2 bus.

> 
> > -
> >      required:
> >        - endpoint
> >  
> > @@ -110,4 +107,34 @@ examples:
> >          };
> >      };
> >  
> > +  - |
> > +    #include <dt-bindings/gpio/gpio.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        camera@3c {
> > +            compatible = "galaxycore,gc2145";
> > +            reg = <0x3c>;
> > +            clocks = <&clk_ext_camera>;
> > +            iovdd-supply = <&scmi_v3v3_sw>;
> > +            avdd-supply = <&scmi_v3v3_sw>;
> > +            dvdd-supply = <&scmi_v3v3_sw>;
> > +            powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
> > +            reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
> > +
> > +            port {
> > +                endpoint {
> > +                    remote-endpoint = <&parallel_from_gc2145>;
> > +                    bus-width = <8>;
> > +                    hsync-active = <1>;
> > +                    vsync-active = <1>;
> > +                    data-active = <1>;
> > +                    pclk-sample = <1>;
> 
> Are there defaults for these if there are no such properties?

good point. I'll add them to the endpoint properties description then.
  

Patch

diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
index 1726ecca4c77..fb376b9d0f2a 100644
--- a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml
@@ -61,9 +61,6 @@  properties:
         properties:
           link-frequencies: true
 
-        required:
-          - link-frequencies
-
     required:
       - endpoint
 
@@ -110,4 +107,34 @@  examples:
         };
     };
 
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@3c {
+            compatible = "galaxycore,gc2145";
+            reg = <0x3c>;
+            clocks = <&clk_ext_camera>;
+            iovdd-supply = <&scmi_v3v3_sw>;
+            avdd-supply = <&scmi_v3v3_sw>;
+            dvdd-supply = <&scmi_v3v3_sw>;
+            powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
+            reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
+
+            port {
+                endpoint {
+                    remote-endpoint = <&parallel_from_gc2145>;
+                    bus-width = <8>;
+                    hsync-active = <1>;
+                    vsync-active = <1>;
+                    data-active = <1>;
+                    pclk-sample = <1>;
+                };
+            };
+        };
+    };
+
 ...