Re: [PATCH 4/6] media: imx208: Support device probe in non-zero ACPI D state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bingbu,

On Wed, Dec 15, 2021 at 11:13:03AM +0800, Bingbu Cao wrote:
> 
> 
> On 12/14/21 11:59 PM, Sakari Ailus wrote:
> > Hi Bingbu,
> > 
> > On Tue, Nov 09, 2021 at 04:48:33PM +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@xxxxxxxxx>
> >> ---
> >>  drivers/media/i2c/imx208.c | 77 +++++++++++++++++++++++++++++-----------------
> >>  1 file changed, 48 insertions(+), 29 deletions(-)
> >>
> >> diff --git a/drivers/media/i2c/imx208.c b/drivers/media/i2c/imx208.c
> >> index 6f3d9c1b5879..b9f6d5f33b58 100644
> >> --- a/drivers/media/i2c/imx208.c
> >> +++ b/drivers/media/i2c/imx208.c
> >> @@ -296,6 +296,9 @@ struct imx208 {
> >>  	/* OTP data */
> >>  	bool otp_read;
> >>  	char otp_data[IMX208_OTP_SIZE];
> >> +
> >> +	/* True if the device has been identified */
> >> +	bool identified;
> >>  };
> >>  
> >>  static inline struct imx208 *to_imx208(struct v4l2_subdev *_sd)
> >> @@ -619,6 +622,34 @@ static int imx208_set_pad_format(struct v4l2_subdev *sd,
> >>  	return 0;
> >>  }
> >>  
> >> +static int imx208_identify_module(struct imx208 *imx208)
> >> +{
> >> +	struct i2c_client *client = v4l2_get_subdevdata(&imx208->sd);
> >> +	int ret;
> >> +	u32 val;
> >> +
> >> +	if (imx208->identified)
> >> +		return 0;
> > 
> > Otp access requires this as well.
> 
> Sakari, thanks for your review.
> 
> Yes, OTP read will trigger the LED blink, but I am not sure it makes sense that camera
> framework try to read the OTP data without streaming, and it would complain once fail to
> access the OTP data.

That might be the case, but the interface this driver provides is
accessible in the user space before streaming is enabled. Accessing
sensor's other registers shouldn't be done before the sensor is identified.

> > 
> > How about adding a runtime PM resume callback for this?
> 
> For the runtime PM callback, what is the benefit adding a callback here as will call try
> pm_runtime_get_sync() each stream on?

My suggestion is to identify the sensor from the runtime PM resume callback
(which this driver doesn't have yet), i.e. not here.

-- 
Kind regards,

Sakari Ailus



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux