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 786A9C6FD1C for ; Sat, 25 Mar 2023 07:14:39 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qTH+5JD0t+OMzGPJuxsjuiox1R1Z1fPwEj31Af6T7Tw=; b=fy0B2Vf5QlHYWb xsp2e0x0ngJBfjXa0t9Nop90y0uZRtc9UgP9fp3RP/xPo1xLRev/Max8GmHM7lIhUQvRUk4Jtv352 lNoLOfGeCP8d3yALQd+pWag+lnMmBiTh7qdgqGlxyzA16VVm1oh394Sw5X8k8Bk995wzzNvfqMKcj Epqe4bln1RYk8BPJba55rGaWGjmILFOJzoyQK2kpDa8AP+0XPHBvXhde0xMDBkW+2ETsUwkmjWfKv 9HljwljKmG/GCGiQ250i05QHUMYfsCV8J9D5WrhtBjF5F/E5AWCo2GLXdarE9rmoPBMIjC6fmEwmO cN4ro3hiycPbDWuVkb0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfy5y-006Ka4-1x; Sat, 25 Mar 2023 07:13:46 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfy5u-006KZD-30 for linux-arm-kernel@lists.infradead.org; Sat, 25 Mar 2023 07:13:44 +0000 Received: by mail-ed1-x530.google.com with SMTP id b20so16185365edd.1 for ; Sat, 25 Mar 2023 00:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679728421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IM+nUWgRuPmPrHEx7a7/E/AWE3vW5VKDZlbVcGCYHMc=; b=orqylAL0Bl+ispOzAPhx38/5/cGdyHe8UCc4aTge5CVBGASyZnSHRdjGNV+n0KcFSf pKT99BkCBuPc7baw1wX3i0KvCyMC7yeEvD+bGOk9jwEpPDs85DyC758fOrrc+xZIiMU3 vhgf38omSNUGsem0M8zxcp4w67/bzCchmLp7UdqEjykFsOKod2+LLoCkfDySppkg93z1 rd8zNYDea8xJecQixvsGRUG3RRUf/6RF28JoJX0tPVJ97RH70Fcfyp+qJElnKQhtRmDW nzXLYwLIGl6oDA4WRZXGFbfy2wfTrdohhfFmaNA//URpwdQ9gfLrfRr8fx0X9iAA7jLb rx1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679728421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IM+nUWgRuPmPrHEx7a7/E/AWE3vW5VKDZlbVcGCYHMc=; b=d41k1/YpxPK5zmKKoTzumE1Gn+t0iAb5HBue0vJFz5MspKS9J/5veuFZguzSpsPKlc rykLkUcS7sk8MZX+HovYR6cB1F0bsNO2QFxaIcn/rO2oLV111UkHQp1XXf8PI7GiNz3V X16NdCU5qs6V1sxKOfPvhIECHwHIQ6NMav+J9IUiBH8xXdUR6X7ebcz3iJkUij2ftby8 3deJD1vgetzohIRSCrqHAZ7D6wa9e1io6SOnKtMm/esZRi0F83AEwYFiVd9wKSn4n4So aiG/S9opiVOLrDje4jgbissdCncQ5rThMfXlAQIU3PYrFa/wjyC+CpQlOPdttAQF5Qir 595Q== X-Gm-Message-State: AAQBX9dJ+POpgpdXfWpqNMQ8QntqsbxXlgKwJagL7F2dpggszGEBhoV2 xf5DPmA0xHIgUfRoIg38z9I= X-Google-Smtp-Source: AKy350ZcUUX6ku/r3vzVB1zVlgqKWIU80Ihe3H4eMBgK1umX3QGAjiQnUC5hVyZEW11hIFtXMiPysg== X-Received: by 2002:a17:907:8d88:b0:93f:1d2e:8aed with SMTP id tf8-20020a1709078d8800b0093f1d2e8aedmr1839736ejc.50.1679728421133; Sat, 25 Mar 2023 00:13:41 -0700 (PDT) Received: from kista.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b0093ebc654f78sm1313809ejd.25.2023.03.25.00.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 00:13:40 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: 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, Paul Kocialkowski Cc: Paul Kocialkowski , Mauro Carvalho Chehab , Chen-Yu Tsai , Samuel Holland , Laurent Pinchart , Adam Pigg , Thomas Petazzoni Subject: Re: [PATCH 6/9] media: sun6i-csi: capture: Implement MC I/O with extended enum_fmt Date: Sat, 25 Mar 2023 08:13:39 +0100 Message-ID: <3225394.44csPzL39Z@kista> In-Reply-To: <20230324151228.2778112-7-paul.kocialkowski@bootlin.com> References: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> <20230324151228.2778112-7-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230325_001342_968296_1003E188 X-CRM114-Status: GOOD ( 23.43 ) 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 Dne petek, 24. marec 2023 ob 16:12:25 CET je Paul Kocialkowski napisal(a): > 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; Nit: reverse christmas tree. Other than that: Reviewed-by: Jernej Skrabec Best regards, Jernej > + 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; > + > + if (index == index_valid) { > + 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; > video_dev->fops = &sun6i_csi_capture_fops; > -- > 2.39.2 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel