Skip to contentSkip to conversation

media: i2c: Add OV05C10 camera sensor driver

PATCH Superseded Pratap Nirujogi 7 participants 11 messages Mar 28, 2025 – May 7, 2025

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 media: i2c: Add OV05C10 camera sensor driver

From: Bin Du <[email protected]>

Add driver for OmniVision 5.2M OV05C10 sensor. This driver supports only the full size normal 2888x1808@30fps 2-lane sensor profile.

---
v1 -> v2:

- Fixed V4L2 compliance issues. Ensured 100% compliance for ioctls supported.

- Implemented the .enable_streams() and .disable_streams().

- Implemented init_state() function instead of open() in ov05c10_internal_ops.

- Replaced ov05c10_get_pad_format() with v4l2_subdev_get_fmt() for v4l2_subdev_pad_ops.get_fmt().

- Added helper function for sensor page switching. Implemented register read / write wrapper functions that checks the need for page switching before cci_read() and cci_write() operations.

- Added support to parse v4l2 endpoint node using the fwnode handle from i2c_client driver.

- Renamed driver as OV05C10 to reflect the complete sensor name.

- Enabled PM runtime auto suspend / resume.

- Fixed coding errors and other cosmetic corrections based on the review feedback.

 MAINTAINERS                 |    8 +
 drivers/media/i2c/Kconfig   |   10 +
 drivers/media/i2c/Makefile  |    1 +
 drivers/media/i2c/ov05c10.c | 1065 +++++++++++++++++++++++++++++++++++
 4 files changed, 1084 insertions(+)
 create mode 100755 drivers/media/i2c/ov05c10.c
MAINTAINERS +8 -0
index c8f597f7e48a..a13a26903e7f 100644
@@ -17545,6 +17545,14 @@ T:	git git://linuxtv.org/media.git
 F:	Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml
 F:	drivers/media/i2c/ov02a10.c
 
+OMNIVISION OV05C10 SENSOR DRIVER
+M:	Nirujogi Pratap <[email protected]>
+M:	Bin Du <[email protected]>
+L:	[email protected]
+S:	Maintained
+T:	git git://linuxtv.org/media.git
+F:	drivers/media/i2c/ov05c10.c
+
 OMNIVISION OV08D10 SENSOR DRIVER
 M:	Jimmy Su <[email protected]>
 L:	[email protected]
drivers/media/i2c/Kconfig +10 -0
index e576b213084d..70336ee2494e 100644
@@ -356,6 +356,16 @@ config VIDEO_OV02A10
 	  To compile this driver as a module, choose M here: the
 	  module will be called ov02a10.
 
+config VIDEO_OV05C10
+	tristate "OmniVision OV05C10 sensor support"
+	select V4L2_CCI_I2C
+	help
+	  This is a Video4Linux2 sensor driver for the OmniVision
+	  OV05C10 camera.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called OV05C10.
+
 config VIDEO_OV08D10
         tristate "OmniVision OV08D10 sensor support"
         help
drivers/media/i2c/Makefile +1 -0
index 6c23a4463527..a3ec22164389 100644
@@ -83,6 +83,7 @@ obj-$(CONFIG_VIDEO_MT9V111) += mt9v111.o
 obj-$(CONFIG_VIDEO_OG01A1B) += og01a1b.o
 obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o
 obj-$(CONFIG_VIDEO_OV02A10) += ov02a10.o
+obj-$(CONFIG_VIDEO_OV05C10) += ov05c10.o
 obj-$(CONFIG_VIDEO_OV08D10) += ov08d10.o
 obj-$(CONFIG_VIDEO_OV08X40) += ov08x40.o
 obj-$(CONFIG_VIDEO_OV13858) += ov13858.o
drivers/media/i2c/ov05c10.c new file +1065 -0

1,065 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+	{"ov05c10", 0 },
+	{ }
+};

There's an IPU6/IPU7 version of this driver.

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+	.driver = {
+		.name = DRV_NAME,
+		.pm = pm_ptr(&ov05c10_pm_ops),
+	},
+	.id_table = ov05c10_id,
+	.probe = ov05c10_probe,

drivers/media/i2c/ov05c10.c line 1065

Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10 -0
+	.remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

---
bod

#2 lore raw

Hi Bryan,

Thanks for the review.

Thanks,
Pratap

Quoted 13 lines · Bryan O'Donoghue

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

Quoted 4 lines

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/ ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

static const struct acpi_device_id ov05c10_acpi_ids[] = {
	{ "OVTI05C1" },
	{}
};
Quoted 15 lines
Quoted 15 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 9 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

sure, will replace "GPL v2" with "GPL" in V3.

Quoted 2 lines

---
bod

#3 lore raw
Quoted 16 lines · Pratap
Quoted 10 lines · Bryan O'Donoghue

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

Quoted 5 lines

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/
ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

Quoted 8 lines

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

static const struct acpi_device_id ov05c10_acpi_ids[] = {
	{ "OVTI05C1" },
	{}
};

You could drop the i2c_device_id table if you added an OF device ID table, but you'll need DT bindings for that. Sakari, any best practice rule in this area ?

Quoted 25 lines
Quoted 15 lines
Quoted 15 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 8 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

sure, will replace "GPL v2" with "GPL" in V3.

Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

Hi Laurent,

Please see below v4l2-compliance test reports for:

(a) ov05c10 device /dev/v4l-subdev0
(b) amd_isp_capture device /dev/video0

Compliance test for device /dev/v4l-subdev0:
--------------------------------------------

atg@isp-pv-linux:~/v4l-utils/build/utils/v4l2-compliance$ sudo ./v4l2-compliance -u 0
v4l2-compliance 1.29.0-5348, 64 bits, 64-bit time_t
v4l2-compliance SHA: 75e3f0e2c2cb 2025-03-17 18:12:17

Compliance test for device /dev/v4l-subdev0:

Driver Info:

        Driver version   : 6.14.0
        Capabilities     : 0x00000000
        Client Capabilities: 0x0000000000000002

interval-uses-which
Required ioctls:
test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/v4l-subdev0 open: OK
test VIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OK

Debug ioctls:
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 (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 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:
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: 11 Private Controls: 0

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

Codec ioctls:
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:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test CREATE_BUFS maximum buffers: OK
test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)
test blocking wait: OK (Not Supported)

Total for device /dev/v4l-subdev0: 46, Succeeded: 46, Failed: 0, Warnings: 0 atg@isp-pv-linux:~/v4l-utils/build/utils/v4l2-compliance$
---

Compliance test for amd_isp_capture device /dev/video0:
-------------------------------------------------------

atg@isp-pv-linux:~/test$ sudo ./v4l2-compliance -d /dev/video0
[sudo] password for atg:
v4l2-compliance 1.29.0-5348, 64 bits, 64-bit time_t
v4l2-compliance SHA: 75e3f0e2c2cb 2025-03-17 18:12:17

Compliance test for amd_isp_capture device /dev/video0:

Driver Info:

        Driver name      : amd_isp_capture
        Card type        : amd_isp_capture
        Bus info         : platform:amd_isp_capture
        Driver version   : 6.14.0
        Capabilities     : 0xa4200001

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

        Driver name      : amd_isp_capture
        Model            : amd_isp41_mdev
        Serial           :
        Bus info         : platform:amd_isp_capture
        Media version    : 6.14.0
        Hardware revision: 0x00000000 (0)
        Driver version   : 6.14.0

Interface Info:
ID : 0x03000003
Type : V4L Video
Entity Info:

        ID               : 0x00000001 (1)
        Name             : Preview
        Function         : V4L2 I/O
        Pad 0x01000002   : 0: Sink
          Link 0x02000007: from remote pad 0x1000006 of entity 'ov05c10 

99-0010' (Camera Sensor): 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 (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0

Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK
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 (Not Supported)

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 amd_isp_capture device /dev/video0: 49, Succeeded: 49, Failed: 0, Warnings: 0 atg@isp-pv-linux:~/test$
---

Thanks,
Pratap

Quoted 24 lines · Laurent Pinchart

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 20 lines · Pratap
Quoted 10 lines · Bryan O'Donoghue

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

Quoted 5 lines

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/
ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

Quoted 9 lines
Quoted 4 lines
static const struct acpi_device_id ov05c10_acpi_ids[] = {
       { "OVTI05C1" },
       {}
};

You could drop the i2c_device_id table if you added an OF device ID table, but you'll need DT bindings for that. Sakari, any best practice rule in this area ?

Sure, will wait for Sakari's feedback. We will also check if the driver can work using acpi_device_id match instead of i2c_device_id.

Quoted 30 lines
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 8 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

Quoted 1 line

sure, will replace "GPL v2" with "GPL" in V3.

--
Regards,

Laurent Pinchart

maintainer
#5 lore raw
In reply to Laurent Pinchart

Hi Laurent,

Quoted 21 lines · Laurent Pinchart
Quoted 20 lines · Pratap
Quoted 10 lines · Bryan O'Donoghue

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

Quoted 5 lines

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/
ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

Quoted 8 lines
Quoted 4 lines
static const struct acpi_device_id ov05c10_acpi_ids[] = {
	{ "OVTI05C1" },
	{}
};

You could drop the i2c_device_id table if you added an OF device ID table, but you'll need DT bindings for that. Sakari, any best practice rule in this area ?

I don't think there should be a need for an I²C ID in any case, having just ACPI _HID is fine.

DT bindings would of course be a plus.

Quoted 27 lines
Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 8 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

