Skip to contentSkip to conversation

media: i2c: OV8865 image sensor support

PATCH In review Paul Kocialkowski 4 participants 12 messages Oct 23, 2020 – Nov 18, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover media: i2c: OV8865 image sensor support

This series adds support for the OV8865 image sensor, as a V4L2 subdev driver. Although an initial series was submitted by Kévin L'hôpital some weeks ago, this version is significantly new and should be considered a new series.

The final patch (not for merge) shows how to enable the OV8865 on the Banana Pi Camera Board v2 with the Banana Pi M3.

Cheers,

Paul

Kévin L'hôpital (1):
ARM: dts: sun8i: a83t: bananapi-m3: Enable MIPI CSI-2 with OV8865

Paul Kocialkowski (2):
dt-bindings: media: i2c: Add OV8865 bindings documentation
media: i2c: Add support for the OV8865 image sensor

 .../bindings/media/i2c/ovti,ov8865.yaml       |  124 +
 arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts  |   98 +
 drivers/media/i2c/Kconfig                     |   13 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/ov8865.c                    | 3031 +++++++++++++++++
 5 files changed, 3267 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
 create mode 100644 drivers/media/i2c/ov8865.c
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/3 dt-bindings: media: i2c: Add OV8865 bindings documentation

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +124 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk
+
+  dvdd-supply:
+    description: Digital Domain Power Supply
+
+  avdd-supply:
+    description: Analog Domain Power Supply (internal AVDD is used if missing)
+
+  dovdd-supply:
+    description: I/O Domain Power Supply
+
+  powerdown-gpios:
+    maxItems: 1
+    description: Power Down Pin GPIO Control (active low)
+
+  reset-gpios:
+    maxItems: 1
+    description: Reset Pin GPIO Control (active low)
+
+  port:
+    type: object
+    description: Input port, connect to a MIPI CSI-2 receiver
+
+    properties:
+      endpoint:
+        type: object
+
+        properties:
+          remote-endpoint: true
+
+          bus-type:
+            const: 4
+
+          clock-lanes:
+            maxItems: 1
+
+          data-lanes:
+            minItems: 1
+            maxItems: 4
+
+        required:
+          - bus-type
+          - data-lanes
+          - remote-endpoint
+
+        additionalProperties: false
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - dvdd-supply
+  - dovdd-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sun8i-a83t-ccu.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c2 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ov8865: camera@36 {
+            compatible = "ovti,ov8865";
+            reg = <0x36>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&csi_mclk_pin>;
+
+            clocks = <&ccu CLK_CSI_MCLK>;
+            clock-names = "extclk";
+
+            avdd-supply = <&reg_ov8865_avdd>;
+            dovdd-supply = <&reg_ov8865_dovdd>;
+            dvdd-supply = <&reg_ov8865_dvdd>;
+
+            powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_LOW>; /* PE17 */
+            reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
+
+            port {
+                ov8865_out_mipi_csi2: endpoint {
+                    bus-type = <4>; /* MIPI CSI-2 D-PHY */
+                    clock-lanes = <0>;
+                    data-lanes = <1 2 3 4>;
+
+                    remote-endpoint = <&mipi_csi2_in_ov8865>;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.28.0
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Quoted 17 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +0 -0
new file mode 100644
index 000000000000..807f1a94afae

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +1 -0
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0

Dual license please. With that,

Quoted 126 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +123 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk
+
+  dvdd-supply:
+    description: Digital Domain Power Supply
+
+  avdd-supply:
+    description: Analog Domain Power Supply (internal AVDD is used if missing)
+
+  dovdd-supply:
+    description: I/O Domain Power Supply
+
+  powerdown-gpios:
+    maxItems: 1
+    description: Power Down Pin GPIO Control (active low)
+
+  reset-gpios:
+    maxItems: 1
+    description: Reset Pin GPIO Control (active low)
+
+  port:
+    type: object
+    description: Input port, connect to a MIPI CSI-2 receiver
+
+    properties:
+      endpoint:
+        type: object
+
+        properties:
+          remote-endpoint: true
+
+          bus-type:
+            const: 4
+
+          clock-lanes:
+            maxItems: 1
+
+          data-lanes:
+            minItems: 1
+            maxItems: 4
+
+        required:
+          - bus-type
+          - data-lanes
+          - remote-endpoint
+
+        additionalProperties: false
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - dvdd-supply
+  - dovdd-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sun8i-a83t-ccu.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c2 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ov8865: camera@36 {
+            compatible = "ovti,ov8865";
+            reg = <0x36>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&csi_mclk_pin>;
+
+            clocks = <&ccu CLK_CSI_MCLK>;
+            clock-names = "extclk";
+
+            avdd-supply = <&reg_ov8865_avdd>;
+            dovdd-supply = <&reg_ov8865_dovdd>;
+            dvdd-supply = <&reg_ov8865_dvdd>;
+
+            powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_LOW>; /* PE17 */
+            reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
+
+            port {
+                ov8865_out_mipi_csi2: endpoint {
+                    bus-type = <4>; /* MIPI CSI-2 D-PHY */
+                    clock-lanes = <0>;
+                    data-lanes = <1 2 3 4>;
+
+                    remote-endpoint = <&mipi_csi2_in_ov8865>;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.28.0
maintainer
#3 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

In reply to Paul Kocialkowski

Hi Paul,

Quoted 32 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +15 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +10 -0
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

Quoted 24 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +24 -0
+
+  dvdd-supply:
+    description: Digital Domain Power Supply
+
+  avdd-supply:
+    description: Analog Domain Power Supply (internal AVDD is used if missing)
+
+  dovdd-supply:
+    description: I/O Domain Power Supply
+
+  powerdown-gpios:
+    maxItems: 1
+    description: Power Down Pin GPIO Control (active low)
+
+  reset-gpios:
+    maxItems: 1
+    description: Reset Pin GPIO Control (active low)
+
+  port:
+    type: object
+    description: Input port, connect to a MIPI CSI-2 receiver
+
+    properties:
+      endpoint:

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 59

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +10 -0
+        type: object
+
+        properties:
+          remote-endpoint: true
+
+          bus-type:
+            const: 4
+
+          clock-lanes:
+            maxItems: 1

I believe you can drop clock-lanes and bus-type; these are both constants.

I presume the device does not support lane remapping?

Could you also add link-frequencies, to list which frequencies are known to be good?

Same comments on the other OV sensor bindings.

Quoted 65 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +65 -0
+
+          data-lanes:
+            minItems: 1
+            maxItems: 4
+
+        required:
+          - bus-type
+          - data-lanes
+          - remote-endpoint
+
+        additionalProperties: false
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - dvdd-supply
+  - dovdd-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sun8i-a83t-ccu.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c2 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ov8865: camera@36 {
+            compatible = "ovti,ov8865";
+            reg = <0x36>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&csi_mclk_pin>;
+
+            clocks = <&ccu CLK_CSI_MCLK>;
+            clock-names = "extclk";
+
+            avdd-supply = <&reg_ov8865_avdd>;
+            dovdd-supply = <&reg_ov8865_dovdd>;
+            dvdd-supply = <&reg_ov8865_dvdd>;
+
+            powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_LOW>; /* PE17 */
+            reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
+
+            port {
+                ov8865_out_mipi_csi2: endpoint {
+                    bus-type = <4>; /* MIPI CSI-2 D-PHY */
+                    clock-lanes = <0>;
+                    data-lanes = <1 2 3 4>;
+
+                    remote-endpoint = <&mipi_csi2_in_ov8865>;
+                };
+            };
+        };
+    };
+
+...
Signature · 3 lines
Regards,

Sakari Ailus
#4 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Hi Sakari and thanks for the review!

Quoted 37 lines · Sakari Ailus
Quoted 36 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +19 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

Yes I think so: we grab the clock with devm_clk_get which takes a name string that matches the clock-names property.

Quoted 2 lines

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

I'm a bit confused why we would need to do that in the device-tree rather than setting the clock rate with clk_set_rate in the driver, like any other driver does. I think this was discussed before (on the initial ov8865 series) and the conclusion was that there is no particular reason for media i2c drivers to behave differently. So I believe this is the correct approach.

Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +28 -0
+
+  dvdd-supply:
+    description: Digital Domain Power Supply
+
+  avdd-supply:
+    description: Analog Domain Power Supply (internal AVDD is used if missing)
+
+  dovdd-supply:
+    description: I/O Domain Power Supply
+
+  powerdown-gpios:
+    maxItems: 1
+    description: Power Down Pin GPIO Control (active low)
+
+  reset-gpios:
+    maxItems: 1
+    description: Reset Pin GPIO Control (active low)
+
+  port:
+    type: object
+    description: Input port, connect to a MIPI CSI-2 receiver
+
+    properties:
+      endpoint:
+        type: object
+
+        properties:
+          remote-endpoint: true
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 59

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+
+          bus-type:
+            const: 4
+
+          clock-lanes:
+            maxItems: 1

I believe you can drop clock-lanes and bus-type; these are both constants.

I don't understand why bus-type should be dropped because it is constant:
if bus-type is set to something else, the driver will definitely not probe since we're requesting V4L2_MBUS_CSI2_DPHY for v4l2_fwnode_endpoint_parse. So I think it's quite important for the bindings to reflect this.

Quoted 1 line

I presume the device does not support lane remapping?

That's correct so this is indeed not something we can configure. But shouldn't we instead specift clock-lanes = <0> as a const rather than getting rid of it?

Quoted 2 lines

Could you also add link-frequencies, to list which frequencies are known to be good?

Ah right, I had missed it. I'm a bit unsure about what I should do with the information from the driver though: should I refuse to use link frequencies that are not in the list?

Cheers,

Paul

Quoted 72 lines

Same comments on the other OV sensor bindings.

Quoted 65 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +65 -0
+
+          data-lanes:
+            minItems: 1
+            maxItems: 4
+
+        required:
+          - bus-type
+          - data-lanes
+          - remote-endpoint
+
+        additionalProperties: false
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - dvdd-supply
+  - dovdd-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sun8i-a83t-ccu.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c2 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ov8865: camera@36 {
+            compatible = "ovti,ov8865";
+            reg = <0x36>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&csi_mclk_pin>;
+
+            clocks = <&ccu CLK_CSI_MCLK>;
+            clock-names = "extclk";
+
+            avdd-supply = <&reg_ov8865_avdd>;
+            dovdd-supply = <&reg_ov8865_dovdd>;
+            dvdd-supply = <&reg_ov8865_dvdd>;
+
+            powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_LOW>; /* PE17 */
+            reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
+
+            port {
+                ov8865_out_mipi_csi2: endpoint {
+                    bus-type = <4>; /* MIPI CSI-2 D-PHY */
+                    clock-lanes = <0>;
+                    data-lanes = <1 2 3 4>;
+
+                    remote-endpoint = <&mipi_csi2_in_ov8865>;
+                };
+            };
+        };
+    };
+
+...
Signature · 3 lines
Regards,

Sakari Ailus
Signature · 3 lines
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer
#5 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Hi Paul,

Quoted 49 lines · Paul Kocialkowski

Hi Sakari and thanks for the review!

Quoted 37 lines · Sakari Ailus
Quoted 36 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +19 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

Quoted 2 lines

Yes I think so: we grab the clock with devm_clk_get which takes a name string that matches the clock-names property.

That argument may be NULL.

Quoted 9 lines
Quoted 3 lines

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

I'm a bit confused why we would need to do that in the device-tree rather than setting the clock rate with clk_set_rate in the driver, like any other driver does. I think this was discussed before (on the initial ov8865 series) and the conclusion was that there is no particular reason for media i2c drivers to behave differently. So I believe this is the correct approach.

I'm not exactly sure about that conclusion.

You can use clk_set_rate() if you get the frequency from DT, but we recently did conclude that camera sensor drivers can expect to get the frequency indicated by assigned-clock-rate property.

In other words, the driver may not be specific to a particular board and SoC you have.

Please also read Documentation/driver-api/media/camera-sensor.rst .

Quoted 38 lines
Quoted 29 lines
Quoted 29 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +28 -0
+
+  dvdd-supply:
+    description: Digital Domain Power Supply
+
+  avdd-supply:
+    description: Analog Domain Power Supply (internal AVDD is used if missing)
+
+  dovdd-supply:
+    description: I/O Domain Power Supply
+
+  powerdown-gpios:
+    maxItems: 1
+    description: Power Down Pin GPIO Control (active low)
+
+  reset-gpios:
+    maxItems: 1
+    description: Reset Pin GPIO Control (active low)
+
+  port:
+    type: object
+    description: Input port, connect to a MIPI CSI-2 receiver
+
+    properties:
+      endpoint:
+        type: object
+
+        properties:
+          remote-endpoint: true
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 59

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+
+          bus-type:
+            const: 4
+
+          clock-lanes:
+            maxItems: 1

I believe you can drop clock-lanes and bus-type; these are both constants.

Quoted 4 lines

I don't understand why bus-type should be dropped because it is constant:
if bus-type is set to something else, the driver will definitely not probe since we're requesting V4L2_MBUS_CSI2_DPHY for v4l2_fwnode_endpoint_parse. So I think it's quite important for the bindings to reflect this.

This driver is for a particular device that has MIPI CSI-2 on D-PHY as the data bus. You can assume that in the driver.

Quoted 6 lines
Quoted 2 lines

I presume the device does not support lane remapping?

That's correct so this is indeed not something we can configure. But shouldn't we instead specift clock-lanes = <0> as a const rather than getting rid of it?

Why would you put redundant information to DT?

Quoted 7 lines
Quoted 3 lines

Could you also add link-frequencies, to list which frequencies are known to be good?

Ah right, I had missed it. I'm a bit unsure about what I should do with the information from the driver though: should I refuse to use link frequencies that are not in the list?

Yes, please.

Signature · 3 lines
Regards,

Sakari Ailus
#6 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Hi Sakari,

Quoted 52 lines · Sakari Ailus

Hi Paul,

Quoted 49 lines · Paul Kocialkowski

Hi Sakari and thanks for the review!

Quoted 45 lines · Sakari Ailus
Quoted 32 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +15 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +10 -0
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

Quoted 4 lines
Quoted 2 lines

Yes I think so: we grab the clock with devm_clk_get which takes a name string that matches the clock-names property.

That argument may be NULL.

Understood, let's get rid of clock-names then. I see this is done in a few drivers already, but many also give it a name with a single clock.

It would be nice if that was consistent across all drivers just so that the expectation is clear (that the best way for that to happen is probably to fix up a patch myself though).

Quoted 10 lines
Quoted 8 lines
Quoted 2 lines

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

I'm a bit confused why we would need to do that in the device-tree rather than setting the clock rate with clk_set_rate in the driver, like any other driver does. I think this was discussed before (on the initial ov8865 series) and the conclusion was that there is no particular reason for media i2c drivers to behave differently. So I believe this is the correct approach.

I'm not exactly sure about that conclusion.

I may have jumped too far here. It's not exactly clear to me what was the conclusion from...
https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 3 lines

You can use clk_set_rate() if you get the frequency from DT, but we recently did conclude that camera sensor drivers can expect to get the frequency indicated by assigned-clock-rate property.

...but it looks like clock-frequency was preferred over assigned-clock-rates and this is what the binding that was merged suggests. Is that correct?

I now understand that the clock frequency may depend on the system integration for this special case so we have to specify it via dt.

Quoted 2 lines

In other words, the driver may not be specific to a particular board and SoC you have.

Although this is sadly more than often the case, because handling a variable clock rate in the driver is quite complex (and even more with static init tables that include PLL configuration). And sadly my driver is no exception and only supports 24 MHz input.

Quoted 1 line

Please also read Documentation/driver-api/media/camera-sensor.rst .

Thanks, I hadn't seen that document before. It's great that it exists!

Paul

Quoted 68 lines
Quoted 37 lines
Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +28 -0
+
+  dvdd-supply:
+    description: Digital Domain Power Supply
+
+  avdd-supply:
+    description: Analog Domain Power Supply (internal AVDD is used if missing)
+
+  dovdd-supply:
+    description: I/O Domain Power Supply
+
+  powerdown-gpios:
+    maxItems: 1
+    description: Power Down Pin GPIO Control (active low)
+
+  reset-gpios:
+    maxItems: 1
+    description: Reset Pin GPIO Control (active low)
+
+  port:
+    type: object
+    description: Input port, connect to a MIPI CSI-2 receiver
+
+    properties:
+      endpoint:
+        type: object
+
+        properties:
+          remote-endpoint: true
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 59

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+
+          bus-type:
+            const: 4
+
+          clock-lanes:
+            maxItems: 1

I believe you can drop clock-lanes and bus-type; these are both constants.

Quoted 4 lines

I don't understand why bus-type should be dropped because it is constant:
if bus-type is set to something else, the driver will definitely not probe since we're requesting V4L2_MBUS_CSI2_DPHY for v4l2_fwnode_endpoint_parse. So I think it's quite important for the bindings to reflect this.

This driver is for a particular device that has MIPI CSI-2 on D-PHY as the data bus. You can assume that in the driver.

Quoted 6 lines
Quoted 2 lines

I presume the device does not support lane remapping?

That's correct so this is indeed not something we can configure. But shouldn't we instead specift clock-lanes = <0> as a const rather than getting rid of it?

Why would you put redundant information to DT?

Quoted 7 lines
Quoted 3 lines

Could you also add link-frequencies, to list which frequencies are known to be good?

Ah right, I had missed it. I'm a bit unsure about what I should do with the information from the driver though: should I refuse to use link frequencies that are not in the list?

Yes, please.

Signature · 3 lines
Regards,

Sakari Ailus
Signature · 3 lines
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer
#7 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Hi Paul,

Quoted 58 lines · Paul Kocialkowski

Hi Sakari,

Quoted 55 lines · Sakari Ailus

Hi Paul,

Quoted 51 lines · Paul Kocialkowski

Hi Sakari and thanks for the review!

Quoted 37 lines · Sakari Ailus
Quoted 36 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +19 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

Yes I think so: we grab the clock with devm_clk_get which takes a name string that matches the clock-names property.

Quoted 8 lines
Quoted 1 line

That argument may be NULL.

Understood, let's get rid of clock-names then. I see this is done in a few drivers already, but many also give it a name with a single clock.

It would be nice if that was consistent across all drivers just so that the expectation is clear (that the best way for that to happen is probably to fix up a patch myself though).

I guess somewhat different practices exist depending on the tree albeit it's all DT bindings. It's also not wrong to have the name of the clock there, no, but virtually all camera sensors consume a single clock, so you may as well omit the information.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

I'm a bit confused why we would need to do that in the device-tree rather than setting the clock rate with clk_set_rate in the driver, like any other driver does. I think this was discussed before (on the initial ov8865 series) and the conclusion was that there is no particular reason for media i2c drivers to behave differently. So I believe this is the correct approach.

Quoted 5 lines
Quoted 1 line

I'm not exactly sure about that conclusion.

I may have jumped too far here. It's not exactly clear to me what was the conclusion from...
https://lore.kernel.org/linux-arm-kernel/[email protected]/

Yes, there has been more discussion on the topic, most recently in this thread:

<URL:https://lore.kernel.org/linux-arm-kernel/[email protected]/>

I think this deserves to be added to camera-sensor.rst .

Quoted 7 lines
Quoted 4 lines

You can use clk_set_rate() if you get the frequency from DT, but we recently did conclude that camera sensor drivers can expect to get the frequency indicated by assigned-clock-rate property.

...but it looks like clock-frequency was preferred over assigned-clock-rates and this is what the binding that was merged suggests. Is that correct?

assigned-clock-rates is fine. The assumption is that the clock frequency does not change from the value set through DT, and the driver gets that exact frequency.

Quoted 3 lines

I now understand that the clock frequency may depend on the system integration for this special case so we have to specify it via dt.

Correct.

Quoted 8 lines
Quoted 3 lines

In other words, the driver may not be specific to a particular board and SoC you have.

Although this is sadly more than often the case, because handling a variable clock rate in the driver is quite complex (and even more with static init tables that include PLL configuration). And sadly my driver is no exception and only supports 24 MHz input.

That's fine. If someone needs other frequencies, they can always add support for those in the driver.

Quoted 4 lines
Quoted 2 lines

Please also read Documentation/driver-api/media/camera-sensor.rst .

Thanks, I hadn't seen that document before. It's great that it exists!

You're welcome!

This was indeed written to reduce the number of patch revisions needed ot get a driver to upstream. :-)

Signature · 3 lines
Kind regards,

Sakari Ailus
#8 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Hi Sakari,

Quoted 91 lines · Sakari Ailus

Hi Paul,

Quoted 58 lines · Paul Kocialkowski

Hi Sakari,

Quoted 55 lines · Sakari Ailus

Hi Paul,

Quoted 51 lines · Paul Kocialkowski

Hi Sakari and thanks for the review!

Quoted 37 lines · Sakari Ailus
Quoted 36 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +19 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

Yes I think so: we grab the clock with devm_clk_get which takes a name string that matches the clock-names property.

Quoted 8 lines
Quoted 1 line

That argument may be NULL.

Understood, let's get rid of clock-names then. I see this is done in a few drivers already, but many also give it a name with a single clock.

It would be nice if that was consistent across all drivers just so that the expectation is clear (that the best way for that to happen is probably to fix up a patch myself though).

I guess somewhat different practices exist depending on the tree albeit it's all DT bindings. It's also not wrong to have the name of the clock there, no, but virtually all camera sensors consume a single clock, so you may as well omit the information.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

I'm a bit confused why we would need to do that in the device-tree rather than setting the clock rate with clk_set_rate in the driver, like any other driver does. I think this was discussed before (on the initial ov8865 series) and the conclusion was that there is no particular reason for media i2c drivers to behave differently. So I believe this is the correct approach.

Quoted 5 lines
Quoted 1 line

I'm not exactly sure about that conclusion.

I may have jumped too far here. It's not exactly clear to me what was the conclusion from...
https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 6 lines

Yes, there has been more discussion on the topic, most recently in this thread:

<URL:https://lore.kernel.org/linux-arm-kernel/[email protected]/>

I think this deserves to be added to camera-sensor.rst .

It's not really a discussion though :)

We had back in that thread some issues with assigned-clock-rates that don't get addressed at all.

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

You can use clk_set_rate() if you get the frequency from DT, but we recently did conclude that camera sensor drivers can expect to get the frequency indicated by assigned-clock-rate property.

...but it looks like clock-frequency was preferred over assigned-clock-rates and this is what the binding that was merged suggests. Is that correct?

assigned-clock-rates is fine. The assumption is that the clock frequency does not change from the value set through DT, and the driver gets that exact frequency.

That's two fairly big assumptions though. A clock driver is free to round the clock to whatever rate it wants, and assigned-clock-rates doesn't provide any guarantee on this, nor does it let the potential user know about it.

It might work for one-off cases, but there's no guarantee that it will in the future since this is very much dependent on the clock setup, driver and the other devices in the system (and to some extent the configuration as well).

And since we only rely on it, we can't fix it properly either if it ever occurs.

And then, semantically, this assigned-clock-rates isn't about what the devices support but what the driver supports. The clock tree of omnivision sensors (at least, I can't comment on the imx218 linked above) allows for a very flexible input clock, it's only the driver that requires it because most of its configuration relies on it.

It's definitely fine for the driver to do so, but it really doesn't belong in the DT.

I thought we had an agreement on this last time we discussed it, but I'm not really sure what made you change your mind.

Maxime

maintainer
#9 lore raw

Re: [PATCH 1/3] dt-bindings: media: i2c: Add OV8865 bindings documentation

Hi Maxime,

Sorry for the late reply.

Quoted 127 lines · Maxime Ripard

Hi Sakari,

Quoted 91 lines · Sakari Ailus

Hi Paul,

Quoted 58 lines · Paul Kocialkowski

Hi Sakari,

Quoted 55 lines · Sakari Ailus

Hi Paul,

Quoted 51 lines · Paul Kocialkowski

Hi Sakari and thanks for the review!

Quoted 37 lines · Sakari Ailus
Quoted 36 lines · Paul Kocialkowski

This introduces YAML bindings documentation for the OV8865 image sensor.

---
 .../bindings/media/i2c/ovti,ov8865.yaml       | 124 ++++++++++++++++++
 1 file changed, 124 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +19 -0
new file mode 100644
index 000000000000..807f1a94afae
@@ -0,0 +1,124 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ov8865.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OmniVision OV8865 Image Sensor Device Tree Bindings
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+properties:
+  compatible:
+    const: ovti,ov8865
+
+  reg:
+    maxItems: 1
+
+  clocks:
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml line 25

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/ovti,ov8865.yaml new file +6 -0
+    items:
+      - description: EXTCLK Clock
+
+  clock-names:
+    items:
+      - const: extclk

Is this needed with a single clock?

Yes I think so: we grab the clock with devm_clk_get which takes a name string that matches the clock-names property.

Quoted 8 lines
Quoted 1 line

That argument may be NULL.

Understood, let's get rid of clock-names then. I see this is done in a few drivers already, but many also give it a name with a single clock.

It would be nice if that was consistent across all drivers just so that the expectation is clear (that the best way for that to happen is probably to fix up a patch myself though).

I guess somewhat different practices exist depending on the tree albeit it's all DT bindings. It's also not wrong to have the name of the clock there, no, but virtually all camera sensors consume a single clock, so you may as well omit the information.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

And... shouldn't this also come with assigned-clock-rates etc., to set the clock frequency?

I'm a bit confused why we would need to do that in the device-tree rather than setting the clock rate with clk_set_rate in the driver, like any other driver does. I think this was discussed before (on the initial ov8865 series) and the conclusion was that there is no particular reason for media i2c drivers to behave differently. So I believe this is the correct approach.

Quoted 5 lines
Quoted 1 line

I'm not exactly sure about that conclusion.

I may have jumped too far here. It's not exactly clear to me what was the conclusion from...
https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 6 lines

Yes, there has been more discussion on the topic, most recently in this thread:

<URL:https://lore.kernel.org/linux-arm-kernel/[email protected]/>

I think this deserves to be added to camera-sensor.rst .

It's not really a discussion though :)

We had back in that thread some issues with assigned-clock-rates that don't get addressed at all.

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

You can use clk_set_rate() if you get the frequency from DT, but we recently did conclude that camera sensor drivers can expect to get the frequency indicated by assigned-clock-rate property.

...but it looks like clock-frequency was preferred over assigned-clock-rates and this is what the binding that was merged suggests. Is that correct?

assigned-clock-rates is fine. The assumption is that the clock frequency does not change from the value set through DT, and the driver gets that exact frequency.

That's two fairly big assumptions though. A clock driver is free to round the clock to whatever rate it wants, and assigned-clock-rates doesn't provide any guarantee on this, nor does it let the potential user know about it.

It might work for one-off cases, but there's no guarantee that it will in the future since this is very much dependent on the clock setup, driver and the other devices in the system (and to some extent the configuration as well).

Quoted 8 lines

And since we only rely on it, we can't fix it properly either if it ever occurs.

And then, semantically, this assigned-clock-rates isn't about what the devices support but what the driver supports. The clock tree of omnivision sensors (at least, I can't comment on the imx218 linked above) allows for a very flexible input clock, it's only the driver that requires it because most of its configuration relies on it.

There is a semantic difference, yes. The driver in this case assumes the frequency is the one it is expected to use. In case the frequency is different, the most likely outcome is that the image sensor is inoperable. But again that is fairly easy to notice.

If someone prefers to fix this and make it reliable also in principle, that would require changing the semantics a little as well as adding a function to the clock framework to set the assigned frequency.

Quoted 6 lines

It's definitely fine for the driver to do so, but it really doesn't belong in the DT.

I thought we had an agreement on this last time we discussed it, but I'm not really sure what made you change your mind.

Most new sensor drivers come with assigned-clock-rates etc. properties and I'll need to explain the same over and over again in review. Then using "clock-frequency" property requires quite a few more lines of code in the drivers.

I also recently discussed the matter with Rob H. and his opinion was basically that we should be using assigned-clock-rates here instead.

I wonder how this works on other places where the frequency can be one of several options, but the correct frequency is board specific.

Signature · 3 lines
Kind regards,

Sakari Ailus
#10 lore raw

PATCH 2/3 media: i2c: Add support for the OV8865 image sensor

In reply to Paul Kocialkowski

The OV8865 is a 8 Mpx CMOS image sensor producing 3264x2448 at 30 fps. Other modes (including some with sub-sampling) are available too. It outputs 10-bit bayer CFA data through a MIPI CSI-2 interface with up to 4 lanes supported.

Some register initialisation sequences are still needed for this driver, as they cover registers for which no documentation is available.

This work is based on the first version of the driver submitted by Kévin L'hôpital, which was adapted to mainline from the Allwinner BSP. This version is a rewrite of the first version that matches the structure of the OV5648 driver, with explicit PLL configuration, all the necessary mode-specific fields, associatied registers and reduced static sequences.

It was tested with the Banana Pi Camera Board v3 and the Banana Pi M3.

---
 drivers/media/i2c/Kconfig  |   13 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/ov8865.c | 3031 ++++++++++++++++++++++++++++++++++++
 3 files changed, 3045 insertions(+)
 create mode 100644 drivers/media/i2c/ov8865.c
drivers/media/i2c/Kconfig +13 -0
index 49f4e261c48e..e53d54c143a6 100644
@@ -1047,6 +1047,19 @@ config VIDEO_OV8856
 	  To compile this driver as a module, choose M here: the
 	  module will be called ov8856.
 
+config VIDEO_OV8865
+	tristate "OmniVision OV8865 sensor support"
+	depends on I2C && VIDEO_V4L2
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select V4L2_FWNODE
+	help
+	  This is a Video4Linux2 sensor driver for OmniVision
+	  OV8865 camera sensor.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ov8865.
+
 config VIDEO_OV9640
 	tristate "OmniVision OV9640 sensor support"
 	depends on I2C && VIDEO_V4L2
drivers/media/i2c/Makefile +1 -0
index 15d4d6382582..505c2067e780 100644
@@ -82,6 +82,7 @@ obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
 obj-$(CONFIG_VIDEO_OV772X) += ov772x.o
 obj-$(CONFIG_VIDEO_OV7740) += ov7740.o
 obj-$(CONFIG_VIDEO_OV8856) += ov8856.o
+obj-$(CONFIG_VIDEO_OV8865) += ov8865.o
 obj-$(CONFIG_VIDEO_OV9640) += ov9640.o
 obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
 obj-$(CONFIG_VIDEO_OV13858) += ov13858.o
drivers/media/i2c/ov8865.c new file +3031 -0

2,974 lines not on this page · raw message

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

Signature · 1 line
2.28.0

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

#11 lore raw

PATCH 3/3 ARM: dts: sun8i: a83t: bananapi-m3: Enable MIPI CSI-2 with OV8865

In reply to Paul Kocialkowski

From: Kévin L'hôpital <[email protected]>

The Bananapi M3 supports a camera module which includes an OV8865 sensor connected via the parallel CSI interface and an OV8865 sensor connected via MIPI CSI-2.

The I2C2 bus is shared by the two sensors as well as the (active-low) reset signal, but each sensor has it own shutdown line.

---
 arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts | 98 ++++++++++++++++++++
 1 file changed, 98 insertions(+)
arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts +98 -0
index 9d34eabba121..70d305d47d6d 100644
@@ -85,6 +85,30 @@ green {
 		};
 	};
 
