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

IMX219: Adjust PLL settings based on the number of MIPI lanes #6575

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

Conversation

peyton-howe
Copy link

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.

@6by9
Copy link
Contributor

6by9 commented Jan 1, 2025

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

diff --git a/arch/arm/boot/dts/overlays/imx219-overlay.dts b/arch/arm/boot/dts/overlays/imx219-overlay.dts
index 4c4bcd309a3d..3411d5bbd8ce 100644
--- a/arch/arm/boot/dts/overlays/imx219-overlay.dts
+++ b/arch/arm/boot/dts/overlays/imx219-overlay.dts
@@ -65,6 +65,21 @@ csi_ep: endpoint {
                };
        };
 
+       fragment@201 {
+               target = <&csi_ep>;
+               __dormant__ {
+                       data-lanes = <1 2 3 4>;
+               };
+       };
+
+       fragment@202 {
+               target = <&cam_endpoint>;
+               __dormant__ {
+                       data-lanes = <1 2 3 4>;
+                       link-frequencies =
+                               /bits/ 64 <363000000>;
+       };
+
        __overrides__ {
                rotation = <&cam_node>,"rotation:0";
                orientation = <&cam_node>,"orientation:0";
@@ -77,6 +92,7 @@ __overrides__ {
                       <&vcm>, "VANA-supply:0=", <&cam0_reg>;
                vcm = <&vcm>, "status=okay",
                      <&cam_node>,"lens-focus:0=", <&vcm>;
+               4lane = <0>, "+201+202";
        };
 };

imx219->lanes == 2 ? imx219_pll : imx219_pll_4lane,
imx219->lanes == 2 ? ARRAY_SIZE(imx219_pll) : ARRAY_SIZE(imx219_pll_4lane),
NULL);

Copy link
Contributor

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.

Copy link
Author

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

@pelwell
Copy link
Contributor

pelwell commented Jan 1, 2025

There's a missing line (another closing brace and semicolon) in the proposed fragment 202, but otherwise it looks okay.

@peyton-howe peyton-howe changed the title IMX219: Add overlay and fix PLL settings for 4-lane operation IMX219: Update PLL settings based on the number of MIPI lanes Jan 4, 2025
@peyton-howe
Copy link
Author

Removed overlay changes from this PR and updated driver based on 6by9's suggestion

@pelwell
Copy link
Contributor

pelwell commented Jan 4, 2025

Can you give us a Signed-off-by line for the changes in your PRs (this and #6580)? Mine would be: Signed-off-by: Phil Elwell <[email protected]>

@peyton-howe peyton-howe changed the title IMX219: Update PLL settings based on the number of MIPI lanes IMX219: Adjust PLL settings based on the number of MIPI lanes Jan 5, 2025
@peyton-howe
Copy link
Author

Done for both!

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.

3 participants