mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] media: i2c: vd55g1: Two v4l2-compliance fixes for controls
@ 2026-11-01 19:50 Fernando Rimoli
  2026-11-01 19:50 ` [PATCH v2 1/2] media: i2c: vd55g1: Mark the AE lock and bias controls inactive in manual mode Fernando Rimoli
  2026-11-01 19:50 ` [PATCH v2 2/2] media: i2c: vd55g1: Support control events Fernando Rimoli
  0 siblings, 2 replies; 3+ messages in thread
From: Fernando Rimoli @ 2026-11-01 19:50 UTC (permalink / raw)
  To: Benjamin Mugnier, Sylvain Petinot
  Cc: Fernando Rimoli, Sakari Ailus, Mauro Carvalho Chehab,
	linux-media, linux-kernel

Two control fixes for failures v4l2-compliance reports on the sensor
subdev: 1/2 marks the auto exposure lock and bias controls inactive
rather than grabbed in manual exposure mode, and 2/2 adds control
events.

Changes since v1:
 - 1/2: dropped the Fixes tag (Benjamin). No code changes.

Testing is as in v1. I do not have a VD55G1, so the changes were tested
on the VD55G0 of a Surface Pro 9 (IPU6) through an out-of-tree driver
derived from vd55g1, identical in the code these patches touch. With
them, the QUERYCTRL, QUERY_EXT_CTRL, S_CTRL and control event tests
pass on the subdev, where they failed before.

v1: https://lore.kernel.org/linux-media/20261025154031.27083-1-fernandorimoli11@gmail.com/

Fernando Rimoli (2):
  media: i2c: vd55g1: Mark the AE lock and bias controls inactive in
    manual mode
  media: i2c: vd55g1: Support control events

 drivers/media/i2c/vd55g1.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

base-commit: 27285b099fbc5cb2ae3aef20f3bbd7b3c88b3005
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] media: i2c: vd55g1: Mark the AE lock and bias controls inactive in manual mode
  2026-11-01 19:50 [PATCH v2 0/2] media: i2c: vd55g1: Two v4l2-compliance fixes for controls Fernando Rimoli
@ 2026-11-01 19:50 ` Fernando Rimoli
  2026-11-01 19:50 ` [PATCH v2 2/2] media: i2c: vd55g1: Support control events Fernando Rimoli
  1 sibling, 0 replies; 3+ messages in thread
From: Fernando Rimoli @ 2026-11-01 19:50 UTC (permalink / raw)
  To: Benjamin Mugnier, Sylvain Petinot
  Cc: Fernando Rimoli, Sakari Ailus, Mauro Carvalho Chehab,
	linux-media, linux-kernel

In manual exposure mode the auto exposure lock and bias controls have
no effect, and the driver marks them grabbed. The grabbed flag means a
control is temporarily locked, for instance while streaming, so
v4l2-compliance fails on it while the sensor is idle:

  fail: v4l2-test-controls.cpp(134): GRABBED flag set
  test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL
  test VIDIOC_QUERYCTRL: FAIL

A control that does not apply to the current configuration is what the
inactive flag is for. Use v4l2_ctrl_activate() instead.

Setting the controls in manual mode now stores the value rather than
returning -EBUSY. That has no effect on the sensor:
vd55g1_lock_exposure() writes only in auto mode, and the bias sets the
auto exposure target, which the sensor uses only once auto exposure
resumes.

Signed-off-by: Fernando Rimoli <fernandorimoli11@gmail.com>
---
 drivers/media/i2c/vd55g1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index e3939bb..69ffb3a 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -1503,8 +1503,8 @@ static int vd55g1_s_ctrl(struct v4l2_ctrl *ctrl)
 		break;
 	case V4L2_CID_EXPOSURE_AUTO:
 		is_auto = (ctrl->val == V4L2_EXPOSURE_AUTO);
-		__v4l2_ctrl_grab(sensor->ae_lock_ctrl, !is_auto);
-		__v4l2_ctrl_grab(sensor->ae_bias_ctrl, !is_auto);
+		v4l2_ctrl_activate(sensor->ae_lock_ctrl, is_auto);
+		v4l2_ctrl_activate(sensor->ae_bias_ctrl, is_auto);
 		break;
 	case V4L2_CID_HDR_SENSOR_MODE:
 		/* Discriminate if the userspace changed the control value */
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] media: i2c: vd55g1: Support control events
  2026-11-01 19:50 [PATCH v2 0/2] media: i2c: vd55g1: Two v4l2-compliance fixes for controls Fernando Rimoli
  2026-11-01 19:50 ` [PATCH v2 1/2] media: i2c: vd55g1: Mark the AE lock and bias controls inactive in manual mode Fernando Rimoli
@ 2026-11-01 19:50 ` Fernando Rimoli
  1 sibling, 0 replies; 3+ messages in thread
From: Fernando Rimoli @ 2026-11-01 19:50 UTC (permalink / raw)
  To: Benjamin Mugnier, Sylvain Petinot
  Cc: Fernando Rimoli, Sakari Ailus, Mauro Carvalho Chehab,
	linux-media, linux-kernel

The sensor subdev exposes controls but does not implement the control
event operations, so VIDIOC_SUBSCRIBE_EVENT fails and v4l2-compliance
reports:

  fail: v4l2-test-controls.cpp(1108): subscribe event for control 'User Controls' failed
  test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL

Add the standard control event subdev operations and set
V4L2_SUBDEV_FL_HAS_EVENTS.

Signed-off-by: Fernando Rimoli <fernandorimoli11@gmail.com>
---
 drivers/media/i2c/vd55g1.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 69ffb3a..162c2d5 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -1447,7 +1447,13 @@ static const struct v4l2_subdev_video_ops vd55g1_video_ops = {
 	.s_stream = v4l2_subdev_s_stream_helper,
 };
 
+static const struct v4l2_subdev_core_ops vd55g1_core_ops = {
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
 static const struct v4l2_subdev_ops vd55g1_subdev_ops = {
+	.core = &vd55g1_core_ops,
 	.video = &vd55g1_video_ops,
 	.pad = &vd55g1_pad_ops,
 };
@@ -1918,7 +1924,8 @@ static int vd55g1_subdev_init(struct vd55g1 *sensor)
 	int ret;
 
 	/* Init sub device */
-	sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			    V4L2_SUBDEV_FL_HAS_EVENTS;
 	sensor->sd.internal_ops = &vd55g1_internal_ops;
 
 	/* Init source pad */
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-01 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01 19:50 [PATCH v2 0/2] media: i2c: vd55g1: Two v4l2-compliance fixes for controls Fernando Rimoli
2026-11-01 19:50 ` [PATCH v2 1/2] media: i2c: vd55g1: Mark the AE lock and bias controls inactive in manual mode Fernando Rimoli
2026-11-01 19:50 ` [PATCH v2 2/2] media: i2c: vd55g1: Support control events Fernando Rimoli

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®