Re: [PATCH v1] media: cadence: csi2rx: Add enum_mbus_code pad ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 12/11/23 10:43, Changhuang Liang wrote:
Add enum_mbus_code ioctl so that user space can know what
formats are supported to csi2rx.

Signed-off-by: Changhuang Liang <changhuang.liang@xxxxxxxxxxxxxxxx>

Reviewed-by: Julien Massot <julien.massot@xxxxxxxxxxxxx>
Tested-by: Julien Massot <julien.massot@xxxxxxxxxxxxx>

---
  drivers/media/platform/cadence/cdns-csi2rx.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 889f4fbbafb3..7788ce0e3171 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -389,6 +389,18 @@ static int csi2rx_s_stream(struct v4l2_subdev *subdev, int enable)
  	return ret;
  }
+static int csi2rx_enum_mbus_code(struct v4l2_subdev *subdev,
+				 struct v4l2_subdev_state *state,
+				 struct v4l2_subdev_mbus_code_enum *code_enum)
+{
+	if (code_enum->index >= ARRAY_SIZE(formats))
+		return -EINVAL;
+
+	code_enum->code = formats[code_enum->index].code;
+
+	return 0;
+}
+
  static int csi2rx_set_fmt(struct v4l2_subdev *subdev,
  			  struct v4l2_subdev_state *state,
  			  struct v4l2_subdev_format *format)
@@ -439,6 +451,7 @@ static int csi2rx_init_cfg(struct v4l2_subdev *subdev,
  }
static const struct v4l2_subdev_pad_ops csi2rx_pad_ops = {
+	.enum_mbus_code	= csi2rx_enum_mbus_code,
  	.get_fmt	= v4l2_subdev_get_fmt,
  	.set_fmt	= csi2rx_set_fmt,
  	.init_cfg	= csi2rx_init_cfg,

Regards,
--
Julien Massot





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux