diff options
author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2022-04-26 09:02:40 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-05-17 09:11:57 +0200 |
commit | 7a12903182c8c0e3ba61eb9c5bdf160f337686c5 (patch) | |
tree | 709ebb1ee6b8f347b7bb25b601acec33aab45d6e /drivers/media/platform/ti/cal/cal-camerarx.c | |
parent | 897c45df291ff063d6a0acb20b3a0c276c6adf6a (diff) |
media: ti: cal: use frame desc to get vc and dt
Use get_frame_desc() to get the frame desc from the connected source,
and use the provided virtual channel and datatype instead of hardcoded
ones.
get_frame_desc() can contain multiple streams, but as we don't support
multiple streams yet, we will just always use the first stream.
If the source doesn't support get_frame_desc(), fall back to the
previous method of always capturing virtual channel 0 and any datatype.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/platform/ti/cal/cal-camerarx.c')
-rw-r--r-- | drivers/media/platform/ti/cal/cal-camerarx.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/media/platform/ti/cal/cal-camerarx.c b/drivers/media/platform/ti/cal/cal-camerarx.c index 6b43a1525b45..e69fed117fea 100644 --- a/drivers/media/platform/ti/cal/cal-camerarx.c +++ b/drivers/media/platform/ti/cal/cal-camerarx.c @@ -583,6 +583,33 @@ done: return ret; } +int cal_camerarx_get_remote_frame_desc(struct cal_camerarx *phy, + struct v4l2_mbus_frame_desc *desc) +{ + struct media_pad *pad; + int ret; + + if (!phy->source) + return -EPIPE; + + pad = media_entity_remote_pad(&phy->pads[CAL_CAMERARX_PAD_SINK]); + if (!pad) + return -EPIPE; + + ret = v4l2_subdev_call(phy->source, pad, get_frame_desc, pad->index, + desc); + if (ret) + return ret; + + if (desc->type != V4L2_MBUS_FRAME_DESC_TYPE_CSI2) { + dev_err(phy->cal->dev, + "Frame descriptor does not describe CSI-2 link"); + return -EINVAL; + } + + return 0; +} + /* ------------------------------------------------------------------ * V4L2 Subdev Operations * ------------------------------------------------------------------ |