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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3793C04FDF for ; Wed, 2 Aug 2023 12:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234432AbjHBMJj (ORCPT ); Wed, 2 Aug 2023 08:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbjHBMJh (ORCPT ); Wed, 2 Aug 2023 08:09:37 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20D9D1BF9; Wed, 2 Aug 2023 05:09:35 -0700 (PDT) Received: from [192.168.88.20] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A4D08DA; Wed, 2 Aug 2023 14:08:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690978110; bh=dFHjp0u14PNVIqbD7MDsFSNrr4G9iZZbUmhtrzJ8pZ0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=lXGYLSBlj7V8uWwGIPM0yWgf20TFiBhd2F7+uTiiPGxlwLSOO0N8a87U2TQUwdfw7 IxADMafWg58moT3hclaJjCvShTZOJ1FQ/kYzNMUGoBni76Vu8DMz006+97q2+Cnvut UciMioHBfTnSPbeBqFy0DhBoAU0vSozExkHbgcK0= Message-ID: <00e1bb24-c2c0-e24b-9852-3b40858859cf@ideasonboard.com> Date: Wed, 2 Aug 2023 15:09:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v8 16/16] media: ti: Add CSI2RX support for J721E Content-Language: en-US To: Sakari Ailus Cc: Jai Luthra , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Laurent Pinchart , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab , Maxime Ripard , niklas.soderlund+renesas@ragnatech.se, Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , nm@ti.com, devarsht@ti.com References: <20230731-upstream_csi-v8-0-fb7d3661c2c9@ti.com> <20230731-upstream_csi-v8-16-fb7d3661c2c9@ti.com> From: Tomi Valkeinen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/08/2023 14:14, Sakari Ailus wrote: > Moi, > > On Wed, Aug 02, 2023 at 02:04:57PM +0300, Tomi Valkeinen wrote: >>> +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 >> >>> + >>> + 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; >>> +} >