linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugues FRUCHET <hugues.fruchet@st.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Paul <paul.kocialkowski@bootlin.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	Prabhakar <prabhakar.csengg@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH v4 3/6] media: i2c: ov5640: Enable data pins on poweron for DVP mode
Date: Mon, 7 Sep 2020 09:44:17 +0000	[thread overview]
Message-ID: <5fd9865f-4c4d-66c7-1fb4-ec3e65ab0d28@st.com> (raw)
In-Reply-To: <20200904201835.5958-4-prabhakar.mahadev-lad.rj@bp.renesas.com>

Hi Prabhakar,

Thanks for your patches, good to see one more OV5640 stakeholder 
upstreaming some fixes/features.

I'm also using a parallel setup with OV5640 connected on STM32 DCMI 
camera interface.
First basic tests have not shown any regressions on my side but I would 
like to better understand the problem you encountered and the way you 
solve it, see below my comments.


On 9/4/20 10:18 PM, Lad Prabhakar wrote:
> During testing this sensor on iW-RainboW-G21D-Qseven platform in 8-bit DVP
> mode with rcar-vin bridge noticed the capture worked fine for the first run
> (with yavta), but for subsequent runs the bridge driver waited for the
> frame to be captured. Debugging further noticed the data lines were
> enabled/disabled in stream on/off callback and dumping the register
> contents 0x3017/0x3018 in ov5640_set_stream_dvp() reported the correct
> values, but yet frame capturing failed.

Could you show the sequence of V4L2 calls which lead to freeze ?

Reading the patch you proposed, my guess is that issue is coming when 
multiple S_STREAM(on)/S_STREAM(off) are made while power remains, is 
that true ?
I have added some traces in code and tried to reproduce with yavta, 
v4l2-ctl and GStreamer but I'm not able to generate such sequence, here 
is what I got everytime:

[  809.113790] ov5640 0-003c: ov5640_s_power>
[  809.116431] ov5640 0-003c: ov5640_set_power>
[  809.120788] ov5640 0-003c: ov5640_set_power_on>
[  809.622047] ov5640 0-003c: ov5640_set_power_dvp>
[  809.862734] ov5640 0-003c: ov5640_s_stream>
[  809.865462] ov5640 0-003c: ov5640_set_stream_dvp on>
<capturing here>
[  828.549531] ov5640 0-003c: ov5640_s_stream>
[  828.552265] ov5640 0-003c: ov5640_set_stream_dvp off>
[  828.580970] ov5640 0-003c: ov5640_s_power>
[  828.583613] ov5640 0-003c: ov5640_set_power>
[  828.587921] ov5640 0-003c: ov5640_set_power_dvp>
[  828.620346] ov5640 0-003c: ov5640_set_power_off>

Which application/command line are you using to reproduce your problem ?


