media: imx: imx-mipi-csis: Implement the .get_frame_desc() operation

The CSIS is connected to its sink through an SoC-specific gasket that
needs to be configured. Depending on the platform, the gasket
configuration requires knowing the CSI-2 DT. To provide the needed
information, implement the .get_frame_desc() operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Laurent Pinchart 2022-02-22 09:50:25 +00:00 committed by Mauro Carvalho Chehab
parent a1c046d322
commit d200de90de
1 changed files with 27 additions and 0 deletions

View File

@ -1160,6 +1160,32 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd,
return 0; return 0;
} }
static int mipi_csis_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
struct v4l2_mbus_frame_desc *fd)
{
struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[0];
if (pad != CSIS_PAD_SOURCE)
return -EINVAL;
fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL;
fd->num_entries = 1;
memset(entry, 0, sizeof(*entry));
mutex_lock(&csis->lock);
entry->flags = 0;
entry->pixelcode = csis->csis_fmt->code;
entry->bus.csi2.vc = 0;
entry->bus.csi2.dt = csis->csis_fmt->data_type;
mutex_unlock(&csis->lock);
return 0;
}
static int mipi_csis_log_status(struct v4l2_subdev *sd) static int mipi_csis_log_status(struct v4l2_subdev *sd)
{ {
struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd); struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
@ -1184,6 +1210,7 @@ static const struct v4l2_subdev_pad_ops mipi_csis_pad_ops = {
.enum_mbus_code = mipi_csis_enum_mbus_code, .enum_mbus_code = mipi_csis_enum_mbus_code,
.get_fmt = mipi_csis_get_fmt, .get_fmt = mipi_csis_get_fmt,
.set_fmt = mipi_csis_set_fmt, .set_fmt = mipi_csis_set_fmt,
.get_frame_desc = mipi_csis_get_frame_desc,
}; };
static const struct v4l2_subdev_ops mipi_csis_subdev_ops = { static const struct v4l2_subdev_ops mipi_csis_subdev_ops = {