[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240222-multistream-v1-9-1837ed916eeb@ti.com>
Date: Thu, 22 Feb 2024 17:01:25 +0530
From: Jai Luthra <j-luthra@...com>
To: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Mauro Carvalho Chehab
<mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Hans
Verkuil <hverkuil-cisco@...all.nl>,
Vaishnav Achath <vaishnav.a@...com>,
Maxime Ripard <mripard@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof
Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley
<conor+dt@...nel.org>
CC: <linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>, Vignesh Raghavendra <vigneshr@...com>,
Aradhya
Bhatia <a-bhatia1@...com>, Devarsh Thakkar <devarsht@...com>,
Changhuang
Liang <changhuang.liang@...rfivetech.com>,
Jack Zhu
<jack.zhu@...rfivetech.com>,
Julien Massot <julien.massot@...labora.com>,
Jayshri Pawar <jpawar@...ence.com>, Jai Luthra <j-luthra@...com>
Subject: [PATCH RFC 09/21] SQUASH: media: ti: j721e-csi2rx: Fix link
validation for multi-stream
With the new architecture, multiple video nodes are connected to output
pads of the ticsi2rx subdev. Fix the link validation for such scenarios.
Signed-off-by: Jai Luthra <j-luthra@...com>
---
.../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 31 ++++++++++++++--------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
index 42eb1bff21e2..1443338f4134 100644
--- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -1133,45 +1133,54 @@ static int ti_csi2rx_link_validate(struct media_link *link)
struct v4l2_subdev_format source_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.pad = link->source->index,
+ .stream = 0,
};
+ struct v4l2_subdev_state *state;
const struct ti_csi2rx_fmt *ti_fmt;
int ret;
- ret = v4l2_subdev_call_state_active(&csi->subdev, pad,
- get_fmt, &source_fmt);
- if (ret)
- return ret;
+ state = v4l2_subdev_lock_and_get_active_state(&csi->subdev);
+ ret = v4l2_subdev_call(&csi->subdev, pad, get_fmt, state, &source_fmt);
+ v4l2_subdev_unlock_state(state);
+
+ if (ret) {
+ dev_dbg(csi->dev,
+ "Skipping validation as no format present on \"%s\":%u:0\n",
+ link->source->entity->name, link->source->index);
+ return 0;
+ }
if (source_fmt.format.width != csi_fmt->width) {
- dev_dbg(csi->dev, "Width does not match (source %u, sink %u)\n",
+ dev_err(csi->dev, "Width does not match (source %u, sink %u)\n",
source_fmt.format.width, csi_fmt->width);
return -EPIPE;
}
if (source_fmt.format.height != csi_fmt->height) {
- dev_dbg(csi->dev, "Height does not match (source %u, sink %u)\n",
+ dev_err(csi->dev, "Height does not match (source %u, sink %u)\n",
source_fmt.format.height, csi_fmt->height);
return -EPIPE;
}
if (source_fmt.format.field != csi_fmt->field &&
csi_fmt->field != V4L2_FIELD_NONE) {
- dev_dbg(csi->dev, "Field does not match (source %u, sink %u)\n",
+ dev_err(csi->dev, "Field does not match (source %u, sink %u)\n",
source_fmt.format.field, csi_fmt->field);
return -EPIPE;
}
ti_fmt = find_format_by_code(source_fmt.format.code);
if (!ti_fmt) {
- dev_dbg(csi->dev, "Media bus format 0x%x not supported\n",
+ dev_err(csi->dev, "Media bus format 0x%x not supported\n",
source_fmt.format.code);
return -EPIPE;
}
if (ti_fmt->fourcc != csi_fmt->pixelformat) {
- dev_dbg(csi->dev,
- "Cannot transform source fmt 0x%x to sink fmt 0x%x\n",
- ti_fmt->fourcc, csi_fmt->pixelformat);
+ dev_err(csi->dev,
+ "Cannot transform \"%s\":%u format %p4cc to %p4cc\n",
+ link->source->entity->name, link->source->index,
+ &ti_fmt->fourcc, &csi_fmt->pixelformat);
return -EPIPE;
}
--
2.43.0
Powered by blists - more mailing lists