Skip to contentSkip to conversation

media: i2c: Add OX05B1S camera sensor driver

PATCH In review Mirela Rabulea 4 participants 17 messages Mar 5, 2025 – Jul 9, 2025

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

v4 cover media: i2c: Add OX05B1S camera sensor driver

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
Supported resolution:
- 2592 x 1944 @ 30fps (SGRBG10)

Support for another sensor, OS08A20, is added as a separate patch, using another compatible.
For OS08a20, HDR mode control is supported, with one HDR mode: staggered HDR with 2 exposures on separate virtual channels. However, for now, only one exposure (VC 0) is accessible via get_frame_desc.

Supported resolutions:
- 1920 x 1080 @ 60fps (SBGGR10, no HDR)
- 1920 x 1080 @ 30fps (SBGGR10, HDR)
- 3840 x 2160 @ 30fps (SBGGR12, no HDR)
- 3840 x 2160 @ 15fps (SBGGR12, HDR)
- 3840 x 2160 @ 30fps (SBGGR10, no HDR)
- 3840 x 2160 @ 15fps (SBGGR10, HDR)

The driver was tested on upstream 6.14-rc2 on imx8mp-evk, but also on nxp tree based on 6.12 on imx95-19x19-evk.

The results of v4l2-compliance test:

root@imx8mpevk:/unit_tests# ./v4l2-compliance -d /dev/video0
v4l2-compliance 1.29.0-5342, 64 bits, 64-bit time_t
v4l2-compliance SHA: 0b852765266e 2025-03-04 11:39:48

Compliance test for mxc-isi device /dev/video0:

Driver Info:

	Driver name      : mxc-isi
	Card type        : mxc-isi-cap
	Bus info         : platform:32e00000.isi
	Driver version   : 6.14.0
	Capabilities     : 0xa4201000

Video Capture Multiplanar
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x24201000
Video Capture Multiplanar
I/O MC
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : mxc-isi
	Model            : FSL Capture Media Device
	Serial           : 
	Bus info         : platform:32e00000.isi
	Media version    : 6.14.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.14.0
Interface Info:
	ID               : 0x0300000c
	Type             : V4L Video
Entity Info:
	ID               : 0x0000000a (10)
	Name             : mxc_isi.0.capture
	Function         : V4L2 I/O
	Pad 0x0100000b   : 0: Sink
	  Link 0x0200000e: from remote pad 0x1000009 of entity 'mxc_isi.0' (Video Pixel Formatter): Data, Enabled, Immutable

Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 4 Private Controls: 0

Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK

Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK

Total for mxc-isi device /dev/video0: 49, Succeeded: 49, Failed: 0, Warnings: 0

Mirela Rabulea (4):
dt-bindings: media: i2c: Add OX05B1S sensor
media: ox05b1s: Add omnivision OX05B1S raw sensor driver
MAINTAINERS: Add entry for OX05B1S sensor driver
media: ox05b1s: Add support for Omnivision OS08A20 raw sensor

 .../bindings/media/i2c/ovti,ox05b1s.yaml      |  119 ++
 MAINTAINERS                                   |   10 +
 drivers/media/i2c/Kconfig                     |    1 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/ox05b1s/Kconfig             |   10 +
 drivers/media/i2c/ox05b1s/Makefile            |    2 +
 drivers/media/i2c/ox05b1s/ox05b1s.h           |   26 +
 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c      | 1136 +++++++++++++++++
 drivers/media/i2c/ox05b1s/ox05b1s_modes.c     |  187 +++
 9 files changed, 1492 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml
 create mode 100644 drivers/media/i2c/ox05b1s/Kconfig
 create mode 100644 drivers/media/i2c/ox05b1s/Makefile
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/4 dt-bindings: media: i2c: Add OX05B1S sensor

Add bindings for Omnivision OX05B1S sensor. Also add compatible for Omnivision OS08A20 sensor.

---

Changes in v4:
Collect Reviewed-by

Changes in v3:
Use unevaluatedProperties: false and drop orientation/rotation Drop items and keep alphabetical order in compatible property Shorten the description for reset_gpio
Make the supplies required.
Use generic node name (camera instead of ox05b1s)

Changes in v2:
Small updates on description
Update subject, drop "bindings" and "driver"
Just one binding patch (squash os08a20 bindings)
Re-flow to 80 columns.
Drop clock name (not needed in case of single clock)
Make the clock required property, strictly from sensor module point of view, it is mandatory (will use a fixed clock for nxp board)
Add regulators: avdd, dvdd, dovdd
Add $ref: /schemas/media/video-interface-devices.yaml
Drop assigned-clock* properties (defined in clocks.yaml)
Keep "additionalProperties : false" and orientation/rotation (unevaluatedProperties: false was suggested, but only orientation/rotation are needed from video-interface-devices.yaml) Include assigned-clock* in the example, for completeness sake (although it was also suggested to omit them)

 .../bindings/media/i2c/ovti,ox05b1s.yaml      | 119 ++++++++++++++++++
 1 file changed, 119 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +119 -0
