Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp463209pxy; Wed, 28 Apr 2021 07:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq8atq2tFYzx/qELnSWJT899ehcUHJapECA4PWSrzXcc1FHw6caJWmyT66RCpfUmOKcIlo X-Received: by 2002:a62:5cc3:0:b029:203:54be:e4c9 with SMTP id q186-20020a625cc30000b029020354bee4c9mr28309401pfb.80.1619621116471; Wed, 28 Apr 2021 07:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619621116; cv=none; d=google.com; s=arc-20160816; b=E1QPMpnk3vQMbMN5fnGInYv0tk9gcLfEsYIqhtoNmT2+QOL7OhrGPYVLaph+vr86MN k4gecVCw8vYEpTbQoHv2p8dnUvQBsqVfAksx2ts11UTXfE42WNgewlhHCzMgwlmQ80jl zxoPnO6Q93s18fZJL1pewQl0gzLkO6S++uez4Ea7211hCpYnRVAWtMzW/X5vapJBnZrL npY6r8eK9UNUt6T/twK/SWay/LMVMPTtFThOS5A8pMCymSMQY8/hNVe3TMUgAORzwnGQ f/uJdMTQG+L/mIllEbDM8GU+7Jn/7DXuoGFrt50FeCKImZmgZi1XjeXzeuo2yHSt3nPj gwlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:in-reply-to:date:sender:references:subject:cc:to:from :dkim-signature:dkim-filter; bh=QG+dsPO25iZIXCJg6jPdT+oPy9Rb1+B7Kg31/40cdVM=; b=EU/Had4jcJaRNUff+VvAB/Wf3AOBVF+9VEdbi9uKMVdH9lIQSzzHZswA9Ls/FbyvpS wJVOliDtlzAYlGpvuDKf7aqbJCW+GB0Ti/vKuOfPum4S6kaimGyMCxw7QpQtz+Oq8BnA HcalV6RoCp/h3M8iyQZycyuRKrtEcBRNY2n+0gP/lZm2uxLUEyBaC3VeGHoABrtta8xO VHaKY5NePp7JTfrIMx+sbn3fDU7ucmqchVG6fyyZHh/rmtt2jk8ss9gQJI4OxL9pRCrt NNBJmUffxKn1y4V729vf9DyvJEgL5eNx8ZWOVYCU7hAq4MIoQcJxOoezov3fXsk6BybU CM4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@piap.pl header.s=mail header.b=BzBX6c2U; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=piap.pl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si4276701plf.302.2021.04.28.07.45.02; Wed, 28 Apr 2021 07:45:16 -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 header.i=@piap.pl header.s=mail header.b=BzBX6c2U; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=piap.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237613AbhD1MgW (ORCPT + 99 others); Wed, 28 Apr 2021 08:36:22 -0400 Received: from ni.piap.pl ([195.187.100.5]:48998 "EHLO ni.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234439AbhD1MgV (ORCPT ); Wed, 28 Apr 2021 08:36:21 -0400 Received: from t19.piap.pl (OSB1819.piap.pl [10.0.9.19]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ni.piap.pl (Postfix) with ESMTPSA id 9E831444032; Wed, 28 Apr 2021 14:35:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 ni.piap.pl 9E831444032 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=piap.pl; s=mail; t=1619613332; bh=QG+dsPO25iZIXCJg6jPdT+oPy9Rb1+B7Kg31/40cdVM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=BzBX6c2UJyS4SVAp2e8hVYI0I8O3B+bIcpTKZg6z1etSX4U41uetBv210EYWv5pgj 6J3M21+t5QWuaC6aaFxNbCE7GN9i3JUFbbPc+aXxUAfb61pQcZANyZmFM9+S4a7XOg Xu0Krjr8zl5d/0s8HPXqhmDLsZjojwbcP5TkzJFs= From: =?utf-8?Q?Krzysztof_Ha=C5=82asa?= To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Laurent Pinchart , linux-kernel@vger.kernel.org Subject: Re: RFC: MEDIA: Driver for ON Semi AR0521 camera sensor References: Sender: khalasa@piap.pl Date: Wed, 28 Apr 2021 14:35:32 +0200 In-Reply-To: (Laurent Pinchart's message of "Tue, 16 Mar 2021 21:19:57 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-KLMS-Rule-ID: 4 X-KLMS-Message-Action: skipped X-KLMS-AntiSpam-Status: not scanned, whitelist X-KLMS-AntiPhishing: not scanned, whitelist X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, not scanned, whitelist Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm working on AR0521 MIPI camera sensor driver update and I'm still not sure how the timings should be programmed. V4L2 has: - V4L2_CID_LINK_FREQ I understand it's a menu with fixed integers (frequencies in Hz). Documentation/driver-api/media/camera-sensor.rst: "For camera sensors that are connected to a bus where transmitter and recei= ver require common configuration set by drivers, such as CSI-2 or parallel (BT.= 601 or BT.656) bus, the ``V4L2_CID_LINK_FREQ`` control is mandatory on transmit= ter drivers. Receiver drivers can use the ``V4L2_CID_LINK_FREQ`` to query the frequency used on the bus." How (and if) do I use the above when the sensor in question uses PLLs and can generate arbitrary link frequencies? - V4L2_CID_VBLANK and V4L2_CID_HBLANK These are fine for setting the timings (and the AR0521 can use them). There is, however, another value needed for precise timing control, the so called "extra" timing (a hw register), specified in pixels. The calculated frame rate is thus: fr =3D pixel_clock / (width + hblank) * (height + vblank) + extra. How do I specify the "extra"? Currently, I'm using the [sg]_frame_interval() functions, should it stay this way (so there are [HV]BLANK controls AND [sg]_frame_interval() in parallel on the same device)? It appears the userspace should be able to set, in addition to *BLANK, the pixel clock. How do I do that? The V4L2_CID_PIXEL_RATE appears to be a good candidate, but v4l2_ctrl_fill() sets a read-only flag on it. Any ideas? At present I'm about to use two (orthogonal) interfaces (frame interval based and the - incomplete - [hv]blank-based) - but perhaps I'm missing something important? --=20 Krzysztof Ha=C5=82asa Sie=C4=87 Badawcza =C5=81ukasiewicz Przemys=C5=82owy Instytut Automatyki i Pomiar=C3=B3w PIAP Al. Jerozolimskie 202, 02-486 Warszawa