Conversation
Insert a usleep_range(30000, 50000) settle window between the final mode-configuration register write and the MODE_SELECT=STREAMING write in imx471_start_streaming(). On platforms with a discrete MIPI retimer between the sensor and the IPU CSI2 receiver, the retimer's PLL/CDR needs time to complete HS lock after the sensor is powered back on (e.g. after a privacy-shutter reopen). Without this margin, the very first HS burst can arrive before the retimer has locked, causing the CSI2 receiver to flag short-packet errors on frame 0 of the new streaming session, which can cascade into sync-frame-drop / poll-timeout symptoms downstream. WIP: posting for early feedback, not ready for review yet. Signed-off-by: Amarnath Kumar, Deepak <deepak.amarnath.kumar@intel.com>
Replace the fixed usleep_range(30000, 50000) settle delay with a per-platform configurable value (imx471->settle_delay_us, default 40ms +/-10ms), overridable via the optional firmware property "intel,retimer-settle-delay-us". This mirrors the pattern used by the Windows sensor driver, which defines a per-module default delay that can be overridden via a registry key (OS_ReadRegistry_V2(..., "IsSupportCameraMask"/delay overrides, ...)). Linux lacks the same per-DSDT-module-name string identification Windows uses, so this exposes the equivalent knob as a standard fwnode/ACPI property instead, so specific boards (e.g. platforms with a discrete MIPI retimer) can tune the value without a code change. Signed-off-by: Amarnath Kumar, Deepak <deepak.amarnath.kumar@intel.com>
- imx471_power_off(): assert hardware reset (XCLR low) and wait 1-2ms while the imaging clock is still active, before disabling the clock and regulator. Previously the clock was cut before reset was asserted, risking undefined internal sensor state on next power-up. - imx471_power_on(): assert reset immediately, then enable regulator/clock, hold reset low for >= 20ms while supplies and MCLK stabilize, then release reset and wait 30ms for the sensor's internal PLL and I2C core to stabilize before any register access. Previously reset was never actively asserted during power-up and had no hold time, matching reference driver patterns (ov01a10.c, ov02c10.c, ov5675.c) that all assert reset for >= 2-20ms during power-up and enforce a post-reset settle delay. This is a separate, complementary fix to the retimer settle delay in imx471_start_streaming(): this one ensures the sensor's own internal state (frame counters, PLL, I2C core) is reliably reset on every power-on, independent of any external MIPI retimer. Signed-off-by: Amarnath Kumar, Deepak <deepak.amarnath.kumar@intel.com>
Issue IMX471_REG_SW_RESET (0x0103=1) and place the sensor in standby (MODE_SELECT=STANDBY) at the start of imx471_start_streaming(), before identify_module()/register configuration, to reset frame counters and digital logic on every stream start. Uses a 10-15ms settle window after the software reset write (matching ov2740.c and imx258.c's ~12ms), NOT the shorter 1-2ms initially proposed: a too-short settle here was previously observed to cause MIPI runt packets on frame 0 and FLL/VMAX timing-register corruption (66 FPS overrun) when register writes landed while the digital core was still mid-reset. Signed-off-by: Amarnath Kumar, Deepak <deepak.amarnath.kumar@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status: WIP — for early feedback only, not ready for review.
Problem
On platforms with a discrete MIPI retimer between the imx471 sensor and the IPU CSI2 receiver (e.g. Lenovo privacy-shutter designs that gate the retimer via EC), reopening the camera stream (privacy shutter un-shutter /
switchToNormal) can produce CSI2 short-packet errors (error status 0x00000020/0x00000048) on the very first frame of the new session, which can cascade into sync-frame-drop and V4L2 poll timeouts downstream.Root cause
imx471_start_streaming()writesMODE_SELECT = STREAMINGwith no settle margin after finishing register configuration. This triggers the sensor's first MIPI HS burst immediately, racing against the external retimer's PLL/CDR lock time (which is not tracked or signaled back to the driver).Change
Adds a
usleep_range(30000, 50000)settle window immediately before theMODE_SELECT = STREAMINGwrite inimx471_start_streaming(), giving the retimer time to complete HS lock before the sensor begins transmitting.Notes