Skip to contentSkip to conversation

media: i2c: Add support for alvium camera

PATCH Superseded Tommaso Merciai 5 participants 14 messages Jun 7, 2023

Subsystems (3)

v4 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Tommaso Merciai

author maintainer
#0 lore raw

v4 cover media: i2c: Add support for alvium camera

Hello All,

This series add support for Allied Vision Alvium camera. The Alvium camera is shipped with sensor + isp in the same housing. The camera can be equipped with one out of various sensor and abstract the user from this. Camera is connected via MIPI CSI-2.

Working on top of Ideas on Board (branch: ideasonboard/v6.2/isi) I'm able to test the driver on imx8mp-evk.
I collect also some patches to enable HDMI on imx8mp-evk from Pengutronix (branch: pengutronix-imx8mp-hdmi)

I collect the patchset required to enable ISI + HDMI on imx8mp-evk into the following branch from Avnet Silica Software & Services EMEA [1].

Some documentation on testing ISP and ISI of imx8mp-evk here [2].

Thanks all for the great work!

[1] - https://github.com/avs-sas/linux/tree/tm/ideasonboard/v6.4.0-rc2/isi/imx8mp_evk/alvium_drv_skel1e_v1
[2] - https://gist.github.com/Scott31393/077a10024a6058536d3f2fdde476265a

Tommaso Merciai (3):
dt-bindings: vendor-prefixes: Add prefix alliedvision
media: dt-bindings: alvium: add document YAML binding
media: i2c: Add support for alvium camera

 .../media/i2c/alliedvision,alvium-csi2.yaml   |   96 +
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 drivers/media/i2c/Kconfig                     |   10 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/alvium-csi2.c               | 3481 +++++++++++++++++
 drivers/media/i2c/alvium-csi2.h               |  485 +++
 6 files changed, 4075 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
 create mode 100644 drivers/media/i2c/alvium-csi2.c
 create mode 100644 drivers/media/i2c/alvium-csi2.h
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v4 1/3 dt-bindings: vendor-prefixes: Add prefix alliedvision

Add a vendor prefix entry for Allied Vision Inc.
(https://www.alliedvision.com)

---
Changes since v3:
- Collected tags from LPinchart, CDooley, KKozlowski

 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 82d39ab0231b..7bd678956b3d 100644
@@ -77,6 +77,8 @@ patternProperties:
     description: ALFA Network Inc.
   "^allegro,.*":
     description: Allegro DVT
+  "^alliedvision,.*":
+    description: Allied Vision Inc.
   "^allo,.*":
     description: Allo.com
   "^allwinner,.*":
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH v4 2/3 media: dt-bindings: alvium: add document YAML binding

In reply to Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

 .../media/i2c/alliedvision,alvium-csi2.yaml   | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +96 -0
new file mode 100644
index 000000000000..4726d0068229
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/alliedvision,alvium.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allied Vision Alvium Camera
+
+maintainers:
+  - Tommaso Merciai <[email protected]>
+  - Martin Hecht <[email protected]>
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    const: alliedvision,alvium-csi2
+
+  reg:
+    maxItems: 1
+
+  vcc-ext-in-supply:
+    description: |
+      The regulator that supplies power to the VCC_EXT_IN pins.
+
+  alliedvision,lp2hs-delay-us:
+    maximum: 150000
+    description: |
+      Low power to high speed delay time.
+
+      If the value is larger than 0, the camera forces a reset of all
+      D-PHY lanes for the duration specified by this property. All lanes
+      will transition to the low-power state and back to the high-speed
+      state after the delay. Otherwise the lanes will transition to and
+      remain in the high-speed state immediately after power on.
+
+      This is meant to help CSI-2 receivers synchronizing their D-PHY
+      RX.
+
+  port:
+    description: Digital Output Port
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          link-frequencies: true
+
+          data-lanes:
+            minItems: 1
+            items:
+              - const: 1
+              - const: 2
+              - const: 3
+              - const: 4
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+required:
+  - compatible
+  - reg
+  - vcc-ext-in-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        alvium: camera@3c {
+            compatible = "alliedvision,alvium-csi2";
+            reg = <0x3c>;
+            vcc-ext-in-supply = <&reg_vcc_ext_in>;
+            alliedvision,lp2hs-delay-us = <20>;
+
+            port {
+                alvium_out: endpoint {
+                    remote-endpoint = <&mipi_csi_0_in>;
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <681250000>;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Quoted 44 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

 .../media/i2c/alliedvision,alvium-csi2.yaml   | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +0 -0
new file mode 100644
index 000000000000..4726d0068229

Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml line 4

Quoted 4 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/alliedvision,alvium.yaml#

This is still wrong, see Rob's bot reply in the previous version.

Quoted 92 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +92 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allied Vision Alvium Camera
+
+maintainers:
+  - Tommaso Merciai <[email protected]>
+  - Martin Hecht <[email protected]>
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    const: alliedvision,alvium-csi2
+
+  reg:
+    maxItems: 1
+
+  vcc-ext-in-supply:
+    description: |
+      The regulator that supplies power to the VCC_EXT_IN pins.
+
+  alliedvision,lp2hs-delay-us:
+    maximum: 150000
+    description: |
+      Low power to high speed delay time.
+
+      If the value is larger than 0, the camera forces a reset of all
+      D-PHY lanes for the duration specified by this property. All lanes
+      will transition to the low-power state and back to the high-speed
+      state after the delay. Otherwise the lanes will transition to and
+      remain in the high-speed state immediately after power on.
+
+      This is meant to help CSI-2 receivers synchronizing their D-PHY
+      RX.
+
+  port:
+    description: Digital Output Port
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          link-frequencies: true
+
+          data-lanes:
+            minItems: 1
+            items:
+              - const: 1
+              - const: 2
+              - const: 3
+              - const: 4
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+required:
+  - compatible
+  - reg
+  - vcc-ext-in-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        alvium: camera@3c {
+            compatible = "alliedvision,alvium-csi2";
+            reg = <0x3c>;
+            vcc-ext-in-supply = <&reg_vcc_ext_in>;
+            alliedvision,lp2hs-delay-us = <20>;
+
+            port {
+                alvium_out: endpoint {
+                    remote-endpoint = <&mipi_csi_0_in>;
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <681250000>;
+                };
+            };
+        };
+    };
+
+...
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#4 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Quoted 39 lines · Laurent Pinchart
Quoted 38 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

 .../media/i2c/alliedvision,alvium-csi2.yaml   | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
Quoted 12 lines

Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml line 4

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
new file mode 100644
index 000000000000..4726d0068229
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/alliedvision,alvium.yaml#

This is still wrong, see Rob's bot reply in the previous version.

Arg... :'(

Thanks Laurent.

Regards,
Tommaso

Quoted 98 lines
Quoted 93 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +92 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allied Vision Alvium Camera
+
+maintainers:
+  - Tommaso Merciai <[email protected]>
+  - Martin Hecht <[email protected]>
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    const: alliedvision,alvium-csi2
+
+  reg:
+    maxItems: 1
+
+  vcc-ext-in-supply:
+    description: |
+      The regulator that supplies power to the VCC_EXT_IN pins.
+
+  alliedvision,lp2hs-delay-us:
+    maximum: 150000
+    description: |
+      Low power to high speed delay time.
+
+      If the value is larger than 0, the camera forces a reset of all
+      D-PHY lanes for the duration specified by this property. All lanes
+      will transition to the low-power state and back to the high-speed
+      state after the delay. Otherwise the lanes will transition to and
+      remain in the high-speed state immediately after power on.
+
+      This is meant to help CSI-2 receivers synchronizing their D-PHY
+      RX.
+
+  port:
+    description: Digital Output Port
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          link-frequencies: true
+
+          data-lanes:
+            minItems: 1
+            items:
+              - const: 1
+              - const: 2
+              - const: 3
+              - const: 4
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+required:
+  - compatible
+  - reg
+  - vcc-ext-in-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        alvium: camera@3c {
+            compatible = "alliedvision,alvium-csi2";
+            reg = <0x3c>;
+            vcc-ext-in-supply = <&reg_vcc_ext_in>;
+            alliedvision,lp2hs-delay-us = <20>;
+
+            port {
+                alvium_out: endpoint {
+                    remote-endpoint = <&mipi_csi_0_in>;
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <681250000>;
+                };
+            };
+        };
+    };
+
+...
Signature · 3 lines
Regards,

Laurent Pinchart
#5 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

In reply to Tommaso Merciai
Quoted 28 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Quoted 5 lines

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

You still did not test it before sending. Four versions of which none were tested :(

Best regards,
Krzysztof

author maintainer
#6 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Hi Krzysztof,

Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Quoted 8 lines
Quoted 5 lines

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

You still did not test it before sending. Four versions of which none were tested :(

You are right.. my bad. :'(

After fixing id, as suggested by Laurent/bot into:

$id: http://devicetree.org/schemas/media/i2c/alliedvision,alvium-csi2.yaml#

I'm running the following test:

make dt_binding_check DT_SCHEMA_FILES=alliedvision,alvium-csi2.yaml

With the following result:

  LINT    Documentation/devicetree/bindings
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json

/home/tom/work/mainline/linux/Documentation/devicetree/bindings/media/i2c/.alliedvision,alvium-csi2.example.dts.pre.yaml: ignoring, error parsing file
DTEX Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.example.dts
DTC_CHK Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.example.dtb

Is that correct?
Let me know. Thanks in advance :)

Regards,
Tommaso

Quoted 4 lines

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Quoted 53 lines · Tommaso Merciai

Hi Krzysztof,

Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Quoted 8 lines
Quoted 5 lines

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

You still did not test it before sending. Four versions of which none were tested :(

You are right.. my bad. :'(

After fixing id, as suggested by Laurent/bot into:

$id: http://devicetree.org/schemas/media/i2c/alliedvision,alvium-csi2.yaml#

I'm running the following test:

make dt_binding_check DT_SCHEMA_FILES=alliedvision,alvium-csi2.yaml

With the following result:

Quoted 8 lines
  LINT    Documentation/devicetree/bindings
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json

/home/tom/work/mainline/linux/Documentation/devicetree/bindings/media/i2c/.alliedvision,alvium-csi2.example.dts.pre.yaml: ignoring, error parsing file
DTEX Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.example.dts
DTC_CHK Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.example.dtb

Is that correct?

No, it doesn't look correct. You have error parsing your file. Check your yaml file and its example DTSI.

Be sure you have also yamlling installed.

Best regards,
Krzysztof

author maintainer
#8 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Quoted 61 lines · Krzysztof Kozlowski
Quoted 60 lines · Tommaso Merciai

Hi Krzysztof,

Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Quoted 8 lines
Quoted 5 lines

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

You still did not test it before sending. Four versions of which none were tested :(

You are right.. my bad. :'(

After fixing id, as suggested by Laurent/bot into:

$id: http://devicetree.org/schemas/media/i2c/alliedvision,alvium-csi2.yaml#

I'm running the following test:

make dt_binding_check DT_SCHEMA_FILES=alliedvision,alvium-csi2.yaml

With the following result:

  LINT    Documentation/devicetree/bindings
  CHKDT   Documentation/devicetree/bindings/processed-schema.json
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json

/home/tom/work/mainline/linux/Documentation/devicetree/bindings/media/i2c/.alliedvision,alvium-csi2.example.dts.pre.yaml: ignoring, error parsing file
DTEX Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.example.dts
DTC_CHK Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.example.dtb

Quoted 6 lines
Quoted 1 line

Is that correct?

No, it doesn't look correct. You have error parsing your file. Check your yaml file and its example DTSI.

Be sure you have also yamlling installed.

Thanks for the feedback!

Regards,
Tommaso

Quoted 4 lines

Best regards,
Krzysztof

maintainer
#9 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

In reply to Tommaso Merciai
Quoted 34 lines · Tommaso Merciai

Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc.

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v1:
- Fixed build error as suggested by RHerring bot

Changes since v2:
- Fixed License as suggested by KKozlowski/CDooley
- Removed rotation property as suggested by CDooley/LPinchart
- Fixed example node name as suggested by CDooley
- Fixed title as suggested by LPinchart
- Fixed compatible name as suggested by LPinchart
- Removed clock as suggested by LPinchart
- Removed gpios not as suggested by LPinchart
- Renamed property name streamon-delay into alliedvision,lp2hs-delay-us
- Fixed vendor prefix, unit append as suggested by KKozlowski
- Fixed data-lanes
- Fixed blank space + example indentation (from 6 -> 4 space) as suggested by KKozlowski
- Dropped status into example as suggested by KKozlowski
- Added vcc-ext-in supply as suggested by LPinchart
- Dropped pinctrl into example as suggested by LPinchart

Changes since v3:
- Fixed vcc-ext-in-supply description as suggested by LPinchart
- Fixed alliedvision,lp2hs-delay-us description as suggested by LPinchart
- Added maximum to alliedvision,lp2hs-delay-us as suggested by LPinchart
- Collected Reviewed-by tag from LPinchart

Quoted 4 lines
 .../media/i2c/alliedvision,alvium-csi2.yaml   | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml

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:
./Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/media/i2c/alliedvision,alvium-csi2.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

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.

#10 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

In reply to Tommaso Merciai

Hey Tommaso,

Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml line 39

Quoted 13 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +13 -0
+  alliedvision,lp2hs-delay-us:
+    maximum: 150000
+    description: |
+      Low power to high speed delay time.
+
+      If the value is larger than 0, the camera forces a reset of all
+      D-PHY lanes for the duration specified by this property. All lanes
+      will transition to the low-power state and back to the high-speed
+      state after the delay. Otherwise the lanes will transition to and
+      remain in the high-speed state immediately after power on.
+
+      This is meant to help CSI-2 receivers synchronizing their D-PHY
+      RX.

Since this new version was posted before I got a chance to reply, I still don't think it makes sense to allow 0 & then special case it, when testing for the presence of a property is trivial. The property should describe some behaviour/property of the hardware, not be a mechanism to convey what you want to write into registers.

I don't really get why you'd not do:
If present, the camera forces a reset of all D-PHY lanes, for the duration specified by this property. All lanes will transition to the low-power state and back to the high-speed state after the delay.
Otherwise the lanes will transition to and remain in the high-speed state immediately after power on.

Quoted 5 lines
(quoted diff) +5 -0
+static int alvium_get_dt_data(struct alvium_dev *alvium)
+{
+	struct device *dev = &alvium->i2c_client->dev;
+	struct device_node *node = dev->of_node;
+	struct fwnode_handle *endpoint;

Review

Quoted 10 lines
(quoted diff) +10 -0
+	int ret = 0;
+
+	if (!node)
+		return -EINVAL;
+
+	ret = fwnode_property_read_u32(dev_fwnode(dev),
+			  "alliedvision,lp2hs-delay-us",
+			  &alvium->lp2hs_delay);
+	if (ret)
+		dev_info(dev, "lp2hs-delay-us not found\n");

And this print, which I also don't understand the presence of as well behaving driver should be quiet, goes away.

Cheers,
Conor.

Quoted 29 lines
(quoted diff) +29 -0
+
+	endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
+	if (!endpoint) {
+		dev_err(dev, "endpoint node not found\n");
+		return -EINVAL;
+	}
+
+	if (v4l2_fwnode_endpoint_alloc_parse(endpoint, &alvium->ep)) {
+		dev_err(dev, "could not parse endpoint\n");
+		return 0;
+	}
+
+	if (alvium->ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
+		dev_err(dev, "unsupported bus type\n");
+		return -EINVAL;
+	}
+
+	if (!alvium->ep.nr_of_link_frequencies) {
+		dev_err(dev, "no link frequencies defined");
+		return -EINVAL;
+	}
+
+	dev_info(dev, "freq: %llu\n",
+				    alvium->ep.link_frequencies[0]);
+	dev_info(dev, "lanes: %d\n",
+				    alvium->ep.bus.mipi_csi2.num_data_lanes);
+
+	return 0;
+}
author maintainer
#11 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Hi Conor,

Quoted 13 lines · Conor Dooley

Hey Tommaso,

Quoted 9 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +9 -0
+  alliedvision,lp2hs-delay-us:
+    maximum: 150000
+    description: |
+      Low power to high speed delay time.
+
+      If the value is larger than 0, the camera forces a reset of all
+      D-PHY lanes for the duration specified by this property. All lanes
+      will transition to the low-power state and back to the high-speed
+      state after the delay. Otherwise the lanes will transition to and
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml line 39

Quoted 4 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+      remain in the high-speed state immediately after power on.
+
+      This is meant to help CSI-2 receivers synchronizing their D-PHY
+      RX.

Since this new version was posted before I got a chance to reply, I still don't think it makes sense to allow 0 & then special case it, when testing for the presence of a property is trivial.

My bad, sry.
My keyboard is too quick :P

Quoted 11 lines

The property should describe some behaviour/property of the hardware, not be a mechanism to convey what you want to write into registers.

I don't really get why you'd not do:
If present, the camera forces a reset of all D-PHY lanes, for the duration specified by this property. All lanes will transition to the low-power state and back to the high-speed state after the delay.
Otherwise the lanes will transition to and remain in the high-speed state immediately after power on.

You are suggesting the following solution:

minimum: 1
maximum: 150000

Right?

Personally I prefer to keep also 0 but never mind
is ok also this solution. :)

Let me know if I have understood correctly pls.
Thanks in advance :)

Quoted 10 lines
Quoted 10 lines
(quoted diff) +10 -0
+static int alvium_get_dt_data(struct alvium_dev *alvium)
+{
+	struct device *dev = &alvium->i2c_client->dev;
+	struct device_node *node = dev->of_node;
+	struct fwnode_handle *endpoint;
+	int ret = 0;
+
+	if (!node)
+		return -EINVAL;
+
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	ret = fwnode_property_read_u32(dev_fwnode(dev),
+			  "alliedvision,lp2hs-delay-us",
+			  &alvium->lp2hs_delay);
+	if (ret)
+		dev_info(dev, "lp2hs-delay-us not found\n");

And this print, which I also don't understand the presence of as well behaving driver should be quiet, goes away.

Then you are suggesting to drop this print right?

Thanks for your review!

Regards,
Tommaso

Quoted 33 lines

Cheers,
Conor.

Quoted 29 lines
(quoted diff) +29 -0
+
+	endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
+	if (!endpoint) {
+		dev_err(dev, "endpoint node not found\n");
+		return -EINVAL;
+	}
+
+	if (v4l2_fwnode_endpoint_alloc_parse(endpoint, &alvium->ep)) {
+		dev_err(dev, "could not parse endpoint\n");
+		return 0;
+	}
+
+	if (alvium->ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
+		dev_err(dev, "unsupported bus type\n");
+		return -EINVAL;
+	}
+
+	if (!alvium->ep.nr_of_link_frequencies) {
+		dev_err(dev, "no link frequencies defined");
+		return -EINVAL;
+	}
+
+	dev_info(dev, "freq: %llu\n",
+				    alvium->ep.link_frequencies[0]);
+	dev_info(dev, "lanes: %d\n",
+				    alvium->ep.bus.mipi_csi2.num_data_lanes);
+
+	return 0;
+}
#12 lore raw

Re: [PATCH v4 2/3] media: dt-bindings: alvium: add document YAML binding

Quoted 8 lines · Tommaso Merciai
Quoted 1 line · Conor Dooley

On Wed, Jun 07, 2023 at 03:19:24PM +0200, Tommaso Merciai wrote:

You are suggesting the following solution:

minimum: 1
maximum: 150000

Quoted 7 lines

Right?

Personally I prefer to keep also 0 but never mind
is ok also this solution. :)

Let me know if I have understood correctly pls.
Thanks in advance :)

Yup, you got it.

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +10 -0
+static int alvium_get_dt_data(struct alvium_dev *alvium)
+{
+	struct device *dev = &alvium->i2c_client->dev;
+	struct device_node *node = dev->of_node;
+	struct fwnode_handle *endpoint;
+	int ret = 0;
+
+	if (!node)
+		return -EINVAL;
+
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	ret = fwnode_property_read_u32(dev_fwnode(dev),
+			  "alliedvision,lp2hs-delay-us",
+			  &alvium->lp2hs_delay);
+	if (ret)
+		dev_info(dev, "lp2hs-delay-us not found\n");

And this print, which I also don't understand the presence of as well behaving driver should be quiet, goes away.

Quoted 1 line

Then you are suggesting to drop this print right?

Yeah, in general we do not want drivers to be printing things while they are behaving correctly & not having the property isn't an error ;)

Cheers,
Conor.

author maintainer
#13 lore raw

PATCH v4 3/3 media: i2c: Add support for alvium camera

In reply to Tommaso Merciai

The Alvium camera is shipped with sensor + isp in the same housing. The camera can be equipped with one out of various sensor and abstract the user from this. Camera is connected via MIPI CSI-2.

Most of the camera module features are supported, with the main exception being fw update.

The driver provides all mandatory, optional and recommended V4L2 controls for maximum compatibility with libcamera

References:
- https://www.alliedvision.com/en/products/embedded-vision-solutions

---
Changes since v2:
- Removed gpios/clock handling as suggested by LPinchart
- Added vcc-ext-in supply support as suggested by LPinchart
- Fixed alvium_setup_mipi_fmt funct as suggested by CJAILLET
- Removed upside_down/hshake_bit priv data as suggested by CJAILLET
- Fixed commit body as suggested by LPinchart
- Mv alvium_set_streamon_delay to yalvium_set_lp2hs_delay
- Fixed comment on lp2hs prop as suggested by LPinchart
- Added pm resume/suspend functs as suggested by LPinchart
- Dropped alvium_link_setup/alvium_s_power as suggested by LPinchart
- Fixed regs defines as suggested by LPinchart
- Fixed typedef as suggested by LPinchart
- Dropped bcrm_v/fw_v from priv data as suggested by LPinchart
- Now driver use the subdev active state to store the active format and crop as suggested by LPinchart
- Dropped alvium_is_csi2/i2c_to_alvium as suggested by LPinchart

Changes since v3:
- Fixed warnings Reported-by: kernel test robot <[email protected]>

 drivers/media/i2c/Kconfig       |   10 +
 drivers/media/i2c/Makefile      |    1 +
 drivers/media/i2c/alvium-csi2.c | 3481 +++++++++++++++++++++++++++++++
 drivers/media/i2c/alvium-csi2.h |  485 +++++
 4 files changed, 3977 insertions(+)
 create mode 100644 drivers/media/i2c/alvium-csi2.c
 create mode 100644 drivers/media/i2c/alvium-csi2.h
drivers/media/i2c/Kconfig +10 -0
index 256d55bb2b1d..a9fdf10ffc15 100644
@@ -34,6 +34,16 @@ config VIDEO_APTINA_PLL
 config VIDEO_CCS_PLL
 	tristate
 
+config VIDEO_ALVIUM_CSI2
+	tristate "Allied Vision ALVIUM MIPI CSI-2 camera support"
+	depends on I2C
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select V4L2_FWNODE
+	help
+	  This is a Video4Linux2 sensor driver for the Allied Vision
+	  ALVIUM camera connected via MIPI CSI-2 interface.
+
 config VIDEO_AR0521
 	tristate "ON Semiconductor AR0521 sensor support"
 	depends on I2C && VIDEO_DEV
drivers/media/i2c/Makefile +1 -0
index b44dacf935f4..be4dddd6fd98 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_VIDEO_ADV7604) += adv7604.o
 obj-$(CONFIG_VIDEO_ADV7842) += adv7842.o
 obj-$(CONFIG_VIDEO_AK7375) += ak7375.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
+obj-$(CONFIG_VIDEO_ALVIUM_CSI2) += alvium-csi2.o
 obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o
 obj-$(CONFIG_VIDEO_AR0521) += ar0521.o
 obj-$(CONFIG_VIDEO_BT819) += bt819.o
drivers/media/i2c/alvium-csi2.c new file +3481 -0

2,977 lines not on this page · raw message

drivers/media/i2c/alvium-csi2.h new file +485 -0

485 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.