public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Bingbu Cao <bingbu.cao@linux.intel.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>
Cc: linux-media@vger.kernel.org, rafael@kernel.org,
	shawnx.tu@intel.com, tian.shu.qiu@intel.com,
	chiranjeevi.rapolu@intel.com, hyungwoo.yang@intel.com,
	tfiga@chromium.org, senozhatsky@chromium.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] media: hi556: Support device probe in non-zero ACPI D state
Date: Wed, 15 Dec 2021 10:46:35 +0800	[thread overview]
Message-ID: <7a1db2f4-f132-c700-9406-387977308f97@linux.intel.com> (raw)
In-Reply-To: <YbjAHhDFJOSxFI+v@paasikivi.fi.intel.com>



On 12/15/21 12:02 AM, Sakari Ailus wrote:
> Hi Bingbu,
> 
> On Tue, Nov 09, 2021 at 04:48:35PM +0800, Bingbu Cao wrote:
>> Tell ACPI device PM code that the driver supports the device being in
>> non-zero ACPI D state when the driver's probe function is entered.
>>
>> Also do identification on the first access of the device, whether in probe
>> or when starting streaming.
>>
>> Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
>> Signed-off-by: Kao, Arec <arec.kao@intel.com>
>> ---
>>  drivers/media/i2c/hi556.c | 67 +++++++++++++++++++++++++++++------------------
>>  1 file changed, 42 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
>> index 8db1cbedc1fd..c8011467d1a4 100644
>> --- a/drivers/media/i2c/hi556.c
>> +++ b/drivers/media/i2c/hi556.c
>> @@ -495,6 +495,9 @@ struct hi556 {
>>  
>>  	/* Streaming on/off */
>>  	bool streaming;
>> +
>> +	/* True if the device has been identified */
>> +	bool identified;
>>  };
>>  
>>  static u64 to_pixel_rate(u32 f_index)
>> @@ -757,12 +760,38 @@ static void hi556_assign_pad_format(const struct hi556_mode *mode,
>>  	fmt->field = V4L2_FIELD_NONE;
>>  }
>>  
>> +static int hi556_identify_module(struct hi556 *hi556)
>> +{
>> +	struct i2c_client *client = v4l2_get_subdevdata(&hi556->sd);
>> +	int ret;
>> +	u32 val;
> 
> If the sensor's already identified, you can return 0 here.

Yes, I will add in v2. Thanks!

> 
>> +
>> +	ret = hi556_read_reg(hi556, HI556_REG_CHIP_ID,
>> +			     HI556_REG_VALUE_16BIT, &val);
>> +	if (ret)
>> +		return ret;
>> +
>> +	if (val != HI556_CHIP_ID) {
>> +		dev_err(&client->dev, "chip id mismatch: %x!=%x",
>> +			HI556_CHIP_ID, val);
>> +		return -ENXIO;
>> +	}
>> +
>> +	hi556->identified = true;
>> +
>> +	return 0;
>> +}
> 

-- 
Best regards,
Bingbu Cao

      reply	other threads:[~2021-12-15  2:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  8:48 [PATCH 0/6] Support device probe in non-zero ACPI D state Bingbu Cao
2021-11-09  8:48 ` [PATCH 1/6] media: ov8856: support " Bingbu Cao
2021-11-09  8:48 ` [PATCH 2/6] media: ov5670: Support " Bingbu Cao
2021-11-09  8:48 ` [PATCH 3/6] media: ov2740: support " Bingbu Cao
2021-11-09  8:48 ` [PATCH 4/6] media: imx208: Support " Bingbu Cao
2021-12-14 15:59   ` Sakari Ailus
2021-12-15  3:13     ` Bingbu Cao
2021-12-15  7:14       ` Sakari Ailus
2021-11-09  8:48 ` [PATCH 5/6] media: ov5675: " Bingbu Cao
2021-11-09  8:48 ` [PATCH 6/6] media: hi556: " Bingbu Cao
2021-12-14 16:02   ` Sakari Ailus
2021-12-15  2:46     ` Bingbu Cao [this message]

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=7a1db2f4-f132-c700-9406-387977308f97@linux.intel.com \
    --to=bingbu.cao@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=hyungwoo.yang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=senozhatsky@chromium.org \
    --cc=shawnx.tu@intel.com \
    --cc=tfiga@chromium.org \
    --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