Skip to content

media: i2c: ov5647: Modernize driver with CCI and new stream APIs

Xiaolei Wang linux-media lkml 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 0 repliesNew
  2. v43 patches 4 repliesSuperseded
  3. v33 patches 7 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches10 repliesSuperseded
v12 patches4 repliesSuperseded

Changes in V4 from the cover letter

- In patch 1, have corrected the issue of variables that do not need initialization. I have defined a chip ID, dropped all control functions, and now set the chip ID directly in the set control, using cci_update_bits() instead of read + write operations.

- In patch 2, Use dev_err_probe instead of dev_err

- In patch 3, have corrected the issue of variables that do not need initialization.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3media: i2c: ov5647: Convert to CCI register access helpersdrivers/media/i2c/Kconfig drivers/media/i2c/ov5647.c+115 -2840 replies
2/3media: i2c: ov5647: Switch to using the sub-device state lockdrivers/media/i2c/ov5647.c+18 -220 replies
3/3media: i2c: ov5647: switch to {enable,disable}_streamsdrivers/media/i2c/ov5647.c+38 -510 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchLaurent PinchartTarang RavalHans de Goede
1/3R-b R-b
2/3R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/3] media: i2c: ov5647: Modernize driver with CCI and new stream APIs

This patch series modernizes the OV5647 camera sensor driver by:

1. Converting from private I2C register access functions to the common CCI (Camera Control Interface) register access helpers, which simplifies the code and provides better error handling.

2. Switching from driver-specific mutex to the sub-device state lock and properly implementing v4l2_subdev_init_finalize() lifecycle.

3. Converting from the legacy s_stream callback to the new enable_streams/disable_streams operations to align with current V4L2 subsystem standards.

I tested each patch on a Raspberry Pi 5 using the following commands:

rpicam-jpeg --output test.jpg
rpicam-still -o long_exposure.jpg --shutter 100000000 --gain 1 --awbgains 1,1 --immediate

Changes in V5:

Because Dave's patch has already been applied to https://git.linuxtv.org/sailus/media_tree.git/log/?h=cleanup,
there will be conflicts when applying this set of patches. Therefore, in version V5, I used 'git clone --depth 1 https://git.linuxtv.org/sailus/media_tree.git -b cleanup' to reapply the patch to the https://git.linuxtv.org/sailus/media_tree.git cleanup branch.

- In patch 1, I also updated OV5647_REG_HTS, OV5647_REG_HTS, and OV5647_REG_HTS to cci_write operations.

- In patch 2, I moved the v4l2_async_register_subdev_sensor() call to before enabling Runtime PM.

Changes in V4:

- In patch 1, have corrected the issue of variables that do not need initialization. I have defined a chip ID, dropped all control functions, and now set the chip ID directly in the set control, using cci_update_bits() instead of read + write operations.

- In patch 2, Use dev_err_probe instead of dev_err

- In patch 3, have corrected the issue of variables that do not need initialization.

Changes in V3:
https://patchwork.kernel.org/project/linux-media/cover/[email protected]/

- In patch 1, I replaced cci_multi_reg_write() with regmap_multi_reg_write() and
fixed OV5647_REG_GAIN at 0x350a. I also replaced the original ret = PTR_ERR(sensor->regmap) with dev_err_probe().

- In patch 2, I replaced the mutex with v4l2_subdev_lock_and_get_active_state() in s_stream().

- In patch 3, I replaced err_rpm_put with done, and added the ov5647_stream_stop() function.

Changes in V2:
https://patchwork.kernel.org/project/linux-media/cover/[email protected]/

- Proper register width definitions
- Fixed formatting and indentation
- Error chaining implementation
- Simplified chip detection logic
- Clean compilation with -Werror
- Add a new patch, switch from s_stream to enable_streams and disable_streams callbacks.

Link to V1: https://patchwork.kernel.org/project/linux-media/cover/[email protected]/

Xiaolei Wang (3):
media: i2c: ov5647: Convert to CCI register access helpers
media: i2c: ov5647: Switch to using the sub-device state lock
media: i2c: ov5647: switch to {enable,disable}_streams

 drivers/media/i2c/Kconfig  |   1 +
 drivers/media/i2c/ov5647.c | 501 ++++++++++++-------------------------
 2 files changed, 158 insertions(+), 344 deletions(-)
Signature · 1 line
2.43.0