+	reg_ov8865_avdd: ov8865-avdd {
+		compatible = "regulator-fixed";
+		regulator-name = "ov8865-avdd";
+		regulator-min-microvolt = <2800000>;
+		regulator-max-microvolt = <2800000>;
+		vin-supply = <&reg_dldo4>;
+	};
+
+	reg_ov8865_dovdd: ov8865-dovdd {
+		compatible = "regulator-fixed";
+		regulator-name = "ov8865-dovdd";
+		regulator-min-microvolt = <2800000>;
+		regulator-max-microvolt = <2800000>;
+		vin-supply = <&reg_dldo4>;
+	};
+
+	reg_ov8865_dvdd: ov8865-dvdd {
+		compatible = "regulator-fixed";
+		regulator-name = "ov8865-dvdd";
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <1200000>;
+		vin-supply = <&reg_eldo1>;
+	};
+
 	reg_usb1_vbus: reg-usb1-vbus {
 		compatible = "regulator-fixed";
 		regulator-name = "usb1-vbus";
@@ -115,6 +139,17 @@ &cpu100 {
 	cpu-supply = <&reg_dcdc3>;
 };
 
+&csi {
+	status = "okay";
+};
+
+&csi_in {
+	csi_in_mipi_csi2: endpoint {
+		bus-type = <4>; /* CSI2_DPHY */
+		remote-endpoint = <&mipi_csi2_out_csi>;
+	};
+};
+
 &de {
 	status = "okay";
 };
@@ -147,6 +182,36 @@ hdmi_out_con: endpoint {
 	};
 };
 
