From nobody Tue Dec 2 02:52:27 2025 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 361B4333723 for ; Mon, 17 Nov 2025 20:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410462; cv=none; b=KQk8UC4GTfFDfXi9y7cjCsAaipyDYyfaxgPQ2Ir89dQ7BrUfIc5gATFqNZE26lDrEgjuc+GsEinLNObhgknMQgM9terfe5GzNeFcrG2TA+cYXPf1ewBE44S45QBIhF4xGE3GSG/fQRYAxzayCKV7ukbY4dLzGlzQhrFOmVZeMhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410462; c=relaxed/simple; bh=tUilLqPF6SzmbypUvh0pDDtsvnGuYdJyG0lrVm8dnvk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CcZjAtaTZO2o8rnRJwLJgmTxLF9HLB1lCKnlpJDW3VXBSrPfrgK7zqzZcsOF7m/ugaKHMexqsVsqq3TigGCpx8+yA3ZKcODUcHpIQoZfEBk3SOgabBSHGCaJwJB0hqnIuIkxCu6URUSxNvMlJ4KIVrR6Ufz3ncKZvGUAlk1E6k8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mCccB1o5; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mCccB1o5" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-594270ec7f9so4374207e87.3 for ; Mon, 17 Nov 2025 12:14:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763410458; x=1764015258; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=llhisBgVyW1mIvqEoq3wSr5faLynyoEF2VocpfmN4uM=; b=mCccB1o51CQH+KJEzMmYdNVTo8nFFHL60Dd5l29qbcJ/o4tCe+RDzlgoqZE/bISq29 DZBi0hh8TdKDwvBAp8rdEuyKL3MuZaWT9FoyTcH3lNeYQ/M/bmBwPIR21Imko/RfnI3s +FQwA7QqTErZoCdDiDl/zusMzDXSofaKv636c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763410458; x=1764015258; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=llhisBgVyW1mIvqEoq3wSr5faLynyoEF2VocpfmN4uM=; b=FBMTKJ6JYLOfTfavhl2q6RqA1pQkQxJ0fyN+jWFPrH9N7fA5BK00snKHi7kUWnG/Lv XNm1J9fivCyTxPt1kaYABNXzbGaNgYXYFUx2a0CQBCzMm1aydF2nXI0sQkmZZdK0eWd0 W1UtQGp7NxQSo8HOSMI4QYgvyu6DSO7ZhAHbijg9zRuEifTSS4RFZ4bBr9xCujgjazA6 ZdSFEM27i8zce+2Yx6p00j17qp1n/X1f4KJ9eyyOztPBcZj/5LGlftGtcnZYF3vhyLc5 SUgcGbEKqQ2EziwuQ6+vxp8ti53ACjxfOPmMEAstlDDtVoFiR7/UMWx4bkDhRzh0ZB13 cAmw== X-Forwarded-Encrypted: i=1; AJvYcCVGeZeJl4hVEoiQT/CDAN3Dhl4jPs65iCMX/NQXJ2SveLSN2gT6Mrg5p3tdarqQKAZG8PG//zBTSaIhf5Y=@vger.kernel.org X-Gm-Message-State: AOJu0YyyH7ByIIQAVlqdheZIu7f1Ra4/OP+Ptsf03AFbZgOIRipIJhwZ buMplwxSHQD3UHBmvabqEV56juU5H+Y8/jtTNJvoVLY6SiaX5EqahZ+Ijo64J0T91g== X-Gm-Gg: ASbGncsiydtChsxqJhD/nZun5cZPBPMZX6joD50mIaiSkJIr26CpYJ6ZC3JASLoMIVX vZa/NRKb3hhW1s2f/N8APqqjyYAH3hKmEY4JIqqWQxWWcPGKbfkXBrpXaZI2zx/EY2IHp+pfzdx 420m/AoJpxk5faz0/Oo7UZBcGxJc+yIUyvnXUUsOFmpPkuZtWTYLCdJ6ZeE9e4yNnjvsWHfbmU4 3CjlZDPgCI7FdOMjcSndSBwAdQDWr80l1P4nFJW/rGTK7mzPoGf2kFFpgWTZNQOnWCmom6m7T9v PMEv5qP5jivlJcLfBT7u1yOD8yA2Dnq5jxcPdrWaIAmFKFe2eJ+kCTH/tlu2rznki1Xn14uH2Zg 54ZssXanGNDqtgCoRd/pExiOF9xPa3Fg1T2HZDXiC/ivpA/68NhruY8eB42FqHtvg/ntW8BBC8N hq3eH8lhrCgnQaupqO/u1Jdpk8nh2o7lvW6AB/OaUD1u24tnAUIEzO0RRAbwKQ872HYuAyemAp X-Google-Smtp-Source: AGHT+IHqA/rZVuUUTwCH7FDfVPsb0ar2Z5rIxo0AI3uwDk5VfFJ6s5EDzJh5I1/3N26JtJcj3MUnfg== X-Received: by 2002:a05:6512:1289:b0:594:4fee:c1db with SMTP id 2adb3069b0e04-595841f99b7mr4455750e87.43.1763410458288; Mon, 17 Nov 2025 12:14:18 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-595804003a4sm3413302e87.59.2025.11.17.12.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 12:14:17 -0800 (PST) From: Ricardo Ribalda Date: Mon, 17 Nov 2025 20:14:16 +0000 Subject: [PATCH 1/4] media: uvcvideo: Remove nodrop parameter Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251117-uvcdynctrl-v1-1-aed70eadf3d8@chromium.org> References: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> In-Reply-To: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 We announced the deprecation intentions one year ago in the commit commit 40ed9e9b2808 ("media: uvcvideo: Announce the user our deprecation intentions"). We have not hear any complains, lets remove the nodrop parameter. Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 19 ------------------- drivers/media/usb/uvc/uvc_queue.c | 25 ------------------------- drivers/media/usb/uvc/uvcvideo.h | 1 - 3 files changed, 45 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc= _driver.c index ee4f54d6834962414979a046afc59c5036455124..71563d8f4bcf581694ccd4b665f= f52b629caa0b6 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -32,7 +32,6 @@ =20 unsigned int uvc_clock_param =3D CLOCK_MONOTONIC; unsigned int uvc_hw_timestamps_param; -unsigned int uvc_no_drop_param =3D 1; static unsigned int uvc_quirks_param =3D -1; unsigned int uvc_dbg_param; unsigned int uvc_timeout_param =3D UVC_CTRL_STREAMING_TIMEOUT; @@ -2468,24 +2467,6 @@ MODULE_PARM_DESC(clock, "Video buffers timestamp clo= ck"); module_param_named(hwtimestamps, uvc_hw_timestamps_param, uint, 0644); MODULE_PARM_DESC(hwtimestamps, "Use hardware timestamps"); =20 -static int param_set_nodrop(const char *val, const struct kernel_param *kp) -{ - pr_warn_once("uvcvideo: " - DEPRECATED - "nodrop parameter will be eventually removed.\n"); - return param_set_bool(val, kp); -} - -static const struct kernel_param_ops param_ops_nodrop =3D { - .set =3D param_set_nodrop, - .get =3D param_get_uint, -}; - -param_check_uint(nodrop, &uvc_no_drop_param); -module_param_cb(nodrop, ¶m_ops_nodrop, &uvc_no_drop_param, 0644); -__MODULE_PARM_TYPE(nodrop, "uint"); -MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames"); - module_param_named(quirks, uvc_quirks_param, uint, 0644); MODULE_PARM_DESC(quirks, "Forced device quirks"); module_param_named(trace, uvc_dbg_param, uint, 0644); diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_= queue.c index 790184c9843d211d34fa7d66801631d5a07450bd..3bc54456b4d98ed50b1ea250ce8= 501e67141e1ef 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -331,34 +331,9 @@ struct uvc_buffer *uvc_queue_get_current_buffer(struct= uvc_video_queue *queue) return nextbuf; } =20 -/* - * uvc_queue_buffer_requeue: Requeue a buffer on our internal irqqueue - * - * Reuse a buffer through our internal queue without the need to 'prepare'. - * The buffer will be returned to userspace through the uvc_buffer_queue c= all if - * the device has been disconnected. - */ -static void uvc_queue_buffer_requeue(struct uvc_video_queue *queue, - struct uvc_buffer *buf) -{ - buf->error =3D 0; - buf->state =3D UVC_BUF_STATE_QUEUED; - buf->bytesused =3D 0; - vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0); - - uvc_buffer_queue(&buf->buf.vb2_buf); -} - static void uvc_queue_buffer_complete(struct kref *ref) { struct uvc_buffer *buf =3D container_of(ref, struct uvc_buffer, ref); - struct vb2_buffer *vb =3D &buf->buf.vb2_buf; - struct uvc_video_queue *queue =3D vb2_get_drv_priv(vb->vb2_queue); - - if (buf->error && !uvc_no_drop_param) { - uvc_queue_buffer_requeue(queue, buf); - return; - } =20 buf->state =3D buf->error ? UVC_BUF_STATE_ERROR : UVC_BUF_STATE_DONE; vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused); diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index ed7bad31f75ca474c1037d666d5310c78dd764df..9a86d7f1f6ea022dace87614030= bf0fde0d260f0 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -659,7 +659,6 @@ static inline struct uvc_fh *to_uvc_fh(struct file *fil= p) #define UVC_WARN_XU_GET_RES 2 =20 extern unsigned int uvc_clock_param; -extern unsigned int uvc_no_drop_param; extern unsigned int uvc_dbg_param; extern unsigned int uvc_timeout_param; extern unsigned int uvc_hw_timestamps_param; --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:52:27 2025 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FE33334692 for ; Mon, 17 Nov 2025 20:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410463; cv=none; b=oSK9nAaCyrMOMfqLYKCLShTeJikISfBDsSN41BgTNpmC/C1yYYvxdG43NQKQ7kU1eA8ldGhPJXl+ubil8yRcYtkFGYM5fkLgXzpKZuI7mvMowQKC9H34u7Fr//pk4Jn8DAT1lbtzyxHMMtYf7eCfFJBTB3zUdWEb0+dB27JI0tI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410463; c=relaxed/simple; bh=RqpIaG3485hgh4nkz9wTNzcwCeRCjae1qwX6Dg9LUNc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VnIFh4xrcwKNfeTYmGkSXRtOn1aaqix5g+YtoWlj6+KaF+ovbZt4mxGQ/EQbEgpnAVOToHFKjXRuY7n2ZLyeZd7dl2xEpnBuFTGal1bNis/eFNjLauqFjrzuNvlKhh3xU7SKEGsMCX8xP8TheS4qh6umISjNFmxR5Gjp3Df+SWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=jbfTqVcb; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jbfTqVcb" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5958232f806so4524079e87.0 for ; Mon, 17 Nov 2025 12:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763410459; x=1764015259; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3QRNsE9fgm4OgsAmIZZxrFGrQZpgm3YVoy5645Fyn2U=; b=jbfTqVcbgMXEHNnJAIIYjQA9D3YcmyPCeO0Gvy1JKAf7S+7z6wRbRt0l1xrSt7Z9HF BjFXqebgqOgMsQ++SusL90IygaO+iOhwhEAP0xgpFUgSO3HtpoT4+IdTqiDsTbWpnTIs btXfreTXxqM+l7hPn0z7XnrQWVSwvOJt4X3WQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763410459; x=1764015259; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=3QRNsE9fgm4OgsAmIZZxrFGrQZpgm3YVoy5645Fyn2U=; b=PQ0obd1ouNXrp8dH9sxKdzDbdTWzbmufkjXwmEVVmw4QUfGv5TZ+h6LGhJagJRwuMq odv/1dXyGyJLqdX7k4nw9lRHSZfX71MYmjv0Dgl6E2pE1CUnjHB2vkKBlDA7574Mj//l 0ss8ETo6V1ukZHREkRK6gLkW5Wa6rxHCL4S+jIlKruQ5Q7N2hJ+RVyfj3WuExr37vtjM XNiTmhpaQPwwHIxZ7LSJQKGzRROMoxOM9lamdzzMCXhvRJcooTOyfAGslFJ9G/P/Y8hk 6wPzBONYNQR0Ogy3qp2tkWYpuyUo2W1u/iSl3RNHxT94gzU3JXqFlCvHMAs9oIM7IGWX fLgQ== X-Forwarded-Encrypted: i=1; AJvYcCVmdNtDuvaH4UsZF1+n6uc3rZtPIvsOPbjLuds2v1TBfbyFzRae9QKmFk3gWuIn6Ur1eIGD+ztpJV2adGc=@vger.kernel.org X-Gm-Message-State: AOJu0YxzPKVA0IUtKeBDPOpOLiapz0+SvII/ggVALACxtlB1zNevWQHH waGGcBqc4CzcDI+xfn6uL/gGO/ZHfxUXmKo1cDx//09ioDEmhmfNtBb1Nipyc7KozQ== X-Gm-Gg: ASbGncsn7utKOfqTzCQ+3xw1NXXiALesWbDnFSFYYfTwukMzKZHtrvIgZWnPZ5dkXyf xpiQ0OxP6uFDHazw33/I6xFfeZIYD//KN1aDAjxJhw7DzINTtB8ITkzAQaNTAD6LK5HYe9Ae4NL IjtZXQ8PZ++kYh43MbjaeCIljsXjXb16k7YLL6GigF2OHmz0KkP+shYY91tAz6Zz4kp+fP9nav4 NlebokD83D57L/eVfPSq7m5IM14LAwnCA5wjwJgQqNL3YnP/1rSSxc+Ft44de4M6i88yK7fHQt7 PuDt4HSQ5wRuoq7jIXntronOQRcj2dCdkWWjqqMMuMXqBzeUcpTPO/4rmtiD5mrxdXg9YCyDg0+ CTg8xqYbI9vSH6uOQ4uqrTrLMpglLN22gjycNtsPOVM/kuTrt5XEx5bcmnSEWdFJ/Mm/Bph3P89 AXVD5rDiXhU8VdVCtaRsGgxRz7DcMl0UclI3Tchg5VEb3hn+ORVBg= X-Google-Smtp-Source: AGHT+IH4EcxYDEh5I4nH0gMfxPcsFW4ZrVgmvkzRGCBLNo1Bl/kRZw5LabKokyTQ0QA4Xf2D5if7Uw== X-Received: by 2002:a05:6512:1599:b0:594:2f46:3912 with SMTP id 2adb3069b0e04-5958423b186mr4264070e87.52.1763410459062; Mon, 17 Nov 2025 12:14:19 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-595804003a4sm3413302e87.59.2025.11.17.12.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 12:14:18 -0800 (PST) From: Ricardo Ribalda Date: Mon, 17 Nov 2025 20:14:17 +0000 Subject: [PATCH 2/4] media: uvcvideo: Import standard controls from uvcdynctrl Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251117-uvcdynctrl-v1-2-aed70eadf3d8@chromium.org> References: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> In-Reply-To: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda , Manav Gautama , Martin Rubli X-Mailer: b4 0.14.2 The uvcdynctrl tool from libwebcam: https://sourceforge.net/projects/libwebcam/ maps proprietary controls into v4l2 controls using the UVCIOC_CTRL_MAP ioctl. The tool has not been updated for 10+ years now, and there is no reason for the UVC driver to not do the mapping by itself. This patch adds the mappings from the uvcdynctrl into the driver. Hopefully this effort can help in deprecating the UVCIOC_CTRL_MAP ioctl. During the porting, the following mappings where NOT imported because they were not using standard v4l2 IDs. It is recommended that userspace moves to UVCIOC_CTRL_QUERY for non standard controls. { .id =3D V4L2_CID_FLASH_MODE, .entity =3D UVC_GUID_SIS_LED_HW_CONTROL, .selector =3D 4, .size =3D 4, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_MENU, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_mask =3D 0x3, .menu_mapping =3D { 0x20, 0x22 }, .menu_names =3D { "Off", "On" }, }, { .id =3D V4L2_CID_FLASH_FREQUENCY, .entity =3D UVC_GUID_SIS_LED_HW_CONTROL, .selector =3D 4, .size =3D 8, .offset =3D 16, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_LED1_MODE, .entity =3D UVC_GUID_LOGITECH_USER_HW_CONTROL_V1, .selector =3D 1, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_MENU, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_mask =3D 0xF, .menu_mapping =3D { 0, 1, 2, 3 }, .menu_names =3D { "Off", "On", "Blinking", "Auto" }, }, { .id =3D V4L2_CID_LED1_FREQUENCY, .entity =3D UVC_GUID_LOGITECH_USER_HW_CONTROL_V1, .selector =3D 1, .size =3D 8, .offset =3D 16, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_DISABLE_PROCESSING, .entity =3D UVC_GUID_LOGITECH_VIDEO_PIPE_V1, .selector =3D 5, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_BOOLEAN, .data_type =3D UVC_CTRL_DATA_TYPE_BOOLEAN, }, { .id =3D V4L2_CID_RAW_BITS_PER_PIXEL, .entity =3D UVC_GUID_LOGITECH_VIDEO_PIPE_V1, .selector =3D 8, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_RAW_BITS_PER_PIXEL, .entity =3D UVC_GUID_LOGITECH_VIDEO_PIPE_V1, .selector =3D 8, .size =3D 8, .offset =3D 0, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, { .id =3D V4L2_CID_LED1_MODE, .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, .selector =3D 0x09, .size =3D 2, .offset =3D 8, .v4l2_type =3D V4L2_CTRL_TYPE_MENU, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, .menu_mask =3D 0xF, .menu_mapping =3D { 0, 1, 2, 3 }, .menu_names =3D { "Off", "On", "Blink", "Auto" }, }, { .id =3D V4L2_CID_LED1_FREQUENCY, .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, .selector =3D 0x09, .size =3D 8, .offset =3D 24, .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, }, This script has been used to generate the mappings. They were then reformatted manually to follow the driver style. import sys import uuid import re import xml.etree.ElementTree as ET def get_namespace(root): return re.match(r"\{.*\}", root.tag).group(0) def get_single_guid(ns, constant): id =3D constant.find(ns + "id").text value =3D constant.find(ns + "value").text return (id, value) def get_constants(ns, root): out =3D dict() for constant in root.iter(ns + "constant"): attr =3D constant.attrib if attr["type"] =3D=3D "integer": id, value =3D get_single_guid(ns, constant) if id in out: print(f"dupe constant {id}") out[id] =3D value return out def get_guids(ns, root): out =3D dict() for constant in root.iter(ns + "constant"): attr =3D constant.attrib if attr["type"] =3D=3D "guid": id, value =3D get_single_guid(ns, constant) if id in out: print(f"dupe guid {id}") out[id] =3D value return out def get_single_control(ns, control): out =3D {} for id in "entity", "selector", "index", "size", "description": v =3D control.find(ns + id) if v is None and id =3D=3D "description": continue out[id] =3D v.text reqs =3D set() for r in control.find(ns + "requests"): reqs.add(r.text) out["requests"] =3D reqs return (control.attrib["id"], out) def get_controls(ns, root): out =3D dict() for control in root.iter(ns + "control"): id, value =3D get_single_control(ns, control) if id in out: print(f"Dupe control id {id}") out[id] =3D value return out def get_single_mapping(ns, mapping): out =3D {} out["name"] =3D mapping.find(ns + "name").text uvc =3D mapping.find(ns + "uvc") for id in "size", "offset", "uvc_type": out[id] =3D uvc.find(ns + id).text out["control_ref"] =3D uvc.find(ns + "control_ref").attrib["idref"] v4l2 =3D mapping.find(ns + "v4l2") for id in "id", "v4l2_type": out[id] =3D v4l2.find(ns + id).text menu =3D {} for entry in v4l2.iter(ns + "menu_entry"): menu[entry.attrib["name"]] =3D entry.attrib["value"] if menu: out["menu"] =3D menu return out def get_mapping(ns, root): out =3D [] for control in root.iter(ns + "mapping"): mapping =3D get_single_mapping(ns, control) out +=3D [mapping] return out def print_guids(guids): for g in guids: print(f"#define {g} \\") u_bytes =3D uuid.UUID(guids[g]).bytes_le u_bytes =3D [f"0x{b:02x}" for b in u_bytes] print("\t{ " + ", ".join(u_bytes) + " }") def print_flags(flags): get_range =3D {"GET_MIN", "GET_DEF", "GET_MAX", "GET_CUR", "GET_RES"} if get_range.issubset(flags): flags -=3D get_range flags.add("GET_RANGE") flags =3D list(flags) flags.sort() out =3D "" for f in flags[:-1]: out +=3D f"UVC_CTRL_FLAG_{f}\n\t\t\t\t| " out +=3D f"UVC_CTRL_FLAG_{flags[-1]}" return out def print_description(desc): print("/*") for line in desc.strip().splitlines(): print(f" * {line.strip()}") print("*/") def print_controls(controls, cons): for id in controls: c =3D controls[id] if "description" in c: print_description(c["description"]) print( f"""\t{{ \t\t.entity\t\t=3D {c["entity"]}, \t\t.selector\t=3D {cons[c["selector"]]}, \t\t.index\t\t=3D {c["index"]}, \t\t.size\t\t=3D {c["size"]}, \t\t.flags\t\t=3D {print_flags(c["requests"])}, \t}},""" ) def menu_mapping_txt(menu): out =3D f"\n\t\t.menu_mask\t=3D 0x{((1< Cc: Martin Rubli Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_ctrl.c | 161 +++++++++++++++++++++++++++++++++++= ++++ include/linux/usb/uvc.h | 6 ++ 2 files changed, 167 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_c= trl.c index 2905505c240c060e5034ea12d33b59d5702f2e1f..5c0398c81334649649ff654f903= d03e16381a865 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -385,6 +385,86 @@ static const struct uvc_control_info uvc_ctrls[] =3D { | UVC_CTRL_FLAG_GET_RANGE | UVC_CTRL_FLAG_RESTORE, }, + /* + * Allows the control of pan/tilt motor movements for camera models + * that support mechanical pan/tilt. + * + * Bits 0 to 15 control pan, bits 16 to 31 control tilt. + * The unit of the pan/tilt values is 1/64th of a degree and the + * resolution is 1 degree. + */ + { + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 1, + .index =3D 0, + .size =3D 4, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_SET_CUR, + }, + /* + * Reset the pan/tilt motors to their original position for camera + * models that support mechanical pan/tilt. + * + * Setting bit 0 resets the pan position. + * Setting bit 1 resets the tilt position. + * + * Both bits can be set at the same time to reset both, pan and tilt, + * at the same time. + */ + { + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 2, + .index =3D 1, + .size =3D 1, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_SET_CUR, + }, + /* + * Allows the control of focus motor movements for camera models that + * support mechanical focus. + * + * Bits 0 to 7 allow selection of the desired lens position. + * There are no physical units, instead, the focus range is spread over + * 256 logical units with 0 representing infinity focus and 255 being + * macro focus. + */ + { + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 3, + .index =3D 2, + .size =3D 6, + .flags =3D UVC_CTRL_FLAG_GET_CUR + | UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_SET_CUR, + }, + { + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 1, + .index =3D 0, + .size =3D 4, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_GET_RES + | UVC_CTRL_FLAG_SET_CUR, + }, + { + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 2, + .index =3D 1, + .size =3D 1, + .flags =3D UVC_CTRL_FLAG_GET_DEF + | UVC_CTRL_FLAG_GET_MAX + | UVC_CTRL_FLAG_GET_MIN + | UVC_CTRL_FLAG_GET_RES + | UVC_CTRL_FLAG_SET_CUR, + }, }; =20 static const u32 uvc_control_classes[] =3D { @@ -1009,6 +1089,87 @@ static const struct uvc_control_mapping uvc_ctrl_map= pings[] =3D { .menu_mask =3D BIT(V4L2_COLORFX_VIVID) | BIT(V4L2_COLORFX_NONE), }, + { + .id =3D V4L2_CID_PAN_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 1, + .size =3D 16, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_TILT_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 1, + .size =3D 16, + .offset =3D 16, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_PAN_RESET, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 2, + .size =3D 1, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_TILT_RESET, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 2, + .size =3D 1, + .offset =3D 1, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_PAN_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 1, + .size =3D 16, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_TILT_RELATIVE, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 1, + .size =3D 16, + .offset =3D 16, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_SIGNED, + }, + { + .id =3D V4L2_CID_PAN_RESET, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 2, + .size =3D 1, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_TILT_RESET, + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 2, + .size =3D 1, + .offset =3D 1, + .v4l2_type =3D V4L2_CTRL_TYPE_BUTTON, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id =3D V4L2_CID_FOCUS_ABSOLUTE, + .entity =3D UVC_GUID_LOGITECH_MOTOR_CONTROL_V1, + .selector =3D 3, + .size =3D 8, + .offset =3D 0, + .v4l2_type =3D V4L2_CTRL_TYPE_INTEGER, + .data_type =3D UVC_CTRL_DATA_TYPE_UNSIGNED, + }, }; =20 /* ------------------------------------------------------------------------ diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h index 22e0dab0809e296e089940620ae0e8838e109701..b939a01da11466747249c64c72a= 3ea40cd364a59 100644 --- a/include/linux/usb/uvc.h +++ b/include/linux/usb/uvc.h @@ -35,6 +35,12 @@ #define UVC_GUID_MSXU_1_5 \ {0xdc, 0x95, 0x3f, 0x0f, 0x32, 0x26, 0x4e, 0x4c, \ 0x92, 0xc9, 0xa0, 0x47, 0x82, 0xf4, 0x3b, 0xc8} +#define UVC_GUID_LOGITECH_MOTOR_CONTROL_V1 \ + {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \ + 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x56 } +#define UVC_GUID_LOGITECH_PERIPHERAL \ + {0x21, 0x2d, 0xe5, 0xff, 0x30, 0x80, 0x2c, 0x4e, \ + 0x82, 0xd9, 0xf5, 0x87, 0xd0, 0x05, 0x40, 0xbd } =20 /* https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-e= xtensions-1-5#222-extension-unit-controls */ #define UVC_MSXU_CONTROL_FOCUS 0x01 --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:52:27 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3C37335567 for ; Mon, 17 Nov 2025 20:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410463; cv=none; b=MWCychQJq8M9YG7V4QZseilf55obVjCJ37MuI/AaGc5sNEBuArfB0jHOoI6Rhv1diL69o9ttIlzJsQcN6lpJpPG/SjDgMBnh1yGrYo+wLWqYd2YC2120YLWO365KC34oJdG04UF8a/n+I9uDHpF8APdlRu34Cvuvvlqf+51a9BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410463; c=relaxed/simple; bh=PDXeoHjilGLmsgGYWs2pF2jFpc8Fek8OZ2Tb7dK3KHo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=itRkYtv9zf2JKOW9jFvi2JG5y+jtD70B8j6WeYzvJWIKqWZZOf4dmX4E/jnq5Qz8jmwjK30puMRZ+Tk4kfbGZWg0bR7KdYG+QIy0RIEjOLP+TGspmTjQ8YNbGgoLCp4lHQPOx3pO55e31ggeiq75E50eDR3GnmZPDQJ5QA2XpB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=PztX19rh; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PztX19rh" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5942b58ac81so3620103e87.2 for ; Mon, 17 Nov 2025 12:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763410460; x=1764015260; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fbLn7Tq1LCaFET/TnEDu5Mn2s8865xnIcHY2GnqwqUI=; b=PztX19rhPiie997q8mtTerXXbf2+F8okODOozgEy+OaL3JJFzyIqQsECZCpStvGKlp QN+HhtOrfzao339FpOxlqhl+hLvoA3t+Yd6x0+8W8XhmXmdiz+G2kBZSEI5KtjsXj7aT o6rCvkUQor3IVrlr/rS9RliHyYpEdHsU3ODag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763410460; x=1764015260; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fbLn7Tq1LCaFET/TnEDu5Mn2s8865xnIcHY2GnqwqUI=; b=uF3L+7pwyRoRQ5uxvE4utGqJoRR2Vi1E2tHfvV6VT0EK0sFUZURiLXlBfVwBjZeqQB P0AUYvDLH4uydPPapMPiQNyAI2xkCPi9TDwu9N7GZZENUozmMCq9K4kEEsNR10Hi8523 QWOWhdvl4G+SEiem/E8abANCWuNjdaQc/Inz/MCKpZyiY5b1CluA0KIX0EP8iqu+TshL BWvOhE1in9qVgkzrlGjez0A9HFXft8wrGgc42qFqwj7Rrhxq3raBExP6qE0maPnbbgWG dT4FIP12XhYH5RX514iZNGtHiNioBe4OH0EvKMcdknygmzNVFyPuyhxqwrj3Q3DNf5Z+ 3fpA== X-Forwarded-Encrypted: i=1; AJvYcCXhUBlxwffZcGvR8vv8d8l9/qQXs6f82VXPlYAoE5oGamW7tMIRXjaaPqDxU1/d+3oHg6L2CKOJ4qE5IhU=@vger.kernel.org X-Gm-Message-State: AOJu0YwJDmjJPssu3+vrOW6pHXycE0lfEPg4W6MtBBB92ZfqijfinBIv rdLvNlKzDkdJOH+NIXOsMeWYKvIPtkblfaYaHiN/lTv+eJJVrXs900alC2K3Z71D2w== X-Gm-Gg: ASbGncuIm6JovD7SmBRDvR+b/eSF1mVf3Y8cLprcQOD6ci8VwvYz/SHA6pnjBhePo0X 0VB87stJtxptNGcrd7s1TAkuZ7P2qCdhLsTGO8kXKMm44IewF+nJDKk+WPYVMygd8s6Wt01niMB FNXWp8jKCFOCIZEwnJDyDiGIk9bzKhPlPJaiRyL8KiN+vHUUwqPohH8YiKN6CS1t+G/v+v3+pil AfjLYKceVfAMN4irMAmXLViA9mj0MwxpzoSARp+rlHDUGVwvvH6ebIeThqGTYXS0PaskabJ3FXj djhbKoazl4+ekIlwdOUHknM8stYWn/lHOtuh/V+iSC8is1wdzltJlmB//LfkNhBFqCGx4esvV2F xV+w9WdGxibArAfBp/mZoYb8Kuhphpw+DKefqTJbAlHrrQuVXDzs2SGi9XVXMyuMjcEcV1J/hw+ 0NXuP0+G65VlbwNb1eblcTlVEEwkKtgwhG/NGiG/ieFwzsqofcfCDYWKJPM6c1Mw== X-Google-Smtp-Source: AGHT+IGHMJO5hFsbeAdTfXDrkQ3dodtkLlSLucMoWep7XxCSBof4UP5umUgUewkik/7Fm/oml3AtYA== X-Received: by 2002:a05:6512:3e07:b0:595:81ce:ff83 with SMTP id 2adb3069b0e04-59584209400mr4209898e87.25.1763410460056; Mon, 17 Nov 2025 12:14:20 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-595804003a4sm3413302e87.59.2025.11.17.12.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 12:14:19 -0800 (PST) From: Ricardo Ribalda Date: Mon, 17 Nov 2025 20:14:18 +0000 Subject: [PATCH 3/4] media: uvcvideo: Announce deprecation intentions for UVCIOC_CTRL_MAP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251117-uvcdynctrl-v1-3-aed70eadf3d8@chromium.org> References: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> In-Reply-To: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 The UVCIOC_CTRL_MAP lets userspace create a mapping for a custom control. This mapping is usually created by the uvcdynctrl userspace utility. We would like to get the mappings into the driver instead. Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- Documentation/userspace-api/media/drivers/uvcvideo.rst | 2 ++ drivers/media/usb/uvc/uvc_v4l2.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Documentation/userspace-api/media/drivers/uvcvideo.rst b/Docum= entation/userspace-api/media/drivers/uvcvideo.rst index dbb30ad389ae4d53bc734b4269ebea20ecdd7535..b09d2f8ba66ecde67f1e35fd778= 58a505ad44eb1 100644 --- a/Documentation/userspace-api/media/drivers/uvcvideo.rst +++ b/Documentation/userspace-api/media/drivers/uvcvideo.rst @@ -109,6 +109,8 @@ IOCTL reference UVCIOC_CTRL_MAP - Map a UVC control to a V4L2 control ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ =20 +**This IOCTL is deprecated and will be eventually removed** + Argument: struct uvc_xu_control_mapping =20 **Description**: diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 9e4a251eca88085a1b4e0e854370015855be92ee..03c64b5698bf4331fed8437fa6e= 9c726a07450bd 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1044,6 +1044,8 @@ static long uvc_ioctl_default(struct file *file, void= *priv, bool valid_prio, switch (cmd) { /* Dynamic controls. */ case UVCIOC_CTRL_MAP: + pr_warn_once("uvcvideo: " DEPRECATED + "UVCIOC_CTRL_MAP ioctl will be eventually removed.\n"); return uvc_ioctl_xu_ctrl_map(chain, arg); =20 case UVCIOC_CTRL_QUERY: @@ -1158,6 +1160,8 @@ static long uvc_v4l2_compat_ioctl32(struct file *file, =20 switch (cmd) { case UVCIOC_CTRL_MAP32: + pr_warn_once("uvcvideo: " DEPRECATED + "UVCIOC_CTRL_MAP32 ioctl will be eventually removed.\n"); ret =3D uvc_v4l2_get_xu_mapping(&karg.xmap, up); if (ret) break; --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Tue Dec 2 02:52:27 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15FE233344D for ; Mon, 17 Nov 2025 20:14:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410465; cv=none; b=UCxInyVRcWW3ug/1D42jo1vRBrLnQqtwJOSUvv+2BbfOrXiYPL8/FvDtIndLy/vp6Vw762OWm5VlWmliWB6+QpY5rmJCaUR4ZHMXtKSfvgaFfRKc0Ztr57/kLOjL2HFR2kymtw4rdfcGfhdQWcjR8iJ6qAL4opOhDXCyB3arJCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763410465; c=relaxed/simple; bh=lNuoYkLvd+eD46/OBdJpQ72e0YfFGIty3L9APEHHUsI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b3WK2ONKMtohD9SoCsDRSXK+JThiRsp/2BtnizQOwEfY83Ee7jOjJprmW1RxVRIU+u2b6e8p3SCDI1EKKMNz05qVK2BA7tX2IMlhcG2w8pPlBBWmvRitk4dW7019rutq94BqAVtAxfPXnuvEFQZdNaipbC1kUORLgqgCgYSGm+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=HYZxAWEg; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HYZxAWEg" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-591c98ebe90so5118080e87.3 for ; Mon, 17 Nov 2025 12:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763410461; x=1764015261; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GJ11MTmtpMbfLC31x15oun+LOtxDWcheLgXdGkh/tGo=; b=HYZxAWEgZ7WMoRNSOU9MWgT6li+Pi7wvVdaXS4PGcAS+AYoFG/qqIyMePAUyTzLdi+ ZPQTch5BbsdjXMDLfqHQ9zWNzskw3+GFNWpx/otka1UwaLIdPT13fQ6R6PGk7cqp70SM 0rgApnqQl6/c3LEAnK2jDXCSNWdrC65bPBm4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763410461; x=1764015261; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GJ11MTmtpMbfLC31x15oun+LOtxDWcheLgXdGkh/tGo=; b=IEap3uaZsdZERrvz4SKoV+M+d9f7sezBbmg5KUeO+j9zXY5g+9Tkwoi+erljjGmdiA VGFEZBb1JhVvI2FGvnu3exlJZoriPPPZ8SJp/gOOkHGdR7V4f8q34JboGg8gb5zc2yVT 046oSx3o05+gBaTAPoYL1XJQQyxaD/8hBm3L0NHTFvVtb4Jr6yedzgbzUmhDlQSmR7/G ftZxJbJ2BCmHAyQRpHSA/kzbGKsVKN/xyDq2q7aJuTPUFYEyzuvckElHBYNYYPehiysl kGDHs6od7d4a/rWhJk3EBzQOCHYlDezb09IrsUXF9FWVnATty0S3RVlvsfApzgjo3T6O n2TQ== X-Forwarded-Encrypted: i=1; AJvYcCXWLfxDEht1mq3Qa9WWxtqyITfvL8IQv4W9QTUca3nYoBpEjry7HegRwvUP/AHfgypCTKlt3oR+rgXX3m4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywa5ghKLD2igt6kQ7RFgbzI3T/aOfYWcf4b9U8alT7EHdPcf59P tRMK/HUkgqqtbdff1ewg+x7g/v26AaFrooh31mbWGJZfVYFnONAqayT2DZ+ZxlulcQ== X-Gm-Gg: ASbGncualPZsZq5Sptc4pm6IaINPtsCfBquzF/bHCl8WxoV5fiftJmCkGrK6O1974wa wYZ6/09fJGyr6uRmMgsdrayN1B9efTif8DWRRhIRkffPKHeEPOMAmHSMhqdMtWhca2SapEHUxRl 9xGMS7Vx1VpRWIJI717/TZ7/hB4GhtXHCJ0PSaZ2BHkPGBk8RfdshalpHrz8HdRcrzrlIY2ED7D pV4HTzU9oYt8NIZ13vZqejEm7K9jScG/BfbIwyDxeQ84DzleQbeYEgELDlr66vjyeJKXkmuVpYg jszT/odh56X+gFQy/j7wAxEWOKQI+bU5jkDheeOd+2yVr/6fhHSmVuTGP0Rr6ZxxVa5xn9b+esC 3bWQG8U4/Tpght66wjZIXF4aqIVISrtyI/H9yz6+duGqNaw2oDs3VyqQORccbea8kg1WXD9NsgD olYwf4u0I9KKvbeVyx8hUdGwJtbNuQOjwSYZ7Qd9QKOpquEBZqCI0WGEst87Vu54RvXWjSBXRj X-Google-Smtp-Source: AGHT+IH/Si6c/IRfGlQZcmYGRMYCiNBeXJ2Mujhyi1F02SW3SKnVbJIOPFSmJ7DPN02kVq+M9GRlLA== X-Received: by 2002:a05:6512:131c:b0:594:5ec5:8fec with SMTP id 2adb3069b0e04-595841ff9f5mr3977626e87.28.1763410461174; Mon, 17 Nov 2025 12:14:21 -0800 (PST) Received: from ribalda.c.googlers.com (80.38.88.34.bc.googleusercontent.com. [34.88.38.80]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-595804003a4sm3413302e87.59.2025.11.17.12.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 12:14:20 -0800 (PST) From: Ricardo Ribalda Date: Mon, 17 Nov 2025 20:14:19 +0000 Subject: [PATCH 4/4] media: uvcvideo: Introduce allow_privacy_override Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251117-uvcdynctrl-v1-4-aed70eadf3d8@chromium.org> References: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> In-Reply-To: <20251117-uvcdynctrl-v1-0-aed70eadf3d8@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 Some camera modules have XU controls that can configure the behaviour of the privacy LED. Block mapping of those controls, unless the module is configured with a new parameter: allow_privacy_override. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_driver.c | 5 +++++ drivers/media/usb/uvc/uvc_v4l2.c | 32 ++++++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 1 + include/linux/usb/uvc.h | 4 ++++ 4 files changed, 42 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc= _driver.c index 71563d8f4bcf581694ccd4b665ff52b629caa0b6..d50c501121e6f774dfd6cfdb859= 279e0860d06a5 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -35,6 +35,7 @@ unsigned int uvc_hw_timestamps_param; static unsigned int uvc_quirks_param =3D -1; unsigned int uvc_dbg_param; unsigned int uvc_timeout_param =3D UVC_CTRL_STREAMING_TIMEOUT; +bool uvc_allow_privacy_override_param; =20 static struct usb_driver uvc_driver; =20 @@ -2473,6 +2474,10 @@ module_param_named(trace, uvc_dbg_param, uint, 0644); MODULE_PARM_DESC(trace, "Trace level bitmask"); module_param_named(timeout, uvc_timeout_param, uint, 0644); MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); +module_param_named(allow_privacy_override, uvc_allow_privacy_override_para= m, + bool, 0644); +MODULE_PARM_DESC(allow_privacy_override, + "Allow UVCIOC_CTRL_MAP ioctl map privacy related control"); =20 /* ------------------------------------------------------------------------ * Driver initialization and cleanup diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 03c64b5698bf4331fed8437fa6e9c726a07450bd..e067b8f38500299fe6acc7e3b97= 70f7374748823 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -18,6 +18,7 @@ #include #include #include +#include =20 #include #include @@ -121,6 +122,32 @@ static int uvc_control_add_xu_mapping(struct uvc_video= _chain *chain, /* ------------------------------------------------------------------------ * UVC ioctls */ + +static bool uvc_is_privacy_mapping(struct uvc_xu_control_mapping *xmap) +{ + struct mapping { + u8 entity[16]; + u8 selector; + } privacy_mappings[] =3D { + { + .entity =3D UVC_GUID_LOGITECH_USER_HW_CONTROL_V1, + .selector =3D 1, + }, + { + .entity =3D UVC_GUID_LOGITECH_PERIPHERAL, + .selector =3D 9, + }, + }; + int i; + + for (i =3D 0; i < ARRAY_SIZE(privacy_mappings); i++) + if (!memcmp(xmap->entity, privacy_mappings[i].entity, 16) && + xmap->selector =3D=3D privacy_mappings[i].selector) + return true; + + return false; +} + static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chain *chain, struct uvc_xu_control_mapping *xmap) { @@ -133,6 +160,11 @@ static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chai= n *chain, return -EINVAL; } =20 + if (uvc_is_privacy_mapping(xmap) && !uvc_allow_privacy_override_param) { + pr_warn_once("uvcvideo: Privacy related controls can only be mapped if p= aram allow_privacy_override is true\n"); + return -EINVAL; + } + map =3D kzalloc(sizeof(*map), GFP_KERNEL); if (map =3D=3D NULL) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 9a86d7f1f6ea022dace87614030bf0fde0d260f0..1895e4fe45e9c0246b7f0613dd2= bc51f60b78759 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -662,6 +662,7 @@ extern unsigned int uvc_clock_param; extern unsigned int uvc_dbg_param; extern unsigned int uvc_timeout_param; extern unsigned int uvc_hw_timestamps_param; +extern bool uvc_allow_privacy_override_param; =20 #define uvc_dbg(_dev, flag, fmt, ...) \ do { \ diff --git a/include/linux/usb/uvc.h b/include/linux/usb/uvc.h index b939a01da11466747249c64c72a3ea40cd364a59..f2d6cf52427ce9c0a62a80ca362= 9c6e350fa02c8 100644 --- a/include/linux/usb/uvc.h +++ b/include/linux/usb/uvc.h @@ -41,6 +41,10 @@ #define UVC_GUID_LOGITECH_PERIPHERAL \ {0x21, 0x2d, 0xe5, 0xff, 0x30, 0x80, 0x2c, 0x4e, \ 0x82, 0xd9, 0xf5, 0x87, 0xd0, 0x05, 0x40, 0xbd } +#define UVC_GUID_LOGITECH_USER_HW_CONTROL_V1 \ + {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \ + 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1f } + =20 /* https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-e= xtensions-1-5#222-extension-unit-controls */ #define UVC_MSXU_CONTROL_FOCUS 0x01 --=20 2.52.0.rc1.455.g30608eb744-goog