From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27516C6FD1C for ; Sat, 25 Mar 2023 21:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c68g0yChKCHV1bfLLU+Vgm9WwbRck4yClznRmgAV6V8=; b=RTxxQq1ceLaKJS ZgvTADDwkH6yAA+Pq+EdtNKIRzZkfIRc+lwNtWxtJQXVozjJjDwzc/mENmw5UV/wRcwT5LCF6QCqS lCbwkApK8xF26Bo16kCQJQ3f+Ho6kXlnzTjvPOKekjeUcilzz+4U3BqUUO01zd5z8a4xGKaj9LXp4 0X6W6Ez0G/c6Dw1XjwP/EAS979Z1J6nAM9pWjkrWL4TK+poo3t4ojR64QBP1olb6ruQK6QUOsL+Xf jfQoi6EnNl8k1nujF6WH9vqqMDg5m9Z4J4QtcuRc3QDYVz5zzugh1p4SLiptOuutAlTIqV8zJAMPX fxcujA/lm7XzG8Vy1HsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgBSS-007QUU-2Q; Sat, 25 Mar 2023 21:29:52 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgBSO-007QTa-31 for linux-arm-kernel@lists.infradead.org; Sat, 25 Mar 2023 21:29:50 +0000 Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5500A8BE; Sat, 25 Mar 2023 22:29:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679779786; bh=Jpj+akEfg2jGUqXOXG5JWaUslPt6fAU0Vc613gWhvT0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iRjNIJ5FwvxoAj4MESIMf+5qXpJxHj/nxIU/EQ+GUL3Yd8VLhtwda9uFVFgBprHsw 97fp1wiGJlIPH/xaoZ7pwHofdeKrrDd/SVtAOd02nZ0pphEmJyhTc/OhWwPQhmsCsQ VDrEA1pyLEdi4cub86kR9/LLr2/Ylso5qyPQ86jY= Date: Sat, 25 Mar 2023 23:29:53 +0200 From: Laurent Pinchart To: Paul Kocialkowski Cc: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Adam Pigg , Thomas Petazzoni Subject: Re: [PATCH 6/9] media: sun6i-csi: capture: Implement MC I/O with extended enum_fmt Message-ID: <20230325212953.GD22214@pendragon.ideasonboard.com> References: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> <20230324151228.2778112-7-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230324151228.2778112-7-paul.kocialkowski@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230325_142949_146266_0EF3706A X-CRM114-Status: GOOD ( 26.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Paul, Thank you for the patch. On Fri, Mar 24, 2023 at 04:12:25PM +0100, Paul Kocialkowski wrote: > This driver needs the media-controller API to operate and should not be > considered as a video-device-centric implementation. > > Properly report the IO_MC device cap and extend the enum_fmt > implementation to support enumeration with an explicit mbus_code. > > Signed-off-by: Paul Kocialkowski > --- > .../sunxi/sun6i-csi/sun6i_csi_capture.c | 36 ++++++++++++++++--- > 1 file changed, 32 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c > index 6ce7f1d3ed57..9627030ff060 100644 > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c > @@ -777,13 +777,40 @@ static int sun6i_csi_capture_enum_fmt(struct file *file, void *private, > struct v4l2_fmtdesc *fmtdesc) > { > u32 index = fmtdesc->index; > + u32 mbus_code = fmtdesc->mbus_code; > + unsigned int index_valid = 0; > + unsigned int i; > + > + if (!mbus_code) { > + if (index >= ARRAY_SIZE(sun6i_csi_capture_formats)) > + return -EINVAL; > + > + fmtdesc->pixelformat = > + sun6i_csi_capture_formats[index].pixelformat; > + > + return 0; > + } > + > + /* Check capture pixel format matching with mbus code. */ > > - if (index >= ARRAY_SIZE(sun6i_csi_capture_formats)) > + if (!sun6i_csi_bridge_format_find(mbus_code)) > return -EINVAL; > > - fmtdesc->pixelformat = sun6i_csi_capture_formats[index].pixelformat; > + for (i = 0; i < ARRAY_SIZE(sun6i_csi_capture_formats); i++) { > + u32 pixelformat = sun6i_csi_capture_formats[i].pixelformat; > > - return 0; > + if (!sun6i_csi_capture_format_check(pixelformat, mbus_code)) > + continue; I would probably have added compatible media bus codes to the sun6i_csi_capture_format structure. This should work though, even if it is more CPU-intensive. I'm OK with either option. > + > + if (index == index_valid) { You can replace this with if (index == 0) { and index_valid++; with index--; below, and drop the index_valid variable. > + fmtdesc->pixelformat = pixelformat; > + return 0; > + } > + > + index_valid++; > + } > + > + return -EINVAL; > } > > static int sun6i_csi_capture_g_fmt(struct file *file, void *private, > @@ -1039,7 +1066,8 @@ int sun6i_csi_capture_setup(struct sun6i_csi_device *csi_dev) > > strscpy(video_dev->name, SUN6I_CSI_CAPTURE_NAME, > sizeof(video_dev->name)); > - video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; > + video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | > + V4L2_CAP_IO_MC; > video_dev->vfl_dir = VFL_DIR_RX; > video_dev->release = video_device_release_empty; -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel