Re: [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile

From: Laurent Pinchart

Date: Tue Sep 29 2026 - 08:43:35 EST


On Mon, Sep 28, 2026 at 05:50:18PM -0400, Michael Jordan wrote:
> AUTO_UPDATE controls can change on their own, and the driver already
> re-reads them from the device. Tell userspace by setting
> V4L2_CTRL_FLAG_VOLATILE, plus EXECUTE_ON_WRITE for writable controls
> so that writes are not ignored.

Writes are not ignored by the driver regardless of whether or not
V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is reported to userspace.

> Suggested-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> Reviewed-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> Reviewed-by: Hans de Goede <johannes.goede@xxxxxxxxxxxxxxxx>
> Assisted-by: LLM
> Signed-off-by: Michael Jordan <jordan.mymail@xxxxxxxxx>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 3ca108b83f1d..aceb263103e9 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -1840,6 +1840,17 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
> if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_MAX) &&
> (ctrl->info.flags & UVC_CTRL_FLAG_GET_MIN))
> v4l2_ctrl->flags |= V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX;

A blank line here would be nice.

> + if (ctrl->info.flags & UVC_CTRL_FLAG_AUTO_UPDATE) {
> + v4l2_ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
> + /*
> + * Writes to a volatile control are documented to be ignored
> + * unless EXECUTE_ON_WRITE is also reported. The driver sends
> + * every write of a writable control to the device, so report
> + * the flag accordingly.
> + */
> + if (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)
> + v4l2_ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
> + }

The V4L2 documentation also states

Setting a new value for a volatile control will never trigger a
V4L2_EVENT_CTRL_CH_VALUE event.

This patch seems to break that as we unconditionally send
V4L2_EVENT_CTRL_CH_VALUE events on control write for controls that don't
have UVC_CTRL_FLAG_ASYNCHRONOUS set.

>
> if (mapping->master_id)
> __uvc_find_control(ctrl->entity, mapping->master_id,

--
Regards,

Laurent Pinchart