mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5] media: uvcvideo: report AUTO_UPDATE controls as volatile
@ 2026-09-29 16:36 Michael Jordan
  0 siblings, 0 replies; only message in thread
From: Michael Jordan @ 2026-09-29 16:36 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Ricardo Ribalda
  Cc: Hans de Goede, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
	linux-kernel, Michael Jordan

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-29 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 16:36 [PATCH v5] media: uvcvideo: report AUTO_UPDATE controls as volatile Michael Jordan

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®