All of lore.kernel.org
 help / color / mirror / Atom feed
* [Query] OV5640 DVP and BT656 modes
@ 2020-07-28 17:50 Lad, Prabhakar
  2020-07-28 18:42 ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Lad, Prabhakar @ 2020-07-28 17:50 UTC (permalink / raw)
  To: Steve Longerbeam, Jacopo Mondi, Laurent Pinchart
  Cc: linux-media, Chris Paterson

Hi,

I am currently investigating adding support for the BT656 format which
is currently missing in the driver.

The platform which I am currently testing can support both 8-bit DVP
and BT656 modes.
* Testing DVP mode capturing 320x240, 640x480 worked  OK with random
green lines in-between

Following is the chunk of code which enables BT656 support,  (for
BT656 mode ov5640_set_dvp_pclk() is used), with the below changes I
can get 640x480 working

#define OV5640_REG_CCIR656_CTRL00    0x4730

static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
{
    int ret;

    ret = ov5640_write_reg(sensor,
                   OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
    if (ret)
        return ret;

    ret = ov5640_write_reg(sensor,
                   OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f);
    if (ret)
        return ret;

    ret = ov5640_write_reg(sensor,
                   OV5640_REG_PAD_OUTPUT_ENABLE02, 0xfc);
    if (ret)
        return ret;

    return ov5640_write_reg(sensor,
                OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
}

As soon as I change the code to below to disable the data pads on
stream OFF as below it stops working!

static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
{
    int ret;

    ret = ov5640_write_reg(sensor,
                   OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
    if (ret)
        return ret;

    ret = ov5640_write_reg(sensor,
                   OV5640_REG_PAD_OUTPUT_ENABLE01, on ? 0x7f, 0);
    if (ret)
        return ret;

    ret = ov5640_write_reg(sensor,
                   OV5640_REG_PAD_OUTPUT_ENABLE02, on ? 0xfc, 0);
    if (ret)
        return ret;

    return ov5640_write_reg(sensor,
                OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
}

Looking at the datasheet [1] I don't find it wrong or is there any
information missing in this freely available datasheet.

Ideally BT656 mode should just work in DVP mode by setting 0x1 in
0x4730, but doesn work.

Is there anything  I'm missing here, any thoughts ?

[1] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf

Cheers,
--Prabhakar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Query] OV5640 DVP and BT656 modes
  2020-07-28 17:50 [Query] OV5640 DVP and BT656 modes Lad, Prabhakar
@ 2020-07-28 18:42 ` Laurent Pinchart
  2020-07-28 19:04   ` Lad, Prabhakar
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2020-07-28 18:42 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Steve Longerbeam, Jacopo Mondi, Laurent Pinchart, linux-media,
	Chris Paterson

Hi Prabhakar,

On Tue, Jul 28, 2020 at 06:50:21PM +0100, Lad, Prabhakar wrote:
> Hi,
> 
> I am currently investigating adding support for the BT656 format which
> is currently missing in the driver.
> 
> The platform which I am currently testing can support both 8-bit DVP
> and BT656 modes.
> * Testing DVP mode capturing 320x240, 640x480 worked  OK with random
> green lines in-between
> 
> Following is the chunk of code which enables BT656 support,  (for
> BT656 mode ov5640_set_dvp_pclk() is used), with the below changes I
> can get 640x480 working
> 
> #define OV5640_REG_CCIR656_CTRL00    0x4730
> 
> static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> {
>     int ret;
> 
>     ret = ov5640_write_reg(sensor,
>                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
>     if (ret)
>         return ret;
> 
>     ret = ov5640_write_reg(sensor,
>                    OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f);
>     if (ret)
>         return ret;
> 
>     ret = ov5640_write_reg(sensor,
>                    OV5640_REG_PAD_OUTPUT_ENABLE02, 0xfc);
>     if (ret)
>         return ret;
> 
>     return ov5640_write_reg(sensor,
>                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> }
> 
> As soon as I change the code to below to disable the data pads on
> stream OFF as below it stops working!
> 
> static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> {
>     int ret;
> 
>     ret = ov5640_write_reg(sensor,
>                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
>     if (ret)
>         return ret;
> 
>     ret = ov5640_write_reg(sensor,
>                    OV5640_REG_PAD_OUTPUT_ENABLE01, on ? 0x7f, 0);

s/,/:/ ? Is that a typo in your e-mail, or also in the code you've
tested ? I assume the former as the latter shouldn't compile.

>     if (ret)
>         return ret;
> 
>     ret = ov5640_write_reg(sensor,
>                    OV5640_REG_PAD_OUTPUT_ENABLE02, on ? 0xfc, 0);
>     if (ret)
>         return ret;
> 
>     return ov5640_write_reg(sensor,
>                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> }
> 
> Looking at the datasheet [1] I don't find it wrong or is there any
> information missing in this freely available datasheet.
> 
> Ideally BT656 mode should just work in DVP mode by setting 0x1 in
> 0x4730, but doesn work.
> 
> Is there anything  I'm missing here, any thoughts ?
> 
> [1] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Query] OV5640 DVP and BT656 modes
  2020-07-28 18:42 ` Laurent Pinchart
@ 2020-07-28 19:04   ` Lad, Prabhakar
  2020-07-28 19:54     ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Lad, Prabhakar @ 2020-07-28 19:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Steve Longerbeam, Jacopo Mondi, Laurent Pinchart, linux-media,
	Chris Paterson

Hi Laurent,

On Tue, Jul 28, 2020 at 7:43 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Prabhakar,
>
> On Tue, Jul 28, 2020 at 06:50:21PM +0100, Lad, Prabhakar wrote:
> > Hi,
> >
> > I am currently investigating adding support for the BT656 format which
> > is currently missing in the driver.
> >
> > The platform which I am currently testing can support both 8-bit DVP
> > and BT656 modes.
> > * Testing DVP mode capturing 320x240, 640x480 worked  OK with random
> > green lines in-between
> >
> > Following is the chunk of code which enables BT656 support,  (for
> > BT656 mode ov5640_set_dvp_pclk() is used), with the below changes I
> > can get 640x480 working
> >
> > #define OV5640_REG_CCIR656_CTRL00    0x4730
> >
> > static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> > {
> >     int ret;
> >
> >     ret = ov5640_write_reg(sensor,
> >                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
> >     if (ret)
> >         return ret;
> >
> >     ret = ov5640_write_reg(sensor,
> >                    OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f);
> >     if (ret)
> >         return ret;
> >
> >     ret = ov5640_write_reg(sensor,
> >                    OV5640_REG_PAD_OUTPUT_ENABLE02, 0xfc);
> >     if (ret)
> >         return ret;
> >
> >     return ov5640_write_reg(sensor,
> >                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> > }
> >
> > As soon as I change the code to below to disable the data pads on
> > stream OFF as below it stops working!
> >
> > static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> > {
> >     int ret;
> >
> >     ret = ov5640_write_reg(sensor,
> >                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
> >     if (ret)
> >         return ret;
> >
> >     ret = ov5640_write_reg(sensor,
> >                    OV5640_REG_PAD_OUTPUT_ENABLE01, on ? 0x7f, 0);
>
> s/,/:/ ? Is that a typo in your e-mail, or also in the code you've
> tested ? I assume the former as the latter shouldn't compile.
>
My bad it's a typo :) as my code base had one which doesnt disable
data pads on stream off, so I mistyped while hand crafting it.

Cheers,
Prabhakar

> >     if (ret)
> >         return ret;
> >
> >     ret = ov5640_write_reg(sensor,
> >                    OV5640_REG_PAD_OUTPUT_ENABLE02, on ? 0xfc, 0);
> >     if (ret)
> >         return ret;
> >
> >     return ov5640_write_reg(sensor,
> >                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> > }
> >
> > Looking at the datasheet [1] I don't find it wrong or is there any
> > information missing in this freely available datasheet.
> >
> > Ideally BT656 mode should just work in DVP mode by setting 0x1 in
> > 0x4730, but doesn work.
> >
> > Is there anything  I'm missing here, any thoughts ?
> >
> > [1] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf
>
> --
> Regards,
>
> Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Query] OV5640 DVP and BT656 modes
  2020-07-28 19:04   ` Lad, Prabhakar
@ 2020-07-28 19:54     ` Laurent Pinchart
  2020-07-28 20:30       ` Lad, Prabhakar
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2020-07-28 19:54 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Steve Longerbeam, Jacopo Mondi, Laurent Pinchart, linux-media,
	Chris Paterson

Hi Prabhakar,

On Tue, Jul 28, 2020 at 08:04:39PM +0100, Lad, Prabhakar wrote:
> On Tue, Jul 28, 2020 at 7:43 PM Laurent Pinchart wrote:
> > On Tue, Jul 28, 2020 at 06:50:21PM +0100, Lad, Prabhakar wrote:
> > > Hi,
> > >
> > > I am currently investigating adding support for the BT656 format which
> > > is currently missing in the driver.
> > >
> > > The platform which I am currently testing can support both 8-bit DVP
> > > and BT656 modes.
> > > * Testing DVP mode capturing 320x240, 640x480 worked  OK with random
> > > green lines in-between
> > >
> > > Following is the chunk of code which enables BT656 support,  (for
> > > BT656 mode ov5640_set_dvp_pclk() is used), with the below changes I
> > > can get 640x480 working
> > >
> > > #define OV5640_REG_CCIR656_CTRL00    0x4730
> > >
> > > static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> > > {
> > >     int ret;
> > >
> > >     ret = ov5640_write_reg(sensor,
> > >                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
> > >     if (ret)
> > >         return ret;
> > >
> > >     ret = ov5640_write_reg(sensor,
> > >                    OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f);
> > >     if (ret)
> > >         return ret;
> > >
> > >     ret = ov5640_write_reg(sensor,
> > >                    OV5640_REG_PAD_OUTPUT_ENABLE02, 0xfc);
> > >     if (ret)
> > >         return ret;
> > >
> > >     return ov5640_write_reg(sensor,
> > >                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> > > }
> > >
> > > As soon as I change the code to below to disable the data pads on
> > > stream OFF as below it stops working!

What stops working ? BT.656, non-BT.656, or both ? And how exactly does
it stop working ? The change below only affects the !on case, does the
first capture succeed and the subsequent captures fail ?

> > > static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> > > {
> > >     int ret;
> > >
> > >     ret = ov5640_write_reg(sensor,
> > >                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
> > >     if (ret)
> > >         return ret;
> > >
> > >     ret = ov5640_write_reg(sensor,
> > >                    OV5640_REG_PAD_OUTPUT_ENABLE01, on ? 0x7f, 0);
> >
> > s/,/:/ ? Is that a typo in your e-mail, or also in the code you've
> > tested ? I assume the former as the latter shouldn't compile.
>
> My bad it's a typo :) as my code base had one which doesnt disable
> data pads on stream off, so I mistyped while hand crafting it.
> 
> > >     if (ret)
> > >         return ret;
> > >
> > >     ret = ov5640_write_reg(sensor,
> > >                    OV5640_REG_PAD_OUTPUT_ENABLE02, on ? 0xfc, 0);
> > >     if (ret)
> > >         return ret;
> > >
> > >     return ov5640_write_reg(sensor,
> > >                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> > > }
> > >
> > > Looking at the datasheet [1] I don't find it wrong or is there any
> > > information missing in this freely available datasheet.
> > >
> > > Ideally BT656 mode should just work in DVP mode by setting 0x1 in
> > > 0x4730, but doesn work.
> > >
> > > Is there anything  I'm missing here, any thoughts ?
> > >
> > > [1] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Query] OV5640 DVP and BT656 modes
  2020-07-28 19:54     ` Laurent Pinchart
@ 2020-07-28 20:30       ` Lad, Prabhakar
  0 siblings, 0 replies; 5+ messages in thread
From: Lad, Prabhakar @ 2020-07-28 20:30 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Steve Longerbeam, Jacopo Mondi, Laurent Pinchart, linux-media,
	Chris Paterson

Hi Laurent,

On Tue, Jul 28, 2020 at 8:55 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Prabhakar,
>
> On Tue, Jul 28, 2020 at 08:04:39PM +0100, Lad, Prabhakar wrote:
> > On Tue, Jul 28, 2020 at 7:43 PM Laurent Pinchart wrote:
> > > On Tue, Jul 28, 2020 at 06:50:21PM +0100, Lad, Prabhakar wrote:
> > > > Hi,
> > > >
> > > > I am currently investigating adding support for the BT656 format which
> > > > is currently missing in the driver.
> > > >
> > > > The platform which I am currently testing can support both 8-bit DVP
> > > > and BT656 modes.
> > > > * Testing DVP mode capturing 320x240, 640x480 worked  OK with random
> > > > green lines in-between
> > > >
> > > > Following is the chunk of code which enables BT656 support,  (for
> > > > BT656 mode ov5640_set_dvp_pclk() is used), with the below changes I
> > > > can get 640x480 working
> > > >
> > > > #define OV5640_REG_CCIR656_CTRL00    0x4730
> > > >
> > > > static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> > > > {
> > > >     int ret;
> > > >
> > > >     ret = ov5640_write_reg(sensor,
> > > >                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
> > > >     if (ret)
> > > >         return ret;
> > > >
> > > >     ret = ov5640_write_reg(sensor,
> > > >                    OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f);
> > > >     if (ret)
> > > >         return ret;
> > > >
> > > >     ret = ov5640_write_reg(sensor,
> > > >                    OV5640_REG_PAD_OUTPUT_ENABLE02, 0xfc);
> > > >     if (ret)
> > > >         return ret;
> > > >
> > > >     return ov5640_write_reg(sensor,
> > > >                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> > > > }
> > > >
> > > > As soon as I change the code to below to disable the data pads on
> > > > stream OFF as below it stops working!
>
> What stops working ? BT.656, non-BT.656, or both ? And how exactly does
> it stop working ? The change below only affects the !on case, does the
> first capture succeed and the subsequent captures fail ?
>
Sorry for the confusion. I am mainly focusing on BT.656 atm, so with
the below (!on case) BT.6565 stops working. Using yavta to capture
single frames [1] the first run is OK and subsequent fails and its
similar behaviour with gstreamer pipeline [2] too.

[1] yavta /dev/video$1 -c1 -n3 -s640x480 -fUYVY -Fov.raw
[2] gst-launch-1.0 -emv v4l2src device=/dev/video$1 io-mode=dmabuf !
queue ! 'video/x-raw,format=UYVY,width=640,height=480,framerate=30/1'
! queue ! videoconvert ! queue ! fbdevsink sync=false

Cheers,
Prabhakar

> > > > static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on)
> > > > {
> > > >     int ret;
> > > >
> > > >     ret = ov5640_write_reg(sensor,
> > > >                    OV5640_REG_IO_MIPI_CTRL00, on ? 0x18: 0);
> > > >     if (ret)
> > > >         return ret;
> > > >
> > > >     ret = ov5640_write_reg(sensor,
> > > >                    OV5640_REG_PAD_OUTPUT_ENABLE01, on ? 0x7f, 0);
> > >
> > > s/,/:/ ? Is that a typo in your e-mail, or also in the code you've
> > > tested ? I assume the former as the latter shouldn't compile.
> >
> > My bad it's a typo :) as my code base had one which doesnt disable
> > data pads on stream off, so I mistyped while hand crafting it.
> >
> > > >     if (ret)
> > > >         return ret;
> > > >
> > > >     ret = ov5640_write_reg(sensor,
> > > >                    OV5640_REG_PAD_OUTPUT_ENABLE02, on ? 0xfc, 0);
> > > >     if (ret)
> > > >         return ret;
> > > >
> > > >     return ov5640_write_reg(sensor,
> > > >                 OV5640_REG_CCIR656_CTRL00, on ? 0x1: 0x0);
> > > > }
> > > >
> > > > Looking at the datasheet [1] I don't find it wrong or is there any
> > > > information missing in this freely available datasheet.
> > > >
> > > > Ideally BT656 mode should just work in DVP mode by setting 0x1 in
> > > > 0x4730, but doesn work.
> > > >
> > > > Is there anything  I'm missing here, any thoughts ?
> > > >
> > > > [1] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf
>
> --
> Regards,
>
> Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-28 20:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 17:50 [Query] OV5640 DVP and BT656 modes Lad, Prabhakar
2020-07-28 18:42 ` Laurent Pinchart
2020-07-28 19:04   ` Lad, Prabhakar
2020-07-28 19:54     ` Laurent Pinchart
2020-07-28 20:30       ` Lad, Prabhakar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.