Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1862757rda; Tue, 24 Oct 2023 05:53:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQx6+2WAO47BHnZf4T12sCwVis7X77mtDl0ikKp574rOb0dUHL5s+7aVMltQnamMVbvlVX X-Received: by 2002:a17:902:d4c7:b0:1ca:3cd7:eadb with SMTP id o7-20020a170902d4c700b001ca3cd7eadbmr14182317plg.9.1698151999161; Tue, 24 Oct 2023 05:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698151999; cv=none; d=google.com; s=arc-20160816; b=kwpoa2FEOZmz9A5oGUC7hVjb8CDbAGu59GJYkw8UxZN8FBX3uEb3YQbKtZGYxNTB1S vekPgVaFBwgjOV+izGzeTwGsn/R89AYDusQQ9Shl67T9NPCXaegajQDVW47zdTdssg4G h5XYrgpBVXAiHT935qir7Ku7Dug5EwryjFOz4CFWqKJwnixiay21kaXQVUybYGf7ryBj 0SfJyUPIhkkJKjD/fBw+rHqkx1uxnActRi6/G0itWGrzl2wxdOQ+qJcPWwwSMZHgT7L/ 344HbY5WTudyycq2XiEZjMWbjZWZyCFN6mxoyrMYbZkMC+rVDbUBJLYfk8Nr4By3l4uT 8V/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=tJykzeF/huAUfG0yMyUFj09RbeMmFNxu47SIkckppZ8=; fh=jXJa1ENSozJzcCxEieie18o8GvGdcESk1mmP2PdYSY0=; b=lHyauSdTvdfUqTo6Cgrke1VkczTiTXhoZA+iXZwht2LxfZaxLybCNu3cXPOFznMY+d +P5snjYOm64owq30x3Kx4EdyNqx2M+9lTp07sPtYnPTKFmHp8E2PCrmEb/P6WU+UNKbt LguBVqFKGnUAfZeMMm3lf8q/1Pun7DZPzz5wBzaCsnwI7zlMZ7/MpGN7gEk8Vy7o40AA 8HIU6NCBkn6SOxVfWGbd+gD4VpVRtte5Nu/dyFvRENjRLWXUjvFP7IQyyNgYfP7rtelc waaRt5wxXMmzmtKl7M3odrJ5lLnunKv+JGjGJM8YtJlOG4NbTeY7B8r4BJT2mz/MdNfI dDwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=mha+FND4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id j13-20020a170903024d00b001c9ad75c067si8743211plh.149.2023.10.24.05.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 05:53:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=mha+FND4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5EF658080ED0; Tue, 24 Oct 2023 05:53:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234385AbjJXMxC (ORCPT + 99 others); Tue, 24 Oct 2023 08:53:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234343AbjJXMxC (ORCPT ); Tue, 24 Oct 2023 08:53:02 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74DE490; Tue, 24 Oct 2023 05:52:59 -0700 (PDT) Received: from pendragon.ideasonboard.com (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5CC0CAE; Tue, 24 Oct 2023 14:52:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698151966; bh=Z8lGk3CLn172c1awVm68bNMBIr+yFrYRyprU4D+J9gM=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=mha+FND4nmKh74daFUIU4wshVjn7alJPLszWBvaDkp4xQC34SQrBomYQhzWrHmy74 yn+nuqCufcnyD4I5owfKfuc5azIlW9VY11zWut+RARP/Nr3YEVgbl+n+K9WLHc4AsM 3c4aRSL6191tRTOdE32ul5XYlrKXiusUIHIbyQ94= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <9117e551a4a4dd0e94a1395817d89cb18ac11b24.camel@apitzsch.eu> References: <20231023-imx214-v1-0-b33f1bbd1fcf@apitzsch.eu> <20231023-imx214-v1-1-b33f1bbd1fcf@apitzsch.eu> <169810104910.2245571.16606813523946813634@ping.linuxembedded.co.uk> <9117e551a4a4dd0e94a1395817d89cb18ac11b24.camel@apitzsch.eu> Subject: Re: [PATCH 1/4] media: i2c: imx214: Explain some magic numbers From: Kieran Bingham Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht To: =?utf-8?q?Andr=C3=A9?= Apitzsch , Mauro Carvalho Chehab , Ricardo Ribalda , Sakari Ailus Date: Tue, 24 Oct 2023 13:52:54 +0100 Message-ID: <169815197462.630990.3330310524563366908@ping.linuxembedded.co.uk> User-Agent: alot/0.10 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 24 Oct 2023 05:53:16 -0700 (PDT) Quoting Andr=C3=A9 Apitzsch (2023-10-24 08:30:01) > Am Montag, dem 23.10.2023 um 23:44 +0100 schrieb Kieran Bingham: > > Quoting Andr=C3=A9 Apitzsch (2023-10-23 22:47:50) > > > Code refinement, no functional changes. > > >=20 > > > Signed-off-by: Andr=C3=A9 Apitzsch > > > --- > > > =C2=A0drivers/media/i2c/imx214.c | 24 +++++++++++++++++++----- > > > =C2=A01 file changed, 19 insertions(+), 5 deletions(-) > > >=20 > > > diff --git a/drivers/media/i2c/imx214.c > > > b/drivers/media/i2c/imx214.c > > > index 4f77ea02cc27..9218c149d4c8 100644 > > > --- a/drivers/media/i2c/imx214.c > > > +++ b/drivers/media/i2c/imx214.c > > > @@ -19,12 +19,23 @@ > > > =C2=A0#include > > > =C2=A0#include > > > =C2=A0 > > > +#define IMX214_REG_MODE_SELECT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 0x0100 > > > +#define IMX214_MODE_STANDBY=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 0x00 > > > +#define IMX214_MODE_STREAMING=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 0x01 > > > + > > > =C2=A0#define IMX214_DEFAULT_CLK_FREQ=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 24000000 > > > =C2=A0#define IMX214_DEFAULT_LINK_FREQ 480000000 > > > =C2=A0#define IMX214_DEFAULT_PIXEL_RATE ((IMX214_DEFAULT_LINK_FREQ * > > > 8LL) / 10) > > > =C2=A0#define IMX214_FPS 30 > > > =C2=A0#define IMX214_MBUS_CODE MEDIA_BUS_FMT_SRGGB10_1X10 > > > =C2=A0 > > > +/* Exposure control */ > > > +#define IMX214_REG_EXPOSURE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 0x0202 > > > +#define IMX214_EXPOSURE_MIN=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 0 > > > +#define IMX214_EXPOSURE_MAX=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 3184 > > > +#define IMX214_EXPOSURE_STEP=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 1 > > > +#define IMX214_EXPOSURE_DEFAULT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x0c70 > >=20 > > I like this change, and I see that 0x0c70 was directly moved here > > from > > the code below. But could we replace 0xc70 here with 3184 please so > > that > > it's /far/ clearer that the Exposure Default =3D=3D Exposure Max which = is > > otherwise hidden? > >=20 > Hi Kieran, >=20 > I can do that. But I propose to replace 3184 with 0x0c70 instead. > Because that matches the entries used in the reg_8 lists > mode_4096x2304[] and mode_1920x1080[]. >=20 > {0x0202, 0x0C}, > {0x0203, 0x70},=20 >=20 > What do you think? I think exposure values are easier to read as integers than hex values. This is the 'Coarse Integration Time' register with a unit of 'lines'. If you have lots of time, or wish to delve deeper - we could talk about splitting out those register tables to use CCI and/or more readable functions ;-) Do you have the datasheet for this sensor - or are you just working from the information within this driver? What device are you using to test this driver? -- Kieran > Regards, > Andr=C3=A9