[PATCH v2 07/13] media: iris: support read-only controls

From: Dmitry Baryshkov

Date: Fri Dec 04 2026 - 13:25:54 EST


Some decoder controls describe the bitstream rather than configure the
decoder, for example the profile and level of the stream being decoded.
Userspace cannot meaningfully set them, and the driver needs to update
them from the parameters reported by the firmware.

Add a CAP_FLAG_READ_ONLY capability flag that marks the V4L2 control
read-only. The V4L2 core already rejects writes from userspace to such
controls, so the only updates reaching the s_ctrl handler come from the
driver itself: store the value without the streaming-state checks that
apply to client-set controls, and without marking it as set by the client.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/iris/iris_ctrls.c | 8 ++++++++
drivers/media/platform/qcom/iris/iris_platform_common.h | 1 +
2 files changed, 9 insertions(+)

diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/platform/qcom/iris/iris_ctrls.c
index 4f2633bbb49f..f1903e028ea8 100644
--- a/drivers/media/platform/qcom/iris/iris_ctrls.c
+++ b/drivers/media/platform/qcom/iris/iris_ctrls.c
@@ -331,6 +331,11 @@ static int iris_op_s_ctrl(struct v4l2_ctrl *ctrl)
if (!iris_valid_cap_id(cap_id))
return -EINVAL;

+ if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) {
+ inst->fw_caps[cap_id].value = ctrl->val;
+ return 0;
+ }
+
q = v4l2_m2m_get_src_vq(inst->m2m_ctx);
if (vb2_is_streaming(q) &&
(!(inst->fw_caps[cap_id].flags & CAP_FLAG_DYNAMIC_ALLOWED)))
@@ -406,6 +411,9 @@ int iris_ctrls_init(struct iris_inst *inst)
goto error;
}

+ if (cap[idx].flags & CAP_FLAG_READ_ONLY)
+ ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+
ctrl_idx++;
}

diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h
index 30cfa3d793b2..47bca539d50d 100644
--- a/drivers/media/platform/qcom/iris/iris_platform_common.h
+++ b/drivers/media/platform/qcom/iris/iris_platform_common.h
@@ -223,6 +223,7 @@ enum platform_inst_fw_cap_flags {
CAP_FLAG_CLIENT_SET = BIT(4),
CAP_FLAG_BITMASK = BIT(5),
CAP_FLAG_VOLATILE = BIT(6),
+ CAP_FLAG_READ_ONLY = BIT(7),
};

struct platform_inst_fw_cap {

--
2.47.3