mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Michael Jordan <jordan.mymail@gmail.com>
Cc: Hans de Goede <hansg@kernel.org>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hans de Goede <johannes.goede@oss.qualcomm.com>
Subject: Re: [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile
Date: Tue, 29 Sep 2026 15:34:22 +0300	[thread overview]
Message-ID: <20260929123422.GA349401@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260928215021.819064-2-jordan.mymail@gmail.com>

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@chromium.org>
> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
> Assisted-by: LLM
> Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
> ---
>  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

  reply	other threads:[~2026-09-29 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 21:50 [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and Tail 2 Michael Jordan
2026-09-28 21:50 ` [PATCH v4 1/4] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan
2026-09-29 12:34   ` Laurent Pinchart [this message]
2026-09-29 13:54     ` Michael Jordan
2026-09-28 21:50 ` [PATCH v4 2/4] media: uvcvideo: generalise the XU flags fixup to all controls Michael Jordan
2026-09-28 21:50 ` [PATCH v4 3/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tiny 2 Michael Jordan
2026-09-28 21:50 ` [PATCH v4 4/4] media: uvcvideo: fix up missing AUTO_UPDATE on the OBSBOT Tail 2 Michael Jordan
2026-09-29 15:51 ` [PATCH v4 0/4] media: uvcvideo: live pan/tilt/zoom readback on OBSBOT Tiny 2 and " Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260929123422.GA349401@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hansg@kernel.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=jordan.mymail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®