Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp915877pxj; Fri, 4 Jun 2021 01:08:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB20jWmsxmZp/cdv+EI5eicKgyLVP+Cz7gS3ancbo4PF9Zl0iWqO1kj6jeCwmM8qV0w7vJ X-Received: by 2002:a17:906:3d9:: with SMTP id c25mr3114185eja.63.1622794083012; Fri, 04 Jun 2021 01:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622794083; cv=none; d=google.com; s=arc-20160816; b=jdDrVMbKumf7hBHeFgNwD8rm6e//sV5qBBKcSXjhmipjkgm6tkNbVEGxkYL0XZmpKQ HUYsLeuHbwntXFceMBsBODrv2xgHV/ounsz1OENLokuBSvj/4c2qeG0xJKBDMuh0cpJM jjHh5BreHOrJefCKc6ysh6VkS2t+Tyd2JB2nmwzGrekj8+OEXA6djCTX01F4FczHishO 62j91DEZORtzDgiGeD42yWzMyMW9i+AKI3+2rwV0JKlXkaKZuWd4ugcSCqzZrAUWK6Mq EWxYH8X8xlzMzmLvH3Qvj1JuI0/G6RwUSODSg/6IrWJQOSIUAZOn/DeIXs5Qjg458gau D6Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=VA/FCDlZuEaz0LfnjA07QxU5P2en4NM3LExubr6x8OI=; b=0yjrU42TZrsf9tJlytZIs0cnaQdYqH1P6/gQerhdsD+g71lJq+n3952t6ler8muYwH 9R5nU7eMbSlgT+yTons+owg3dw/uBD/E886+A2qQz0+7xTq8OkzdJlnnmfdV+3f0B2Q+ fMXZuBI3/YOBP7Ci7aveMkU5xVQohW3p59Sa+YK8VZeKG86h+YaP+gkztSwxIXuE7WI5 sT7OmImJfBSHAsv7Gl1c4g5KYMQNllp9ZSR7quBozJFHYNNT/HVWYniLMk3ZxaqyGAAx 3wvuI66FzAM6TkJe6WHohcJeBtYDFUAgR2vdJfgot7Poaa8Rwg49zDaunbVt4JN4QAfj qQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=NNsF2Qc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg12si4850725edb.166.2021.06.04.01.07.39; Fri, 04 Jun 2021 01:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=NNsF2Qc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbhFDIGT (ORCPT + 99 others); Fri, 4 Jun 2021 04:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbhFDIGS (ORCPT ); Fri, 4 Jun 2021 04:06:18 -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 C20FFC06174A; Fri, 4 Jun 2021 01:04:32 -0700 (PDT) Received: from [192.168.1.111] (91-157-208-71.elisa-laajakaista.fi [91.157.208.71]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 20039A52; Fri, 4 Jun 2021 10:04:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622793871; bh=j1SXMbUoe/8w0rZ6UdZfNhuo9qc6ocoxoJrTdQSBoU0=; h=To:Cc:References:From:Subject:Date:In-Reply-To:From; b=NNsF2Qc6TuwHZ1QwuxlAt3dWSJMADIbpLyeKjMAaTOQxq2XiyGUBVurqN218ePdZK 2YJwDUslifIOVMLazpGhUZn5VwmWXmkrVmS8vgqO88+NV3Y11jWrC+k1i37UV8oBif 2DlZlXlr9W6tCyT5C30McrP1EHCXS0awnpACQbEQ= To: Pratyush Yadav Cc: Maxime Ripard , Mauro Carvalho Chehab , Rob Herring , Kishon Vijay Abraham I , Vinod Koul , Peter Ujfalusi , Steve Longerbeam , Benoit Parrot , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, dmaengine@vger.kernel.org, Vignesh Raghavendra , Chunfeng Yun , Laurent Pinchart References: <20210526152308.16525-1-p.yadav@ti.com> <20210526152308.16525-14-p.yadav@ti.com> <5e00444a-683f-b4fa-9156-4450ca4edaf6@ideasonboard.com> <20210603124920.5o34klhlhjg5phlj@ti.com> From: Tomi Valkeinen Subject: Re: [PATCH v2 13/18] media: ti: Add CSI2RX support for J721E Message-ID: Date: Fri, 4 Jun 2021 11:04:29 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210603124920.5o34klhlhjg5phlj@ti.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/06/2021 15:49, Pratyush Yadav wrote: > On 27/05/21 04:29PM, Tomi Valkeinen wrote: >> Hi Pratyush, >> >> On 26/05/2021 18:23, Pratyush Yadav wrote: >>> TI's J721E uses the Cadence CSI2RX and DPHY peripherals to facilitate >>> capture over a CSI-2 bus. >>> >>> The Cadence CSI2RX IP acts as a bridge between the TI specific parts and >>> the CSI-2 protocol parts. TI then has a wrapper on top of this bridge >>> called the SHIM layer. It takes in data from stream 0, repacks it, and >>> sends it to memory over PSI-L DMA. >>> >>> This driver acts as the "front end" to V4L2 client applications. It >>> implements the required ioctls and buffer operations, passes the >>> necessary calls on to the bridge, programs the SHIM layer, and performs >>> DMA via the dmaengine API to finally return the data to a buffer >>> supplied by the application. >>> >>> Signed-off-by: Pratyush Yadav >> >> I noticed that my test app didn't work at all with this, and I also wasn't >> able to use v4l2-ctl to set the format. > > I have not used v4l2-ctl, but I can see yavta works fine. What command > did you use for setting format via v4l2-ctl? > >> >> At least for my test app the problem was that this driver doesn't initialize >> the format at all. My app first calls VIDIOC_G_FMT with v4l2_format.type == >> V4L2_BUF_TYPE_VIDEO_CAPTURE, then after the call modifies the fields it >> wants to change and calls VIDIOC_S_FMT. This failed, as G_FMT returned >> uninitialized fmt, i.e. type was 0, which my app didn't set again. >> >> I believe the driver should have an initial format, something that it will >> accept if an app calls G_FMT and then S_FMT. > > Right. This is a bug. The question is what should the initial format be? > It is more or less arbitrary since there is no configuration made yet > and we don't know what the camera can or will send. So for example, what > if I use UYVY 640x480? The camera might not support it at all. Is it > still OK to have it as the default? I think it doesn't really matter what the initial format is, as long as it's valid for the subdev itself. There are two separate things: 1) Subdev config, where the subdev is considered independently from the other subdevs. E.g. the formats in the input pads and output pads should be valid, taking into account the capabilities of the subdev. The subdev driver has to take care of these, i.e. if the user sets a format on a pad, the driver must adjust the other pads (if needed) to keep the subdev config valid. 2) pipeline validation, where all the subdevs in the pipeline are looked at and validated that the settings are compatible. We're talking about 1) here, and it doesn't matter if the camera supports the csirx initial format or not. Tomi