sure, will replace "GPL v2" with "GPL" in V3.

Signature · 3 lines
Regards,

Sakari Ailus
#6 lore raw

Hi Sakari,

Quoted 29 lines · Sakari Ailus

Hi Laurent,

Quoted 26 lines · Laurent Pinchart
Quoted 24 lines · Pratap
Quoted 10 lines · Bryan O'Donoghue

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

Quoted 5 lines

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/
ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

static const struct acpi_device_id ov05c10_acpi_ids[] = {
	{ "OVTI05C1" },
	{}
};
Quoted 6 lines
Quoted 3 lines

You could drop the i2c_device_id table if you added an OF device ID table, but you'll need DT bindings for that. Sakari, any best practice rule in this area ?

I don't think there should be a need for an I²C ID in any case, having just ACPI _HID is fine.

AMD laptops with MIPI cameras (where this sensor is used) do not properly describe the sensor as an ACPI I2C device in their ACPI tables. So instead this is going to rely on manual i2c-client instantiation by some pdx86 glue code, see:

https://lore.kernel.org/platform-driver-x86/[email protected]/

To have a driver bind to such manually instantiated i2c-clients there must be an i2c_device_id table.

Regards,

Hans

Quoted 27 lines
Quoted 26 lines
Quoted 25 lines
Quoted 15 lines
Quoted 15 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 8 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

sure, will replace "GPL v2" with "GPL" in V3.

#7 lore raw
Quoted 47 lines · Hans de Goede

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Hi Sakari,

Quoted 29 lines · Sakari Ailus

Hi Laurent,

Quoted 26 lines · Laurent Pinchart
Quoted 24 lines · Pratap
Quoted 10 lines · Bryan O'Donoghue

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

Quoted 5 lines

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/
ov05c10.c

Perhaps you could import the Intel ACPI name contained in there too.

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

static const struct acpi_device_id ov05c10_acpi_ids[] = {
     { "OVTI05C1" },
     {}
};
Quoted 6 lines
Quoted 3 lines

You could drop the i2c_device_id table if you added an OF device ID table, but you'll need DT bindings for that. Sakari, any best practice rule in this area ?

I don't think there should be a need for an I²C ID in any case, having just ACPI _HID is fine.

AMD laptops with MIPI cameras (where this sensor is used) do not properly describe the sensor as an ACPI I2C device in their ACPI tables. So instead this is going to rely on manual i2c-client instantiation by some pdx86 glue code, see:

Quoted 10 lines

https://lore.kernel.org/platform-driver-x86/[email protected]/

To have a driver bind to such manually instantiated i2c-clients there must be an i2c_device_id table.

Regards,

Hans

Thanks Hans for clarifying.

Quoted 31 lines
Quoted 30 lines
Quoted 29 lines
Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 8 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

sure, will replace "GPL v2" with "GPL" in V3.

#8 lore raw
In reply to Nirujogi, Pratap

Hi Bryan,

Quoted 23 lines · Pratap

Hi Bryan,

Thanks for the review.

Thanks,
Pratap

Quoted 15 lines · Bryan O'Donoghue

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

drivers/media/i2c/ov05c10.c line 1045

Quoted 6 lines · Pratap Nirujogi

From: Bin Du <[email protected]>

drivers/media/i2c/ov05c10.c new file +4 -0
+static const struct i2c_device_id ov05c10_id[] = {
+     {"ov05c10", 0 },
+     { }
+};

There's an IPU6/IPU7 version of this driver.

https://github.com/intel/ipu6-drivers/blob/master/drivers/media/i2c/ ov05c10.c

Quoted 9 lines
Quoted 2 lines

Perhaps you could import the Intel ACPI name contained in there too.

sure, will add Intel ACPI names too in V3. To be specific, I'm going to add the below table in addition to the existing "struct i2c_device_id ov05c10_id[]" table:

static const struct acpi_device_id ov05c10_acpi_ids[] = {
    { "OVTI05C1" },
    {}
};

I'm planning to submit v3 addressing the outstanding comments, but will not be including the ACPI device table for now. I will take care of this in the upcoming patch based on Sakari's feedback to accomodate both ACPI and I2C device tables.

Thanks,
Pratap

Quoted 29 lines
Quoted 15 lines
Quoted 15 lines
drivers/media/i2c/ov05c10.c new file +15 -0
+
+MODULE_DEVICE_TABLE(i2c, ov05c10_id);
+
+static struct i2c_driver ov05c10_i2c_driver = {
+     .driver = {
+             .name = DRV_NAME,
+             .pm = pm_ptr(&ov05c10_pm_ops),
+     },
+     .id_table = ov05c10_id,
+     .probe = ov05c10_probe,
+     .remove = ov05c10_remove,
+};
+
+module_i2c_driver(ov05c10_i2c_driver);
+
Quoted 9 lines

