mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Jordan <jordan.mymail@gmail.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans de Goede <hansg@kernel.org>,
	Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans de Goede <johannes.goede@oss.qualcomm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michael Jordan <jordan.mymail@gmail.com>
Subject: [PATCH v5] media: uvcvideo: report AUTO_UPDATE controls as volatile
Date: Tue, 29 Sep 2026 12:36:28 -0400	[thread overview]
Message-ID: <20260929163628.1004589-1-jordan.mymail@gmail.com> (raw)

Report AUTO_UPDATE controls as VOLATILE, and EXECUTE_ON_WRITE when
writable, to describe the driver's existing read and write behaviour.

Volatile controls must not generate CH_VALUE notifications. Filter that
bit in the shared event path for writes and device-status notifications,
including asynchronous completions. Keep flag-change notifications and
initial subscription snapshots.

Suggested-by: Ricardo Ribalda <ribalda@chromium.org>
Assisted-by: LLM
Signed-off-by: Michael Jordan <jordan.mymail@gmail.com>
---
Changes since v4:
- Resend only former patch 1; Hans merged patches 2-4 into uvc/for-next.
- Fix the EXECUTE_ON_WRITE explanation and spacing (Laurent).
- Filter CH_VALUE in the common event path, retaining other change bits.
- Drop the Reviewed-by tags because the event handling changed.

Tests on 7.2.0-rc4+ with the rebased UVC driver:
- Tiny 2: 31/31 PTZ/event checks pass during a 302-frame stream. Live pan,
  tilt, zoom and speed readback work. The same probe records 32 unwanted
  volatile value events with v4 and none with v5.
- Sunplus 1bcf:28cc: 17/17 ioctl event checks pass (v4: 11/17).
- Synthetic controls using the production event functions and real V4L2
  queues: 34/34 checks pass, including async completion (v4: 22/34).

v4: https://lore.kernel.org/linux-media/20260928215021.819064-2-jordan.mymail@gmail.com/

 drivers/media/usb/uvc/uvc_ctrl.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index c633ff7dbe72..70f724d5ec6d 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1841,6 +1841,16 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
 	    (ctrl->info.flags & UVC_CTRL_FLAG_GET_MIN))
 		v4l2_ctrl->flags |= V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX;
 
+	if (ctrl->info.flags & UVC_CTRL_FLAG_AUTO_UPDATE) {
+		v4l2_ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
+		/*
+		 * The driver sends every write to the device, even if the value
+		 * is unchanged. Report this behaviour for writable controls.
+		 */
+		if (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)
+			v4l2_ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
+	}
+
 	if (mapping->master_id)
 		__uvc_find_control(ctrl->entity, mapping->master_id,
 				   &master_map, &master_ctrl, 0, 0);
@@ -2060,6 +2070,13 @@ static void uvc_ctrl_send_event(struct uvc_video_chain *chain,
 	if (list_empty(&mapping->ev_subs))
 		return;
 
+	/* Volatile controls do not generate value-change events. */
+	if (ctrl->info.flags & UVC_CTRL_FLAG_AUTO_UPDATE)
+		changes &= ~V4L2_EVENT_CTRL_CH_VALUE;
+
+	if (!changes)
+		return;
+
 	uvc_ctrl_fill_event(chain, &ev, ctrl, mapping, value, changes);
 
 	list_for_each_entry(sev, &mapping->ev_subs, node) {

base-commit: 7a7c915d6bae574d8f43a205d566a837af0d0868
-- 
2.43.0

                 reply	other threads:[~2026-09-29 16:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260929163628.1004589-1-jordan.mymail@gmail.com \
    --to=jordan.mymail@gmail.com \
    --cc=hansg@kernel.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=laurent.pinchart@ideasonboard.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®