Skip to content

drivers: video: imagers/cci/imx219: easier image sensor contribution #87004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

josuah
Copy link
Collaborator

@josuah josuah commented Mar 12, 2025

Currently, image sensor drivers have a lot of code, while they are essentially a way to pass tables of I2C registers to image sensors.

I will heavily split this in several smaller PRs after some polishing.

Is the general approach looking reasonable?

P.S.: The "Imager" terminology instead of "image sensor" is used because it is compact, and IIRC @ngphibang pointed that some "image sensors" were rather "image sensor + other things". Glad to switch to whichever makes most sense.

josuah added 6 commits March 12, 2025 18:18
The Camera Common Interface part of the MIPI CSI protocol defines methods
to configure a camera device over I2C, such as the size of the register
address and data. This permits to write wrapper software like it is done
on Linux, in order to simplify the image sensor driver development.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Fix an API misuse leading to off-by-one and inaccurate results.
The API introduced by 0cbaea0 does not expect fie.index to be
incremented by the drver.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Imagers, also called image sensors, are implemented using the generic
video API. This makes image sensor require boilerplate code which can
be avoided by providing a common implementation that will fit most image
sensors.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Add an IMX219 image sensor driver, using the newly introduced "CCI" and
"imager" utilities to facilitate image sensor implementation.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Replace the ad-hoc register emulation by the dedicated I2C emulator,
making it usable with the same APIs as every other image sensors.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Now that the emulated I2C is supported, it is possible to use the same
APIs as actual image sensors, permitting to cover the image sensor driver
logics with unit tests.

Signed-off-by: Josuah Demangeon <me@josuah.net>
@josuah
Copy link
Collaborator Author

josuah commented Mar 12, 2025

Case study with the GC2145: a lot of small fix-up PRs:

I believe the original implementation was good, still: this PR uses code from the GC2145 driver.

Currently every new driver needs to go through a copy-paste of a driver contributed ~4 years ago [1], then go through a lot of review to update it make it comply with recent guidelines, then fix any bug caused by this conversion.

Better fix the original sensors, and the proposal to do that is to put most of the sensor logic in common with every sensor, including the emulated imager that runs on CI.

[1]: And I am grateful to have these foundations in place since so long! On top of which we are building today. :)

@josuah josuah changed the title drivers: video: imagers/cci/imx219: simplify image sensor drivers development drivers: video: imagers/cci/imx219: easier image sensor contribution Mar 12, 2025
@josuah
Copy link
Collaborator Author

josuah commented Apr 2, 2025

It is now all dis-aggregated in the PRs above, so closing this one.

@josuah josuah deleted the pr-video-cci branch April 8, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants