[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a1db2f4-f132-c700-9406-387977308f97@linux.intel.com>
Date: Wed, 15 Dec 2021 10:46:35 +0800
From: Bingbu Cao <bingbu.cao@...ux.intel.com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Bingbu Cao <bingbu.cao@...el.com>
Cc: linux-media@...r.kernel.org, rafael@...nel.org,
shawnx.tu@...el.com, tian.shu.qiu@...el.com,
chiranjeevi.rapolu@...el.com, hyungwoo.yang@...el.com,
tfiga@...omium.org, senozhatsky@...omium.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] media: hi556: Support device probe in non-zero ACPI D
state
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@...el.com>
>> Signed-off-by: Kao, Arec <arec.kao@...el.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
Powered by blists - more mailing lists