diff mbox series

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

Message ID 1596465107-14251-5-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series media: i2c: ov5640 feature enhancement and fixes | expand

Commit Message

Lad Prabhakar Aug. 3, 2020, 2:31 p.m. UTC
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@bp.renesas.com>
---
 drivers/media/i2c/ov5640.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Sakari Ailus Aug. 4, 2020, 8:18 a.m. UTC | #1
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@bp.renesas.com>
> ---
>  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.
Lad, Prabhakar Aug. 5, 2020, 8:32 a.m. UTC | #2
Hi Sakari,

Thank you for the review.

On Tue, Aug 4, 2020 at 9:18 AM Sakari Ailus
<sakari.ailus@linux.intel.com> wrote:
>
> 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@bp.renesas.com>
> > ---
> >  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.
>
The bus_type is coming from v4l2_fwnode_endpoint_parse(), I'll add the
check to fail if type doesn't match the supported interfaces and drop
the above check.

Cheers,
Prabhakar

> --
> Sakari Ailus
diff mbox series

Patch

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;
+
 	/* get system clock (xclk) */
 	sensor->xclk = devm_clk_get(dev, "xclk");
 	if (IS_ERR(sensor->xclk)) {