+&i2c2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c2_pe_pins>;
+	status = "okay";
+
+	ov8865: camera@36 {
+		compatible = "ovti,ov8865";
+		reg = <0x36>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&csi_mclk_pin>;
+		clocks = <&ccu CLK_CSI_MCLK>;
+		clock-names = "extclk";
+		avdd-supply = <&reg_ov8865_avdd>;
+		dovdd-supply = <&reg_ov8865_dovdd>;
+		dvdd-supply = <&reg_ov8865_dvdd>;
+		powerdown-gpios = <&pio 4 17 GPIO_ACTIVE_LOW>; /* PE17 */
+		reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
+
+		port {
+			ov8865_out_mipi_csi2: endpoint {
+				bus-type = <4>; /* MIPI CSI-2 D-PHY */
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+
+				remote-endpoint = <&mipi_csi2_in_ov8865>;
+			};
+		};
+	};
+};
+
 &mdio {
 	rgmii_phy: ethernet-phy@1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
@@ -154,6 +219,26 @@ rgmii_phy: ethernet-phy@1 {
 	};
 };
 
+&mipi_csi2 {
+	status = "okay";
+};
+
+&mipi_csi2_in {
+	mipi_csi2_in_ov8865: endpoint {
+		bus-type = <4>; /* MIPI CSI-2 D-PHY */
+		clock-lanes = <0>;
+		data-lanes = <1 2 3 4>;
+
+		remote-endpoint = <&ov8865_out_mipi_csi2>;
+	};
+};
+
+&mipi_csi2_out {
+	mipi_csi2_out_csi: endpoint {
+		remote-endpoint = <&csi_in_mipi_csi2>;
+	};
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
@@ -327,11 +412,24 @@ &reg_dldo3 {
 	regulator-name = "vcc-pd";
 };
 
+&reg_dldo4 {
+	regulator-always-on;
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "avdd-csi";
+};
+
 &reg_drivevbus {
 	regulator-name = "usb0-vbus";
 	status = "okay";
 };
 
+&reg_eldo1 {
+	regulator-min-microvolt = <1200000>;
+	regulator-max-microvolt = <1200000>;
+	regulator-name = "dvdd-csi-r";
+};
+
 &reg_fldo1 {
 	regulator-min-microvolt = <1080000>;
 	regulator-max-microvolt = <1320000>;
Signature · 1 line
2.28.0