new file mode 100644
index 000000000000..9f35b4e67bea
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2024 NXP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ox05b1s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Omnivision OX05B1S Image Sensor
+
+maintainers:
+  - Mirela Rabulea <[email protected]>
+
+description:
+  The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active
+  array size of 2592 x 1944. It is programmable through I2C interface.
+  Image data is available via MIPI CSI-2 serial data output.
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ovti,os08a20
+      - ovti,ox05b1s
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    description: Input clock (24 MHz)
+    maxItems: 1
+
+  reset-gpios:
+    description: Active low XSHUTDOWN pin
+    maxItems: 1
+
+  avdd-supply:
+    description: Power for analog circuit (2.8V)
+
+  dovdd-supply:
+    description: Power for I/O circuit (1.8V)
+
+  dvdd-supply:
+    description: Power for digital circuit (1.2V)
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+    description: MIPI CSI-2 transmitter port
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          data-lanes:
+            anyOf:
+              - items:
+                  - const: 1
+                  - const: 2
+              - items:
+                  - const: 1
+                  - const: 2
+                  - const: 3
+                  - const: 4
+        required:
+          - data-lanes
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - port
+  - avdd-supply
+  - dovdd-supply
+  - dvdd-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@36 {
+            compatible = "ovti,ox05b1s";
+            reg = <0x36>;
+            clocks = <&ox05b1s_clk>;
+
+            assigned-clocks = <&ox05b1s_clk>;
+            assigned-clock-parents = <&ox05b1s_clk_parent>;
+            assigned-clock-rates = <24000000>;
+
+            reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+
+            avdd-supply = <&camera_avdd_2v8>;
+            dovdd-supply = <&camera_dovdd_1v8>;
+            dvdd-supply = <&camera_dvdd_1v2>;
+
+            orientation = <2>;
+            rotation = <0>;
+
+            port {
+                ox05b1s_mipi_0_ep: endpoint {
+                    remote-endpoint = <&mipi_csi0_ep>;
+                    data-lanes = <1 2 3 4>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v4 1/4] dt-bindings: media: i2c: Add OX05B1S sensor

Hi Mirela,

Quoted 55 lines · Mirela Rabulea

Add bindings for Omnivision OX05B1S sensor. Also add compatible for Omnivision OS08A20 sensor.

---

Changes in v4:
Collect Reviewed-by

Changes in v3:
Use unevaluatedProperties: false and drop orientation/rotation Drop items and keep alphabetical order in compatible property Shorten the description for reset_gpio
Make the supplies required.
Use generic node name (camera instead of ox05b1s)

Changes in v2:
Small updates on description
Update subject, drop "bindings" and "driver"
Just one binding patch (squash os08a20 bindings)
Re-flow to 80 columns.
Drop clock name (not needed in case of single clock)
Make the clock required property, strictly from sensor module point of view, it is mandatory (will use a fixed clock for nxp board)
Add regulators: avdd, dvdd, dovdd
Add $ref: /schemas/media/video-interface-devices.yaml
Drop assigned-clock* properties (defined in clocks.yaml)
Keep "additionalProperties : false" and orientation/rotation (unevaluatedProperties: false was suggested, but only orientation/rotation are needed from video-interface-devices.yaml) Include assigned-clock* in the example, for completeness sake (although it was also suggested to omit them)

 .../bindings/media/i2c/ovti,ox05b1s.yaml      | 119 ++++++++++++++++++
 1 file changed, 119 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +15 -0
new file mode 100644
index 000000000000..9f35b4e67bea
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2024 NXP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ox05b1s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Omnivision OX05B1S Image Sensor
+
+maintainers:
+  - Mirela Rabulea <[email protected]>
+
+description:
+  The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active
+  array size of 2592 x 1944. It is programmable through I2C interface.

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

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +10 -0
+  Image data is available via MIPI CSI-2 serial data output.
+
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ovti,os08a20
+      - ovti,ox05b1s

The bindings only describe ox05b1s. How are the two different?

Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml line 32

Quoted 7 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +7 -0
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    description: Input clock (24 MHz)
+    maxItems: 1

Is this really a hardware limitation, or what the driver is currently limited to? In the former case, I'd include the range.

Quoted 87 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +87 -0
+
+  reset-gpios:
+    description: Active low XSHUTDOWN pin
+    maxItems: 1
+
+  avdd-supply:
+    description: Power for analog circuit (2.8V)
+
+  dovdd-supply:
+    description: Power for I/O circuit (1.8V)
+
+  dvdd-supply:
+    description: Power for digital circuit (1.2V)
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+    description: MIPI CSI-2 transmitter port
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          data-lanes:
+            anyOf:
+              - items:
+                  - const: 1
+                  - const: 2
+              - items:
+                  - const: 1
+                  - const: 2
+                  - const: 3
+                  - const: 4
+        required:
+          - data-lanes
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - port
+  - avdd-supply
+  - dovdd-supply
+  - dvdd-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@36 {
+            compatible = "ovti,ox05b1s";
+            reg = <0x36>;
+            clocks = <&ox05b1s_clk>;
+
+            assigned-clocks = <&ox05b1s_clk>;
+            assigned-clock-parents = <&ox05b1s_clk_parent>;
+            assigned-clock-rates = <24000000>;
+
+            reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+
+            avdd-supply = <&camera_avdd_2v8>;
+            dovdd-supply = <&camera_dovdd_1v8>;
+            dvdd-supply = <&camera_dvdd_1v2>;
+
+            orientation = <2>;
+            rotation = <0>;
+
+            port {
+                ox05b1s_mipi_0_ep: endpoint {
+                    remote-endpoint = <&mipi_csi0_ep>;
+                    data-lanes = <1 2 3 4>;
+                };
+            };
+        };
+    };
+...
Signature · 3 lines
Kind regards,

Sakari Ailus
#3 lore raw

Re: [EXT] Re: [PATCH v4 1/4] dt-bindings: media: i2c: Add OX05B1S sensor

Hi Sakari,

Quoted 64 lines · Sakari Ailus

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Hi Mirela,

Quoted 58 lines · Mirela Rabulea

Add bindings for Omnivision OX05B1S sensor. Also add compatible for Omnivision OS08A20 sensor.

---

Changes in v4:
Collect Reviewed-by

Changes in v3:
Use unevaluatedProperties: false and drop orientation/rotation Drop items and keep alphabetical order in compatible property Shorten the description for reset_gpio
Make the supplies required.
Use generic node name (camera instead of ox05b1s)

Changes in v2:
Small updates on description
Update subject, drop "bindings" and "driver"
Just one binding patch (squash os08a20 bindings)
Re-flow to 80 columns.
Drop clock name (not needed in case of single clock)
Make the clock required property, strictly from sensor module point of view, it is mandatory (will use a fixed clock for nxp board)
Add regulators: avdd, dvdd, dovdd
Add $ref: /schemas/media/video-interface-devices.yaml
Drop assigned-clock* properties (defined in clocks.yaml)
Keep "additionalProperties : false" and orientation/rotation (unevaluatedProperties: false was suggested, but only orientation/rotation are needed from video-interface-devices.yaml) Include assigned-clock* in the example, for completeness sake (although it was also suggested to omit them)

  .../bindings/media/i2c/ovti,ox05b1s.yaml      | 119 ++++++++++++++++++
  1 file changed, 119 insertions(+)

create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml

Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +18 -0
new file mode 100644
index 000000000000..9f35b4e67bea
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2024 NXP
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/ovti,ox05b1s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Omnivision OX05B1S Image Sensor
+
+maintainers:
+  - Mirela Rabulea <[email protected]>
+
+description:
+  The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active
+  array size of 2592 x 1944. It is programmable through I2C interface.
+  Image data is available via MIPI CSI-2 serial data output.
+
+allOf:
Quoted 8 lines

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

Quoted 7 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +7 -0
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ovti,os08a20
+      - ovti,ox05b1s

The bindings only describe ox05b1s. How are the two different?

Indeed, thanks for pointing out. I will update the description in _v5 like this, to include also os08a20:

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944 and raw RGB-Ir output. It is programmable through I2C interface. Image data is available via MIPI CSI-2 serial data output. The Omnivision OS08A20 is a 1/1.8-Inch CMOS image sensor with an active array size of 3840 x 2160, raw RGB output and 2-exposure staggered HDR support.

Quoted 10 lines

Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml line 32

Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +7 -0
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    description: Input clock (24 MHz)
+    maxItems: 1

Is this really a hardware limitation, or what the driver is currently limited to? In the former case, I'd include the range.

No, hardware is not limited to 24 MHz. I will include a range like this:

description: Input clock (6-64 MHz for OX05B1S, 6-27 MHz for OS08A20)

Thanks for feedback,

Mirela

Quoted 92 lines
Quoted 78 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +77 -0
+
+  reset-gpios:
+    description: Active low XSHUTDOWN pin
+    maxItems: 1
+
+  avdd-supply:
+    description: Power for analog circuit (2.8V)
+
+  dovdd-supply:
+    description: Power for I/O circuit (1.8V)
+
+  dvdd-supply:
+    description: Power for digital circuit (1.2V)
+
+  port:
+    $ref: /schemas/graph.yaml#/$defs/port-base
+    additionalProperties: false
+    description: MIPI CSI-2 transmitter port
+
+    properties:
+      endpoint:
+        $ref: /schemas/media/video-interfaces.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          data-lanes:
+            anyOf:
+              - items:
+                  - const: 1
+                  - const: 2
+              - items:
+                  - const: 1
+                  - const: 2
+                  - const: 3
+                  - const: 4
+        required:
+          - data-lanes
+
+    required:
+      - endpoint
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - port
+  - avdd-supply
+  - dovdd-supply
+  - dvdd-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        camera@36 {
+            compatible = "ovti,ox05b1s";
+            reg = <0x36>;
+            clocks = <&ox05b1s_clk>;
+
+            assigned-clocks = <&ox05b1s_clk>;
+            assigned-clock-parents = <&ox05b1s_clk_parent>;
+            assigned-clock-rates = <24000000>;
+
+            reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+
+            avdd-supply = <&camera_avdd_2v8>;
+            dovdd-supply = <&camera_dovdd_1v8>;
+            dvdd-supply = <&camera_dvdd_1v2>;
+
+            orientation = <2>;
+            rotation = <0>;

Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml line 119

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml new file +10 -0
+
+            port {
+                ox05b1s_mipi_0_ep: endpoint {
+                    remote-endpoint = <&mipi_csi0_ep>;
+                    data-lanes = <1 2 3 4>;
+                };
+            };
+        };
+    };
+...

--
Kind regards,

Sakari Ailus

#4 lore raw

PATCH v4 2/4 media: ox05b1s: Add omnivision OX05B1S raw sensor driver

In reply to Mirela Rabulea

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor.

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Remove some uneeded local variable initialisations
Fix extra/missing spaces
Add missing ending \n
Use return -ENODEV & return 0 to ease reading
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace more dev_err's with dev_err_probe
Constify more structs
Remove some unneded ending commas after a terminator
Fix smatch error in ox05b1s_s_ctrl: error: typename in expression
Fix a seeries of smatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config) Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Use const for ox05b1s_supported_modes
Device should be silent on success, use dev_dbg.
Drop unneeded {}
Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)
Fix an issue in ox05b1s_set_fmt, the format was saved in subdev state only for _TRY, save it also for _ACTIVE

Changes in v2:
Use dev_err_probe for missing clock, since it is now required property, and use NULL for devm_clk_get (no name for single clock), remove check for non NULL sensor->sensor_clk Remove dev_err message for devm_regmap_init_i2c allocation error
Added spaces inside brackets, wrap lines to 80
Remove some redundant initializations
Add regulators
Make "sizes" a pointer
Use struct v4l2_area instead of u32[2] array
Remove the count for supported_modes[] and supported_codes[], instead use sentinel element at the end
Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count
Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes
Refactor register lists to allow multiple register arrays per mode
Use GPL-2.0-only instead of GPL-2.0

 drivers/media/i2c/Kconfig                 |   1 +
 drivers/media/i2c/Makefile                |   1 +
 drivers/media/i2c/ox05b1s/Kconfig         |  10 +
 drivers/media/i2c/ox05b1s/Makefile        |   2 +
 drivers/media/i2c/ox05b1s/ox05b1s.h       |  22 +
 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 951 ++++++++++++++++++++++
 drivers/media/i2c/ox05b1s/ox05b1s_modes.c |  77 ++
 7 files changed, 1064 insertions(+)
 create mode 100644 drivers/media/i2c/ox05b1s/Kconfig
 create mode 100644 drivers/media/i2c/ox05b1s/Makefile
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c
drivers/media/i2c/Kconfig +1 -0
index 8ba096b8ebca..5cda062c0463 100644
@@ -700,6 +700,7 @@ config VIDEO_VGXY61
 
 source "drivers/media/i2c/ccs/Kconfig"
 source "drivers/media/i2c/et8ek8/Kconfig"
+source "drivers/media/i2c/ox05b1s/Kconfig"
 
 endif
 
drivers/media/i2c/Makefile +1 -0
index fbb988bd067a..028eb08e648c 100644
@@ -114,6 +114,7 @@ obj-$(CONFIG_VIDEO_OV9282) += ov9282.o
 obj-$(CONFIG_VIDEO_OV9640) += ov9640.o
 obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
 obj-$(CONFIG_VIDEO_OV9734) += ov9734.o
+obj-$(CONFIG_VIDEO_OX05B1S) += ox05b1s/
 obj-$(CONFIG_VIDEO_RDACM20) += rdacm20.o
 obj-$(CONFIG_VIDEO_RDACM21) += rdacm21.o
 obj-$(CONFIG_VIDEO_RJ54N1) += rj54n1cb0c.o
drivers/media/i2c/ox05b1s/Kconfig new file +10 -0
new file mode 100644
index 000000000000..48fcd04b20d5
@@ -0,0 +1,10 @@
+config VIDEO_OX05B1S
+	tristate "OmniVision raw sensor support OX05B1S"
+	depends on OF
+	depends on GPIOLIB
+	select REGMAP_I2C
+	help
+	  This is a Video4Linux2 sensor driver for the Omnivision OX05B1S RGB-IR sensor.
+	  This is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.
+	  It is programmable through I2C interface.
+	  The output is on MIPI CSI-2 interface.
drivers/media/i2c/ox05b1s/Makefile new file +2 -0
new file mode 100644
index 000000000000..0b38dbf98bcd
@@ -0,0 +1,2 @@
+ox05b1s-objs := ox05b1s_modes.o ox05b1s_mipi.o
+obj-$(CONFIG_VIDEO_OX05B1S) += ox05b1s.o
drivers/media/i2c/ox05b1s/ox05b1s.h new file +22 -0
new file mode 100644
index 000000000000..2a87d69864f9
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2024, NXP
+ */
+
+#ifndef OX05B1S_H
+#define OX05B1S_H
+
+#include <linux/types.h>
+
+struct ox05b1s_reg {
+	u32 addr;
+	u32 data;
+};
+
+struct ox05b1s_reglist {
+	const struct ox05b1s_reg *regs;
+};
+
+extern const struct ox05b1s_reglist ox05b1s_reglist_2592x1944[];
+
+#endif /* OX05B1S_H */
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +951 -0

