mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: i2c: imx274: implement enum_mbus_code
@ 2021-11-18 15:40 Eugen Hristev
  2021-11-18 17:11 ` Luca Ceresoli
  0 siblings, 1 reply; 7+ messages in thread
From: Eugen Hristev @ 2021-11-18 15:40 UTC (permalink / raw)
  To: leonl, linux-media
  Cc: skomatineni, sakari.ailus, luca, linux-kernel, Eugen Hristev

Current driver supports only SRGGB 10 bit RAW bayer format.
Add the enum_mbus_code implementation to report this format supported.

 # v4l2-ctl -d /dev/v4l-subdev3 --list-subdev-mbus-codes
ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
        0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
 #

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/media/i2c/imx274.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
index 2e804e3b70c4..25a4ef8f6187 100644
--- a/drivers/media/i2c/imx274.c
+++ b/drivers/media/i2c/imx274.c
@@ -1909,7 +1909,21 @@ static int imx274_set_frame_interval(struct stimx274 *priv,
 	return err;
 }
 
+static int imx274_enum_mbus_code(struct v4l2_subdev *sd,
+				 struct v4l2_subdev_state *sd_state,
+				 struct v4l2_subdev_mbus_code_enum *code)
+{
+	if (code->index > 0)
+		return -EINVAL;
+
+	/* only supported format in the driver is Raw 10 bits SRGGB */
+	code->code = MEDIA_BUS_FMT_SRGGB10_1X10;
+
+	return 0;
+}
+
 static const struct v4l2_subdev_pad_ops imx274_pad_ops = {
+	.enum_mbus_code = imx274_enum_mbus_code,
 	.get_fmt = imx274_get_fmt,
 	.set_fmt = imx274_set_fmt,
 	.get_selection = imx274_get_selection,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-19  8:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 15:40 [PATCH] media: i2c: imx274: implement enum_mbus_code Eugen Hristev
2021-11-18 17:11 ` Luca Ceresoli
2021-11-18 17:26   ` Sakari Ailus
2021-11-18 17:34     ` Eugen.Hristev
2021-11-18 17:37       ` Luca Ceresoli
2021-11-18 17:39     ` Luca Ceresoli
2021-11-19  8:26       ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®