lkml.org 
[lkml]   [2021]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6] media: hi556: Support device probe in non-zero ACPI D state
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.

> +
> + 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;
> +}

--
Sakari Ailus

\
 
 \ /
  Last update: 2021-12-14 17:03    [W:0.088 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site