951 lines not on this page · raw message

drivers/media/i2c/ox05b1s/ox05b1s_modes.c new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Mirela,

Thanks a lot for your patch/series.

Quoted 68 lines · Mirela Rabulea

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor.

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Remove some uneeded local variable initialisations
Fix extra/missing spaces
Add missing ending \n
Use return -ENODEV & return 0 to ease reading
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace more dev_err's with dev_err_probe
Constify more structs
Remove some unneded ending commas after a terminator
Fix smatch error in ox05b1s_s_ctrl: error: typename in expression
Fix a seeries of smatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config) Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Use const for ox05b1s_supported_modes
Device should be silent on success, use dev_dbg.
Drop unneeded {}
Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)
Fix an issue in ox05b1s_set_fmt, the format was saved in subdev state only for _TRY, save it also for _ACTIVE

Changes in v2:
Use dev_err_probe for missing clock, since it is now required property, and use NULL for devm_clk_get (no name for single clock), remove check for non NULL sensor->sensor_clk Remove dev_err message for devm_regmap_init_i2c allocation error
Added spaces inside brackets, wrap lines to 80
Remove some redundant initializations
Add regulators
Make "sizes" a pointer
Use struct v4l2_area instead of u32[2] array
Remove the count for supported_modes[] and supported_codes[], instead use sentinel element at the end
Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count
Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes
Refactor register lists to allow multiple register arrays per mode
Use GPL-2.0-only instead of GPL-2.0

 drivers/media/i2c/Kconfig                 |   1 +
 drivers/media/i2c/Makefile                |   1 +
 drivers/media/i2c/ox05b1s/Kconfig         |  10 +
 drivers/media/i2c/ox05b1s/Makefile        |   2 +
 drivers/media/i2c/ox05b1s/ox05b1s.h       |  22 +
 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 951 ++++++++++++++++++++++
 drivers/media/i2c/ox05b1s/ox05b1s_modes.c |  77 ++
 7 files changed, 1064 insertions(+)
 create mode 100644 drivers/media/i2c/ox05b1s/Kconfig
 create mode 100644 drivers/media/i2c/ox05b1s/Makefile
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c

[snip]

Quoted 29 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +22 -0
new file mode 100644
index 000000000000..1026216ddd5b
@@ -0,0 +1,951 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A V4L2 driver for Omnivision OX05B1S RGB-IR camera.
+ * Copyright (C) 2024, NXP
+ *
+ * Inspired from Sony imx219, imx290, imx214 and imx334 camera drivers
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <media/v4l2-cci.h>
+#include <media/mipi-csi2.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
+
+#include "ox05b1s.h"
+
+#define OX05B1S_SENS_PAD_SOURCE	0

drivers/media/i2c/ox05b1s/ox05b1s_mipi.c line 31

Quoted 10 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +9 -0
+#define OX05B1S_SENS_PADS_NUM	1
+
+#define OX05B1S_REG_SW_STB		CCI_REG8(0x0100)
+#define OX05B1S_REG_SW_RST		CCI_REG8(0x0103)
 
+#define OX05B1S_REG_CHIP_ID		CCI_REG24(0x300a)
+#define OX05B1S_REG_TIMING_HTS		CCI_REG16(0x380c)
+#define OX05B1S_REG_TIMING_VTS		CCI_REG16(0x380e)
+#define OX05B1S_REG_EXPOSURE		CCI_REG16(0x3501)
+#define OX05B1S_REG_GAIN		CCI_REG16(0x3508)

There is a non-trivial overlap of registers between this driver and ov9282.c which supports OV9281/OV9282 (1MP Mono).

There are two other Omnivision sensors, OV2311 (2MP Mono) and OV2312 (2MP 4x4 RGB-IR Bayer) with an even larger register overlap with OX05B1S and OS08A20. Unfortunately those two have separate downstream drivers in RPi and TI linux downstream trees respectively, and haven't yet been posted upstream.

It would be ideal to have a single driver for all of these Omnivision sensors, or if not, at least a common C module that can implement the shared functionality like gain, exposure, blanking (vts & hts) in a single place, as this will make maintenance much easier.

My question here to you and the maintainers is, would it be okay to use this driver as a baseline to integrate all these different sensors together? And secondly, would you like to take a look at supporting ov9282, so the other driver can be dropped?

Anyway thanks again for your series, hopefully this will give a good starting point for upstreaming OV2311 and OV2312 soon.

Thanks,
Jai

Quoted 3 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +3 -0
+#define OX05B1S_REG_X_OUTPUT_SIZE	CCI_REG16(0x3808)
+#define OX05B1S_REG_Y_OUTPUT_SIZE	CCI_REG16(0x380a)
+

[snip]

Quoted 1 line
Signature · 2 lines
Thanks,
Jai
#6 lore raw

Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Jai and all,

On 19.03.2025 13:10, Jai Luthra wrote:

Hi Mirela,

Thanks a lot for your patch/series.

On Mar 05, 2025 at 11:43:57 +0200, Mirela Rabulea wrote:

Add a v4l2subdevice driver for theOmnivision OX05B1S RGB-IR sensor.

TheOmnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an

active array size of 2592 x 1944.

The following features are supported for OX05B1S:

- Manual exposure an gain control support

-vblank/hblank control support

- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---

Changes in v4:

Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybeseparatelly as RFC?

Addpixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public.

Use register macros for the registers that are documented. User register group macros, where individual registers are not documented

Remove someuneeded local variableinitialisations

Fix extra/missing spaces

Add missing ending \n

Use return -ENODEV & return 0 to ease reading

Renameretval to ret in probe for consistency

Usedevm_mutex_init instead ofmutex_init

Replace moredev_err's withdev_err_probe

Constify more structs

Remove someunneded ending commas after a terminator

Fixsmatch error in ox05b1s_s_ctrl: error:typename in expression

Fix aseeries ofsmatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?

Shorten some more lines to 80 columns

Changes in v3:

Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config)

Don't hardcode timing registers: remove timing registersx_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode

Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup

ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream)

Use const for ox05b1s_supported_modes

Device should be silent on success, usedev_dbg.

Drop unneeded {}

Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)

Fix an issue in ox05b1s_set_fmt, the format was saved insubdev state only for _TRY, save it also for _ACTIVE

Changes in v2:

Usedev_err_probe for missing clock, since it is now required property, and use NULL fordevm_clk_get (no name for single clock), remove check fornon NULL sensor->sensor_clk

Removedev_err message for devm_regmap_init_i2c allocation error

Added spaces inside brackets, wrap lines to 80

Remove some redundant initializations

Add regulators

Make "sizes" a pointer

Use struct v4l2_area instead of u32[2] array

Remove the count forsupported_modes[] andsupported_codes[], instead use sentinel element at the end

Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count

Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes

Refactor register lists to allow multiple register arrays per mode

Use GPL-2.0-only instead of GPL-2.0

drivers/media/i2c/Kconfig|1 +

drivers/media/i2c/Makefile|1 +

drivers/media/i2c/ox05b1s/Kconfig|10 +

drivers/media/i2c/ox05b1s/Makefile|2 +

drivers/media/i2c/ox05b1s/ox05b1s.h|22 +

drivers/media/i2c/ox05b1s/ox05b1s_mipi.c| 951 ++++++++++++++++++++++

drivers/media/i2c/ox05b1s/ox05b1s_modes.c |77 ++

7 files changed, 1064 insertions(+)

create mode 100644 drivers/media/i2c/ox05b1s/Kconfig

create mode 100644 drivers/media/i2c/ox05b1s/Makefile

create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h

create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c

create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c

[snip]

       diff --git a/drivers/media/i2c/ox05b1s/ox05b1s_mipi.c

       b/drivers/media/i2c/ox05b1s/ox05b1s_mipi.c

       new file mode 100644

       index 000000000000..1026216ddd5b

       --- /dev/null

       +++ b/drivers/media/i2c/ox05b1s/ox05b1s_mipi.c

       @@ -0,0 +1,951 @@

       +// SPDX-License-Identifier: GPL-2.0-only

       +/*

       + * A V4L2 driver forOmnivision  OX05B1S RGB-IR camera.

       + * Copyright (C) 2024, NXP

       + *

       + * Inspired from Sony imx219, imx290, imx214 and imx334 camera drivers

       + *

       + */

       +

       +#include <linux/clk.h>

       +#include <linux/pm_runtime.h>

       +#include <linux/regmap.h>

       +#include <linux/regulator/consumer.h>

       +#include <media/v4l2-cci.h>

       +#include <media/mipi-csi2.h>

       +#include <media/v4l2-ctrls.h>

       +#include <media/v4l2-device.h>

       +#include <media/v4l2-fwnode.h>

       +

       +#include "ox05b1s.h"

       +

       +#define OX05B1S_SENS_PAD_SOURCE0

       +#define OX05B1S_SENS_PADS_NUM1

       +

       +#define OX05B1S_REG_SW_STBCCI_REG8(0x0100)

       +#define OX05B1S_REG_SW_RSTCCI_REG8(0x0103)

       +#define OX05B1S_REG_CHIP_IDCCI_REG24(0x300a)

       +#define OX05B1S_REG_TIMING_HTSCCI_REG16(0x380c)

       +#define OX05B1S_REG_TIMING_VTSCCI_REG16(0x380e)

       +#define OX05B1S_REG_EXPOSURECCI_REG16(0x3501)

       +#define OX05B1S_REG_GAINCCI_REG16(0x3508)