> 
> To get around this issue data lines are enabled in s_power callback.
> (Also the sensor remains in power down mode if not streaming so power
> consumption shouldn't be affected)

For the time being, I really don't understand why this patch is fixing 
capture freeze.

> 
> Fixes: f22996db44e2d ("media: ov5640: add support of DVP parallel interface")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>   drivers/media/i2c/ov5640.c | 73 +++++++++++++++++++++-----------------
>   1 file changed, 40 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 8af11d532699..8288728d8704 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -276,8 +276,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)
>   /* YUV422 UYVY VGA@30fps */
>   static const struct reg_value ov5640_init_setting_30fps_VGA[] = {
>   	{0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0},
> -	{0x3103, 0x03, 0, 0}, {0x3017, 0x00, 0, 0}, {0x3018, 0x00, 0, 0},
> -	{0x3630, 0x36, 0, 0},
> +	{0x3103, 0x03, 0, 0}, {0x3630, 0x36, 0, 0},
>   	{0x3631, 0x0e, 0, 0}, {0x3632, 0xe2, 0, 0}, {0x3633, 0x12, 0, 0},
>   	{0x3621, 0xe0, 0, 0}, {0x3704, 0xa0, 0, 0}, {0x3703, 0x5a, 0, 0},
>   	{0x3715, 0x78, 0, 0}, {0x3717, 0x01, 0, 0}, {0x370b, 0x60, 0, 0},
> @@ -1283,33 +1282,6 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on)
>   	if (ret)
>   		return ret;
>   
> -	/*
> -	 * enable VSYNC/HREF/PCLK DVP control lines
> -	 * & D[9:6] DVP data lines
> -	 *
> -	 * PAD OUTPUT ENABLE 01
> -	 * - 6:		VSYNC output enable
> -	 * - 5:		HREF output enable
> -	 * - 4:		PCLK output enable
> -	 * - [3:0]:	D[9:6] output enable
> -	 */
> -	ret = ov5640_write_reg(sensor,
> -			       OV5640_REG_PAD_OUTPUT_ENABLE01,
> -			       on ? 0x7f : 0);
> -	if (ret)
> -		return ret;
> -
> -	/*
> -	 * enable D[5:0] DVP data lines
> -	 *
> -	 * PAD OUTPUT ENABLE 02
> -	 * - [7:2]:	D[5:0] output enable
> -	 */
> -	ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE02,
> -			       on ? 0xfc : 0);
> -	if (ret)
> -		return ret;
> -
>   	return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ?
>   				OV5640_REG_SYS_CTRL0_SW_PWUP :
>   				OV5640_REG_SYS_CTRL0_SW_PWDN);
> @@ -2069,6 +2041,40 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
>   	return 0;
>   }
>   
> +static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on)
> +{
> +	int ret;
> +
> +	if (!on) {
> +		/* Reset settings to their default values. */
> +		ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE01, 0x00);
> +		ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE02, 0x00);
> +		return 0;
> +	}
> +
> +	/*
> +	 * enable VSYNC/HREF/PCLK DVP control lines
> +	 * & D[9:6] DVP data lines
> +	 *
> +	 * PAD OUTPUT ENABLE 01
> +	 * - 6:		VSYNC output enable
> +	 * - 5:		HREF output enable
> +	 * - 4:		PCLK output enable
> +	 * - [3:0]:	D[9:6] output enable
> +	 */
> +	ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f);
> +	if (ret)
> +		return ret;
> +
> +	/*
> +	 * enable D[5:0] DVP data lines
> +	 *
> +	 * PAD OUTPUT ENABLE 02
> +	 * - [7:2]:	D[5:0] output enable
> +	 */
> +	return ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE02, 0xfc);
> +}
> +
>   static int ov5640_set_power(struct ov5640_dev *sensor, bool on)
>   {
>   	int ret = 0;
> @@ -2083,11 +2089,12 @@ static int ov5640_set_power(struct ov5640_dev *sensor, bool on)
>   			goto power_off;
>   	}
>   
> -	if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
> +	if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY)
>   		ret = ov5640_set_power_mipi(sensor, on);
> -		if (ret)
> -			goto power_off;
> -	}
> +	else
> +		ret = ov5640_set_power_dvp(sensor, on);
> +	if (ret)
> +		goto power_off;
>   
>   	if (!on)
>   		ov5640_set_power_off(sensor);
> 

Best regards,
Hugues.

  reply	other threads:[~2020-09-07  9:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 20:18 [PATCH v4 0/6] media: i2c: ov5640 feature enhancement and fixes Lad Prabhakar
2020-09-04 20:18 ` [PATCH v4 1/6] media: i2c: ov5640: Remain in power down for DVP mode unless streaming Lad Prabhakar
2020-09-09 16:16   ` Hugues FRUCHET
2021-06-29 10:47     ` Eugen.Hristev
2021-12-21  7:37       ` Eugen.Hristev
2021-12-21 12:06         ` Sakari Ailus
2021-12-21 14:47         ` Lad, Prabhakar
2021-12-21 15:01           ` Eugen.Hristev
2021-12-21 15:11             ` Lad, Prabhakar
2022-01-03 11:29               ` Eugen.Hristev
2022-01-04  9:57                 ` Lad, Prabhakar
2022-01-07 15:49                   ` Lad, Prabhakar
2020-09-04 20:18 ` [PATCH v4 2/6] media: i2c: ov5640: Separate out mipi configuration from s_power Lad Prabhakar
2020-09-04 20:18 ` [PATCH v4 3/6] media: i2c: ov5640: Enable data pins on poweron for DVP mode Lad Prabhakar
2020-09-07  9:44   ` Hugues FRUCHET [this message]
2020-09-07 14:35     ` Lad, Prabhakar
2020-09-09 15:48       ` Hugues FRUCHET
2020-09-04 20:18 ` [PATCH v4 4/6] media: i2c: ov5640: Configure HVP lines in s_power callback Lad Prabhakar
2020-09-04 20:18 ` [PATCH v4 5/6] media: i2c: ov5640: Add support for BT656 mode Lad Prabhakar
2020-09-04 20:18 ` [PATCH v4 6/6] media: i2c: ov5640: Fail probe on unsupported bus_type Lad Prabhakar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5fd9865f-4c4d-66c7-1fb4-ec3e65ab0d28@st.com \
    --to=hugues.fruchet@st.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=slongerbeam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).