-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
IMX219: Adjust PLL settings based on the number of MIPI lanes #6575
Conversation
Links to https://forums.raspberrypi.com/viewtopic.php?t=381663 For reference, driver changes and overlay changes need to be in separate patches. The overlay can be an override on the existing imx219 overlay to reduce duplication. My diff (which I can't test) doing that was
|
drivers/media/i2c/imx219.c
Outdated
imx219->lanes == 2 ? imx219_pll : imx219_pll_4lane, | ||
imx219->lanes == 2 ? ARRAY_SIZE(imx219_pll) : ARRAY_SIZE(imx219_pll_4lane), | ||
NULL); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not handling any failures from this table write.
TBH you may as well move the IMX219_REG_CSI_LANE_MODE
register into the array and just return the value from cci_multi_reg_write, or pass &ret
as the last argument to cci_write
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied your recommended changes in the latest commit
There's a missing line (another closing brace and semicolon) in the proposed fragment 202, but otherwise it looks okay. |
Removed overlay changes from this PR and updated driver based on 6by9's suggestion |
Can you give us a Signed-off-by line for the changes in your PRs (this and #6580)? Mine would be: |
fbcce2a
to
52d7f8a
Compare
Done for both! |
drivers/media/i2c/imx219.c
Outdated
@@ -1553,4 +1574,4 @@ module_i2c_driver(imx219_i2c_driver); | |||
|
|||
MODULE_AUTHOR("Dave Stevenson <[email protected]"); | |||
MODULE_DESCRIPTION("Sony IMX219 sensor driver"); | |||
MODULE_LICENSE("GPL v2"); | |||
MODULE_LICENSE("GPL v2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is spurious and makes checkpatch sad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now :)
Signed-off-by: Peyton Howe <[email protected]>
52d7f8a
to
381cdc3
Compare
Any comments, @6by9? |
I'd hoped to test with a module, but it got stuck in customs (hopefully arriving tomorrow). Commit message could be fuller, and include Do the pixel rate numbers work out for frame rate control? sohonomura2020's post at https://forums.raspberrypi.com/viewtopic.php?p=2283325#p2283325 implies the new IMX219_REG_PLL_VT_MPY should be 0x57 = 87 and IMX219_REG_PLL_OP_MPY should be 0x5a = 90. Your patch has 88 and 91. My maths says that IMX219_REG_PLL_OP_MPY = 91 gives a link rate of 364MHz, whilst 90 gives a link rate of 360MHz. Neither is the driver value of 363MHz. The example does say EXCK_FREQ = 12MHz. Continuing the search, registers 0x110A/B are listed as max_pre_pll_clk_div / "Maximum Pre PLL divider value" with a value of 0x0D (14 decimal), so perhaps /4 is permitted. That would be worth a test, as amending the link frequency is a pain (we'd have to log a warning for the approximation if asked for the previously "supported" value). |
I tried setting the pre-dividers to /4 and it didn't work, the frame rates are way off. What would you suggest we do here? |
My 4 lane module arrived today. I'll try and have a play tomorrow to see what we can achieve. If the specified rates can't be achieved, then they'll have to be altered, and a WARN added if the unsupported rate is requested. |
The docs are unclear here.
For a 24MHz EXCK_FREQ it'll set div 3, hence the comment in the driver source However my findings seem to match yours - the value can't be changed. I don't believe I have any further information on the IMX219 PLL configuration, and it's looking like the exact desired rates are just unachievable with a 24MHz clock. Short of a minor miracle beating the PLL into submission, I think we'll have to change the link frequencies. |
#6615 is an updated version of this (on a 6.12 kernel) that I intend to upstream. I'll sort a 6.6. backport in due course. |
Still can tweak the exact PLL settings, but this adds the overlays and driver support needed for 4-lane operation. I have tested on my Pi5 and run with both 4-lane and 2-lane cameras simultaneously.