media: vimc: add support for V4L2_FIELD_ALTERNATE in vimc-sensor
Subsystems (2)
PATCH 1/1 media: vimc: add support for V4L2_FIELD_ALTERNATE in vimc-sensor
The vimc sensor currently ignores V4L2_FIELD_ALTERNATE and always configures the test pattern generator (TPG) with a progressive field. This patch adds basic handling for the ALTERNATE field type.
When userspace requests V4L2_FIELD_ALTERNATE, the TPG is configured to output alternating top and bottom fields by calling tpg_s_field() with the interlaced flag set. For all other field types, existing progressive behaviour is preserved.
This change allows the vimc-sensor subdevice to correctly reflect the requested field type in its reported format, enabling basic testing of interlaced-field negotiation in the media pipeline. Other vimc entities (debayer, scaler, capture) still treat all streams as progressive, so streaming with ALTERNATE may not yet succeed.
--- drivers/media/test-drivers/vimc/vimc-sensor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/test-drivers/vimc/vimc-sensor.c +5 -4
@@ -105,8 +105,10 @@ static void vimc_sensor_tpg_s_format(struct vimc_sensor_device *vsensor,tpg_s_bytesperline (&vsensor->tpg,0 , format->width * vpix->bpp);tpg_s_buf_height (&vsensor->tpg, format->height);tpg_s_fourcc (&vsensor->tpg, vpix->pixelformat); -/* TODO: add support for V4L2_FIELD_ALTERNATE */ -tpg_s_field (&vsensor->tpg, format->field, false); +if (format->field ==V4L2_FIELD_ALTERNATE ) +tpg_s_field (&vsensor->tpg,V4L2_FIELD_TOP , true); +else +tpg_s_field (&vsensor->tpg, format->field, false);tpg_s_colorspace (&vsensor->tpg, format->colorspace);tpg_s_ycbcr_enc (&vsensor->tpg, format->ycbcr_enc);tpg_s_quantization (&vsensor->tpg, format->quantization);
@@ -127,8 +129,7 @@ static void vimc_sensor_adjust_fmt(struct v4l2_mbus_framefmt *fmt) fmt->height =clamp_t (u32, fmt->height,VIMC_FRAME_MIN_HEIGHT ,VIMC_FRAME_MAX_HEIGHT ) & ~1 ; -/* TODO: add support for V4L2_FIELD_ALTERNATE */ -if (fmt->field ==V4L2_FIELD_ANY || fmt->field ==V4L2_FIELD_ALTERNATE ) +if (fmt->field ==V4L2_FIELD_ANY ) fmt->field = fmt_default.field;vimc_colorimetry_clamp (fmt);
Signature · 1 line
2.43.0