Skip to contentSkip to conversation

media: i2c: Add AR0233 camera sensor driver

PATCH Superseded Alexander Shiyan 3 participants 4 messages Oct 9, 2024 – Oct 11, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 media: i2c: Add AR0233 camera sensor driver

This is a new driver for the AR0233 1/2.5" CMOS digital image sensor from ON Semiconductor.

The initial version of the driver supports 12-bit output format and provides controls that cover common camera sensor use cases.

This been tested on Rockchip RK3568 ISP with DS90UB953 serializer and DS90UB954 deserializer.

---
 drivers/media/i2c/Kconfig  |   11 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/ar0233.c | 1178 ++++++++++++++++++++++++++++++++++++
 3 files changed, 1190 insertions(+)
 create mode 100644 drivers/media/i2c/ar0233.c
drivers/media/i2c/Kconfig +11 -0
index 8ba096b8ebca..327e68b5fe0b 100644
@@ -51,6 +51,17 @@ config VIDEO_ALVIUM_CSI2
 	  To compile this driver as a module, choose M here: the
 	  module will be called alvium-csi2.
 
+config VIDEO_AR0233
+	tristate "onsemi AR0233 sensor support"
+	depends on OF || COMPILE_TEST
+	select V4L2_CCI_I2C
+	help
+	  This is a Video4Linux2 sensor driver for the onsemi AR0233 camera
+	  sensor.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ar0233.
+
 config VIDEO_AR0521
 	tristate "ON Semiconductor AR0521 sensor support"
 	help
drivers/media/i2c/Makefile +1 -0
index fbb988bd067a..055123335a28 100644
@@ -19,6 +19,7 @@ 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_AR0233) += ar0233.o
 obj-$(CONFIG_VIDEO_AR0521) += ar0521.o
 obj-$(CONFIG_VIDEO_BT819) += bt819.o
 obj-$(CONFIG_VIDEO_BT856) += bt856.o
drivers/media/i2c/ar0233.c new file +1178 -0

1,178 lines not on this page · raw message

Signature · 1 line
2.39.1
#1 lore raw

PATCH 2/2 media: dt-bindings: media: i2c: Add AR0233 camera sensor

Add device tree binding for the onsemi AR0233 CMOS camera sensor.

---
 .../bindings/media/i2c/onnn,ar0233.yaml       | 122 ++++++++++++++++++
 1 file changed, 122 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0233.yaml
Documentation/devicetree/bindings/media/i2c/onnn,ar0233.yaml new file +122 -0
new file mode 100644
index 000000000000..fa8a4e63a2a3
@@ -0,0 +1,122 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/onnn,ar0233.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ON Semiconductor AR0233 MIPI CSI-2 sensor
+
+maintainers:
+  - Alexander Shiyan <[email protected]>
+
+description:
+  The AR0233 is a 1/2.5" CMOS digital image sensor with MIPI CSI-2 and
+  I2C-compatible control interface.
+
+properties:
+  compatible:
+    const: onnn,ar0233
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: extclk
+
+  vaa-supply:
+    description:
+      Supply for the VAA analog voltage (2.8V).
+
+  vaapix-supply:
+    description:
+      Supply for the VAA_PIX pixel voltage (2.8V).
+
+  vddio-supply:
+    description:
+      Supply for the VDD_IO I/O digital voltage (1.8V/2.8V).
+
+  vddphy-supply:
+    description:
+      Supply for the VDD_PHY digital voltage (1.2V).
+
+  vdd-supply:
+    description:
+      Supply for the VDD core digital voltage (1.2V).
+
+  reset-gpios:
+    description: Reset GPIO, active low.
+    maxItems: 1
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    unevaluatedProperties: false
+    description:
+      Video output port.
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          bus-type:
+            const: 4
+
+          data-lanes:
+            anyOf:
+              - items:
+                  - const: 1
+              - items:
+                  - const: 1
+                  - const: 2
+              - items:
+                  - const: 1
+                  - const: 2
+                  - const: 3
+                  - const: 4
+
+          link-frequencies: true
+
+        required:
+          - data-lanes
+          - link-frequencies
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/media/video-interfaces.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@10 {
+            compatible = "onnn,ar0233";
+            reg = <0x10>;
+
+            clocks = <&clk27m>;
+            clock-names = "extclk";
+
+            reset-gpios = <&ser0 0 GPIO_ACTIVE_LOW>;
+
+            port {
+                ar0233_out: endpoint {
+                    data-lanes = <1 2>;
+                    link-frequencies = /bits/ 64 <375000000>;
+                    remote-endpoint = <&ub953_csi_in>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.39.1
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] media: dt-bindings: media: i2c: Add AR0233 camera sensor

Quoted 8 lines · Alexander Shiyan

Add device tree binding for the onsemi AR0233 CMOS camera sensor.

---
 .../bindings/media/i2c/onnn,ar0233.yaml       | 122 ++++++++++++++++++
 1 file changed, 122 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,ar0233.yaml
#3 lore raw
In reply to Alexander Shiyan
kernel test robot noticed the following build warnings:

Hi Alexander,

kernel test robot noticed the following build warnings:

[auto build test WARNING on media-tree/master]
[also build test WARNING on linuxtv-media-stage/master sailus-media-tree/master linus/master v6.12-rc2 next-20241010] [cannot apply to sailus-media-tree/streams]
[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/Alexander-Shiyan/media-dt-bindings-media-i2c-Add-AR0233-camera-sensor/20241009-164953
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20241009084304.14143-1-eagle.alexander923%40gmail.com
patch subject: [PATCH 1/2] media: i2c: Add AR0233 camera sensor driver
config: parisc-randconfig-r054-20241011 (https://download.01.org/0day-ci/archive/20241011/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241011/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| 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/ar0233.c: In function 'ar0233_s_ctrl':
drivers/media/i2c/ar0233.c:428:42: warning: variable 'format' set but not used [-Wunused-but-set-variable]

     428 |         const struct v4l2_mbus_framefmt *format;
         |                                          ^~~~~~
   drivers/media/i2c/ar0233.c: At top level:
>> drivers/media/i2c/ar0233.c:1159:34: warning: 'ar0233_of_match' defined but not used [-Wunused-const-variable=]
    1159 | static const struct of_device_id ar0233_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~

vim +/ar0233_of_match +1159 drivers/media/i2c/ar0233.c

1158

> 1159	static const struct of_device_id ar0233_of_match[] = {

1160 { .compatible = "onnn,ar0233" },
1161 { }
1162 };
1163 MODULE_DEVICE_TABLE(of, ar0233_of_match);
1164

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