Message ID | 20250226-uvc-granpower-ng-v4-5-3ec9be906048@chromium.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | media: uvcvideo: Implement Granular Power Saving | expand |
Hi Ricardo, On 26-Feb-25 15:23, Ricardo Ribalda wrote: > There are some ioctls that do not need to turn on the camera. Do not > call uvc_pm_get in those cases. > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > drivers/media/usb/uvc/uvc_v4l2.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c > index 6af93e00b304..de8d26164996 100644 > --- a/drivers/media/usb/uvc/uvc_v4l2.c > +++ b/drivers/media/usb/uvc/uvc_v4l2.c > @@ -1450,6 +1450,26 @@ static long uvc_v4l2_video_ioctl2(struct file *file, > { > struct uvc_fh *handle = file->private_data; > > + /* The following IOCTLs do not need to turn on the camera. */ > + switch (cmd) { > + case VIDIOC_CREATE_BUFS: > + case VIDIOC_DQBUF: > + case VIDIOC_ENUM_FMT: > + case VIDIOC_ENUM_FRAMEINTERVALS: > + case VIDIOC_ENUM_FRAMESIZES: > + case VIDIOC_ENUMINPUT: > + case VIDIOC_EXPBUF: > + case VIDIOC_G_FMT: > + case VIDIOC_G_PARM: > + case VIDIOC_G_SELECTION: > + case VIDIOC_QBUF: > + case VIDIOC_QUERYCAP: > + case VIDIOC_REQBUFS: > + case VIDIOC_SUBSCRIBE_EVENT: > + case VIDIOC_UNSUBSCRIBE_EVENT: > + return video_ioctl2(file, cmd, arg); > + } > + > guard(uvc_pm)(handle->stream->dev); > > return video_ioctl2(file, cmd, arg); >
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 6af93e00b304..de8d26164996 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1450,6 +1450,26 @@ static long uvc_v4l2_video_ioctl2(struct file *file, { struct uvc_fh *handle = file->private_data; + /* The following IOCTLs do not need to turn on the camera. */ + switch (cmd) { + case VIDIOC_CREATE_BUFS: + case VIDIOC_DQBUF: + case VIDIOC_ENUM_FMT: + case VIDIOC_ENUM_FRAMEINTERVALS: + case VIDIOC_ENUM_FRAMESIZES: + case VIDIOC_ENUMINPUT: + case VIDIOC_EXPBUF: + case VIDIOC_G_FMT: + case VIDIOC_G_PARM: + case VIDIOC_G_SELECTION: + case VIDIOC_QBUF: + case VIDIOC_QUERYCAP: + case VIDIOC_REQBUFS: + case VIDIOC_SUBSCRIBE_EVENT: + case VIDIOC_UNSUBSCRIBE_EVENT: + return video_ioctl2(file, cmd, arg); + } + guard(uvc_pm)(handle->stream->dev); return video_ioctl2(file, cmd, arg);
There are some ioctls that do not need to turn on the camera. Do not call uvc_pm_get in those cases. Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- drivers/media/usb/uvc/uvc_v4l2.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)