Skip to content

IMX708 ccs and link frequency changes - #7605

Open
naushir wants to merge 5 commits into
raspberrypi:rpi-6.18.yfrom
naushir:imx708_ccs_link_freq
Open

naushir wants to merge 5 commits into
raspberrypi:rpi-6.18.yfrom
naushir:imx708_ccs_link_freq

Conversation

@naushir

@naushir naushir commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
@naushir
naushir force-pushed the imx708_ccs_link_freq branch from 4f58560 to e8f0ba8 Compare September 8, 2026 14:32
@naushir

naushir commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@6by9 and @jailuthra are you both ok for me to merge this change?

@6by9 6by9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, thought I'd submitted this review.

The last two patches feel awkward as it is still defining fixed link frequencies.

Can we do similar to imx355 where as long as the link frequency is valid, we adopt it? In this case it will need to have a list of min link_frequency for each step of line_length_pck because imx708 wants discrete values. Perhaps we do that as a refinement if it doesn't fall out easily.

Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
@6by9

6by9 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

I've just noticed that 4dba86f in my 4 lane support patch set does change it to validate the DT link frequency, and then advertise that value. My validation is via computation rather than ccs_pll though.

@naushir

naushir commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

All fixed. @jailuthra I've updated your patches a bit and added my SoB tag to them.

I'll work on the more flexible link-frequency updates on top of this.

@naushir
naushir force-pushed the imx708_ccs_link_freq branch from e8f0ba8 to 8a2118d Compare October 27, 2026 09:39
@naushir

naushir commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@6by9 ready for you to have another check.

@6by9 6by9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor nit picks. It'll do as is, but there are some cleanups possible.

Comment thread drivers/media/i2c/imx708.c Outdated
{ CCI_REG8(0x3cbd), 0x3c },
{ CCI_REG8(0x3cbe), 0x00 },
{ CCI_REG8(0x3cbf), 0x00 },
{ CCI_REG8(0x0202), 0x0a },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional clean up not required for this patchset:

  • merge the relevant registers into CCI_REG16.
  • 0x0202/3 is actually coarse integration time, defined as IMX708_REG_EXPOSURE and set by V4L2_CID_EXPOSURE, so these values have no business being in the modes table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the exposure regs, but I'll leave out the folding into CCI_REG16() as that will severely trample Jai's patch.

Comment thread drivers/media/i2c/imx708.c Resolved
Comment thread drivers/media/i2c/imx708.c Resolved
.pixel_rate = 595200000,
.timings = {
{
.line_length_pix = 0x3d20,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for the line length to be in hex?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No specific reason, just following similar convention of reg values as hex.

jailuthra and others added 5 commits October 28, 2026 13:57
…ites

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
When the PLL is configured in DUAL_MODE (separate VT and OP trees) and
the sensor's FIFOs allow derating and/or overrating, the VT pixel rate
might be higher or lower than OP pixel rate.

Support such usecases by allowing an optional input for the target VT
pixel rate.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Replace the PLL dividers and multipliers hard coded into the mode and link
frequency register lists with a call to the CCS PLL calculator, describing
the sensor clock tree limits from its manual. The pre-PLL dividers are
pinned to the values those register lists used, so the tree the calculator
arrives at is the one the driver has always programmed, which was confirmed
against every mode at every link frequency.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Give each mode an array of timings rather than one fixed set, so that
a mode can run faster when the link has the bandwidth for it. A mode
uses the higest link frequency timings specified.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Add timings for a 960MHz link frequency, which gives the full resolution
mode enough bandwidth to reach 30fps and roughly doubles the rate of the
binned modes.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
@naushir
naushir force-pushed the imx708_ccs_link_freq branch from 8a2118d to 9c32129 Compare October 28, 2026 14:01
peyton-howe added a commit to peyton-howe/ubuntu-image-builder that referenced this pull request Nov 2, 2026
Replace the DKMS imx708 driver's fixed 2-lane timings with a table of
timings per link frequency, with separate timings for two and four data
lanes, after Raspberry Pi's imx708 link frequency PR
(raspberrypi/linux#7605). 4608x2592 now runs at up to 60 fps on four lanes.

- Two or four data lanes, read from the device tree.
- Each mode has a fallback timing (the Pi's) plus a row per link
  frequency: 447, 549, 750, 960 and 1002 MHz. A row holds a timing for two
  lanes and one for four, at the same pixel rate with half the line length
  on four lanes.
- The PLL registers are static values per timing and per link frequency
  (no CCS PLL calculator). LINE_LENGTH_PCK is written from the timing.
- Each row keeps about 0.5 us of idle link time per line: a 2304x1296 line
  that left 0.34 us idle made the next stream get no frames until a reboot.
- 4608x2592: 30 fps at 549 MHz, 45 at 750 MHz and 60 at 1002 MHz on four
  lanes. 2304x1296 reaches 172 fps at 750 MHz and 220 at 1002 MHz.
- A failed line length write is reported as one, not as a PLL failure.

Tested with raw captures on an Orange Pi 5B (CAM1, CAM2) and a ROCK 5B+
(CAM0): four lanes at 750, 960 and 1002 MHz, and the 450 MHz two-lane
default, match the table. Not run on hardware: the other two-lane rows,
four lanes at 447 and 549 MHz, and HDR. Processed streams above about
115 fps still stall in the rkisp2 interrupt path; this is not changed here.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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