public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hao Yao <hao.yao@intel.com>
To: Bingbu Cao <bingbu.cao@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	"Tianshu Qiu" <tian.shu.qiu@intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Kate Hsuan <hpa@redhat.com>, <linux-media@vger.kernel.org>
Subject: Re: [PATCH v2 8/9] media: ov2740: Add a sleep after resetting the sensor
Date: Mon, 27 Nov 2023 14:39:29 +0800	[thread overview]
Message-ID: <8da923c3-03e4-49a0-ace5-0b62e6a6a20d@intel.com> (raw)
In-Reply-To: <493daf1a-373d-ed48-8136-0aab3ab925f4@linux.intel.com>

Hi Bingbu, Hans,

On 2023/11/27 12:15, Bingbu Cao wrote:
> 
> Hans,
> 
> On 11/26/23 10:15 PM, Hans de Goede wrote:
>> Split the resetting of the sensor out of the link_freq_config reg_list
>> and add a delay after this.
>>
>> This hopefully fixes the stream sometimes not starting, this was
>> taken from the ov2740 sensor driver in the out of tree IPU6 driver:
> 
> Thanks for your patch.
> 
> I don't know the details for ov2740 here, we met some similar issues
> with another OminiVision camera sensor, it is somehow related to the
> OTP read. Unfortunately, we didn't find the root-cause.
> 
> Maybe you can remove the OTP read to check, I think the OTP is useless
> if I don't forget anything.
> 
> Hao, do you have any details for this issue?
> 

Are we talking about this Github issue?
https://github.com/intel/ipu6-drivers/issues/187

I remembered that I added sleep after the power on/off. As for software 
resetting, I encountered similar issue when I worked on HM2170 sensor. 
It hangs if we transfer I2C messages immediately after software reset. 
Even OV2740 document didn't say anything about delay after software 
reset, I think it's worth a try.

I didn't use the OTP feature so I didn't look into it on OV2740.


Best Regards,
Hao Yao

>>
>> https://github.com/intel/ipu6-drivers/
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/media/i2c/ov2740.c | 11 +++++++++--
>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
>> index 8f5c33f68d42..a49c065c6cf4 100644
>> --- a/drivers/media/i2c/ov2740.c
>> +++ b/drivers/media/i2c/ov2740.c
>> @@ -128,7 +128,6 @@ struct ov2740_mode {
>>   };
>>   
>>   static const struct ov2740_reg mipi_data_rate_720mbps[] = {
>> -	{0x0103, 0x01},
>>   	{0x0302, 0x4b},
>>   	{0x030d, 0x4b},
>>   	{0x030e, 0x02},
>> @@ -137,7 +136,6 @@ static const struct ov2740_reg mipi_data_rate_720mbps[] = {
>>   };
>>   
>>   static const struct ov2740_reg mipi_data_rate_360mbps[] = {
>> -	{0x0103, 0x01},
>>   	{0x0302, 0x4b},
>>   	{0x0303, 0x01},
>>   	{0x030d, 0x4b},
>> @@ -935,6 +933,15 @@ static int ov2740_start_streaming(struct ov2740 *ov2740)
>>   	if (ov2740->nvm)
>>   		ov2740_load_otp_data(ov2740->nvm);
>>   
>> +	/* Reset the sensor */
>> +	ret = ov2740_write_reg(ov2740, 0x0103, 1, 0x01);
>> +	if (ret) {
>> +		dev_err(&client->dev, "failed to reset\n");
>> +		return ret;
>> +	}
>> +
>> +	usleep_range(10000, 15000);
>> +
>>   	link_freq_index = ov2740->cur_mode->link_freq_index;
>>   	reg_list = &link_freq_configs[link_freq_index].reg_list;
>>   	ret = ov2740_write_reg_list(ov2740, reg_list);
>>
> 

  reply	other threads:[~2023-11-27  6:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 14:15 [PATCH v2 0/9] media: ov2740: reset GPIO, clk and 180 MHz link-frequency support Hans de Goede
2023-11-26 14:15 ` [PATCH v2 1/9] media: ov2740: Add support for reset GPIO Hans de Goede
2023-11-26 14:15 ` [PATCH v2 2/9] media: ov2740: Add support for external clock Hans de Goede
2023-11-26 14:15 ` [PATCH v2 3/9] media: ov2740: Move fwnode_graph_get_next_endpoint() call up Hans de Goede
2023-11-27 11:55   ` Sakari Ailus
2023-11-26 14:15 ` [PATCH v2 4/9] media: ov2740: Improve ov2740_check_hwcfg() error reporting Hans de Goede
2023-11-26 14:15 ` [PATCH v2 5/9] media: ov2740: Fix hts value Hans de Goede
2023-11-26 14:15 ` [PATCH v2 6/9] media: ov2740: Check hwcfg after allocating the ov2740 struct Hans de Goede
2023-11-26 14:15 ` [PATCH v2 7/9] media: ov2740: Add support for 180 MHz link frequency Hans de Goede
2023-11-26 14:15 ` [PATCH v2 8/9] media: ov2740: Add a sleep after resetting the sensor Hans de Goede
2023-11-27  4:15   ` Bingbu Cao
2023-11-27  6:39     ` Hao Yao [this message]
2023-11-26 14:15 ` [PATCH v2 9/9] media: ipu-bridge: Change ov2740 link-frequency to 180 MHz Hans de Goede

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=8da923c3-03e4-49a0-ace5-0b62e6a6a20d@intel.com \
    --to=hao.yao@intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=hpa@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.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