From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290596; b=aI2ZAsYNKOViJX56Dd3/1HnQ+7btNw2p18OovDM+wMgroC8NGCBcv6IFFb/tAo67QDhr BqcaT9eRppInuFYnTis2nVDPwg/P0aGQAFsB+Wnb63X/4lFaVZAagvZiAS2PLxYSOQYMp qEV9gtBG00mSYleFQCbLIA2rtdxW5cwKCim2m2lNRlUR8ZAmiNIX9Vt/fhEeNYwklCOZu Fx5v9tIIdV5qyOwCQXhhCANGPM46qtQYWwxqHX4uHKrJEWIPI9ivg2VlsXWzp9Q4glFcC cWZZ3lLyQWqMrcrOWVhlMcgXUbt8l2Hjo+yQ3H8cG2DRz/jBZwc+us8lc8ucoJvF3jw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290596; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=OHuITAZ5hXUc+tfXuc64tJpSxqWn+so86IVIJQ6uJ5U=; b=LTxE8mDARAzbpU49AKleTA5IyodbtC8HvNCMzoQSIbVxQibd/0i98AZdlqbgEPUQMI+/ Dt75PAc4Fw7dY2pEbsMnRefkV4AqKb70lb1fZIlaSEfPyDlIHEip4WItf/8e7LQS5TA8C 7K5G6C5iG96zyF9J2ru1gd8vuoRnAmlCmYwir+N9RfT8TqOgNNXQtRJ0VmgEEKADXhLwk NEie3zq9VGkaJbqVuC8Y6SWZ/VatK5QccNQpiTewztL6VCxxgrE3I39X0n5VXfdHtyTYC msUuSgOFrNl/pB0cAWQdv2YjvM0kCIZ1Cd3NWSdaUXosQmCPgTfcX1LIGCbYQaECttw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fLsSboLk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D1E0606A32F; Thu, 3 Dec 2026 09:36:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fLsSboLk Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFA161F00893; Thu, 3 Dec 2026 09:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290596; bh=OHuITAZ5hXUc+tfXuc64tJpSxqWn+so86IVIJQ6uJ5U=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=fLsSboLk6hHOO9V1gn0fQR9B3BZHbaq04eWkJGuQW5MkwK1/yk6wW8OR+kk68Ga6j gO5QNcZEq10fgWfdwSr/6O4KmpC5ENWFLv4APaJU3bZK+W7172WVX+T24w/FhDi7+d wldZxPtUJg0XwjAr3cE2/Nn2qvBZvNOKast/qjf0h7IkFMHryyBAJmR5imjL0+Ngnw 6XsyZ5vxn7QVAmumUBSQTzUsfcxyD5lB0YEMbPLm0dI8UxV9u3g1utg5ruBXgXd1hu dgrND3F/DVlT6cqxPXNPn4rqAI3guvMat/mlExmB0i1LYKeccK2jxkr6yHQExWuiNk MwqZbvBXf775Q== Message-ID: Date: Thu, 3 Dec 2026 10:36:31 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 1/5] media: v4l2-core: add new control type V4L2_CTRL_TYPE_S8 To: Deepa Guthyappa Madivalara , Mauro Carvalho Chehab , Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel test robot References: <20261120-enc_roi_enable-v11-0-c00b95ea1b81@oss.qualcomm.com> <20261120-enc_roi_enable-v11-1-c00b95ea1b81@oss.qualcomm.com> From: Hans Verkuil Content-Language: en-US, nl In-Reply-To: <20261120-enc_roi_enable-v11-1-c00b95ea1b81@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 21/11/2026 00:45, Deepa Guthyappa Madivalara wrote: > Introduce V4L2_CTRL_TYPE_S8 (enum value 0x0103) as a new > control type for signed 8-bit values. Add necessary support in > v4l2_ext_control, v4l2_ctrl_ptr and handling in v4l2-ctrls-core, > v4l2-ctrls-api. > > Reviewed-by: Hans Verkuil > Signed-off-by: Deepa Guthyappa Madivalara This patch is fine, but you need to add another patch adding a test S8 array control to the vivid driver, just as was done for TYPE_U8. This ensures that we can do regression tests for controls of this type using vivid. Regards, Hans > --- > .../userspace-api/media/v4l/videodev2.h.rst.exceptions | 1 + > .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 4 ++++ > .../userspace-api/media/v4l/vidioc-queryctrl.rst | 6 ++++++ > drivers/media/v4l2-core/v4l2-ctrls-api.c | 1 + > drivers/media/v4l2-core/v4l2-ctrls-core.c | 16 ++++++++++++++++ > include/media/v4l2-ctrls.h | 2 ++ > include/uapi/linux/videodev2.h | 2 ++ > 7 files changed, 32 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions > index 6182b4e2d2ee002c0d3562e1cc3bc2fd9c4286d6..b036ed3ec2f0744175cad1cbc4e73fe828e0c955 100644 > --- a/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions > +++ b/Documentation/userspace-api/media/v4l/videodev2.h.rst.exceptions > @@ -141,6 +141,7 @@ replace symbol V4L2_CTRL_TYPE_STRING :c:type:`V4L.v4l2_ctrl_type` > replace symbol V4L2_CTRL_TYPE_U16 :c:type:`V4L.v4l2_ctrl_type` > replace symbol V4L2_CTRL_TYPE_U32 :c:type:`V4L.v4l2_ctrl_type` > replace symbol V4L2_CTRL_TYPE_U8 :c:type:`V4L.v4l2_ctrl_type` > +replace symbol V4L2_CTRL_TYPE_S8 :c:type:`V4L.v4l2_ctrl_type` > replace symbol V4L2_CTRL_TYPE_MPEG2_SEQUENCE :c:type:`V4L.v4l2_ctrl_type` > replace symbol V4L2_CTRL_TYPE_MPEG2_PICTURE :c:type:`V4L.v4l2_ctrl_type` > replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTISATION :c:type:`V4L.v4l2_ctrl_type` > diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst > index d78328152b7552f8f0d30a9e2f7c104bfd4b70d3..fe5f8992389c32d8f35f432229ef2f734002644e 100644 > --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst > +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst > @@ -188,6 +188,10 @@ still cause this situation. > - ``p_u32`` > - A pointer to a matrix control of unsigned 32-bit values. Valid if > this control is of type ``V4L2_CTRL_TYPE_U32``. > + * - __s8 * > + - ``p_s8`` > + - A pointer to a matrix control of signed 8-bit values. Valid if > + this control is of type ``V4L2_CTRL_TYPE_S8``. > * - __s32 * > - ``p_s32`` > - A pointer to a matrix control of signed 32-bit values. Valid if > diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst > index 82c8b52e771ce9301491b3f752e501a8fe7e2434..57e1652ae72e0324742142446acf32a16b94941c 100644 > --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst > +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst > @@ -425,6 +425,12 @@ See also the examples in :ref:`control`. > - any > - An unsigned 32-bit valued control ranging from minimum to maximum > inclusive. The step value indicates the increment between values. > + * - ``V4L2_CTRL_TYPE_S8`` > + - any > + - any > + - any > + - A signed 8-bit valued control ranging from minimum to maximum > + inclusive. The step value indicates the increment between values. > * - ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION`` > - n/a > - n/a > diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c > index 93d8d4012d0f4fef004e417d0aee2ae44b1b30bd..7d41cfd7378baaa929d4da0266c45f731bb54285 100644 > --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c > +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c > @@ -980,6 +980,7 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, > case V4L2_CTRL_TYPE_U8: > case V4L2_CTRL_TYPE_U16: > case V4L2_CTRL_TYPE_U32: > + case V4L2_CTRL_TYPE_S8: > if (ctrl->is_array) > return -EINVAL; > ret = check_range(ctrl->type, min, max, step, def); > diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c > index 6e751a043a210618fd7829df16e99e535e9f45cc..a34eb2a21abafe7b0f1e9509939edb9fbedf8030 100644 > --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c > +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c > @@ -297,6 +297,9 @@ static void __v4l2_ctrl_type_op_init(const struct v4l2_ctrl *ctrl, u32 from_idx, > memset(ptr.p_u32 + from_idx, 0, elems * sizeof(u32)); > } > break; > + case V4L2_CTRL_TYPE_S8: > + memset(ptr.p_s8 + from_idx, (u8)value, elems); > + break; > default: > for (i = from_idx; i < tot_elems; i++) { > switch (which) { > @@ -377,6 +380,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl) > case V4L2_CTRL_TYPE_U32: > pr_cont("%u", (unsigned)*ptr.p_u32); > break; > + case V4L2_CTRL_TYPE_S8: > + pr_cont("%d", *ptr.p_s8); > + break; > case V4L2_CTRL_TYPE_AREA: > pr_cont("%ux%u", ptr.p_area->width, ptr.p_area->height); > break; > @@ -1474,6 +1480,8 @@ static int std_validate_elem(const struct v4l2_ctrl *ctrl, u32 idx, > return ROUND_TO_RANGE(ptr.p_u16[idx], u16, ctrl); > case V4L2_CTRL_TYPE_U32: > return ROUND_TO_RANGE(ptr.p_u32[idx], u32, ctrl); > + case V4L2_CTRL_TYPE_S8: > + return ROUND_TO_RANGE(ptr.p_s8[idx], u8, ctrl); > > case V4L2_CTRL_TYPE_BOOLEAN: > ptr.p_s32[idx] = !!ptr.p_s32[idx]; > @@ -1533,6 +1541,10 @@ int v4l2_ctrl_type_op_validate(const struct v4l2_ctrl *ctrl, > if (ctrl->maximum == 0xffffffff && ctrl->minimum == 0 && ctrl->step == 1) > return 0; > break; > + case V4L2_CTRL_TYPE_S8: > + if (ctrl->maximum == S8_MAX && ctrl->minimum == S8_MIN && ctrl->step == 1) > + return 0; > + break; > > case V4L2_CTRL_TYPE_BUTTON: > case V4L2_CTRL_TYPE_CTRL_CLASS: > @@ -1764,6 +1776,7 @@ int check_range(enum v4l2_ctrl_type type, > case V4L2_CTRL_TYPE_U32: > case V4L2_CTRL_TYPE_INTEGER: > case V4L2_CTRL_TYPE_INTEGER64: > + case V4L2_CTRL_TYPE_S8: > if (step == 0 || min > max || def < min || def > max) > return -ERANGE; > return 0; > @@ -2069,6 +2082,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, > case V4L2_CTRL_TYPE_U32: > elem_size = sizeof(u32); > break; > + case V4L2_CTRL_TYPE_S8: > + elem_size = sizeof(s8); > + break; > case V4L2_CTRL_TYPE_MPEG2_SEQUENCE: > elem_size = sizeof(struct v4l2_ctrl_mpeg2_sequence); > break; > diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h > index cec9217d97ac698cd447574f5d079dd913a9ef6f..cbda866197d894657b571ee5d57b4956818b7ee0 100644 > --- a/include/media/v4l2-ctrls.h > +++ b/include/media/v4l2-ctrls.h > @@ -30,6 +30,7 @@ struct video_device; > * @p_s32: Pointer to a 32-bit signed value. > * @p_s64: Pointer to a 64-bit signed value. > * @p_u8: Pointer to a 8-bit unsigned value. > + * @p_s8: Pointer to a 8-bit signed value. > * @p_u16: Pointer to a 16-bit unsigned value. > * @p_u32: Pointer to a 32-bit unsigned value. > * @p_char: Pointer to a string. > @@ -61,6 +62,7 @@ struct video_device; > * @p_const: Pointer to a constant compound value. > */ > union v4l2_ctrl_ptr { > + s8 *p_s8; > s32 *p_s32; > s64 *p_s64; > u8 *p_u8; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index 5373dba640fae3d19247ab1c74ba336e05dc0fe0..ac588d0093df9cc35c11d0b9d41d052d5e800925 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -1884,6 +1884,7 @@ struct v4l2_ext_control { > __s64 value64; > char __user *string; > __u8 __user *p_u8; > + __s8 __user *p_s8; > __u16 __user *p_u16; > __u32 __user *p_u32; > __s32 __user *p_s32; > @@ -1961,6 +1962,7 @@ enum v4l2_ctrl_type { > V4L2_CTRL_TYPE_U8 = 0x0100, > V4L2_CTRL_TYPE_U16 = 0x0101, > V4L2_CTRL_TYPE_U32 = 0x0102, > + V4L2_CTRL_TYPE_S8 = 0x0103, > V4L2_CTRL_TYPE_AREA = 0x0106, > V4L2_CTRL_TYPE_RECT = 0x0107, > >