From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Deepa Guthyappa Madivalara <deepa.madivalara@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v7 1/5] media: v4l2-core: add new control type V4L2_CTRL_TYPE_S8
Date: Wed, 30 Sep 2026 09:14:31 +0200 [thread overview]
Message-ID: <e9b1f3db-9f53-44f9-a188-b1ee0e9c47aa@kernel.org> (raw)
In-Reply-To: <20260924-enc_roi_enable-v7-1-6fa7413af23c@oss.qualcomm.com>
On 25/09/2026 02:28, 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.
>
> Signed-off-by: Deepa Guthyappa Madivalara <deepa.madivalara@oss.qualcomm.com>
> ---
> .../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 661a3a25da5220d2e824f71e68871181533e6cd8..c5df0e0a54f81c73975f427957b7c99fd421d5ad 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;
> @@ -1442,6 +1448,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];
> @@ -1501,6 +1509,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:
> @@ -1732,6 +1744,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;
> @@ -2037,6 +2050,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..6a181a6c6b43beae87310cacb044a0cc7ad2c063 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -27,6 +27,7 @@ struct video_device;
>
> /**
> * union v4l2_ctrl_ptr - A pointer to a control value.
> + * @p_s8: Pointer to a 8-bit signed value.
Nitpick: move @p_s8 to just below @p_u8...
> * @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.
> @@ -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;
...same as you do here.
With that change:
Reviewed-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Regards,
Hans
> __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,
>
>
next prev parent reply other threads:[~2026-09-30 7:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 0:28 [PATCH v7 0/5] Implement Region of Interest(ROI) support Deepa Guthyappa Madivalara
2026-09-25 0:28 ` [PATCH v7 1/5] media: v4l2-core: add new control type V4L2_CTRL_TYPE_S8 Deepa Guthyappa Madivalara
2026-09-30 7:14 ` Hans Verkuil [this message]
2026-09-30 9:53 ` Vishnu Reddy
2026-09-25 0:28 ` [PATCH v7 2/5] media: uapi: Introduce new control for video encoder ROI Deepa Guthyappa Madivalara
2026-09-28 14:32 ` Nicolas Dufresne
2026-09-28 21:11 ` Deepa Guthyappa Madivalara
2026-09-30 7:15 ` Hans Verkuil
2026-09-25 0:28 ` [PATCH v7 3/5] media: iris: Add ROI delta QP control support for HFI Gen2 encoders Deepa Guthyappa Madivalara
2026-09-25 0:28 ` [PATCH v7 4/5] media: iris: Add HFI metadata buffer delivery support for " Deepa Guthyappa Madivalara
2026-09-30 10:32 ` Vishnu Reddy
2026-09-25 0:28 ` [PATCH v7 5/5] media: iris: Add BUF_ROIMB_DELTAQP metadata buffer for ROI delta QP Deepa Guthyappa Madivalara
2026-09-30 10:58 ` Vishnu Reddy
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=e9b1f3db-9f53-44f9-a188-b1ee0e9c47aa@kernel.org \
--to=hverkuil+cisco@kernel.org \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=deepa.madivalara@oss.qualcomm.com \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mchehab@kernel.org \
--cc=vikash.garodia@oss.qualcomm.com \
/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®