Skip to content

Conversation

jailuthra
Copy link
Contributor

Add support for 2x2 binning mode for Sony IMX335, along with some improvements like using subdev active state, fixing the native pixel array width to match the datasheet (this was needed to circumvent #6896) and misc improvements to the driver.

These changes are picked from these two upstream series, posted by me and @kbingham:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/

jailuthra and others added 7 commits September 20, 2025 11:40
The sensor datasheet reports actual total number of pixels as 2696x2044.

This becomes important for supporting 2x2 binning modes that can go
beyond the current maximum pixel array width set here.

Reviewed-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
While switching modes, updating to a different value of HBLANK isn't
sufficient, as this is a read-only control with a single allowed value,
and thus hblank_min == hblank_max == hblank of the default mode.

So to correctly update the user-facing value of the HBLANK parameter,
which is necessary for correct framerate calculation, update the whole
range when switching modes.

Reviewed-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
Simplify .s_stream callback implementation by moving the runtime PM
calls to the leaf functions. This patch should not affect any
functionality.

Reviewed-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
Port the driver to use the subdev active state. This simplifies locking,
and makes it easier to support different crop sizes for binned modes, by
storing the crop rectangle inside the subdev state.

Reviewed-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
Introduce 2x2 binning mode (1312x972@60fps). Since there are multiple
modes now, use v4l2_find_nearest_size() to select the appropriate mode
in .set_fmt().

For 2x2 binning the minimum shutter value supported is 17 instead of 9.
This effects the maximum allowed exposure time, and if not enforced then
the sensor produces very dark frames when the minimum shutter limit is
violated.

Lastly, update the crop size reported to the userspace. When trying 2x2
binning with the datasheet suggested pixel array size (i.e. 2592 / 2 =>
1296), on some platforms (Raspberry Pi 5) artefacts are introduced on
the right edge of the output image. Instead, using a higher width of
1312 works fine on all platforms.

Reviewed-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
Switch from s_stream to enable_streams and disable_streams callbacks.

Reviewed-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
In the early probe we can fail with -EPROBE_DEFER.

Use dev_err_probe to ignore these warnings before we successfully power
on the camera.

Signed-off-by: Kieran Bingham <[email protected]>
Signed-off-by: Jai Luthra <[email protected]>
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.

2 participants