There is a non-trivial overlap of registers between this driver and

ov9282.c which supports OV9281/OV9282 (1MP Mono).

There are two otherOmnivision sensors, OV2311 (2MP Mono) and OV2312

(2MP 4x4 RGB-IR Bayer) with an even larger register overlap with OX05B1S

and OS08A20. Unfortunately those two have separate downstream drivers in

RPi and TIlinux downstream trees respectively, and haven't yet been

posted upstream.

Thanks for sharing this information, I was unaware. The question of how much similarity should two sensors share, in order to stay in the same driver, was also on my mind for some time, and I’d be glad to hear more opinions on it ;)

It would be ideal to have a single driver for all of theseOmnivision

sensors, or if not, at least a common C module that can implement the

shared functionality like gain, exposure, blanking (vts &hts) in a

single place, as this will make maintenance much easier.

I would need to get more information on the sensors you mentioned in order to issue an informed opinion. So far, with the OX05B1S and OS08A20, I have found some small differences regarding exposure and digital gain registers, so the overlap is not perfect, I expect it will also not be a perfect overlap with the other sensors you mentioned.

My question here to you and the maintainers is, would it be okay to use

this driver as a baseline to integrate all these different sensors

together? And secondly, would you like to take a look at supporting

ov9282, so the other driver can be dropped?

For the first question, I don't know what to say, and I cannot tell if we are far or close for this patch-set to be accepted. Also, I am unsure about how maintenance would go on a driver claiming to support a multitude of sensors, who could test them all, whenever something changes? Are you thinking to add ov2311/12 as other compatibles to this driver?

I agree there is a great deal of similarity shared across many raw, mode-based sensor drivers, and it sounds good to have some common framework. Some steps were done with the common raw sensor model. I would definitely also like to hear more expert opinions on this.

For the second question, as of now, we do not have any of the sensors you mentioned, unfortunately. I could help in the future to test patches for this driver on the sensors that we already have, but cannot make any promises for what I do not have, best effort if we find these sensors in a form factor that will work for our boards.

Anyway thanks again for your series, hopefully this will give a good

starting point for upstreaming OV2311 and OV2312 soon.

I would like to know more about the OV2312 (RGB-Ir) sensor and if it has many similarities with OX05B1S.  What hardware are you using to test this sensor? And what interface to connect the sensor? We are working with MIPI-CSI on most imx boards, and also RPI on imx93.

 Regards,

Mirela

Thanks,

Jai

       +#define OX05B1S_REG_X_OUTPUT_SIZECCI_REG16(0x3808)

       +#define OX05B1S_REG_Y_OUTPUT_SIZECCI_REG16(0x380a)

       +

[snip]

#7 lore raw

Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Quoted 126 lines · Mirela Rabulea

Hi Jai and all,

Quoted 117 lines · Jai Luthra

Hi Mirela,

Thanks a lot for your patch/series.

Quoted 68 lines · Mirela Rabulea

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor.

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Remove some uneeded local variable initialisations
Fix extra/missing spaces
Add missing ending \n
Use return -ENODEV & return 0 to ease reading
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace more dev_err's with dev_err_probe
Constify more structs
Remove some unneded ending commas after a terminator
Fix smatch error in ox05b1s_s_ctrl: error: typename in expression
Fix a seeries of smatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config) Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Use const for ox05b1s_supported_modes
Device should be silent on success, use dev_dbg.
Drop unneeded {}
Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)
Fix an issue in ox05b1s_set_fmt, the format was saved in subdev state only for _TRY, save it also for _ACTIVE

Changes in v2:
Use dev_err_probe for missing clock, since it is now required property, and use NULL for devm_clk_get (no name for single clock), remove check for non NULL sensor->sensor_clk Remove dev_err message for devm_regmap_init_i2c allocation error
Added spaces inside brackets, wrap lines to 80
Remove some redundant initializations
Add regulators
Make "sizes" a pointer
Use struct v4l2_area instead of u32[2] array
Remove the count for supported_modes[] and supported_codes[], instead use sentinel element at the end
Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count
Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes
Refactor register lists to allow multiple register arrays per mode
Use GPL-2.0-only instead of GPL-2.0

 drivers/media/i2c/Kconfig                 |   1 +
 drivers/media/i2c/Makefile                |   1 +
 drivers/media/i2c/ox05b1s/Kconfig         |  10 +
 drivers/media/i2c/ox05b1s/Makefile        |   2 +
 drivers/media/i2c/ox05b1s/ox05b1s.h       |  22 +
 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 951 ++++++++++++++++++++++
 drivers/media/i2c/ox05b1s/ox05b1s_modes.c |  77 ++
 7 files changed, 1064 insertions(+)
 create mode 100644 drivers/media/i2c/ox05b1s/Kconfig
 create mode 100644 drivers/media/i2c/ox05b1s/Makefile
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c
 create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c

[snip]

Quoted 29 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +22 -0
new file mode 100644
index 000000000000..1026216ddd5b
@@ -0,0 +1,951 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A V4L2 driver for Omnivision OX05B1S RGB-IR camera.
+ * Copyright (C) 2024, NXP
+ *
+ * Inspired from Sony imx219, imx290, imx214 and imx334 camera drivers
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <media/v4l2-cci.h>
+#include <media/mipi-csi2.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
+
+#include "ox05b1s.h"
+
+#define OX05B1S_SENS_PAD_SOURCE	0

drivers/media/i2c/ox05b1s/ox05b1s_mipi.c line 31

Quoted 10 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +9 -0
+#define OX05B1S_SENS_PADS_NUM	1
+
+#define OX05B1S_REG_SW_STB		CCI_REG8(0x0100)
+#define OX05B1S_REG_SW_RST		CCI_REG8(0x0103)
 
+#define OX05B1S_REG_CHIP_ID		CCI_REG24(0x300a)
+#define OX05B1S_REG_TIMING_HTS		CCI_REG16(0x380c)
+#define OX05B1S_REG_TIMING_VTS		CCI_REG16(0x380e)
+#define OX05B1S_REG_EXPOSURE		CCI_REG16(0x3501)
+#define OX05B1S_REG_GAIN		CCI_REG16(0x3508)

There is a non-trivial overlap of registers between this driver and ov9282.c which supports OV9281/OV9282 (1MP Mono).

Quoted 5 lines

There are two other Omnivision sensors, OV2311 (2MP Mono) and OV2312 (2MP 4x4 RGB-IR Bayer) with an even larger register overlap with OX05B1S and OS08A20. Unfortunately those two have separate downstream drivers in RPi and TI linux downstream trees respectively, and haven't yet been posted upstream.

Quoted 5 lines

Thanks for sharing this information, I was unaware. The question of how much similarity should two sensors share, in order to stay in the same driver, was also on my mind for some time, and I’d be glad to hear more opinions on it ;)

Same here :)

Quoted 6 lines
Quoted 5 lines

It would be ideal to have a single driver for all of these Omnivision sensors, or if not, at least a common C module that can implement the shared functionality like gain, exposure, blanking (vts & hts) in a single place, as this will make maintenance much easier.

Quoted 6 lines

I would need to get more information on the sensors you mentioned in order to issue an informed opinion. So far, with the OX05B1S and OS08A20, I have found some small differences regarding exposure and digital gain registers, so the overlap is not perfect, I expect it will also not be a perfect overlap with the other sensors you mentioned.

Sure, I had some experience with supporting OV2312 and OX05B1S in the downstream TI linux tree, and while they share the registers for exposure and gain, there are some other differences in features, aside from the 2MP vs 5MP resolution.

Quoted 6 lines
Quoted 6 lines

My question here to you and the maintainers is, would it be okay to use this driver as a baseline to integrate all these different sensors together? And secondly, would you like to take a look at supporting ov9282, so the other driver can be dropped?

Quoted 7 lines

For the first question, I don't know what to say, and I cannot tell if we are far or close for this patch-set to be accepted. Also, I am unsure about how maintenance would go on a driver claiming to support a multitude of sensors, who could test them all, whenever something changes? Are you thinking to add ov2311/12 as other compatibles to this driver?

While it would be ideal to have OV2312 support within this driver if there is a significant register overlap, it might still require some effort, as TI's downstream drivers for the RGBIR sensors capture two streams with different exposure, gain and IR flash values, and different MIPI CSI virtual channels, using the group hold functionality. Which IIUC may be quite different from what your patches implement, and will require adding streams/routing support so the userspace can configure.

Quoted 11 lines

I agree there is a great deal of similarity shared across many raw, mode-based sensor drivers, and it sounds good to have some common framework. Some steps were done with the common raw sensor model. I would definitely also like to hear more expert opinions on this.

For the second question, as of now, we do not have any of the sensors you mentioned, unfortunately. I could help in the future to test patches for this driver on the sensors that we already have, but cannot make any promises for what I do not have, best effort if we find these sensors in a form factor that will work for our boards.

I agree, having a single maintainer would not be feasible given different sensor modules may have incompatible connectors. But yes it should be okay to provide a T-By tag or a Nack on the shared driver if a patch breaks your particular hardware or usecase, similar to how other popular sensor drivers are maintained like IMX219 or OV5640.

Quoted 7 lines
Quoted 3 lines

Anyway thanks again for your series, hopefully this will give a good starting point for upstreaming OV2311 and OV2312 soon.

I would like to know more about the OV2312 (RGB-Ir) sensor and if it has many similarities with OX05B1S.  What hardware are you using to test this sensor? And what interface to connect the sensor? We are working with MIPI-CSI on most imx boards, and also RPI on imx93.

For OV2312 I have used this FPDLink module [1] with the Arducam V3Link board [2] that connects to the EVM using 22-pin FFC MIPI-CSI connector that is pin-compatible with the RPi5 connector.

