media: i2c: vd55g1: Two control fixes
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 1 replyIn review
- v22 patches 4 repliesSuperseded
- v12 patches 1 replySuperseded
Changes in v3 from the cover letter
- 2/2: new approach, see above (Sakari)
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | media: i2c: vd55g1: Mark the AE lock and bias controls inactive in manual modedrivers/ | +2 | 0 replies | |
| 2/2 | media: i2c: vd55g1: Use the control handler lock for the subdev statedrivers/ | +33 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/2] media: i2c: vd55g1: Two control fixes
1/2 marks the auto exposure lock and bias controls inactive rather than grabbed in manual exposure mode. It is unchanged; Sakari's question on it is answered on v2.
2/2 replaces v2's hand-written event ops, as Sakari asked: it initialises the controls before v4l2_subdev_init_finalize(), which enables control events. The same order fixes a locking bug the driver has had since it was added: the state lock was set before the control handler lock existed, so the two were separate mutexes. Moving the finalise alone deadlocks the first stream start, because vd55g1_grab_ctrls() then takes the control handler lock a second time, so 2/2 also switches it to __v4l2_ctrl_grab(). 2/2 does not depend on 1/2.
Because of the locking bug, 2/2 carries Fixes and Cc: stable, unlike v2. Benjamin, drop them if you would rather not have it backported.
Changes since v2:
- 2/2: new approach, see above (Sakari)
Testing. I do not have a VD55G1, so this was tested on the VD55G0 of a Surface Pro 9 (IPU6) through an out-of-tree driver derived from vd55g1. It is identical in the code 2/2 touches, apart from one more format-dependent control (pixel rate). A test-only print in s_ctrl() compared the two locks:
- before 2/2, VIDIOC_S_CTRL ran s_ctrl() with only the control lock held, and setting the active format and stream on ran it with only the state lock held;
- with 2/2 they are one lock, held in all three cases;
- without the __v4l2_ctrl_grab() change, the first stream start hung in vd55g1_grab_ctrls(), blocked on the mutex it already held.
The controls at probe and after a format change match the unpatched driver, apart from the default of that driver's pixel rate control, which my port of 2/2 left at its placeholder. The flip and test pattern controls are grabbed while streaming and released after. R8 644x604, R10 and R10_CSI2P 640x480 streamed 90 of 90 frames, and five start/stop cycles were clean. v4l2-compliance on the subdev gives the same results as with v2, in both exposure modes, and control events pass. The kernel here has no lockdep, hence the print.
v2: https://lore.kernel.org/linux-media/[email protected]/
v1: https://lore.kernel.org/linux-media/[email protected]/
Fernando Rimoli (2):
media: i2c: vd55g1: Mark the AE lock and bias controls inactive in
manual mode
media: i2c: vd55g1: Use the control handler lock for the subdev state
drivers/media/i2c/vd55g1.c | 65 ++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 30 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Signature · 1 line
2.43.0