Skip to content

Commit 6b6df36

Browse files
media/platform/raspberypi/rp1_cfg: Candidate fix for #5821
To avoid lost frame start in a subsequent session, avoid setting the number of lanes back to 1 or putting CSI-2 Host into reset. It's not clear if this is a watertight fix -- what if the camera itself produced a truncated or garbled packet, or continued to send until the next start? -- but it does seem to fix the issue. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
1 parent f5726fb commit 6b6df36

File tree

1 file changed

+13
-3
lines changed
  • drivers/media/platform/raspberrypi/rp1_cfe

1 file changed

+13
-3
lines changed

drivers/media/platform/raspberrypi/rp1_cfe/dphy.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ static void dphy_init(struct dphy_data *dphy)
149149

150150
void dphy_start(struct dphy_data *dphy)
151151
{
152+
dw_csi2_host_write(dphy, RESETN, 0);
152153
dw_csi2_host_write(dphy, N_LANES, (dphy->active_lanes - 1));
153154
dphy_init(dphy);
154155
dw_csi2_host_write(dphy, RESETN, 0xffffffff);
@@ -157,9 +158,18 @@ void dphy_start(struct dphy_data *dphy)
157158

158159
void dphy_stop(struct dphy_data *dphy)
159160
{
160-
/* Set only one lane (lane 0) as active (ON) */
161-
dw_csi2_host_write(dphy, N_LANES, 0);
162-
dw_csi2_host_write(dphy, RESETN, 0);
161+
/*
162+
* We no longer go into reset here, because the camera might still be
163+
* streaming. If we kill the CSI-2 Host in mid-packet, it can leave the
164+
* IDI interface in a bad state, causing the next packet to be lost.
165+
*
166+
* XXX Is it safe to assume it will be idle before the next dphy_start?
167+
* XXX What happens if the camera itself generates an incomplete packet?
168+
*
169+
* TODO: Instead, should we consider resetting the *entire* MIPI block
170+
* (including CSI2AXI and ISP-FE)? That can't safely be done until
171+
* all AXI traffic has completed. It would cause APB access to hang.
172+
*/
163173
}
164174

165175
void dphy_probe(struct dphy_data *dphy)

0 commit comments

Comments
 (0)