Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5355198rwj; Wed, 21 Dec 2022 01:14:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVzAWB7+7l+2l+uDb7/IB+BtcciFLpXWXr9iKS8SzoDQfVDhTGBLmrSL+nGY3vr7MB5QJ1 X-Received: by 2002:a17:90a:de8e:b0:21e:1282:af42 with SMTP id n14-20020a17090ade8e00b0021e1282af42mr1321540pjv.40.1671614061588; Wed, 21 Dec 2022 01:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671614061; cv=none; d=google.com; s=arc-20160816; b=NEUl/dUkRfxEkQGACupiHY37ckLIHFHMqaKbfgOOKKf3hRczLOMmPRPRxGp0NrPdUP A9HBC+Ap7M0xdAe9PhYBdIb2dXkBLInT+UnlPZaaWlhfuZq86LGRwAl8TtdS2Qjni3Ik nJloDHMk4lcQvVf5VvZ5Bbq+O1r7NxKMQ0EAfTyat2H+iAOnh/6VRnHbIWJYOSUebHP4 C8HpacTe0teE4ftlh7gNsHEx0rvug9BcUPq2SthFXBNVOxv/rwysKqWTDse6HjmDKXSv CXI5bJi0eS74DlK0+d1I3u9oGeBH2tAfNaI867Mv2lxOmETuj4NABYkjWJeElcvCiB8X wL0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wv7KxjPWXPDLgT/1bThqQsMCgvNitqZ7V0HtokqXjZY=; b=ZcK85eqpG3JIsCXM0TYoJpnjNH/ojfh8N7d8A4XALL7KEvPYBQbT289oFCI6+lXdnq mBjpJx7PGStg9SBlXMee2eeZUJ70bh1rJ6HXEtODyMnlZfgpxCLwBsdQfphVJixIXZYt a2hNW+vhdcjfC1VTtltOC6XlQKot07wzZsaZTYrEObNwHhkcI4ExmeNs4uuIlYPj+6i6 SAPOvJhDcMu03XZZ1Q8RGKGS4oD2O+N4EWiTBiQJNSgM0EmG01/zmUiVgullhA0Pl0r7 GO/qiSNwK45hI66d8QftzJLQgBkJcdAWEsTeAe8300o7s1UQerPpV110UrGaMuLOO9Aj KR3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a17090ad51200b00213587b200esi1151835pju.189.2022.12.21.01.14.12; Wed, 21 Dec 2022 01:14:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbiLUIn6 (ORCPT + 69 others); Wed, 21 Dec 2022 03:43:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiLUIn4 (ORCPT ); Wed, 21 Dec 2022 03:43:56 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8793A18E17; Wed, 21 Dec 2022 00:43:52 -0800 (PST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 4FE021BF203; Wed, 21 Dec 2022 08:43:47 +0000 (UTC) Date: Wed, 21 Dec 2022 09:43:47 +0100 From: Jacopo Mondi To: Shravan.Chippa@microchip.com Cc: paul.j.murphy@intel.com, daniele.alessandrelli@intel.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 1/5] media: i2c: imx334: modify link frequency as for the configureation Message-ID: <20221221084347.3d4f73txlcgiisvz@uno.localdomain> References: <20221219061526.3169369-1-shravan.chippa@microchip.com> <20221219061526.3169369-2-shravan.chippa@microchip.com> <20221219144414.lfusj67ojjk2phkv@uno.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shravan On Tue, Dec 20, 2022 at 11:11:15AM +0000, Shravan.Chippa@microchip.com wrote: > > > > -----Original Message----- > > From: Jacopo Mondi > > Sent: 19 December 2022 08:14 PM > > To: shravan Chippa - I35088 > > Cc: paul.j.murphy@intel.com; daniele.alessandrelli@intel.com; > > mchehab@kernel.org; linux-media@vger.kernel.org; linux- > > kernel@vger.kernel.org > > Subject: Re: [PATCH v7 1/5] media: i2c: imx334: modify link frequency as for > > the configureation > > > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the > > content is safe > > > > Hi Shravan > > > > On Mon, Dec 19, 2022 at 11:45:22AM +0530, shravan kumar wrote: > > > From: Shravan Chippa > > > > > > Currently imx334 sensor driver is configured for 1782Mbps/lane for > > > 3840x2160@60 resolution with reqired reg mode values but if we run the > > > command "v4l2-ctl --all -d /dev/v4l-subdevX" it is showing incorrect > > > link frequeny, This is because of the incorrect value of > > > IMX334_LINK_FREQ witch is 891000000. it should be 1782000000. > > > > > > In general with the value of 891000000 link frequency it is not > > > possible to configure 3840x2160@60 resolution. > > > > > > Fixes: 9746b11715c3 ("media: i2c: Add imx334 camera sensor driver") > > > > > > Signed-off-by: Shravan Chippa > > > --- > > > drivers/media/i2c/imx334.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c > > > index 7b0a9086447d..acc9f9f15e47 100644 > > > --- a/drivers/media/i2c/imx334.c > > > +++ b/drivers/media/i2c/imx334.c > > > @@ -49,7 +49,7 @@ > > > #define IMX334_INCLK_RATE 24000000 > > > > > > /* CSI2 HW configuration */ > > > -#define IMX334_LINK_FREQ 891000000 > > > +#define IMX334_LINK_FREQ 1782000000 > > > > Is this your reasoning ? > > > > width: 3840 > > hblank: 560 > > height: 2160 > > vblank: 2340 > > bpp: 12 > > fps: 60 > > lanes: 4 > > > > Total bandwidth: (3840 + 560) * (2160 + 2340) * 60 * 12 = 14.256.000.000 > > Bandwidth per lane = Total / 4 = 3.564.000.000 mipi clock = > > Bandwidth_per_lane / 2 = 1.782.000.000 > > > > Two questions: > > > > - Should you update the pixel clock as well ? It is currently set to > > 594000000 while as per the above reasoning it should be doubled too. > > > > - Where is the sensor's clock tree programmed in the driver ? > > It's kind of weird that the pixel_clock and link_freq in the driver > > are half of what they theoretically should be... > > > > > As per my understanding. > the mode_3840x2160_regs[] array value which is written through the i2c bus is 4k resolution, 60fps, link frequency 1782Mbps per lane > but the vblank value is dynamic from user space. > Min-90 to Max-130000, default value is 2340. With the default value, we will get 30fps. Ah, it's 30, not 60. So my calculations above should be halved > > if we set vblank value from user space it will change FPS. > Sure, but the link frequency stays the same, and it should be computed with the FPS resulting from the current blankings > Total bandwidth: (3840 + 560) * (2160 + 2340) * 30 * 12 = 7.128.000.000 Correct > Bandwidth per lane = Total / 4 = 1.782.000.000 Correct. But with CID_LINK_FREQ you're reporting the bus link frequency, not the lane bandwidth. As MIPI CSI-2 uses DDR read mode, two bits per clock cycle are transmitted, hence the bus frequency is half of the lane bandwidth. TL;DR you don't need this patch, the current value is correct as it is in my understanding. Thanks j > > Thanks, > Shravan > > > > > > #define IMX334_NUM_DATA_LANES 4 > > > > > > #define IMX334_REG_MIN 0x00 > > > -- > > > 2.34.1 > > >