Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp17193rdh; Wed, 25 Oct 2023 14:41:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEj8n6De7RwuXdgOsxnkIO16y3FfJwCCtX5qWjA6GR9RGVQk76TyDvYetMfzCrrWuIdGSuo X-Received: by 2002:a0d:ec4b:0:b0:5a8:1bc6:352 with SMTP id r11-20020a0dec4b000000b005a81bc60352mr1354590ywn.20.1698270089069; Wed, 25 Oct 2023 14:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698270089; cv=none; d=google.com; s=arc-20160816; b=Y6mrDStEmdKykqabAtg3BJ//zDsELCfPKCqAuyg0Du8glT6ztRTUe1gWCkYDBJT1/r gC7QKDcaJSBwSkNiLMijVS8CpsdCDgNKnfPd2TyfegDFO3LC00GienjzS4SSMHqmt3CT 6UyfpH9ghlX25cqBw0U0/HSzR55K9n0YnNcnlS9ilivxnaEaqM6H/Zgt3JJbSNGe9NoD xE2rFPuZpJPVgdg3uY4Hx3SDBXzNkc8ACmeaU/u/7yuiMTJJGtRbVdrAJ88ofCEjz5WT 7k5opmuuckeU7TiXbv/uBYHHbX8v9WZyEc6ZqeHMYvjhNeaFG1hr+nAaJvtNskGYle89 N7Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id; bh=sY9SUdA6yIk37PHRyZunChoT1hNKVbVdHKyRj8s8blE=; fh=PQ2t6BMTtEYcpEafYusGTFKg6bnyDw5zyI0w6/ae5vI=; b=leluUbcQ/tKPJCGvjD4vgg3BQi3nXqAWruc+48CEmpuWt3dq+uMNcRblqrT2CwofMx +V0DqN4/dBTQ8va/wZs6RP63eh36a9ScSUXOMxsrPiOIQd2dG0fOa66fS/T/yhJqE56G 8HUZ8Rv1ih8sNfEHR6wFR/2UnyZb8NMEnxO8WnovuLh2GllBM5we0wOvB0UgIZ/EQg8N +4Oi801c2RToS0O/EshHqtp7AcT1kaL4W3Lx9ZFi62ZOgCsorc1YTkulvwLUDHDHSoxj ZNXwZ6gfZAhjK6OyLAb10AT1HyArXJvP0+xYQFqcGTRN8Vf/11/AUiu20FGtODt2ZMAp BpfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d10-20020a81d34a000000b00589f247a0c2si12554367ywl.222.2023.10.25.14.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 14:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 8BCAC8090EAD; Wed, 25 Oct 2023 14:41:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbjJYVkm convert rfc822-to-8bit (ORCPT + 99 others); Wed, 25 Oct 2023 17:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbjJYVkk (ORCPT ); Wed, 25 Oct 2023 17:40:40 -0400 Received: from smtprelay07.ispgateway.de (smtprelay07.ispgateway.de [134.119.228.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B4EB133 for ; Wed, 25 Oct 2023 14:40:37 -0700 (PDT) Received: from [92.206.139.21] (helo=note-book.lan) by smtprelay07.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qvlc9-0007xU-37; Wed, 25 Oct 2023 23:40:34 +0200 Message-ID: <23fcdaea6267ce2aa547094e3f578ae8d245b3cb.camel@apitzsch.eu> Subject: Re: [PATCH 1/4] media: i2c: imx214: Explain some magic numbers From: =?ISO-8859-1?Q?Andr=E9?= Apitzsch To: Kieran Bingham , Mauro Carvalho Chehab , Ricardo Ribalda , Sakari Ailus Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Date: Wed, 25 Oct 2023 23:40:32 +0200 In-Reply-To: <169815197462.630990.3330310524563366908@ping.linuxembedded.co.uk> 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> <169815197462.630990.3330310524563366908@ping.linuxembedded.co.uk> Autocrypt: addr=git@apitzsch.eu; prefer-encrypt=mutual; keydata=mQINBFZtkcEBEADF2OvkhLgFvPPShI0KqafRlTDlrZw5H7pGDHUCxh0Tnxsj7r1V6N7M8L2ck9GBhoQ9uSNeer9sYJV3QCMs6uIJD8XV60fsLrGZxSnZejYxAmT5IMp7hHZ6EXtgbRBwPUUymfKpMJ55pmyNFBkxWxQA6E33X/rH0ddtGmAsw+g6tOHBY+byBDZrsAZ7MLKqGVaW7IZCQAk4yzO7cLnLVHS2Pk4EOaG+XR/NYQ+jTfMtszD/zSW6hwskGZ6RbADHzCbV01105lnh61jvzpKPXMNTJ31L13orLJyaok1PUfyH0KZp8xki8+cXUxy+4m0QXVJemnnBNW5DG3YEp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ZIH95dCBnYNgi0ehVftqf0AEHXWRZgtKToYrG9kfkUdxft0fpilIG5aK0r242OKtQcGESyCltiwGakQ4qytf7kQ4SUYiJ8YQ2E2QU19zUrOkmjq32Be4C3QUYRBloU2l2VyGghZxdShJvNIZvup0ID0BFhcs0+4dWS4Loz8HW7FBWcmsUsti3mUBuBb6PN+jRoIYBbsUGDffbxz2/tHF3mckCS4qVtwiD7noU0l69FqZm/aOOUbwZ7UiTuuYgZ0HvQBMEb9PiiC0qjrTIST/U6zqLs4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.50.1 MIME-Version: 1.0 X-Df-Sender: YW5kcmVAYXBpdHpzY2guZXU= X-Spam-Status: No, score=-0.8 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 14:41:02 -0700 (PDT) Am Dienstag, dem 24.10.2023 um 13:52 +0100 schrieb Kieran Bingham: > Quoting André Apitzsch (2023-10-24 08:30:01) > > Am Montag, dem 23.10.2023 um 23:44 +0100 schrieb Kieran Bingham: > > > Quoting André Apitzsch (2023-10-23 22:47:50) > > > > Code refinement, no functional changes. > > > > > > > > Signed-off-by: André Apitzsch > > > > --- > > > >  drivers/media/i2c/imx214.c | 24 +++++++++++++++++++----- > > > >  1 file changed, 19 insertions(+), 5 deletions(-) > > > > > > > > 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 @@ > > > >  #include > > > >  #include > > > >   > > > > +#define IMX214_REG_MODE_SELECT         0x0100 > > > > +#define IMX214_MODE_STANDBY            0x00 > > > > +#define IMX214_MODE_STREAMING          0x01 > > > > + > > > >  #define IMX214_DEFAULT_CLK_FREQ        24000000 > > > >  #define IMX214_DEFAULT_LINK_FREQ 480000000 > > > >  #define IMX214_DEFAULT_PIXEL_RATE ((IMX214_DEFAULT_LINK_FREQ * > > > > 8LL) / 10) > > > >  #define IMX214_FPS 30 > > > >  #define IMX214_MBUS_CODE MEDIA_BUS_FMT_SRGGB10_1X10 > > > >   > > > > +/* Exposure control */ > > > > +#define IMX214_REG_EXPOSURE            0x0202 > > > > +#define IMX214_EXPOSURE_MIN            0 > > > > +#define IMX214_EXPOSURE_MAX            3184 > > > > +#define IMX214_EXPOSURE_STEP           1 > > > > +#define IMX214_EXPOSURE_DEFAULT                0x0c70 > > > > > > 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 == Exposure Max > > > which is > > > otherwise hidden? > > > > > Hi Kieran, > > > > 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[]. > > > >         {0x0202, 0x0C}, > >         {0x0203, 0x70}, > > > > What do you think? > > I think exposure values are easier to read as integers than hex > values. Okay, integer it is. > > 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 ;-) I will consider it. > > Do you have the datasheet for this sensor - or are you just working > from the information within this driver? I don't have the datasheet, yet (maybe somebody could provide it), so I have to work with the information within this driver and downstream implementations, like the one by nvidia [1]. > > What device are you using to test this driver? > The sensor is part of my mobile, BQ Aquaris M5 (Longcheer L9100). Best regards, André [1] https://github.com/InES-HPMM/linux-l4t/blob/9150157d2b1f73aefe01e9a07e3b062a45d57247/drivers/media/i2c/imx214_mode_tbls.h > -- > Kieran > > > Regards, > > André