Right now we power-up the device when a user open() the device and we power it off when the last user close() the first video node. This behaviour affects the power consumption of the device is multiple use cases, such as: - Polling the privacy gpio - udev probing the device This patchset introduces a more granular power saving behaviour where the camera is only awaken when needed. It is compatible with asynchronous controls. While developing this patchset, two bugs were found. The patchset has been developed so these fixes can be taken independently. Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx> --- Changes in v2: - Add missing semicolon. - Rebase on top of media-committers/next - Link to v1: https://lore.kernel.org/r/20241126-uvc-granpower-ng-v1-0-6312bf26549c@xxxxxxxxxxxx --- Ricardo Ribalda (6): media: uvcvideo: Keep streaming state in the file handle media: uvcvideo: Move usb_autopm_(get|put)_interface to status_get media: uvcvideo: Add a uvc_status guard media: uvcvideo: Increase/decrease the PM counter per IOCTL media: uvcvideo: Make power management granular media: uvcvideo: Do not turn on the camera for some ioctls drivers/media/usb/uvc/uvc_ctrl.c | 13 ++++++- drivers/media/usb/uvc/uvc_status.c | 38 ++++++++++++++++--- drivers/media/usb/uvc/uvc_v4l2.c | 76 ++++++++++++++++++++++++++------------ drivers/media/usb/uvc/uvcvideo.h | 3 ++ 4 files changed, 100 insertions(+), 30 deletions(-) --- base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b change-id: 20241126-uvc-granpower-ng-069185a6d474 Best regards, -- Ricardo Ribalda <ribalda@xxxxxxxxxxxx>