[PATCH v6 00/11] Show privacy_gpio as a v4l2_ctrl

From: Ricardo Ribalda
Date: Tue Dec 22 2020 - 18:05:49 EST


Some devices can implement a physical switch to disable the input of the
camera on demand. Think of it like an elegant privacy sticker.

The system can read the status of the privacy switch via a GPIO.

The ACPI table maps this GPIO to the USB device via _CRS and _DSD
descriptors, so the kernel can find it.

The userspace applications need to know if the privacy pin is enabled
or not.

The obvious way to show it to userspace is via the V4L2_CID_PRIVACY
control.

This patchset implement this functionality.

v6: Thanks to all the comments from Laurent!
- Remove multiple async_ctrls from v5, it is not needed
- Split event handling in two parts, so it can be triggered without wq
- Save pointer to the privacy entity in the main structure
- Handle the quirk in a different location to avoid races
- CodeStyle

v5: Thanks to all the comments from Laurent!
- Allow multiple async_ctrls
- Use dev_dbg() for uvc_trace
- Major redesing of "Implement UVC_EXT_GPIO_UNIT"
- Major redesing of "Implement UVC_QUIRK_PRIVACY_DURING_STREAM"

v4: Implement UVC_QUIRK_PRIVACY_DURING_STREAM

v3: Thanks to all the comments from Joe Perches
- Rework of printk macros

v2: Thanks to all the comments from Laurent!
- move guid to unit
- support entities with no pads
- CodeStyle
- Irq handling
- pr_cont
- new ids

Ricardo Ribalda (11):
media: uvcvideo: Move guid to entity
media: uvcvideo: Allow extra entities
media: uvcvideo: Allow entities with no pads
media: uvcvideo: Add uvc_ctrl_status_event_direct
media: uvcvideo: Allow entity-defined get_info and get_cur
media: uvcvideo: Implement UVC_EXT_GPIO_UNIT
media: uvcvideo: Add Privacy control based on EXT_GPIO
media: uvcvideo: Implement UVC_QUIRK_PRIVACY_DURING_STREAM
media: uvcvideo: Use dev_ printk aliases
media: uvcvideo: New macro uvc_trace_cont
media: uvcvideo: use dev_printk() for uvc_trace()

drivers/media/usb/uvc/uvc_ctrl.c | 184 +++++----
drivers/media/usb/uvc/uvc_driver.c | 603 +++++++++++++++++++----------
drivers/media/usb/uvc/uvc_entity.c | 11 +-
drivers/media/usb/uvc/uvc_isight.c | 16 +-
drivers/media/usb/uvc/uvc_queue.c | 9 +-
drivers/media/usb/uvc/uvc_status.c | 32 +-
drivers/media/usb/uvc/uvc_v4l2.c | 53 ++-
drivers/media/usb/uvc/uvc_video.c | 147 ++++---
drivers/media/usb/uvc/uvcvideo.h | 76 +++-
9 files changed, 727 insertions(+), 404 deletions(-)

--
2.29.2.729.g45daf8777d-goog