Re: [PATCH v2] media: ov5640: Use runtime PM

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

 



Hi Laurent,

On Sat, Mar 19, 2022 at 12:28:22AM +0200, Laurent Pinchart wrote:
> > @@ -3288,6 +3256,9 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
> >  
> >  	/* v4l2_ctrl_lock() locks our own mutex */
> >  
> > +	if (!pm_runtime_get_if_in_use(&sensor->i2c_client->dev))
> > +		return 0;
> 
> I'm afraid this won't work as intended :-S This function is called by
> v4l2_ctrl_handler_setup(), itself called from ov5640_sensor_resume(). At
> that point, runtime PM isn't flagged as in use yet, we're still in the
> process of resuming.
> 
> There are a few ways around this. The simplest one may be to move the
> v4l2_ctrl_handler_setup() call from ov5640_sensor_resume() to
> ov5640_s_stream(). Sakari, any opinion ?

That's one way to do it, yes.

The problem is that when the s_ctrl callback is run, there's no information
on whether it's being called from the runtime PM resume handler (which
powers on the device) or via another path.

Changing that would require changing the callback arguments, or adding a
new callback with that information included.

-- 
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