Re: [PATCH 1/2] media: rockchip: rkcif: Filter enumerated formats by media bus code
From: Faizel K B
Date: Mon Nov 09 2026 - 15:05:45 EST
Hi Mehdi,
On Mon, Nov 09, 2026 at 01:27:34PM +0100, Mehdi Djait wrote:
--- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
+++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
@@ -395,13 +395,20 @@ static int rkcif_stream_enum_formats(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
struct rkcif_stream *stream = video_drvdata(file);
+ unsigned int i, n = 0;
- if (f->index >= stream->out_fmts_num)
- return -EINVAL;
+ for (i = 0; i < stream->out_fmts_num; i++) {
+ if (f->mbus_code &&
+ stream->out_fmts[i].mbus_code != f->mbus_code)
what about dvp capture. The dvp_out_fmts[] does not have the mbus_code
set.
Thanks for the review. Yes, the DVP case is missing. How about only filtering the formats that have a media bus code, so DVP behaves as
before (see the change).
const struct rkcif_output_fmt *fmt = &stream->out_fmts[i];
if (f->mbus_code && fmt->mbus_code &&
fmt->mbus_code != f->mbus_code)
continue;
I don't have DVP hardware to test with. I can submit a v2 if that's ok.
Regards,
Faizel