Thread (42 messages) 42 messages, 7 authors, 2023-08-08

Re: [PATCH v8 16/16] media: ti: Add CSI2RX support for J721E

From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date: 2023-08-02 12:09:40
Also in: linux-devicetree, linux-media, lkml

On 02/08/2023 14:14, Sakari Ailus wrote:
Moi,

On Wed, Aug 02, 2023 at 02:04:57PM +0300, Tomi Valkeinen wrote:
quoted
quoted
+static int ti_csi2rx_enum_fmt_vid_cap(struct file *file, void *priv,
+				      struct v4l2_fmtdesc *f)
+{
+	const struct ti_csi2rx_fmt *fmt = NULL;
+
+	if (f->mbus_code) {
+		if (f->index > 0)
+			return -EINVAL;
This fails to enumerate the formats if mbus_code is set, doesn't it?
This is intentional: if the mbus_code field is set, you're supposed to get
only format(s) corresponding to that mbus code.
Right. But the above code doesn't do that, does it? It will only return 
the first format, and error for anything else. Ah, the driver only 
supports a single mbus code per fourcc. In that case it's ok.

  Tomi
quoted
quoted
+
+		fmt = find_format_by_code(f->mbus_code);
+	} else {
+		if (f->index >= num_formats)
+			return -EINVAL;
+
+		fmt = &formats[f->index];
+	}
+
+	if (!fmt)
+		return -EINVAL;
+
+	f->pixelformat = fmt->fourcc;
+	memset(f->reserved, 0, sizeof(f->reserved));
+	f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+	return 0;
+}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help