drivers/media/i2c/ov05c10.c line 1065

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+MODULE_AUTHOR("Pratap Nirujogi <[email protected]>");
+MODULE_AUTHOR("Venkata Narendra Kumar Gutta <[email protected]>");
+MODULE_AUTHOR("Bin Du <[email protected]>");
+MODULE_DESCRIPTION("OmniVision OV05C1010 sensor driver");
+MODULE_LICENSE("GPL v2");

Why v2 ? Checkpatch will complain about v2 and BTW the IPU6 driver above is GPL not GPL v2.

sure, will replace "GPL v2" with "GPL" in V3.

Quoted 2 lines

---
bod

#9 lore raw
In reply to Pratap Nirujogi

drivers/media/i2c/ov05c10.c line 938

Quoted 13 lines · Pratap Nirujogi
drivers/media/i2c/ov05c10.c new file +13 -0
+static int ov05c10_probe(struct i2c_client *client)
+{
+	struct ov05c10 *ov05c10;
+	u32 refclk;
+	int ret;
+
+	ov05c10 = devm_kzalloc(&client->dev, sizeof(*ov05c10), GFP_KERNEL);
+	if (!ov05c10)
+		return -ENOMEM;
+
+	struct fwnode_handle *fwnode = dev_fwnode(&client->dev);
+
+	ret = fwnode_property_read_u32(fwnode, "refclk", &refclk);

Use existing properties, like clock-frequency. refclk means this is the clock, not it's frequency.

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+	if (ret)
+		return  dev_err_probe(&client->dev, -EINVAL,
+				      "fail to get refclk\n");
+	if (refclk != OV05C10_REF_CLK)
+		return dev_err_probe(&client->dev, -EINVAL,

drivers/media/i2c/ov05c10.c line 953

Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10 -0
+				     "failbad refclk %u, %lu expected\n",
+				     refclk, OV05C10_REF_CLK);
+
+	ret = ov05c10_parse_endpoint(&client->dev, fwnode);
+	if (ret)
+		return dev_err_probe(&client->dev, -EINVAL,
+				     "fail to parse endpoint\n");
+
+	ov05c10->enable_gpio = devm_gpiod_get(&client->dev, "sensor0_enable",
+					      GPIOD_OUT_LOW);

Nothing improved and you did not bothered to wait for my feedback. You just sent v2.

There is no second GPIO, otherwise would be present here.

NAK.

Best regards,
Krzysztof

#10 lore raw

Hi Krzysztof,

Thanks for the review.

Thanks,
Pratap

Quoted 4 lines · Krzysztof Kozlowski

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

On 28/03/2025 22:42, Pratap Nirujogi wrote:

Quoted 17 lines

drivers/media/i2c/ov05c10.c line 938

Quoted 13 lines
drivers/media/i2c/ov05c10.c new file +13 -0
+static int ov05c10_probe(struct i2c_client *client)
+{
+     struct ov05c10 *ov05c10;
+     u32 refclk;
+     int ret;
+
+     ov05c10 = devm_kzalloc(&client->dev, sizeof(*ov05c10), GFP_KERNEL);
+     if (!ov05c10)
+             return -ENOMEM;
+
+     struct fwnode_handle *fwnode = dev_fwnode(&client->dev);
+
+     ret = fwnode_property_read_u32(fwnode, "refclk", &refclk);

Use existing properties, like clock-frequency. refclk means this is the clock, not it's frequency.

sure, will replace "refclk" with "clock-frequency" variable in the next V3 patch.

Quoted 10 lines
Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10 -0
+     if (ret)
+             return  dev_err_probe(&client->dev, -EINVAL,
+                                   "fail to get refclk\n");
+     if (refclk != OV05C10_REF_CLK)
+             return dev_err_probe(&client->dev, -EINVAL,
+                                  "failbad refclk %u, %lu expected\n",
+                                  refclk, OV05C10_REF_CLK);
+
+     ret = ov05c10_parse_endpoint(&client->dev, fwnode);
+     if (ret)
Quoted 9 lines

drivers/media/i2c/ov05c10.c line 953

Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5 -0
+             return dev_err_probe(&client->dev, -EINVAL,
+                                  "fail to parse endpoint\n");
+
+     ov05c10->enable_gpio = devm_gpiod_get(&client->dev, "sensor0_enable",
+                                           GPIOD_OUT_LOW);

Nothing improved and you did not bothered to wait for my feedback. You just sent v2.

sorry, I should have waited for your feedback before submitting V2. I will use the suggested name "enable" in the next V3 submission.

Quoted 2 lines

There is no second GPIO, otherwise would be present here.

I rechecked both GPIOs. Only one is relevant for sensor driver and other one is for the ISP driver. Sorry for the confusion caused.

Quoted 6 lines

NAK.

Best regards,
Krzysztof