Skip to contentSkip to conversation

media: i2c: Add support for alvium camera

PATCH Superseded Tommaso Merciai 6 participants 18 messages Jun 6, 2023 – Jun 7, 2023

Subsystems (3)

v3 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Tommaso Merciai

author maintainer
#0 lore raw

v3 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   |   93 +
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 drivers/media/i2c/Kconfig                     |   10 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/alvium-csi2.c               | 3478 +++++++++++++++++
 drivers/media/i2c/alvium-csi2.h               |  485 +++
 6 files changed, 4069 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 v3 1/3 dt-bindings: vendor-prefixes: Add prefix alliedvision

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

---
 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
Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: vendor-prefixes: Add prefix alliedvision

Hi Tommaso,

Thank you for the patch.

Quoted 4 lines · Tommaso Merciai

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

Quoted 17 lines
---
 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 · 3 lines
Regards,

Laurent Pinchart
author maintainer
#5 lore raw

PATCH v3 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

 .../media/i2c/alliedvision,alvium-csi2.yaml   | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +93 -0
new file mode 100644
index 000000000000..191534e2f7bd
@@ -0,0 +1,93 @@
+# 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:
+      Definition of the regulator used as interface power supply.
+
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.
+
+  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
maintainer
#6 lore raw

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

Quoted 27 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 4 lines
 .../media/i2c/alliedvision,alvium-csi2.yaml   | 93 +++++++++++++++++++
 1 file changed, 93 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.

Reviewed-by on v3 2/3
#7 lore raw

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

In reply to Tommaso Merciai

Hi Tommaso,

Thank you for the patch.

Quoted 52 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

 .../media/i2c/alliedvision,alvium-csi2.yaml   | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +15 -0
new file mode 100644
index 000000000000..191534e2f7bd
@@ -0,0 +1,93 @@
+# 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#
+

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

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +10 -0
+properties:
+  compatible:
+    const: alliedvision,alvium-csi2
+
+  reg:
+    maxItems: 1
+
+  vcc-ext-in-supply:
+    description:
+      Definition of the regulator used as interface power supply.

The regulator that supplies power to the VCC_EXT_IN pins.

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

Quoted 5 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +5 -0
+
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

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.

Quoted 57 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +57 -0
+
+  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
#8 lore raw

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

Hey Laurent, Tommaso,

Quoted 21 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

description: |
Low power to high speed delay time.

Quoted 8 lines

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.

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

Cheers,
Conor.

#9 lore raw

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

Quoted 30 lines · Conor Dooley

Hey Laurent, Tommaso,

Quoted 27 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

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.

Quoted 6 lines
Quoted 2 lines

This is meant to help CSI-2 receivers synchronizing their D-PHY RX.

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

The property is optional, so it can indeed be omitted if no delay is desired. I have no strong preference on whether or not to allow 0 as a valid value.

Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

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

Quoted 34 lines · Laurent Pinchart
Quoted 33 lines · Conor Dooley

Hey Laurent, Tommaso,

Quoted 29 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

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.

Quoted 7 lines
Quoted 3 lines

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

The property is optional, so it can indeed be omitted if no delay is desired. I have no strong preference on whether or not to allow 0 as a valid value.

FWIW, I prefer the semantics of the property if it doesn't have the limbo state of being present but doing nothing.

Cheers,
Conor.

BTW, I seem to get bounces from [email protected], who is listed in MAINTAINERS for several drivers. Do you know if they have a non-intel address to replace those entries with, or should they be dropped?

author maintainer
#11 lore raw

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

Hi Conor,

Quoted 46 lines · Conor Dooley
Quoted 34 lines · Laurent Pinchart
Quoted 33 lines · Conor Dooley

Hey Laurent, Tommaso,

Quoted 29 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

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.

Quoted 7 lines
Quoted 3 lines

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

The property is optional, so it can indeed be omitted if no delay is desired. I have no strong preference on whether or not to allow 0 as a valid value.

FWIW, I prefer the semantics of the property if it doesn't have the limbo state of being present but doing nothing.

Quoted 6 lines

Cheers,
Conor.

BTW, I seem to get bounces from [email protected], who is listed in MAINTAINERS for several drivers. Do you know if they have a non-intel address to replace those entries with, or should they be dropped?

