media: i2c: Add Omnivision ov05c10 sensor driver
Subsystems (2)
Sakari Ailus
maintainerPATCH v3 1/1 media: i2c: Add Omnivision ov05c10 sensor driver
From: Hao Yao <[email protected]>
Add a driver for the Omnivision ov05c10 camera sensor. This driver implements a single mode only.
---
since v2:
- Added missing MAINTAINERS entry.
MAINTAINERS | 7 + drivers/media/i2c/Kconfig | 10 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ov05c10.c | 978 ++++++++++++++++++++++++++++++++++++ 4 files changed, 996 insertions(+) create mode 100644 drivers/media/i2c/ov05c10.c
MAINTAINERS +7 -0
@@ -20203,6 +20203,13 @@ T: git git://linuxtv.org/media.git F: Documentation/devicetree/bindings/media/i2c/ovti,ov02e10.yaml F: drivers/media/i2c/ov02e10.c +OMNIVISION OV05C10 SENSOR DRIVER +M: Sakari Ailus <[email protected]> +R: Antti Laakso <[email protected]> +L: [email protected] +S: Maintained +F: drivers/media/i2c/ov05c10.c + OMNIVISION OV08D10 SENSOR DRIVER M: Jimmy Su <[email protected]> R: Matthias Fend <[email protected]>
drivers/media/i2c/Kconfig +10 -0
@@ -466,6 +466,16 @@ config VIDEO_OV02C10 To compile this driver as a module, choose M here: the module will be called ov02c10. +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
@@ -94,6 +94,7 @@ obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o obj-$(CONFIG_VIDEO_OV02A10) += ov02a10.o obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.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 +978 -0
978 lines not on this page · raw message
Signature · 1 line
2.47.3
Hi Sakari, Hao,
I identified a few issues. Could you please check the comments below?
Quoted 21 lines
From: Hao Yao <[email protected]>
Add a driver for the Omnivision ov05c10 camera sensor. This driver implements a single mode only.
Signed-off-by Hao Yao <[email protected]>Co-developed-by Sakari Ailus <[email protected]>Signed-off-by Sakari Ailus <[email protected]>Tested-by Antti Laakso <[email protected]>Reviewed-by Antti Laakso <[email protected]>---
since v2:- Added missing
MAINTAINERSentry.MAINTAINERS | 7 + drivers/media/i2c/Kconfig | 10 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ov05c10.c | 978 ++++++++++++++++++++++++++++++++++++ 4 files changed, 996 insertions(+) create mode 100644 drivers/media/i2c/ov05c10.c
...
Quoted 1 line
+#define
to_ov05c10(_sd)container_of(_sd, struct ov05c10, sd)
Please use container_of_const.
Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5
-0+ +static const char *const ov05c10_test_pattern_menu[] = { +"Disabled" , +"Color Bar" , +};
...
drivers/media/i2c/ov05c10.c line 154
Quoted 13 lines
drivers/media/i2c/ov05c10.c new file +13
-0+static const struct cci_reg_sequence mode_2800_1576_30fps[] = { + {OV05C10_REG8 (0x00 ,0x20 ),0x00 }, + {OV05C10_REG8 (0x00 ,0x20 ),0x0b }, + {OV05C10_REG8 (0x00 ,0xc1 ),0x09 }, + {OV05C10_REG8 (0x00 ,0x21 ),0x06 }, + {OV05C10_REG8 (0x00 ,0x11 ),0x4e }, + {OV05C10_REG8 (0x00 ,0x12 ),0x13 }, + {OV05C10_REG8 (0x00 ,0x14 ),0x96 }, + {OV05C10_REG8 (0x00 ,0x1b ),0x64 }, + {OV05C10_REG8 (0x00 ,0x1d ),0x02 }, + {OV05C10_REG8 (0x00 ,0x1e ),0x40 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x03 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x00 },
Multiple entries for the same register value seem unnecessary. You can keep the last entry only.
I can see several similar cases below as well.
drivers/media/i2c/ov05c10.c line 161
Quoted 7 lines
drivers/media/i2c/ov05c10.c new file +7
-0+ { OV05C10_REG8(0x00, 0x21), 0x00 }, + { OV05C10_REG8(0x01, 0x03), 0x00 }, + { OV05C10_REG8(0x01, 0x04), 0x06 }, + { OV05C10_REG8(0x01, 0x06), 0x76 }, + { OV05C10_REG8(0x01, 0x07), 0x08 }, + { OV05C10_REG8(0x01, 0x1b), 0x01 }, + { OV05C10_REG8(0x01, 0x24), 0xff },
Use OV05C10_REG_ANALOG_GAIN here. Also, you can remove this entry, as it is not required.
Quoted 25 lines
drivers/media/i2c/ov05c10.c new file +25
-0+ { OV05C10_REG8(0x01, 0x42), 0x5d }, + { OV05C10_REG8(0x01, 0x43), 0x08 }, + { OV05C10_REG8(0x01, 0x44), 0x81 }, + { OV05C10_REG8(0x01, 0x46), 0x5f }, + { OV05C10_REG8(0x01, 0x48), 0x18 }, + { OV05C10_REG8(0x01, 0x49), 0x04 }, + { OV05C10_REG8(0x01, 0x5c), 0x18 }, + { OV05C10_REG8(0x01, 0x5e), 0x13 }, + { OV05C10_REG8(0x01, 0x70), 0x15 }, + { OV05C10_REG8(0x01, 0x77), 0x35 }, + { OV05C10_REG8(0x01, 0x79), 0xb2 }, + { OV05C10_REG8(0x01, 0x7b), 0x08 }, + { OV05C10_REG8(0x01, 0x7d), 0x08 }, + { OV05C10_REG8(0x01, 0x7e), 0x08 }, + { OV05C10_REG8(0x01, 0x7f), 0x08 }, + { OV05C10_REG8(0x01, 0x90), 0x37 }, + { OV05C10_REG8(0x01, 0x91), 0x05 }, + { OV05C10_REG8(0x01, 0x92), 0x18 }, + { OV05C10_REG8(0x01, 0x93), 0x27 }, + { OV05C10_REG8(0x01, 0x94), 0x05 }, + { OV05C10_REG8(0x01, 0x95), 0x38 }, + { OV05C10_REG8(0x01, 0x9b), 0x00 }, + { OV05C10_REG8(0x01, 0x9c), 0x06 }, + { OV05C10_REG8(0x01, 0x9d), 0x28 }, + { OV05C10_REG8(0x01, 0x9e), 0x06 },
...
drivers/media/i2c/ov05c10.c line 323
Quoted 4 lines
drivers/media/i2c/ov05c10.c new file +4
-0+static int ov05c10_set_ctrl (struct v4l2_ctrl *ctrl) +{ +struct ov05c10 *ov05c10 = + container_of(ctrl->handler, struct ov05c10, ctrl_handler);
Please use container_of_const.
Quoted 56 lines
drivers/media/i2c/ov05c10.c new file +56
-0+struct i2c_client *client =v4l2_get_subdevdata (&ov05c10->sd); +struct v4l2_subdev_state *state; +const struct v4l2_mbus_framefmt *format; +u64 vts; +int ret; + + state =v4l2_subdev_get_locked_active_state (&ov05c10->sd); + format =v4l2_subdev_state_get_format (state,0 ); + +if (ctrl->id ==V4L2_CID_VBLANK ) { + ret =__v4l2_ctrl_modify_range (ov05c10->exposure, + ov05c10->exposure->minimum, + format->height + ctrl->val - +OV05C10_EXPOSURE_MARGIN , + ov05c10->exposure->step, + format->height - +OV05C10_EXPOSURE_MARGIN ); + +if (ret) +return ret; + } + +if (!pm_runtime_get_if_active (&client->dev)) +return 0 ; + +switch (ctrl->id) { +case V4L2_CID_ANALOGUE_GAIN : + ret =cci_write (ov05c10->regmap,OV05C10_REG_ANALOG_GAIN , + ctrl->val,NULL ); +break ; +case V4L2_CID_DIGITAL_GAIN : + ret =cci_write (ov05c10->regmap,OV05C10_REG_DIGITAL_GAIN , + ctrl->val,NULL ); +break ; +case V4L2_CID_EXPOSURE : + ret =cci_write (ov05c10->regmap,OV05C10_REG_EXPOSURE , + ctrl->val,NULL ); +break ; +case V4L2_CID_VBLANK : +/* +* REG_TIMING_VTS is read-only and increased by writing to +* REG_DUMMY_LINE in ov05c10. The calculation formula is +* required VTS = dummyline + current VTS. Here get the +* current VTS and calculate the required dummyline. +*/ +cci_read (ov05c10->regmap,OV05C10_REG_TIMING_VTS , &vts, &ret); +if (ret) + goto err; + + ret =cci_write (ov05c10->regmap,OV05C10_REG_DUMMY_LINE , +max_t (int, ctrl->val + format->height - vts,0 ), +NULL ); +break ; +case V4L2_CID_TEST_PATTERN : + ret =ov05c10_test_pattern (ov05c10, ctrl->val); +break ;
drivers/media/i2c/ov05c10.c line 389
Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10
-0+default : + ret = -EINVAL ; +break ; + } + +cci_write (ov05c10->regmap,OV05C10_REG_TRIGGER , +OV05C10_TRIGGER_APPLY , &ret); +if (ret) { +dev_err (&client->dev,"failed to trigger write" ); + goto err;
We can drop this line.
Quoted 8 lines
drivers/media/i2c/ov05c10.c new file +8
-0+ } + +err: +pm_runtime_put_autosuspend (&client->dev); + +return ret; +} +
...
drivers/media/i2c/ov05c10.c line 441
Quoted 9 lines
drivers/media/i2c/ov05c10.c new file +9
-0+ hblank =OV05C10_PPL - mode->width; + ov05c10->hblank =v4l2_ctrl_new_std (ctrl_hdlr, &ov05c10_ctrl_ops, +V4L2_CID_HBLANK , hblank, hblank,1 , + hblank); + +v4l2_ctrl_new_std (ctrl_hdlr, &ov05c10_ctrl_ops,V4L2_CID_ANALOGUE_GAIN , +OV05C10_MIN_ANALOG_GAIN ,OV05C10_MAX_ANALOG_GAIN , +OV05C10_ANALOG_GAIN_STEP , +OV05C10_ANALOG_GAIN_DEFAULT );
It would be better to add a blank line after this.
Quoted 12 lines
drivers/media/i2c/ov05c10.c new file +12
-0+v4l2_ctrl_new_std (ctrl_hdlr, &ov05c10_ctrl_ops,V4L2_CID_DIGITAL_GAIN , +OV05C10_MIN_DIG_GAIN ,OV05C10_MAX_DIG_GAIN , +OV05C10_DGTL_GAIN_STEP ,OV05C10_DGTL_GAIN_DEFAULT ); + + exposure_max = mode->vts_def -OV05C10_EXPOSURE_MARGIN ; + ov05c10->exposure =v4l2_ctrl_new_std (ctrl_hdlr, &ov05c10_ctrl_ops, +V4L2_CID_EXPOSURE , +OV05C10_EXPOSURE_MIN , + exposure_max, +OV05C10_EXPOSURE_STEP , + exposure_max); +
...
drivers/media/i2c/ov05c10.c line 699
Quoted 4 lines
drivers/media/i2c/ov05c10.c new file +4
-0+static const struct v4l2_subdev_core_ops ov05c10_core_ops = { + .subscribe_event = v4l2_ctrl_subdev_subscribe_event, + .unsubscribe_event = v4l2_event_subdev_unsubscribe, +};
Drop this.
Quoted 5 lines
drivers/media/i2c/ov05c10.c new file +5
-0+ +static const struct v4l2_subdev_ops ov05c10_subdev_ops = { + .core = &ov05c10_core_ops, + .pad = &ov05c10_pad_ops, +};
...
Quoted 6 lines
drivers/media/i2c/ov05c10.c new file +6
-0+static int ov05c10_get_pm_resources (struct device *dev) +{ +struct v4l2_subdev *sd =dev_get_drvdata (dev); +struct ov05c10 *ov05c10 =to_ov05c10 (sd); + + ov05c10->img_clk =devm_v4l2_sensor_clk_get (dev,NULL );
drivers/media/i2c/ov05c10.c line 776
Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10
-0+if (IS_ERR (ov05c10->img_clk)) +return dev_err_probe (dev,PTR_ERR (ov05c10->img_clk), +"failed to get imaging clock\n" ); + + ov05c10->avdd =devm_regulator_get (dev,"avdd" ); +if (IS_ERR (ov05c10->avdd)) +return dev_err_probe (dev,PTR_ERR (ov05c10->avdd), +"failed to get avdd regulator\n" ); + + ov05c10->reset =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW );
Default state should be GPIOD_OUT_HIGH.
Quoted 6 lines
drivers/media/i2c/ov05c10.c new file +6
-0+if (IS_ERR (ov05c10->reset)) +return dev_err_probe (dev,PTR_ERR (ov05c10->reset), +"failed to get reset gpio\n" ); + +return 0 ; +}
...
Quoted 34 lines
drivers/media/i2c/ov05c10.c new file +34
-0+static int ov05c10_probe (struct i2c_client *client) +{ +struct device *dev = &client->dev; +struct ov05c10 *ov05c10; +bool full_power; +int ret; + + ov05c10 =devm_kzalloc (&client->dev,sizeof (*ov05c10),GFP_KERNEL ); +if (!ov05c10) +return -ENOMEM ; + + ret =ov05c10_parse_fwnode (ov05c10, dev); +if (ret) +return ret; + + ov05c10->regmap =devm_regmap_init_i2c (client, &ov05c10_regmap_config); +if (IS_ERR (ov05c10->regmap)) +return dev_err_probe (dev,PTR_ERR (ov05c10->regmap), +"failed to init regmap\n" ); + +v4l2_i2c_subdev_init (&ov05c10->sd, client, &ov05c10_subdev_ops); + + ret =ov05c10_get_pm_resources (dev); +if (ret) +return ret; + + full_power =acpi_dev_state_d0 (dev); +if (full_power) { + ret =ov05c10_power_on (dev); +if (ret) { +dev_err (&client->dev,"failed to power on\n" ); +return ret; + } + }
drivers/media/i2c/ov05c10.c line 888
Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10
-0+ + ret =ov05c10_init_controls (ov05c10); +if (ret) { +dev_err (&client->dev,"failed to init controls: %d" , ret); + goto probe_error_power_off; + } + + ov05c10->sd.internal_ops = &ov05c10_internal_ops; + ov05c10->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE | +V4L2_SUBDEV_FL_HAS_EVENTS ;
Drop V4L2_SUBDEV_FL_HAS_EVENTS flag.
drivers/media/i2c/ov05c10.c line 895
Quoted 7 lines
drivers/media/i2c/ov05c10.c new file +7
-0+ ov05c10->sd.entity.ops =NULL ; + ov05c10->sd.entity.function =MEDIA_ENT_F_CAM_SENSOR ; + ov05c10->pad.flags =MEDIA_PAD_FL_SOURCE ; + + ret =media_entity_pads_init (&ov05c10->sd.entity,1 , &ov05c10->pad); +if (ret) { +dev_err (&client->dev,"failed to init entity pads: %d" , ret);
Can we use dev_err_probe.
drivers/media/i2c/ov05c10.c line 902
Quoted 7 lines
drivers/media/i2c/ov05c10.c new file +7
-0+ goto probe_error_v4l2_ctrl_handler_free; + } + + ov05c10->sd.state_lock = ov05c10->ctrl_handler.lock; + ret =v4l2_subdev_init_finalize (&ov05c10->sd); +if (ret <0 ) { +dev_err (dev,"v4l2 subdev init error: %d\n" , ret);
same here.
Quoted 11 lines
drivers/media/i2c/ov05c10.c new file +11
-0+ goto probe_error_media_entity_cleanup; + } + +if (full_power) +pm_runtime_set_active (&client->dev); +pm_runtime_enable (&client->dev); + + ret =v4l2_async_register_subdev_sensor (&ov05c10->sd); +if (ret <0 ) { +dev_err (&client->dev,"failed to register V4L2 subdev: %d" , + ret);
drivers/media/i2c/ov05c10.c line 923
Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10
-0+ goto probe_error_rpm; + } +pm_runtime_set_autosuspend_delay (&client->dev,1000 ); +pm_runtime_use_autosuspend (&client->dev); +pm_runtime_idle (&client->dev); + +return 0 ; + +probe_error_rpm: +pm_runtime_disable (&client->dev);
Add pm_runtime_dont_use_autosuspend(&client->dev) before pm_runtime_disable() to undo the pm_runtime_use_autosuspend() call from probe. Maybe Sashiko will point this out.
Also, if v4l2_async_register_subdev_sensor() fails with full_power set to true, pm_runtime_set_active() has already been called. After pm_runtime_disable(), the runtime PM status remains active while the sensor is powered off.
drivers/media/i2c/ov05c10.c line 933
Quoted 10 lines
drivers/media/i2c/ov05c10.c new file +10
-0+v4l2_subdev_cleanup (&ov05c10->sd); + +probe_error_media_entity_cleanup: +media_entity_cleanup (&ov05c10->sd.entity); + +probe_error_v4l2_ctrl_handler_free: +v4l2_ctrl_handler_free (ov05c10->sd.ctrl_handler); + +probe_error_power_off: +ov05c10_power_off (&client->dev);
If full_power is false, power_on was never called. so power_off must be skipped.
Quoted 3 lines
drivers/media/i2c/ov05c10.c new file +3
-0+ +return ret; +}
...
Quoted 26 lines
drivers/media/i2c/ov05c10.c new file +24
-1+#if IS_BUILTIN (CONFIG_ACPI ) +static const struct acpi_device_id ov05c10_acpi_ids[] = { + { .id ="OVTI05C1" }, + { } +}; + +MODULE_DEVICE_TABLE (acpi, ov05c10_acpi_ids); +#endif + +static struct i2c_driver ov05c10_i2c_driver = { + .driver = { + .name ="ov05c10" , + .pm =pm_ptr (&ov05c10_pm_ops), + .acpi_match_table =ACPI_PTR (ov05c10_acpi_ids), + }, + .probe = ov05c10_probe, + .remove = ov05c10_remove, + .flags =I2C_DRV_ACPI_WAIVE_D0_PROBE , +}; + +module_i2c_driver (ov05c10_i2c_driver); +MODULE_DESCRIPTION ("OmniVision ov05c10 camera driver" ); +MODULE_AUTHOR ("Dongcheng Yan <[email protected]>" ); +MODULE_LICENSE ("GPL" ); --
Quoted 1 line
2.47.3
Best Regards,
Tarang
Sakari Ailus
maintainerHi Tarang,
Quoted 3 lines · Tarang Raval
Hi Sakari, Hao,
I identified a few issues. Could you please check the comments below?
Thank you for the review. I'll address these in follow-up patches.
Signature · 3 lines
Regards, Sakari Ailus
Sakari Ailus
maintainerHi Tarang,
Quoted 14 lines · Tarang Raval
drivers/media/i2c/ov05c10.c line 154
Quoted 13 lines
drivers/media/i2c/ov05c10.c new file +13
-0+static const struct cci_reg_sequence mode_2800_1576_30fps[] = { + {OV05C10_REG8 (0x00 ,0x20 ),0x00 }, + {OV05C10_REG8 (0x00 ,0x20 ),0x0b }, + {OV05C10_REG8 (0x00 ,0xc1 ),0x09 }, + {OV05C10_REG8 (0x00 ,0x21 ),0x06 }, + {OV05C10_REG8 (0x00 ,0x11 ),0x4e }, + {OV05C10_REG8 (0x00 ,0x12 ),0x13 }, + {OV05C10_REG8 (0x00 ,0x14 ),0x96 }, + {OV05C10_REG8 (0x00 ,0x1b ),0x64 }, + {OV05C10_REG8 (0x00 ,0x1d ),0x02 }, + {OV05C10_REG8 (0x00 ,0x1e ),0x40 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x03 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x00 },
Quoted 2 lines
Multiple entries for the same register value seem unnecessary. You can keep the last entry only.
There seems to be some, but in at least one case this is quite possibly
required: P0:0x20 is software reset, and this being Omnivision sensor, it's hard to say what it actually does. The hardware reset value of the register is 0xb, and it seems it won't return to 0xb when written 0 nor streaming works. So it seems these two writes are needed.
Signature · 3 lines
Regards, Sakari Ailus
Hi Sakari,
Quoted 15 lines · Tarang Raval
Quoted 14 lines
Quoted 13 lines
drivers/media/i2c/ov05c10.c new file +13
-0+static const struct cci_reg_sequence mode_2800_1576_30fps[] = { + {OV05C10_REG8 (0x00 ,0x20 ),0x00 }, + {OV05C10_REG8 (0x00 ,0x20 ),0x0b }, + {OV05C10_REG8 (0x00 ,0xc1 ),0x09 }, + {OV05C10_REG8 (0x00 ,0x21 ),0x06 }, + {OV05C10_REG8 (0x00 ,0x11 ),0x4e }, + {OV05C10_REG8 (0x00 ,0x12 ),0x13 }, + {OV05C10_REG8 (0x00 ,0x14 ),0x96 }, + {OV05C10_REG8 (0x00 ,0x1b ),0x64 }, + {OV05C10_REG8 (0x00 ,0x1d ),0x02 }, + {OV05C10_REG8 (0x00 ,0x1e ),0x40 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x03 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x00 },
Quoted 8 lines
Quoted 2 lines
Multiple entries for the same register value seem unnecessary. You can keep the last entry only.
There seems to be some, but in at least one case this is quite possibly
required: P0:0x20 is software reset, and this being Omnivision sensor, it's hard to say what it actually does. The hardware reset value of the register is0xb, and it seems it won't return to0xbwhen written 0 nor streaming works. So it seems these two writes are needed.
I have tested the OS04D10 and OS02G10 sensors, which are similar to the OV05C10, and both work after removing the P0:0x20 reset writes. So the OV05C10 may work without them too, but this would need to be verified on the actual sensor.
You are right that the purpose of many entries in OmniVision init sequences is unclear. For repeated writes to the same register, keeping only the last entry should work, as far as I know.
So, we can keep them as they are for now. If you get some free time later, you can check this.
Best regards,
Tarang
Sakari Ailus
maintainerHi Tarang,
Quoted 26 lines · Tarang Raval
Hi Sakari,
Quoted 15 lines · Tarang Raval
Quoted 14 lines
Quoted 13 lines
drivers/media/i2c/ov05c10.c new file +13
-0+static const struct cci_reg_sequence mode_2800_1576_30fps[] = { + {OV05C10_REG8 (0x00 ,0x20 ),0x00 }, + {OV05C10_REG8 (0x00 ,0x20 ),0x0b }, + {OV05C10_REG8 (0x00 ,0xc1 ),0x09 }, + {OV05C10_REG8 (0x00 ,0x21 ),0x06 }, + {OV05C10_REG8 (0x00 ,0x11 ),0x4e }, + {OV05C10_REG8 (0x00 ,0x12 ),0x13 }, + {OV05C10_REG8 (0x00 ,0x14 ),0x96 }, + {OV05C10_REG8 (0x00 ,0x1b ),0x64 }, + {OV05C10_REG8 (0x00 ,0x1d ),0x02 }, + {OV05C10_REG8 (0x00 ,0x1e ),0x40 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x03 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x00 },Quoted 8 lines
Quoted 2 lines
Multiple entries for the same register value seem unnecessary. You can keep the last entry only.
There seems to be some, but in at least one case this is quite possibly
required: P0:0x20 is software reset, and this being Omnivision sensor, it's hard to say what it actually does. The hardware reset value of the register is0xb, and it seems it won't return to0xbwhen written 0 nor streaming works. So it seems these two writes are needed.
Quoted 4 lines
I have tested the OS04D10 and OS02G10 sensors, which are similar to the OV05C10, and both work after removing the P0:0x20 reset writes. So the OV05C10 may work without them too, but this would need to be verified on the actual sensor.
I'm not saying it wouldn't work, at least if you have hardware reset GPIO, but if you don't, then removing software reset could have implications.
Software reset here indeed appears to require two writes to the register.
Signature · 3 lines
Regards, Sakari Ailus
Hi Sakari,
Quoted 32 lines · Tarang Raval
Quoted 26 lines
Hi Sakari,
Quoted 15 lines · Tarang Raval
Quoted 14 lines
Quoted 13 lines
drivers/media/i2c/ov05c10.c new file +13
-0+static const struct cci_reg_sequence mode_2800_1576_30fps[] = { + {OV05C10_REG8 (0x00 ,0x20 ),0x00 }, + {OV05C10_REG8 (0x00 ,0x20 ),0x0b }, + {OV05C10_REG8 (0x00 ,0xc1 ),0x09 }, + {OV05C10_REG8 (0x00 ,0x21 ),0x06 }, + {OV05C10_REG8 (0x00 ,0x11 ),0x4e }, + {OV05C10_REG8 (0x00 ,0x12 ),0x13 }, + {OV05C10_REG8 (0x00 ,0x14 ),0x96 }, + {OV05C10_REG8 (0x00 ,0x1b ),0x64 }, + {OV05C10_REG8 (0x00 ,0x1d ),0x02 }, + {OV05C10_REG8 (0x00 ,0x1e ),0x40 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x03 }, + {OV05C10_REG8 (0x00 ,0xe7 ),0x00 },Quoted 8 lines
Quoted 2 lines
Multiple entries for the same register value seem unnecessary. You can keep the last entry only.
There seems to be some, but in at least one case this is quite possibly
required: P0:0x20 is software reset, and this being Omnivision sensor, it's hard to say what it actually does. The hardware reset value of the register is0xb, and it seems it won't return to0xbwhen written 0 nor streaming works. So it seems these two writes are needed.Quoted 4 lines
I have tested the OS04D10 and OS02G10 sensors, which are similar to the OV05C10, and both work after removing the P0:0x20 reset writes. So the OV05C10 may work without them too, but this would need to be verified on the actual sensor.
Quoted 4 lines
I'm not saying it wouldn't work, at least if you have hardware reset GPIO, but if you don't, then removing software reset could have implications.
Software reset here indeed appears to require two writes to the register.
That makes sense. I didn't consider boards without a hardware reset GPIO.
Best regards,
Tarang