Skip to contentSkip to conversation

IMX334 Camera Sensor Driver

PATCH In review Martina Krasteva 4 participants 8 messages Feb 3, 2021 – Feb 9, 2021

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

v7 cover IMX334 Camera Sensor Driver

From: Martina Krasteva <[email protected]>

Hello,

This patch series contains Sony imx334 sensor driver and device tree binding document.

A v4l2 sub-device driver for the Sony imx334 image sensor is added. This is a camera sensor using the i2c bus for control and the csi-2 bus for data.

The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate control support
- supported resolution:
- 3840x2160 @ 60fps
- supported bayer order output:
- SRGGB12

v1: https://patchwork.kernel.org/project/linux-media/list/?series=388393

v1->v2:
- dt-bindings doc fixes
- minor cosmetic changes
- improvement in write_reg()
- set all media bus format fields to pass v4l2-compliance test
- remove link_validate from source entity

v2: https://patchwork.kernel.org/project/linux-media/list/?series=396393

v2->v3:
- small cosmetic changes

v3: https://patchwork.kernel.org/project/linux-media/list/?series=397689

v3->v4:
- fix read/write_reg() functions

v4: https://patchwork.kernel.org/project/linux-media/list/?series=400459

v4->v5:
- add link-frequencies in dt-bindings doc
- edit required properties in db-bindings doc
- fix data_buf overrun in read_reg()
- add function to parse dt configuration
- allow cahnging vblank in power off state
- change lpfr and ppln with vblank and hblank in mode description

v5: https://patchwork.kernel.org/project/linux-media/list/?series=425541

v5->v6:
- declare imx334_parse_hw_config() as static function

v6: https://patchwork.kernel.org/project/linux-media/list/?series=426171

v6->v7:
- add clocks and reset-gpios in dt-bindings doc
- fix error handling in imx334_set_pad_format()
- add LINK_FREQ ctrl
- do not specify a clock name in devm_clk_get()

Best Regards,
Martina

Martina Krasteva (2):
dt-bindings: media: Add bindings for imx334
media: i2c: Add imx334 camera sensor driver

 .../devicetree/bindings/media/i2c/sony,imx334.yaml |   90 ++
 MAINTAINERS                                        |    9 +
 drivers/media/i2c/Kconfig                          |   14 +
 drivers/media/i2c/Makefile                         |    1 +
 drivers/media/i2c/imx334.c                         | 1131 ++++++++++++++++++++
 5 files changed, 1245 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
 create mode 100644 drivers/media/i2c/imx334.c

base-commit: fb2a9c3209872b6e65661e3737f2767832a42973

Signature · 1 line
2.11.0
#1 lore raw

PATCH v7 1/2 dt-bindings: media: Add bindings for imx334

From: Martina Krasteva <[email protected]>

- Add dt-bindings documentation for Sony imx334 sensor driver.
- Add MAINTAINERS entry for Sony imx334 binding documentation.

---
 .../devicetree/bindings/media/i2c/sony,imx334.yaml | 90 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml new file +90 -0
new file mode 100644
index 000000000000..3145e94d043e
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2021 Intel Corporation
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/sony,imx334.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sony IMX334 Sensor
+
+maintainers:
+  - Paul J. Murphy <[email protected]>
+  - Daniele Alessandrelli <[email protected]>
+
+description:
+  IMX334 sensor is a Sony CMOS active pixel digital image sensor with an active
+  array size of 3864H x 2202V. It is programmable through I2C interface. The
+  I2C client address is fixed to 0x1a as per sensor data sheet. Image data is
+  sent through MIPI CSI-2.
+
+properties:
+  compatible:
+    const: sony,imx334
+  reg:
+    description: I2C address
+    maxItems: 1
+
+  assigned-clocks: true
+  assigned-clock-parents: true
+  assigned-clock-rates: true
+
+  clocks:
+    description: Clock frequency from 6 to 27 MHz, 37.125MHz, 74.25MHz
+    maxItems: 1
+
+  reset-gpios:
+    description: Reference to the GPIO connected to the XCLR pin, if any.
+
+  port:
+    type: object
+    additionalProperties: false
+    $ref: /schemas/graph.yaml#/properties/port
+
+    properties:
+      endpoint:
+        type: object
+        properties:
+          data-lanes:
+            $ref: ../video-interfaces.yaml#/properties/data-lanes
+          link-frequencies:
+            $ref: ../video-interfaces.yaml#/properties/link-frequencies
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@1a {
+            compatible = "sony,imx334";
+            reg = <0x1a>;
+            clocks = <&imx334_clk>
+
+            assigned-clocks = <&imx334_clk>;
+            assigned-clock-rates = <24000000>;
+
+            port {
+                imx334: endpoint {
+                    remote-endpoint = <&cam>;
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <891000000>;
+                };
+            };
+        };
+    };
+...
MAINTAINERS +8 -0
index 3353de0c4bc8..2ab75519938a 100644
@@ -16589,6 +16589,14 @@ S:	Maintained
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/i2c/imx319.c
 
+SONY IMX334 SENSOR DRIVER
+M:	Paul J. Murphy <[email protected]>
+M:	Daniele Alessandrelli <[email protected]>
+L:	[email protected]
+S:	Maintained
+T:	git git://linuxtv.org/media_tree.git
+F:	Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
+
 SONY IMX355 SENSOR DRIVER
 M:	Tianshu Qiu <[email protected]>
 L:	[email protected]
Signature · 1 line
2.11.0
maintainer
#2 lore raw

Re: [PATCH v7 1/2] dt-bindings: media: Add bindings for imx334

Quoted 10 lines · Martina Krasteva

From: Martina Krasteva <[email protected]>

- Add dt-bindings documentation for Sony imx334 sensor driver.
- Add MAINTAINERS entry for Sony imx334 binding documentation.

Quoted 6 lines
---
 .../devicetree/bindings/media/i2c/sony,imx334.yaml | 90 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dts:28.17-18 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:344: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1435383

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

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.

maintainer
#3 lore raw

Re: [PATCH v7 1/2] dt-bindings: media: Add bindings for imx334

Hi Rob,

Quoted 34 lines · Rob Herring
Quoted 10 lines · Martina Krasteva

From: Martina Krasteva <[email protected]>

- Add dt-bindings documentation for Sony imx334 sensor driver.
- Add MAINTAINERS entry for Sony imx334 binding documentation.

Quoted 6 lines
---
 .../devicetree/bindings/media/i2c/sony,imx334.yaml | 90 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dts:28.17-18 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:344: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1435383

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

Quoted 7 lines

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.

Thanks for reporting this. The example was apparently missing the assigned-clock-parents property. I'll squash the following change to the patch:

Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml +1 -0
index 3145e94d043e7..4217fbea0735a 100644
@@ -76,6 +76,7 @@ examples:
             clocks = <&imx334_clk>
 
             assigned-clocks = <&imx334_clk>;
+            assigned-clock-parents = <&imx334_clk_parent>;
             assigned-clock-rates = <24000000>;
 
             port {
Signature · 3 lines
Kind regards,

Sakari Ailus
maintainer
#4 lore raw

Re: [PATCH v7 1/2] dt-bindings: media: Add bindings for imx334

Quoted 29 lines · Sakari Ailus

Hi Rob,

Quoted 25 lines · Rob Herring
Quoted 10 lines · Martina Krasteva

From: Martina Krasteva <[email protected]>

- Add dt-bindings documentation for Sony imx334 sensor driver.
- Add MAINTAINERS entry for Sony imx334 binding documentation.

Quoted 6 lines
---
 .../devicetree/bindings/media/i2c/sony,imx334.yaml | 90 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dts:28.17-18 syntax error FATAL ERROR: Unable to parse input tree

That's usually a missing header for #defines.

Quoted 13 lines
Quoted 13 lines

make[1]: *** [scripts/Makefile.lib:344: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1435383

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

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:

Quoted 7 lines
Quoted 3 lines

pip3 install dtschema --upgrade

Please check and re-submit.

Thanks for reporting this. The example was apparently missing the assigned-clock-parents property. I'll squash the following change to the patch:

Doubtful. That would be a more specific schema error.

Quoted 18 lines
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml +1 -1
index 3145e94d043e7..4217fbea0735a 100644
@@ -76,6 +76,7 @@ examples:
             clocks = <&imx334_clk>
 
             assigned-clocks = <&imx334_clk>;
+            assigned-clock-parents = <&imx334_clk_parent>;
             assigned-clock-rates = <24000000>;
 
             port {
 
--

Kind regards,

Sakari Ailus

maintainer
#5 lore raw

Re: [PATCH v7 1/2] dt-bindings: media: Add bindings for imx334

HI Rob,

Quoted 49 lines · Rob Herring
Quoted 29 lines · Sakari Ailus

Hi Rob,

Quoted 25 lines · Rob Herring
Quoted 10 lines · Martina Krasteva

From: Martina Krasteva <[email protected]>

- Add dt-bindings documentation for Sony imx334 sensor driver.
- Add MAINTAINERS entry for Sony imx334 binding documentation.

Quoted 6 lines
---
 .../devicetree/bindings/media/i2c/sony,imx334.yaml | 90 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dts:28.17-18 syntax error FATAL ERROR: Unable to parse input tree

That's usually a missing header for #defines.

Quoted 15 lines
Quoted 15 lines

make[1]: *** [scripts/Makefile.lib:344: Documentation/devicetree/bindings/media/i2c/sony,imx334.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1435383

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

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

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Please check and re-submit.

Thanks for reporting this. The example was apparently missing the assigned-clock-parents property. I'll squash the following change to the patch:

Doubtful. That would be a more specific schema error.

Well, I guess the parsing didn't get quite there. There's a missing semicolon a few lines above it.

Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml examples: · line 76

Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml +0 -0
index 3145e94d043e7..4217fbea0735a 100644
@@ -76,6 +76,7 @@ examples:
             clocks = <&imx334_clk>
				       ^
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml +1 -0
             assigned-clocks = <&imx334_clk>;
+            assigned-clock-parents = <&imx334_clk_parent>;
             assigned-clock-rates = <24000000>;
 
             port {
 
Signature · 3 lines
Kind regards,

Sakari Ailus
Reviewed-by on v7 1/2
#6 lore raw

Re: [PATCH v7 1/2] dt-bindings: media: Add bindings for imx334

In reply to Martina Krasteva
Quoted 77 lines · Martina Krasteva

From: Martina Krasteva <[email protected]>

- Add dt-bindings documentation for Sony imx334 sensor driver.
- Add MAINTAINERS entry for Sony imx334 binding documentation.

---
 .../devicetree/bindings/media/i2c/sony,imx334.yaml | 90 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++
 2 files changed, 98 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml new file +55 -0
new file mode 100644
index 000000000000..3145e94d043e
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2021 Intel Corporation
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/sony,imx334.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sony IMX334 Sensor
+
+maintainers:
+  - Paul J. Murphy <[email protected]>
+  - Daniele Alessandrelli <[email protected]>
+
+description:
+  IMX334 sensor is a Sony CMOS active pixel digital image sensor with an active
+  array size of 3864H x 2202V. It is programmable through I2C interface. The
+  I2C client address is fixed to 0x1a as per sensor data sheet. Image data is
+  sent through MIPI CSI-2.
+
+properties:
+  compatible:
+    const: sony,imx334
+  reg:
+    description: I2C address
+    maxItems: 1
+
+  assigned-clocks: true
+  assigned-clock-parents: true
+  assigned-clock-rates: true
+
+  clocks:
+    description: Clock frequency from 6 to 27 MHz, 37.125MHz, 74.25MHz
+    maxItems: 1
+
+  reset-gpios:
+    description: Reference to the GPIO connected to the XCLR pin, if any.
+
+  port:
+    type: object
+    additionalProperties: false
+    $ref: /schemas/graph.yaml#/properties/port
+
+    properties:
+      endpoint:
+        type: object
+        properties:
+          data-lanes:
+            $ref: ../video-interfaces.yaml#/properties/data-lanes
+          link-frequencies:
+            $ref: ../video-interfaces.yaml#/properties/link-frequencies
+
+        required:
+          - data-lanes
+          - link-frequencies
+

Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml line 65

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml new file +10 -0
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - port
+
+additionalProperties: false

For the bindings:

Quoted 21 lines
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml new file +16 -0
+            reg = <0x1a>;
+            clocks = <&imx334_clk>
+
+            assigned-clocks = <&imx334_clk>;
+            assigned-clock-rates = <24000000>;
+
+            port {
+                imx334: endpoint {
+                    remote-endpoint = <&cam>;
+                    data-lanes = <1 2 3 4>;
+                    link-frequencies = /bits/ 64 <891000000>;
+                };
+            };
+        };
+    };
+...
MAINTAINERS +0 -0
index 3353de0c4bc8..2ab75519938a 100644

MAINTAINERS S: Maintained · line 16593

Quoted 5 lines
MAINTAINERS +2 -0
@@ -16589,6 +16589,14 @@ S:	Maintained
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/i2c/imx319.c
 
+SONY IMX334 SENSOR DRIVER
+M:	Paul J. Murphy <[email protected]>

This entry looks unusual. Paul's name appears in multiple places (added as maintainer for Keembay and this sensor) but there are no emails from him:
https://lore.kernel.org/lkml/?q=f%3Apaul.j.murphy%40intel.com
Nothing on LKML.

Does this person really exists and plans to work with upstream?

I am asking because several patches came with acks and reviews before first submission to LKML which could mean that you just send something from your internal kernel tree. Usually it is expected to see the Acks/Reviews/Tested on the lists. Providing them via private channels is rather discouraged - does not look like open way of doing things.

Best regards,
Krzysztof

Quoted 5 lines
MAINTAINERS +5 -0
+M:	Daniele Alessandrelli <[email protected]>
+L:	[email protected]
+S:	Maintained
+T:	git git://linuxtv.org/media_tree.git
+F:	Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
#7 lore raw

PATCH v7 2/2 media: i2c: Add imx334 camera sensor driver

In reply to Martina Krasteva

From: Martina Krasteva <[email protected]>

Add a v4l2 sub-device driver for the Sony imx334 image sensor. This is a camera sensor using the i2c bus for control and the csi-2 bus for data.

The following features are supported:
- manual exposure and analog gain control support
- vblank/hblank/pixel rate/link freq control support
- supported resolution:
- 3840x2160 @ 60fps
- supported bayer order output:
- SRGGB12

---
 MAINTAINERS                |    1 +
 drivers/media/i2c/Kconfig  |   14 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/imx334.c | 1131 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1147 insertions(+)
 create mode 100644 drivers/media/i2c/imx334.c
MAINTAINERS +1 -0
index 2ab75519938a..ef4e27d9cd89 100644
@@ -16596,6 +16596,7 @@ L:	[email protected]
 S:	Maintained
 T:	git git://linuxtv.org/media_tree.git
 F:	Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml
+F:	drivers/media/i2c/imx334.c
 
 SONY IMX355 SENSOR DRIVER
 M:	Tianshu Qiu <[email protected]>
drivers/media/i2c/Kconfig +14 -0
index bb1b5a340431..b6a1f5482dd5 100644
@@ -813,6 +813,20 @@ config VIDEO_IMX319
 	  To compile this driver as a module, choose M here: the
 	  module will be called imx319.
 
+config VIDEO_IMX334
+	tristate "Sony IMX334 sensor support"
+	depends on OF_GPIO
+	depends on I2C && VIDEO_V4L2
+	select VIDEO_V4L2_SUBDEV_API
+	select MEDIA_CONTROLLER
+	select V4L2_FWNODE
+	help
+	  This is a Video4Linux2 sensor driver for the Sony
+	  IMX334 camera.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called imx334.
+
 config VIDEO_IMX355
 	tristate "Sony IMX355 sensor support"
 	depends on I2C && VIDEO_V4L2
drivers/media/i2c/Makefile +1 -0
index 5b1dcfa3ce76..b7e12770a8b0 100644
@@ -122,6 +122,7 @@ obj-$(CONFIG_VIDEO_IMX258)	+= imx258.o
 obj-$(CONFIG_VIDEO_IMX274)	+= imx274.o
 obj-$(CONFIG_VIDEO_IMX290)	+= imx290.o
 obj-$(CONFIG_VIDEO_IMX319)	+= imx319.o
+obj-$(CONFIG_VIDEO_IMX334)	+= imx334.o
 obj-$(CONFIG_VIDEO_IMX355)	+= imx355.o
 obj-$(CONFIG_VIDEO_MAX9286)	+= max9286.o
 rdacm20-camera_module-objs	:= rdacm20.o max9271.o
drivers/media/i2c/imx334.c new file +1131 -0

1,131 lines not on this page · raw message

Signature · 1 line
2.11.0