[1]: https://leopardimaging.com/wp-content/uploads/2024/03/LI-OV2312-FPDLINKIII_Datasheet.pdf
[2]: https://www.arducam.com/downloads/datasheet/Arducam_V3Link_Datasheet.pdf

Quoted 4 lines

 Regards,

Mirela

PS: Your mail client broke the quotations on your reply. I have fixed those here, but might be a good idea to double-check your client settings.

Signature · 2 lines
Thanks,
Jai
#8 lore raw

Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Jai,

Quoted 158 lines · Jai Luthra
Quoted 123 lines · Mirela Rabulea

Hi Jai and all,

Quoted 115 lines · Jai Luthra

Hi Mirela,

Thanks a lot for your patch/series.

Quoted 68 lines · Mirela Rabulea

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor.

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Remove some uneeded local variable initialisations
Fix extra/missing spaces
Add missing ending \n
Use return -ENODEV & return 0 to ease reading
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace more dev_err's with dev_err_probe
Constify more structs
Remove some unneded ending commas after a terminator
Fix smatch error in ox05b1s_s_ctrl: error: typename in expression
Fix a seeries of smatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config) Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Use const for ox05b1s_supported_modes
Device should be silent on success, use dev_dbg.
Drop unneeded {}
Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)
Fix an issue in ox05b1s_set_fmt, the format was saved in subdev state only for _TRY, save it also for _ACTIVE

Changes in v2:
Use dev_err_probe for missing clock, since it is now required property, and use NULL for devm_clk_get (no name for single clock), remove check for non NULL sensor->sensor_clk Remove dev_err message for devm_regmap_init_i2c allocation error
Added spaces inside brackets, wrap lines to 80
Remove some redundant initializations
Add regulators
Make "sizes" a pointer
Use struct v4l2_area instead of u32[2] array
Remove the count for supported_modes[] and supported_codes[], instead use sentinel element at the end
Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count
Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes
Refactor register lists to allow multiple register arrays per mode
Use GPL-2.0-only instead of GPL-2.0

  drivers/media/i2c/Kconfig                 |   1 +
  drivers/media/i2c/Makefile                |   1 +
  drivers/media/i2c/ox05b1s/Kconfig         |  10 +
  drivers/media/i2c/ox05b1s/Makefile        |   2 +
  drivers/media/i2c/ox05b1s/ox05b1s.h       |  22 +
  drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 951 ++++++++++++++++++++++
  drivers/media/i2c/ox05b1s/ox05b1s_modes.c |  77 ++
  7 files changed, 1064 insertions(+)

create mode 100644 drivers/media/i2c/ox05b1s/Kconfig create mode 100644 drivers/media/i2c/ox05b1s/Makefile create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c

[snip]

Quoted 28 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +21 -0
new file mode 100644
index 000000000000..1026216ddd5b
@@ -0,0 +1,951 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A V4L2 driver for Omnivision OX05B1S RGB-IR camera.
+ * Copyright (C) 2024, NXP
+ *
+ * Inspired from Sony imx219, imx290, imx214 and imx334 camera drivers
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <media/v4l2-cci.h>
+#include <media/mipi-csi2.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
+
+#include "ox05b1s.h"
+

drivers/media/i2c/ox05b1s/ox05b1s_mipi.c line 31

Quoted 10 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +10 -0
+#define OX05B1S_SENS_PAD_SOURCE	0
+#define OX05B1S_SENS_PADS_NUM	1
+
+#define OX05B1S_REG_SW_STB		CCI_REG8(0x0100)
+#define OX05B1S_REG_SW_RST		CCI_REG8(0x0103)
+#define OX05B1S_REG_CHIP_ID		CCI_REG24(0x300a)
+#define OX05B1S_REG_TIMING_HTS		CCI_REG16(0x380c)
+#define OX05B1S_REG_TIMING_VTS		CCI_REG16(0x380e)
+#define OX05B1S_REG_EXPOSURE		CCI_REG16(0x3501)
+#define OX05B1S_REG_GAIN		CCI_REG16(0x3508)

There is a non-trivial overlap of registers between this driver and ov9282.c which supports OV9281/OV9282 (1MP Mono).

Quoted 5 lines

There are two other Omnivision sensors, OV2311 (2MP Mono) and OV2312 (2MP 4x4 RGB-IR Bayer) with an even larger register overlap with OX05B1S and OS08A20. Unfortunately those two have separate downstream drivers in RPi and TI linux downstream trees respectively, and haven't yet been posted upstream.

Quoted 5 lines

Thanks for sharing this information, I was unaware. The question of how much similarity should two sensors share, in order to stay in the same driver, was also on my mind for some time, and I’d be glad to hear more opinions on it ;)

Same here :)

Quoted 10 lines
Quoted 4 lines

It would be ideal to have a single driver for all of these Omnivision sensors, or if not, at least a common C module that can implement the shared functionality like gain, exposure, blanking (vts & hts) in a single place, as this will make maintenance much easier.

I would need to get more information on the sensors you mentioned in order to issue an informed opinion. So far, with the OX05B1S and OS08A20, I have found some small differences regarding exposure and digital gain registers, so the overlap is not perfect, I expect it will also not be a perfect overlap with the other sensors you mentioned.

Sure, I had some experience with supporting OV2312 and OX05B1S in the downstream TI linux tree, and while they share the registers for exposure and gain, there are some other differences in features, aside from the 2MP vs 5MP resolution.

Quoted 5 lines
Quoted 5 lines

My question here to you and the maintainers is, would it be okay to use this driver as a baseline to integrate all these different sensors together? And secondly, would you like to take a look at supporting ov9282, so the other driver can be dropped?

Quoted 7 lines

For the first question, I don't know what to say, and I cannot tell if we are far or close for this patch-set to be accepted. Also, I am unsure about how maintenance would go on a driver claiming to support a multitude of sensors, who could test them all, whenever something changes? Are you thinking to add ov2311/12 as other compatibles to this driver?

Quoted 7 lines

While it would be ideal to have OV2312 support within this driver if there is a significant register overlap, it might still require some effort, as TI's downstream drivers for the RGBIR sensors capture two streams with different exposure, gain and IR flash values, and different MIPI CSI virtual channels, using the group hold functionality. Which IIUC may be quite different from what your patches implement, and will require adding streams/routing support so the userspace can configure.

You are not alone on this ;)

We have an internal solution for adding streams/routing support to this driver, we used it both for ox05b1s (AB mode with 2 pixel streams on separate virtual channels) and for os08a20 (staggered hdr mode with 2 pixel streams on separate virtual channels), and also a separate stream for embedded data (same VC but a different mipi data type). I did not post these patches because of 2 reasons:

1. We are waiting for internal pads to be accepted, and possibly the common raw sensor model

2. There are issues with the individual control (exposure, analog and digital gain) per exposure/context, with the current available standard controls. This is an entire topic on its own, maybe I should start a separate discussion thread on that.

Quoted 12 lines
Quoted 6 lines

I agree there is a great deal of similarity shared across many raw, mode-based sensor drivers, and it sounds good to have some common framework. Some steps were done with the common raw sensor model. I would definitely also like to hear more expert opinions on this.

Quoted 6 lines

For the second question, as of now, we do not have any of the sensors you mentioned, unfortunately. I could help in the future to test patches for this driver on the sensors that we already have, but cannot make any promises for what I do not have, best effort if we find these sensors in a form factor that will work for our boards.

Quoted 5 lines

I agree, having a single maintainer would not be feasible given different sensor modules may have incompatible connectors. But yes it should be okay to provide a T-By tag or a Nack on the shared driver if a patch breaks your particular hardware or usecase, similar to how other popular sensor drivers are maintained like IMX219 or OV5640.

Sounds ok to me, we cannot guarantee to test the other sensors, but having T-by tag from other users will hopefully cover it.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Anyway thanks again for your series, hopefully this will give a good starting point for upstreaming OV2311 and OV2312 soon.

I would like to know more about the OV2312 (RGB-Ir) sensor and if it has many similarities with OX05B1S.  What hardware are you using to test this sensor? And what interface to connect the sensor? We are working with MIPI-CSI on most imx boards, and also RPI on imx93.

Quoted 6 lines

For OV2312 I have used this FPDLink module [1] with the Arducam V3Link board [2] that connects to the EVM using 22-pin FFC MIPI-CSI connector that is pin-compatible with the RPi5 connector.

[1]: https://leopardimaging.com/wp-content/uploads/2024/03/LI-OV2312-FPDLINKIII_Datasheet.pdf
[2]: https://www.arducam.com/downloads/datasheet/Arducam_V3Link_Datasheet.pdf

Thanks, we don't have any ser/des involved in the ox05b1s/os08a20 case, if we will ever get into the position to try ov2312, probably we will look for some solution for imx95-15x15 board, on the RPi connector (22-pin), cannot tell if it will work, one can never tell what may go wrong.

Quoted 7 lines
Quoted 4 lines

 Regards,

Mirela

PS: Your mail client broke the quotations on your reply. I have fixed those here, but might be a good idea to double-check your client settings.

Sorry about that, I may have edited the draft from both Thunderbird and Outlook. Hope this will be ok, sending from Thunderbird now as plain text only.

Regards,

Mirela

#9 lore raw

Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Quoted 169 lines · Mirela Rabulea

Hi Jai,

Quoted 158 lines · Jai Luthra
Quoted 123 lines · Mirela Rabulea

Hi Jai and all,

Quoted 115 lines · Jai Luthra

Hi Mirela,

Thanks a lot for your patch/series.

Quoted 68 lines · Mirela Rabulea

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor.

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Remove some uneeded local variable initialisations
Fix extra/missing spaces
Add missing ending \n
Use return -ENODEV & return 0 to ease reading
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace more dev_err's with dev_err_probe
Constify more structs
Remove some unneded ending commas after a terminator
Fix smatch error in ox05b1s_s_ctrl: error: typename in expression
Fix a seeries of smatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config) Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Use const for ox05b1s_supported_modes
Device should be silent on success, use dev_dbg.
Drop unneeded {}
Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)
Fix an issue in ox05b1s_set_fmt, the format was saved in subdev state only for _TRY, save it also for _ACTIVE

