Skip to content
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

media: i2c: imx290: Add support for High Conversion Gain #6325

Open
wants to merge 1 commit into
base: rpi-6.6.y
Choose a base branch
from

Conversation

velkoborsky
Copy link

This update adds support for High Conversion Gain (HCG) mode, which significantly improves low-light performance.

According to the IMX290 and IMX462 datasheets, the address 3009h is configured as follows:

  • Bits 0-1: "FRSEL [1:0]": Frame rate (Data rate) setting
  • Bit 4: "FDG_SEL": Conversion gain switching; 0: LCG Mode, 1: HCG Mode
  • Other bits: Fixed to 0

The frame rate setting has been implemented in the driver; however, conversion gain switching has not yet been implemented.

@6by9
Copy link
Contributor

6by9 commented Aug 27, 2024

We've been here already - #5859 / https://forums.raspberrypi.com/viewtopic.php?t=363696, and #4593 before it.

Adding new V4L2 controls in a downstream repo is a maintenance nightmare, which generally means it's a fairly hard "no".
Controls also need useful names, and I've still not actually seen a decent explanation of what this conversion gain property on IMX327/290/462 does.
As in #5859, a module parameter is generally the least painful route, although it does limit it to being a global option for all users of the module on a system (ie shared by 2 imx290's connected to the same system).

I'd not noticed the comment on the forum thread that says that the CG isn't being applied on first startup. It looks like I've got a clash between imx290_set_data_lanes and imx290_set_ctrl(V4L2_CID_ANALOGUE_GAIN) both trying to set the same IMX290_FR_FDG_SEL register. Odd as the control handler should come second.
I'm short on time at present, but have just rebased #5859 so that CI reruns. I may see if I can find 5 mins to try it out later in the week.

@velkoborsky
Copy link
Author

Thank you for reviewing the patch. A module parameter would indeed be a useful compromise. I will test #5859.

For the explanation of the HCG - even in the datasheet there is no description of what HCG is doing. Practically, it allows you to capture low light signals with much less noise. We are using it for scientific purposes, greatly improving signal-to-noise ratio.

There are some good measurements on the following website: https://player-one-astronomy.com/product/mars-color-camera/ The effect of HCG is visible as a step change in the readout noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants