media: i2c: ov08x40: Default to a mode matching the lane count
PATCH 1/1 media: i2c: ov08x40: Default to a mode matching the lane count
On 2-lane boards, probe and open() default to 3856x2416, a 4-lane only mode. Use the largest mode supported by the configured number of lanes.
Signed-off-by Pierre Pinon <[email protected]>
---
This follows up on the review of the get_selection v2:
https://lore.kernel.org/linux-media/[email protected]/
drivers/media/i2c/ov08x40.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/media/i2c/ov08x40.c +16 -2
@@ -1541,10 +1541,24 @@ static int ov08x40_write_reg_list(struct ov08x40 *ov08x,return ov08x40_write_regs (ov08x, r_list->regs, r_list->num_of_regs); } +/* Largest mode supported by the configured number of CSI-2 data lanes */ +static const struct ov08x40_mode * +ov08x40_default_mode (const struct ov08x40 *ov08x) +{ +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (supported_modes); i++) { +if (supported_modes[i].lanes == ov08x->mipi_lanes) +return &supported_modes[i]; + } + +return &supported_modes[0 ]; +} +static int ov08x40_open (struct v4l2_subdev *sd,struct v4l2_subdev_fh *fh) { -const struct ov08x40_mode *default_mode = &supported_modes[0 ];struct ov08x40 *ov08x =to_ov08x40 (sd); +const struct ov08x40_mode *default_mode =ov08x40_default_mode (ov08x);struct v4l2_mbus_framefmt *try_fmt =v4l2_subdev_state_get_format (fh->state,0 );
@@ -2309,7 +2323,7 @@ static int ov08x40_probe(struct i2c_client *client) }/* Set default mode to max resolution */ - ov08x->cur_mode = &supported_modes[0 ]; + ov08x->cur_mode =ov08x40_default_mode (ov08x); ret =ov08x40_init_controls (ov08x);if (ret)
Signature · 1 line
2.55.0