Changes in v2:
Use dev_err_probe for missing clock, since it is now required property, and use NULL for devm_clk_get (no name for single clock), remove check for non NULL sensor->sensor_clk Remove dev_err message for devm_regmap_init_i2c allocation error
Added spaces inside brackets, wrap lines to 80
Remove some redundant initializations
Add regulators
Make "sizes" a pointer
Use struct v4l2_area instead of u32[2] array
Remove the count for supported_modes[] and supported_codes[], instead use sentinel element at the end
Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count
Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes
Refactor register lists to allow multiple register arrays per mode
Use GPL-2.0-only instead of GPL-2.0

  drivers/media/i2c/Kconfig                 |   1 +
  drivers/media/i2c/Makefile                |   1 +
  drivers/media/i2c/ox05b1s/Kconfig         |  10 +
  drivers/media/i2c/ox05b1s/Makefile        |   2 +
  drivers/media/i2c/ox05b1s/ox05b1s.h       |  22 +
  drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 951 ++++++++++++++++++++++
  drivers/media/i2c/ox05b1s/ox05b1s_modes.c |  77 ++
  7 files changed, 1064 insertions(+)

create mode 100644 drivers/media/i2c/ox05b1s/Kconfig create mode 100644 drivers/media/i2c/ox05b1s/Makefile create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c

[snip]

Quoted 28 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +21 -0
new file mode 100644
index 000000000000..1026216ddd5b
@@ -0,0 +1,951 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A V4L2 driver for Omnivision OX05B1S RGB-IR camera.
+ * Copyright (C) 2024, NXP
+ *
+ * Inspired from Sony imx219, imx290, imx214 and imx334 camera drivers
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <media/v4l2-cci.h>
+#include <media/mipi-csi2.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
+
+#include "ox05b1s.h"
+

drivers/media/i2c/ox05b1s/ox05b1s_mipi.c line 31

Quoted 10 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +10 -0
+#define OX05B1S_SENS_PAD_SOURCE	0
+#define OX05B1S_SENS_PADS_NUM	1
+
+#define OX05B1S_REG_SW_STB		CCI_REG8(0x0100)
+#define OX05B1S_REG_SW_RST		CCI_REG8(0x0103)
+#define OX05B1S_REG_CHIP_ID		CCI_REG24(0x300a)
+#define OX05B1S_REG_TIMING_HTS		CCI_REG16(0x380c)
+#define OX05B1S_REG_TIMING_VTS		CCI_REG16(0x380e)
+#define OX05B1S_REG_EXPOSURE		CCI_REG16(0x3501)
+#define OX05B1S_REG_GAIN		CCI_REG16(0x3508)

There is a non-trivial overlap of registers between this driver and ov9282.c which supports OV9281/OV9282 (1MP Mono).

Quoted 5 lines

There are two other Omnivision sensors, OV2311 (2MP Mono) and OV2312 (2MP 4x4 RGB-IR Bayer) with an even larger register overlap with OX05B1S and OS08A20. Unfortunately those two have separate downstream drivers in RPi and TI linux downstream trees respectively, and haven't yet been posted upstream.

Quoted 5 lines

Thanks for sharing this information, I was unaware. The question of how much similarity should two sensors share, in order to stay in the same driver, was also on my mind for some time, and I’d be glad to hear more opinions on it ;)

Same here :)

Quoted 10 lines
Quoted 4 lines

It would be ideal to have a single driver for all of these Omnivision sensors, or if not, at least a common C module that can implement the shared functionality like gain, exposure, blanking (vts & hts) in a single place, as this will make maintenance much easier.

I would need to get more information on the sensors you mentioned in order to issue an informed opinion. So far, with the OX05B1S and OS08A20, I have found some small differences regarding exposure and digital gain registers, so the overlap is not perfect, I expect it will also not be a perfect overlap with the other sensors you mentioned.

Sure, I had some experience with supporting OV2312 and OX05B1S in the downstream TI linux tree, and while they share the registers for exposure and gain, there are some other differences in features, aside from the 2MP vs 5MP resolution.

Quoted 5 lines
Quoted 5 lines

My question here to you and the maintainers is, would it be okay to use this driver as a baseline to integrate all these different sensors together? And secondly, would you like to take a look at supporting ov9282, so the other driver can be dropped?

Quoted 7 lines

For the first question, I don't know what to say, and I cannot tell if we are far or close for this patch-set to be accepted. Also, I am unsure about how maintenance would go on a driver claiming to support a multitude of sensors, who could test them all, whenever something changes? Are you thinking to add ov2311/12 as other compatibles to this driver?

Quoted 7 lines

While it would be ideal to have OV2312 support within this driver if there is a significant register overlap, it might still require some effort, as TI's downstream drivers for the RGBIR sensors capture two streams with different exposure, gain and IR flash values, and different MIPI CSI virtual channels, using the group hold functionality. Which IIUC may be quite different from what your patches implement, and will require adding streams/routing support so the userspace can configure.

Quoted 8 lines

You are not alone on this ;)

We have an internal solution for adding streams/routing support to this driver, we used it both for ox05b1s (AB mode with 2 pixel streams on separate virtual channels) and for os08a20 (staggered hdr mode with 2 pixel streams on separate virtual channels), and also a separate stream for embedded data (same VC but a different mipi data type). I did not post these patches because of 2 reasons:

Ah that's good to know that you also use AB mode, as combining the drivers makes even more sense now.

Quoted 3 lines

1. We are waiting for internal pads to be accepted, and possibly the common raw sensor model

I wasn't aware of the raw sensor model series, will read up more on that as that also seems to have an easier way to represent RGB-Ir bayer formats.

Quoted 6 lines

2. There are issues with the individual control (exposure, analog and digital gain) per exposure/context, with the current available standard controls. This is an entire topic on its own, maybe I should start a separate discussion thread on that.

Yes individual controls, be it for internal pads or per-stream, will be a requirement for multi-stream sensor drivers. I have proposed a topic to discuss this with the rest of the community at the Media Summit being held on May 13 in Nice. [1]

Do you have plans to attend the summit? In any case, please feel free to start a RFC discussion thread on it :)

One idea is to move the controls in the v4l2_subdev_state, which would make it easier to specify pad/stream combinations, but I am not yet sure on what the userspace ioctls will look like for that.

[1] https://lore.kernel.org/linux-media/sbhsskq7kzrl5bkbqbijxszz7hfg34pjajgdmw23x7aseztyy3@26zcjwnjkpl4/

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

I agree there is a great deal of similarity shared across many raw, mode-based sensor drivers, and it sounds good to have some common framework. Some steps were done with the common raw sensor model. I would definitely also like to hear more expert opinions on this.

For the second question, as of now, we do not have any of the sensors you mentioned, unfortunately. I could help in the future to test patches for this driver on the sensors that we already have, but cannot make any promises for what I do not have, best effort if we find these sensors in a form factor that will work for our boards.

Quoted 8 lines
Quoted 5 lines

I agree, having a single maintainer would not be feasible given different sensor modules may have incompatible connectors. But yes it should be okay to provide a T-By tag or a Nack on the shared driver if a patch breaks your particular hardware or usecase, similar to how other popular sensor drivers are maintained like IMX219 or OV5640.

Sounds ok to me, we cannot guarantee to test the other sensors, but having T-by tag from other users will hopefully cover it.

Quoted 1 line

Thanks.

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

Anyway thanks again for your series, hopefully this will give a good starting point for upstreaming OV2311 and OV2312 soon.

I would like to know more about the OV2312 (RGB-Ir) sensor and if it has many similarities with OX05B1S.  What hardware are you using to test this sensor? And what interface to connect the sensor? We are working with MIPI-CSI on most imx boards, and also RPI on imx93.

For OV2312 I have used this FPDLink module [1] with the Arducam V3Link board [2] that connects to the EVM using 22-pin FFC MIPI-CSI connector that is pin-compatible with the RPi5 connector.

Quoted 7 lines
Quoted 2 lines

[1]: https://leopardimaging.com/wp-content/uploads/2024/03/LI-OV2312-FPDLINKIII_Datasheet.pdf
[2]: https://www.arducam.com/downloads/datasheet/Arducam_V3Link_Datasheet.pdf

Thanks, we don't have any ser/des involved in the ox05b1s/os08a20 case, if we will ever get into the position to try ov2312, probably we will look for some solution for imx95-15x15 board, on the RPi connector (22-pin), cannot tell if it will work, one can never tell what may go wrong.

Quoted 1 line

Makes sense.

Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

 Regards,

Mirela

PS: Your mail client broke the quotations on your reply. I have fixed those here, but might be a good idea to double-check your client settings.

Sorry about that, I may have edited the draft from both Thunderbird and Outlook. Hope this will be ok, sending from Thunderbird now as plain text only.

No problem, this mail looks okay.

Quoted 4 lines

Regards,

Mirela

Thanks,
Jai

#10 lore raw

Re: [EXT] Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Jai,

Quoted 196 lines · Jai Luthra
Quoted 168 lines · Mirela Rabulea

Hi Jai,

Quoted 158 lines · Jai Luthra
Quoted 123 lines · Mirela Rabulea

Hi Jai and all,

Quoted 115 lines · Jai Luthra

Hi Mirela,

Thanks a lot for your patch/series.

Quoted 68 lines · Mirela Rabulea

Add a v4l2 subdevice driver for the Omnivision OX05B1S RGB-IR sensor.

The Omnivision OX05B1S is a 1/2.5-Inch CMOS image sensor with an active array size of 2592 x 1944.

The following features are supported for OX05B1S:
- Manual exposure an gain control support
- vblank/hblank control support
- Supported resolution: 2592 x 1944 @ 30fps (SGRBG10)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Remove some uneeded local variable initialisations
Fix extra/missing spaces
Add missing ending \n
Use return -ENODEV & return 0 to ease reading
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace more dev_err's with dev_err_probe
Constify more structs
Remove some unneded ending commas after a terminator
Fix smatch error in ox05b1s_s_ctrl: error: typename in expression
Fix a seeries of smatch warnings like: warning: symbol 'ovx5b_init_setting_2592x1944' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Use helpers from v4l2-cci.h (drop ox05b1s_write_reg, ox05b1s_read_reg, ox05b1s_set_hts/vts/exp/analog_gain, ox05b1s_regmap_config) Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup ox05b1s register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Use const for ox05b1s_supported_modes
Device should be silent on success, use dev_dbg.
Drop unneeded {}
Fixed an error introduced in v2 in ox05b1s_nearest_size (set_fmt for 4k BGGR12 mode was stuck)
Fix an issue in ox05b1s_set_fmt, the format was saved in subdev state only for _TRY, save it also for _ACTIVE

Changes in v2:
Use dev_err_probe for missing clock, since it is now required property, and use NULL for devm_clk_get (no name for single clock), remove check for non NULL sensor->sensor_clk Remove dev_err message for devm_regmap_init_i2c allocation error
Added spaces inside brackets, wrap lines to 80
Remove some redundant initializations
Add regulators
Make "sizes" a pointer
Use struct v4l2_area instead of u32[2] array
Remove the count for supported_modes[] and supported_codes[], instead use sentinel element at the end
Consequently, update ox05b1s_enum_mbus_code, ox05b1s_enum_frame_size, ox05b1s_nearest_size, ox05b1s_find_code, to not use the count
Remove .h files for modes, however did not move this code in the driver file but added a separate c file for all supported modes
Refactor register lists to allow multiple register arrays per mode
Use GPL-2.0-only instead of GPL-2.0

   drivers/media/i2c/Kconfig                 |   1 +
   drivers/media/i2c/Makefile                |   1 +
   drivers/media/i2c/ox05b1s/Kconfig         |  10 +
   drivers/media/i2c/ox05b1s/Makefile        |   2 +
   drivers/media/i2c/ox05b1s/ox05b1s.h       |  22 +
   drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 951 ++++++++++++++++++++++
   drivers/media/i2c/ox05b1s/ox05b1s_modes.c |  77 ++
   7 files changed, 1064 insertions(+)

create mode 100644 drivers/media/i2c/ox05b1s/Kconfig create mode 100644 drivers/media/i2c/ox05b1s/Makefile create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s.h create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c create mode 100644 drivers/media/i2c/ox05b1s/ox05b1s_modes.c

[snip]

Quoted 28 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +21 -0
new file mode 100644
index 000000000000..1026216ddd5b
@@ -0,0 +1,951 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * A V4L2 driver for Omnivision OX05B1S RGB-IR camera.
+ * Copyright (C) 2024, NXP
+ *
+ * Inspired from Sony imx219, imx290, imx214 and imx334 camera drivers
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <media/v4l2-cci.h>
+#include <media/mipi-csi2.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
+
+#include "ox05b1s.h"
+

drivers/media/i2c/ox05b1s/ox05b1s_mipi.c line 31

Quoted 10 lines
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c new file +10 -0
+#define OX05B1S_SENS_PAD_SOURCE	0
+#define OX05B1S_SENS_PADS_NUM	1
+
+#define OX05B1S_REG_SW_STB		CCI_REG8(0x0100)
+#define OX05B1S_REG_SW_RST		CCI_REG8(0x0103)
+#define OX05B1S_REG_CHIP_ID		CCI_REG24(0x300a)
+#define OX05B1S_REG_TIMING_HTS		CCI_REG16(0x380c)
+#define OX05B1S_REG_TIMING_VTS		CCI_REG16(0x380e)
+#define OX05B1S_REG_EXPOSURE		CCI_REG16(0x3501)
+#define OX05B1S_REG_GAIN		CCI_REG16(0x3508)

There is a non-trivial overlap of registers between this driver and ov9282.c which supports OV9281/OV9282 (1MP Mono).

Quoted 5 lines

There are two other Omnivision sensors, OV2311 (2MP Mono) and OV2312 (2MP 4x4 RGB-IR Bayer) with an even larger register overlap with OX05B1S and OS08A20. Unfortunately those two have separate downstream drivers in RPi and TI linux downstream trees respectively, and haven't yet been posted upstream.

Quoted 5 lines

Thanks for sharing this information, I was unaware. The question of how much similarity should two sensors share, in order to stay in the same driver, was also on my mind for some time, and I’d be glad to hear more opinions on it ;)

Same here :)

Quoted 10 lines
Quoted 4 lines

It would be ideal to have a single driver for all of these Omnivision sensors, or if not, at least a common C module that can implement the shared functionality like gain, exposure, blanking (vts & hts) in a single place, as this will make maintenance much easier.

I would need to get more information on the sensors you mentioned in order to issue an informed opinion. So far, with the OX05B1S and OS08A20, I have found some small differences regarding exposure and digital gain registers, so the overlap is not perfect, I expect it will also not be a perfect overlap with the other sensors you mentioned.

Sure, I had some experience with supporting OV2312 and OX05B1S in the downstream TI linux tree, and while they share the registers for exposure and gain, there are some other differences in features, aside from the 2MP vs 5MP resolution.

Quoted 5 lines
Quoted 5 lines

My question here to you and the maintainers is, would it be okay to use this driver as a baseline to integrate all these different sensors together? And secondly, would you like to take a look at supporting ov9282, so the other driver can be dropped?

Quoted 7 lines

For the first question, I don't know what to say, and I cannot tell if we are far or close for this patch-set to be accepted. Also, I am unsure about how maintenance would go on a driver claiming to support a multitude of sensors, who could test them all, whenever something changes? Are you thinking to add ov2311/12 as other compatibles to this driver?

Quoted 7 lines

While it would be ideal to have OV2312 support within this driver if there is a significant register overlap, it might still require some effort, as TI's downstream drivers for the RGBIR sensors capture two streams with different exposure, gain and IR flash values, and different MIPI CSI virtual channels, using the group hold functionality. Which IIUC may be quite different from what your patches implement, and will require adding streams/routing support so the userspace can configure.

Quoted 8 lines

You are not alone on this ;)

We have an internal solution for adding streams/routing support to this driver, we used it both for ox05b1s (AB mode with 2 pixel streams on separate virtual channels) and for os08a20 (staggered hdr mode with 2 pixel streams on separate virtual channels), and also a separate stream for embedded data (same VC but a different mipi data type). I did not post these patches because of 2 reasons:

Ah that's good to know that you also use AB mode, as combining the drivers makes even more sense now.

Quoted 2 lines

1. We are waiting for internal pads to be accepted, and possibly the common raw sensor model

I wasn't aware of the raw sensor model series, will read up more on that as that also seems to have an easier way to represent RGB-Ir bayer formats.

Quoted 5 lines

2. There are issues with the individual control (exposure, analog and digital gain) per exposure/context, with the current available standard controls. This is an entire topic on its own, maybe I should start a separate discussion thread on that.

Yes individual controls, be it for internal pads or per-stream, will be a requirement for multi-stream sensor drivers. I have proposed a topic to discuss this with the rest of the community at the Media Summit being held on May 13 in Nice. [1]

Quoted 8 lines

Do you have plans to attend the summit? In any case, please feel free to start a RFC discussion thread on it :)

One idea is to move the controls in the v4l2_subdev_state, which would make it easier to specify pad/stream combinations, but I am not yet sure on what the userspace ioctls will look like for that.

[1] https://lore.kernel.org/linux-media/sbhsskq7kzrl5bkbqbijxszz7hfg34pjajgdmw23x7aseztyy3@26zcjwnjkpl4/

Thanks for letting me know, yes that is interesting, I will participate, if not in person, at least remotely. I will reply to the indicated thread, after we decide on our agenda.

Regards,

Mirela

Quoted 58 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

I agree there is a great deal of similarity shared across many raw, mode-based sensor drivers, and it sounds good to have some common framework. Some steps were done with the common raw sensor model. I would definitely also like to hear more expert opinions on this.

For the second question, as of now, we do not have any of the sensors you mentioned, unfortunately. I could help in the future to test patches for this driver on the sensors that we already have, but cannot make any promises for what I do not have, best effort if we find these sensors in a form factor that will work for our boards.

Quoted 7 lines
Quoted 5 lines

I agree, having a single maintainer would not be feasible given different sensor modules may have incompatible connectors. But yes it should be okay to provide a T-By tag or a Nack on the shared driver if a patch breaks your particular hardware or usecase, similar to how other popular sensor drivers are maintained like IMX219 or OV5640.

Sounds ok to me, we cannot guarantee to test the other sensors, but having T-by tag from other users will hopefully cover it.

Thanks.

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

Anyway thanks again for your series, hopefully this will give a good starting point for upstreaming OV2311 and OV2312 soon.

I would like to know more about the OV2312 (RGB-Ir) sensor and if it has many similarities with OX05B1S.  What hardware are you using to test this sensor? And what interface to connect the sensor? We are working with MIPI-CSI on most imx boards, and also RPI on imx93.

For OV2312 I have used this FPDLink module [1] with the Arducam V3Link board [2] that connects to the EVM using 22-pin FFC MIPI-CSI connector that is pin-compatible with the RPi5 connector.

Quoted 6 lines
Quoted 2 lines

[1]: https://leopardimaging.com/wp-content/uploads/2024/03/LI-OV2312-FPDLINKIII_Datasheet.pdf
[2]: https://www.arducam.com/downloads/datasheet/Arducam_V3Link_Datasheet.pdf

Thanks, we don't have any ser/des involved in the ox05b1s/os08a20 case, if we will ever get into the position to try ov2312, probably we will look for some solution for imx95-15x15 board, on the RPi connector (22-pin), cannot tell if it will work, one can never tell what may go wrong.

Makes sense.

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

 Regards,

Mirela

PS: Your mail client broke the quotations on your reply. I have fixed those here, but might be a good idea to double-check your client settings.

Sorry about that, I may have edited the draft from both Thunderbird and Outlook. Hope this will be ok, sending from Thunderbird now as plain text only.

No problem, this mail looks okay.

Quoted 4 lines

Regards,

Mirela

Thanks,
Jai

#11 lore raw

Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

In reply to Mirela Rabulea

Hi Mirela,

drivers/media/i2c/ox05b1s/ox05b1s.h line 14

Quoted 4 lines · Mirela Rabulea
drivers/media/i2c/ox05b1s/ox05b1s.h new file +4 -0
+struct ox05b1s_reg {
+	u32 addr;
+	u32 data;
+};

Could you use struct reg_sequence instead, please?

Signature · 1 line
Sakari Ailus
#12 lore raw

Re: [EXT] Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Sakari & all,

Quoted 5 lines · Sakari Ailus

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Hi Mirela,

Quoted 7 lines

drivers/media/i2c/ox05b1s/ox05b1s.h line 14

Quoted 4 lines · Mirela Rabulea
drivers/media/i2c/ox05b1s/ox05b1s.h new file +4 -0
+struct ox05b1s_reg {
+     u32 addr;
+     u32 data;
+};

Could you use struct reg_sequence instead, please?

Yes, sure, thanks for the hint.

Any other suggestions, anyone, before I send the next version?

Thanks,

Mirela

Quoted 3 lines
Signature · 2 lines
-- 
Sakari Ailus
#13 lore raw

Re: [EXT] Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Mirela,

Quoted 18 lines · Mirela Rabulea

Hi Sakari & all,

Quoted 7 lines · Sakari Ailus

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Hi Mirela,

Quoted 7 lines

drivers/media/i2c/ox05b1s/ox05b1s.h line 14

Quoted 4 lines · Mirela Rabulea
drivers/media/i2c/ox05b1s/ox05b1s.h new file +4 -0
+struct ox05b1s_reg {
+     u32 addr;
+     u32 data;
+};

Could you use struct reg_sequence instead, please?

Quoted 3 lines

Yes, sure, thanks for the hint.

Any other suggestions, anyone, before I send the next version?

Do you intend to align this with the common raw sensor model? It may still take a while until we get those patches merged though, but the upside would be there's on concern of backwards compatibility. We should discuss how to implement HDR with that actually (Laurent is cc'd).

Signature · 3 lines
Regards,

Sakari Ailus
#14 lore raw

Re: [EXT] Re: [PATCH v4 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver

Hi Sakari,

Quoted 22 lines · Sakari Ailus

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Hi Mirela,

Quoted 16 lines · Mirela Rabulea

Hi Sakari & all,

Quoted 13 lines · Sakari Ailus

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Hi Mirela,

drivers/media/i2c/ox05b1s/ox05b1s.h line 14

Quoted 4 lines · Mirela Rabulea
drivers/media/i2c/ox05b1s/ox05b1s.h new file +4 -0
+struct ox05b1s_reg {
+     u32 addr;
+     u32 data;
+};

Could you use struct reg_sequence instead, please?

Quoted 7 lines
Quoted 3 lines

Yes, sure, thanks for the hint.

Any other suggestions, anyone, before I send the next version?

Do you intend to align this with the common raw sensor model? It may still take a while until we get those patches merged though, but the upside would be there's on concern of backwards compatibility. We should discuss how to implement HDR with that actually (Laurent is cc'd).

Yes, I will align with the common raw sensor model. By that I mean I will use generic Y formats and the CFA pattern control (already switched to Y formats in this  v4, did not experiment yet the new control) and I can add streams and routes as soon as internal pads are merged, we already experimented with that both for os08a20 HDR and for ox05b1s context switching, both using multiple captures on 2 virtual channels. I'm also planning to send an RFC for standard controls as arrays for exposure and gains, as discussed during the media summit, that's currently under internal review.

I'm open for discussions.

For this driver, up until this version, the HDR support is minimal, it is just enabled/disabled and tied to the existing control V4L2_CID_HDR_SENSOR_MODE, and still only 1 VC is exposed. When we will have internal pads and streams and routes, we can toggle the HDR control depending on what routes are enabled, already experimented with that (the HDR control can in this case be optional).

I saw you sent v10 for generic line based metadata and internal pads, I started looking into it, large patch-set ;)

Regards,

Mirela

Quoted 5 lines

--
Regards,

Sakari Ailus

#15 lore raw

PATCH v4 3/4 MAINTAINERS: Add entry for OX05B1S sensor driver

In reply to Mirela Rabulea

Add maintainer for Omnivision OX05B1S sensor driver.

---
Changes in v4:
None

Changes in v3:
None

Changes in v2:
None

 MAINTAINERS | 10 ++++++++++
 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
index 3c10a18fac78..a9d0fa44403a 100644
@@ -17635,6 +17635,16 @@ S:	Maintained
 T:	git git://linuxtv.org/media.git
 F:	drivers/media/i2c/ov9734.c
 
+OMNIVISION OX05B1S SENSOR DRIVER
+M:	Mirela Rabulea <[email protected]>
+R:	Laurentiu Palcu <[email protected]>
+R:	Robert Chiras <[email protected]>
+L:	[email protected]
+S:	Maintained
+T:	git git://linuxtv.org/media_tree.git
+F:	Documentation/devicetree/bindings/media/i2c/ovti,ox05b1s.yaml
+F:	drivers/media/i2c/ox05b1s/*
+
 ONBOARD USB HUB DRIVER
 M:	Matthias Kaehlcke <[email protected]>
 L:	[email protected]
Signature · 1 line
2.25.1
#16 lore raw

PATCH v4 4/4 media: ox05b1s: Add support for Omnivision OS08A20 raw sensor

In reply to Mirela Rabulea

This is an 8 megapixel raw10/raw12 sensor with HDR capabilities. HDR mode control is supported, with one HDR mode: staggered HDR with 2 exposures on separate virtual channels. However, for now, only one exposure (VC 0) is accessible via get_frame_desc.

Supported resolutions:
- 1920 x 1080 @ 60fps (SBGGR10, no HDR)
- 1920 x 1080 @ 30fps (SBGGR10, HDR)
- 3840 x 2160 @ 30fps (SBGGR12, no HDR)
- 3840 x 2160 @ 15fps (SBGGR12, HDR)
- 3840 x 2160 @ 30fps (SBGGR10, no HDR)
- 3840 x 2160 @ 15fps (SBGGR10, HDR)

---
Changes in v4:
Switch to Y media bus codes. The CFA pattern control will be implemented when patches get merged, or maybe separatelly as RFC?
Add pixel_rate member to mode struct, remove fps member. We do not have information how to calculate the pixel rate from the PLL parameters that can be made public. Use register macros for the registers that are documented. User register group macros, where individual registers are not documented Constify more structs
Remove some unneded ending commas after a terminator
Fix a seeries of smatch warnings like: warning: symbol 'os08a20_init_setting_common' was not declared. Should it be static?
Shorten some more lines to 80 columns

Changes in v3:
Don't hardcode timing registers: remove timing registers x_output_size/y_output_size from register configuration list, add them to ox05b1s_apply_current_mode Remove HTS,VTS from register config list as they are written by HBLANK and VBLANK controls through __v4l2_ctrl_handler_setup
Use const for os08a20_supported_modes
os08a20 register config cleaning (remove all registers that were at their default value, and more, keep only what seems mandatory to be able to stream) Let the 4k 10bit mode by default without hdr, all 3 modes are now by default without hdr, staggered hdr may be enabled via v4l2-ctl for any of them. Separate the 10/12 bit register settings into separate lists: os08a20_init_setting_10bit, os08a20_init_setting_12bit
Update commit description: rearrange supported resolutions and remove 1 duplicate line, state HDR limitation
Increase a bit the default vts for 1080p, to get exactly 60fps, it was 62.61
Use regmap_update_bits() directly and remove ox05b1s_regmap_update_bits()

Changes in v2:
Add spaces inside brackets, wrap lines to 80
Remove some redundant initialization
Use a loop in os08a20_enable_staggered_hdr/os08a20_disable_staggered_hdr, for that, add a register settings array for HDR enabling/disabling Make "sizes" a pointer
Remove mode headers, add supported modes in the dedicated c file, ox05b1s_modes.c
Refactor register lists, for os08a20 use a common list for all modes, and also specific lists per mode

 drivers/media/i2c/ox05b1s/ox05b1s.h       |   4 +
 drivers/media/i2c/ox05b1s/ox05b1s_mipi.c  | 187 +++++++++++++++++++++-
 drivers/media/i2c/ox05b1s/ox05b1s_modes.c | 110 +++++++++++++
 3 files changed, 300 insertions(+), 1 deletion(-)
drivers/media/i2c/ox05b1s/ox05b1s.h +4 -0
index 2a87d69864f9..58454e10150b 100644
@@ -17,6 +17,10 @@ struct ox05b1s_reglist {
 	const struct ox05b1s_reg *regs;
 };
 
+extern const struct ox05b1s_reglist os08a20_reglist_4k_10b[];
+extern const struct ox05b1s_reglist os08a20_reglist_4k_12b[];
+extern const struct ox05b1s_reglist os08a20_reglist_1080p_10b[];
+
 extern const struct ox05b1s_reglist ox05b1s_reglist_2592x1944[];
 
 #endif /* OX05B1S_H */
drivers/media/i2c/ox05b1s/ox05b1s_mipi.c +186 -1

256 lines not on this page · raw message

drivers/media/i2c/ox05b1s/ox05b1s_modes.c +110 -0

116 lines not on this page · raw message

Signature · 1 line
2.25.1