Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4042644pxb; Tue, 26 Jan 2021 10:50:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlwE6vUof/giGbGpLVwLBxEA3IU42e/9PfpnCoU3cUWPm/6mGlun4lqG4+StE9EJw2gvNG X-Received: by 2002:a05:6402:32c:: with SMTP id q12mr5690575edw.145.1611687014465; Tue, 26 Jan 2021 10:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611687014; cv=none; d=google.com; s=arc-20160816; b=XNpkU5xUgaDdlEMceKhCvD4k5Ck6xeyo6HpgUQOS3bLpI+7F8+MqvxU1l9xWS2jOs+ S1oXbu29IETsQ3LkSbUcJC+nmzgH/7s4Er0/ZoXaM43S6LmBM0mVBxnFINBRXnQzo30p tsK7EG310yQ1Gj1+lWZqEinQp17B0XwpkWl6xC0Ai2VBGEShwOQBgeDW8hVDtBL3hxqP YFWIXZegUmXPVsUP25isqy5grPv6McZLrC3G/X4pL443F6+QdweOffEp3StBtJFF7Mf5 5J6JuW8r5SXJHKkCQkmFZONilTuxdbt7fh95tT+sUzAXHocEyriE4iE4Kr7mlFveLi/M yqaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jQcCABBC17KmUAuXZo/7BHi5IQnnHongxBg4EuG4t3M=; b=s5/OxTdR2nBCKlzwpP3udny0+R/AQe1Xecitt9DwS+xQjB+j7SUH+zIK50gLbmRJy0 o1qgVdyW3ZjLis+UlroaspHxFJW3y7QEiSa4+YRJ4VPSTiYG5OInA3QfO0652R6Uffoy u3M+1+2vV/JLuaYCxVq4yVjtru2Yx7SV2riQcZ2RBVJis01kmxLBehcZwlw7OJiRCxMc 7/SHF6X8FyvrFgQPAsLJB6JBalggtEOkLWLLWf0LcdmnsA3yJZJe4mSdsl7sM5OX4LXO yhkSVibM8qu7NHlXvQkLvcvCJuX05eHnlm15Qb/jaNTGdI9mXz+mW2lqd7RE0m1qVcoV rb0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b="ENvx/iua"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx1si7118969ejb.146.2021.01.26.10.49.49; Tue, 26 Jan 2021 10:50:14 -0800 (PST) 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 header.i=@raspberrypi.com header.s=google header.b="ENvx/iua"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392674AbhAZNCs (ORCPT + 99 others); Tue, 26 Jan 2021 08:02:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392388AbhAZNCG (ORCPT ); Tue, 26 Jan 2021 08:02:06 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E666C0611BD for ; Tue, 26 Jan 2021 05:01:24 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id m2so2399693wmm.1 for ; Tue, 26 Jan 2021 05:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jQcCABBC17KmUAuXZo/7BHi5IQnnHongxBg4EuG4t3M=; b=ENvx/iua50dPt58+eNmVO50QUi/SXoqwTbAA5pJ7ByKjuAr2UdPD3ZfOOqfb0KVfiV KaScskpmF5l/0Mn4dPLoblMLtaCbF0pXWm23GpeD60kCMc106bxTN4dV3kiJ3xgjqiQh i9Xc5DwoDIbf+4l57/3zyhvTi51I0p1LLKL7/jJvym2lq74TYcTJ2yyUI6TltKwMiS1x HTHTJ+GkmIZ+ewqLshGC+FeGzjNFZHZVH6JY1mtC20LQrckUFP+W3yv94B4HWFecfoHb IMHVNnbcmjHg6nr9BvdVvtervE7KfgywPo5JkBN+89ja1fTCcp+F2S2zteJnu+wxkoao ZhMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jQcCABBC17KmUAuXZo/7BHi5IQnnHongxBg4EuG4t3M=; b=Dgmn7QK/1FfUhs0o0cGNWIj3knC+lWISEH0UwBqDarAmXHdRTMDtJx7/yXxbOW8/WA imjw/Cs0MNksQT232iamUAQN33hI/ePextdFiuhqowlLENNhNBVv0EuLGr13T4zC/XA8 WXUmMT8IOrDn5bFs2uU8NTMMQ6XJje9xeHH2K94WmByIsv5hvv4en2TX/fGW768U7AqT K495vPCpi0vWsNyiZL2Z09uzt4bxCefKKL4ES4YoibrM1OTW1jg3Pbq4USlqasHwEDSE XLgmnFxSq+zAIb3KXM/3fP8ZCUmjR3uiiyBFfVgKAD8r9Wdkf8xVMDESx11rFC/zfmak yAog== X-Gm-Message-State: AOAM530R6IjiqyVu0dliCOAto2an6wW9oqDG8jGK9VELeCLcBQXyRABn s1WC/fZNdnv1+FZ7EWvgQbtnhOFuhI3JuhTY5beGfg== X-Received: by 2002:a7b:cbd7:: with SMTP id n23mr4609756wmi.116.1611666082750; Tue, 26 Jan 2021 05:01:22 -0800 (PST) MIME-Version: 1.0 References: <20210126074934.26980-1-andrey.konovalov@linaro.org> In-Reply-To: <20210126074934.26980-1-andrey.konovalov@linaro.org> From: Dave Stevenson Date: Tue, 26 Jan 2021 13:01:08 +0000 Message-ID: Subject: Re: [PATCH] media: i2c: imx219: Implement V4L2_CID_LINK_FREQ control To: Andrey Konovalov Cc: Mauro Carvalho Chehab , Linux Media Mailing List , LKML , Sakari Ailus , Peter Griffin Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrey On Tue, 26 Jan 2021 at 07:50, Andrey Konovalov wrote: > > This control is needed for imx219 driver, as the link frequency > is independent from the pixel rate in this case, and can't be > calculated from the pixel rate. > > Signed-off-by: Andrey Konovalov > --- > drivers/media/i2c/imx219.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c > index 92a8d52776b8..6e3382b85a90 100644 > --- a/drivers/media/i2c/imx219.c > +++ b/drivers/media/i2c/imx219.c > @@ -390,6 +390,10 @@ static const struct imx219_reg raw10_framefmt_regs[] = { > {0x0309, 0x0a}, > }; > > +static const s64 imx219_link_freq_menu[] = { > + IMX219_DEFAULT_LINK_FREQ, Link frequency is one of the parameters that is largely irrelevant on the Pi, so I've partially ignored it. Is the link frequency really the same for all modes? Even 8 bit vs 10 bit readout? The pixel rate is constant at 182.4Mpix/s for all modes. Switching to 8 bit changes register 0x0309 (op_pix_clk_div) from 10 to 8. Figure 43 "Clock System Block Diagram" in the datasheet I have says this reduces the divider to the FIFO between the pipeline and MIPI. As we haven't changed PLL2 or Pre-div2 I'd expect the link frequency to stay the same, but that leaves me confused over that FIFO clock as it'll go UP in frequency. I can't quite see how that works, but it clearly does. Both 8 and 10 bit modes do read out at the same frame / pixel rate, therefore that bit is correct, but that leaves me puzzling over link frequency. I have no information on how big that FIFO is, or how it's clocked on input and output. Simplest option is that as I need to go into the office in the next day or so I'll pop into the lab and measure it in each mode. Otherwise I have no issues with the implementation of the patch. Dave > +}; > + > static const char * const imx219_test_pattern_menu[] = { > "Disabled", > "Color Bars", > @@ -547,6 +551,7 @@ struct imx219 { > struct v4l2_ctrl_handler ctrl_handler; > /* V4L2 Controls */ > struct v4l2_ctrl *pixel_rate; > + struct v4l2_ctrl *link_freq; > struct v4l2_ctrl *exposure; > struct v4l2_ctrl *vflip; > struct v4l2_ctrl *hflip; > @@ -1269,7 +1274,7 @@ static int imx219_init_controls(struct imx219 *imx219) > int i, ret; > > ctrl_hdlr = &imx219->ctrl_handler; > - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 11); > + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 12); > if (ret) > return ret; > > @@ -1283,6 +1288,14 @@ static int imx219_init_controls(struct imx219 *imx219) > IMX219_PIXEL_RATE, 1, > IMX219_PIXEL_RATE); > > + imx219->link_freq = > + v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx219_ctrl_ops, > + V4L2_CID_LINK_FREQ, > + ARRAY_SIZE(imx219_link_freq_menu) - 1, 0, > + imx219_link_freq_menu); > + if (imx219->link_freq) > + imx219->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; > + > /* Initial vblank/hblank/exposure parameters based on current mode */ > imx219->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops, > V4L2_CID_VBLANK, IMX219_VBLANK_MIN, > -- > 2.17.1 >