Same here! :)

Thanks,
Tommaso

author maintainer
#12 lore raw

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

In reply to Conor Dooley

Hi Conor,

Thanks for your feedback.

Quoted 30 lines · Conor Dooley

Hey Laurent, Tommaso,

Quoted 27 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

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.

Quoted 6 lines
Quoted 2 lines

This is meant to help CSI-2 receivers synchronizing their D-PHY RX.

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

Personally I prefer to stay with zero case. This reflect better the real camera register behaviour.

(also is optional)

Thanks! :)
Tommaso

Quoted 3 lines

Cheers,
Conor.

#13 lore raw

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

Quoted 32 lines · Tommaso Merciai
Quoted 31 lines · Conor Dooley
Quoted 29 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

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.

Quoted 6 lines
Quoted 3 lines

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

Personally I prefer to stay with zero case. This reflect better the real camera register behaviour.

Speaking of which, could you document the maximum value in the bindings ?

Quoted 1 line

(also is optional)

Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#14 lore raw

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

Hi Laurent,

Quoted 37 lines · Laurent Pinchart
Quoted 36 lines · Tommaso Merciai
Quoted 34 lines · Conor Dooley
Quoted 21 lines · Laurent Pinchart

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

Quoted 4 lines · Tommaso Merciai
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +4 -0
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

description: |
Low power to high speed delay time.

Quoted 8 lines

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.

Question about the property.
Why not make it have a minimum value of 1 and drop the special-case behaviour for zero?

Quoted 5 lines
Quoted 2 lines

Personally I prefer to stay with zero case. This reflect better the real camera register behaviour.

Speaking of which, could you document the maximum value in the bindings ?

150ms is the max value I'll document this in v4.

Regards,
Tommaso

Quoted 7 lines
Quoted 2 lines

(also is optional)

Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#15 lore raw

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

In reply to Laurent Pinchart

Hi Laurent,

Quoted 61 lines · Laurent Pinchart

Hi Tommaso,

Thank you for the patch.

Quoted 56 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

 .../media/i2c/alliedvision,alvium-csi2.yaml   | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +19 -0
new file mode 100644
index 000000000000..191534e2f7bd
@@ -0,0 +1,93 @@
+# 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
+
Quoted 8 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+  reg:
+    maxItems: 1
+
+  vcc-ext-in-supply:
+    description:
+      Definition of the regulator used as interface power supply.

The regulator that supplies power to the VCC_EXT_IN pins.

Oks. Ty.

Quoted 8 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +5 -0
+
+  alliedvision,lp2hs-delay-us:
+    maxItems: 1
+    description:
+      Low power to high speed delay time in microseconds.

You can drop "in microseconds", that's implied by the suffix.

Oks.

Quoted 13 lines

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

Quoted 7 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +6 -0
+      The purpose of this property is force a DPhy reset for the period
+      described by the microseconds on the property, before it starts
+      streaming. To be clear, with that value bigger than 0 the Alvium
+      forces a dphy-reset on all lanes for that period. That means all
+      lanes go up into low power state. This may help a csi2 rx ip to
+      reset if that IP can't deal with a continous clock.

I'd like to propose what I think is a clearer version:

description: |
Low power to high speed delay time.

Quoted 8 lines

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.

Thanks!
I'll fix this in v4 :)

Regards,
Tommaso

Quoted 65 lines
Quoted 57 lines
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml new file +57 -0
+
+  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
#16 lore raw

PATCH v3 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

 drivers/media/i2c/Kconfig       |   10 +
 drivers/media/i2c/Makefile      |    1 +
 drivers/media/i2c/alvium-csi2.c | 3478 +++++++++++++++++++++++++++++++
 drivers/media/i2c/alvium-csi2.h |  485 +++++
 4 files changed, 3974 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 +3478 -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.

#17 lore raw
kernel test robot noticed the following build warnings:

Hi Tommaso,

kernel test robot noticed the following build warnings:

[auto build test WARNING on media-tree/master]
[also build test WARNING on robh/for-next linus/master v6.4-rc5 next-20230606] [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/Tommaso-Merciai/dt-bindings-vendor-prefixes-Add-prefix-alliedvision/20230606-235632
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20230606155416.260941-4-tomm.merciai%40gmail.com
patch subject: [PATCH v3 3/3] media: i2c: Add support for alvium camera
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230607/[email protected]/config)
compiler: mips-linux-gcc (GCC) 12.3.0

reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add media-tree git://linuxtv.org/media_tree.git
git fetch media-tree master
git checkout media-tree/master
b4 shazam https://lore.kernel.org/r/[email protected]
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=mips olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/media/i2c/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/media/i2c/alvium-csi2.c: In function 'alvium_set_ctrl_white_balance':

>> drivers/media/i2c/alvium-csi2.c:2205:21: warning: variable 'blue_min' set but not used [-Wunused-but-set-variable]
    2205 |                 u64 blue_min;
         |                     ^~~~~~~~
>> drivers/media/i2c/alvium-csi2.c:2204:21: warning: variable 'blue_max' set but not used [-Wunused-but-set-variable]
    2204 |                 u64 blue_max;
         |                     ^~~~~~~~
>> drivers/media/i2c/alvium-csi2.c:2203:21: warning: variable 'red_min' set but not used [-Wunused-but-set-variable]
    2203 |                 u64 red_min;
         |                     ^~~~~~~
>> drivers/media/i2c/alvium-csi2.c:2202:21: warning: variable 'red_max' set but not used [-Wunused-but-set-variable]
    2202 |                 u64 red_max;
         |                     ^~~~~~~
   drivers/media/i2c/alvium-csi2.c: In function 'alvium_set_frame_interval':
>> drivers/media/i2c/alvium-csi2.c:2574:29: warning: variable 'max_fr' set but not used [-Wunused-but-set-variable]
    2574 |         u64 req_fr, min_fr, max_fr;
         |                             ^~~~~~
>> drivers/media/i2c/alvium-csi2.c:2574:21: warning: variable 'min_fr' set but not used [-Wunused-but-set-variable]
    2574 |         u64 req_fr, min_fr, max_fr;
         |                     ^~~~~~
   drivers/media/i2c/alvium-csi2.c: In function 'alvium_subdev_init':
>> drivers/media/i2c/alvium-csi2.c:3172:27: warning: variable 'crop' set but not used [-Wunused-but-set-variable]
    3172 |         struct v4l2_rect *crop;
         |                           ^~~~
>> drivers/media/i2c/alvium-csi2.c:3171:36: warning: variable 'fmt' set but not used [-Wunused-but-set-variable]
    3171 |         struct v4l2_mbus_framefmt *fmt;
         |                                    ^~~

vim +/blue_min +2205 drivers/media/i2c/alvium-csi2.c

2186
2187 static int alvium_set_ctrl_white_balance(struct alvium_dev *alvium,
2188 bool awb)
2189 {
2190 struct alvium_ctrls *ctrls = &alvium->ctrls;
2191 int ret = 0;
2192
2193 if (ctrls->auto_wb->is_new) {
2194 ret = alvium_set_awb(alvium, awb);
2195 if (ret)
2196 return ret;
2197 }
2198
2199 if (!awb && ctrls->auto_wb->is_new) {
2200 u64 red = (u64)ctrls->red_balance->val;
2201 u64 blue = (u64)ctrls->blue_balance->val;

> 2202			u64 red_max;
> 2203			u64 red_min;
> 2204			u64 blue_max;
> 2205			u64 blue_min;

2206
2207 ret = alvium_get_red_balance_ratio_params(alvium);
2208 if (ret)
2209 return ret;
2210
2211 ret = alvium_get_blue_balance_ratio_params(alvium);
2212 if (ret)
2213 return ret;
2214
2215 red_max = alvium->max_rbalance;
2216 red_min = alvium->min_rbalance;
2217 blue_max = alvium->max_bbalance;
2218 blue_min = alvium->min_rbalance;
2219
2220 ret = alvium_set_red_balance_ratio(alvium, red);
2221 if (ret)
2222 return ret;
2223
2224 ret = alvium_set_blue_balance_ratio(alvium, blue);
2225 if (ret)
2226 return ret;
2227 }
2228
2229 return ret;
2230 }
2231

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki