Re: [PATCH v2 4/4] media: i2c: ov5640: Fallback to parallel mode

From: Sakari Ailus
Date: Tue Aug 04 2020 - 04:18:08 EST


Hi Prabhakar,

On Mon, Aug 03, 2020 at 03:31:47PM +0100, Lad Prabhakar wrote:
> Fallback to parallel mode if bus_type doesn't match the supported
> interfaces by the driver.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> ---
> drivers/media/i2c/ov5640.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 08c67250042f..4e88b0540740 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -3074,6 +3074,12 @@ static int ov5640_probe(struct i2c_client *client)
> return ret;
> }
>
> + /* fallback to parallel mode */
> + if (sensor->ep.bus_type != V4L2_MBUS_PARALLEL &&
> + sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY &&
> + sensor->ep.bus_type != V4L2_MBUS_BT656)
> + sensor->ep.bus_type = V4L2_MBUS_PARALLEL;

You basically need the type from the v4l2_fwnode_endpoint_parse(), and if
you don't have any of the above bus types, probe should fail. The old
bindings were documented in a way that either parallel or CSI-2 bus will be
used, and there were no defaults. So all should be well.

--
Sakari Ailus