Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp10858rdh; Wed, 25 Oct 2023 14:27:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFA3r6LGcuFc3I4KCmHKj1MjUhuzIyn164b3+pUX3GIjapJ0yetqd23MABGSLcDs5otesRu X-Received: by 2002:a05:690c:708:b0:5a7:b53a:3223 with SMTP id bs8-20020a05690c070800b005a7b53a3223mr1480823ywb.21.1698269246600; Wed, 25 Oct 2023 14:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698269246; cv=none; d=google.com; s=arc-20160816; b=EQGKapVNmGlaOUjZ/S47QcA0jFVsKMZmXHEFXs/9fukYJ9Y44GeM9C3abDhETf+mX1 0HY9IWTRGGiYienepEuWNEGwfOFqK0O/s7e703CGGQiT+fuzwGYvdhGnYl6q03r1KMeF 2V2+6/q0sXL3ifEkyiM5MDUvz+aRHq69Lx0kU1PXOfD4s2P/UcAWMX6KM+lSG5rKVhHj 341QbRzHVwCIDaX1Bm/va0scjUmYf5BODUHs0PLWCL1MTYFpwnliQZBGYxr8eRBrw+kY Wd0mgHbRbgVkrwsj/59nkuKIlPqkH13RZTqNqy9baPkVqV+tzFCSTOhg4+gnMYsEBbOF Uzlw== 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=iUG5R1Hqb+Q7ZlNwgzsjhr/4JWoJwLFA/GCFPtO2bxU=; fh=wlQQiJRqnI3+77cGd4KjMdQDBy5bM1jUnnqjPTZ/XuE=; b=JAMbDJIKLJ7l88FhqzTw0jTg4YRclyLgXRXt/LjRJS5SGSo7gKWysLEVEvrfVThHfu eDhtzGa9vZkUhPGC51Ntptxp4w1wlwnb968RqU/IiMUS70oVwC4wrns4cbxLm7pSOorR 5Hw4arcfhmCaukoJoDpJ4rLF4szjB4f9CFGS+DMLJAxM0FTd9P3IZLEwRg9GphM8IB/R ydTUYWf+G1WljzXSbdUI+H43/s1ztNukf5mJLox9KdQbu7nLIgW8Knh5bWRdko8AIPJU za6bSgLiX3nixMHWAiqgzm6LBKoBGFgRnFEUpD81X5MQa7mGbnW6T+PIUD39O5ty6qV1 UFlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id w128-20020a817b86000000b0059b4f5d17a9si11994617ywc.94.2023.10.25.14.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 14:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 1B47480A311D; Wed, 25 Oct 2023 14:26:45 -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 S231284AbjJYV0R convert rfc822-to-8bit (ORCPT + 99 others); Wed, 25 Oct 2023 17:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbjJYV0O (ORCPT ); Wed, 25 Oct 2023 17:26:14 -0400 Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C6E186; Wed, 25 Oct 2023 14:26:10 -0700 (PDT) Received: from [92.206.139.21] (helo=note-book.lan) by smtprelay05.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qvlOA-0004pg-2F; Wed, 25 Oct 2023 23:26:06 +0200 Message-ID: Subject: Re: [PATCH 4/4] media: i2c: imx214: Add sensor's pixel matrix size From: =?ISO-8859-1?Q?Andr=E9?= Apitzsch To: Jacopo Mondi Cc: Ricardo Ribalda , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Date: Wed, 25 Oct 2023 23:26:00 +0200 In-Reply-To: <56kgwl7zehsxy2pp7nziwk2gt6joax42qpzs6eywufvcto7qxm@ts4i3ccdokjr> References: <20231023-imx214-v1-0-b33f1bbd1fcf@apitzsch.eu> <20231023-imx214-v1-4-b33f1bbd1fcf@apitzsch.eu> <56kgwl7zehsxy2pp7nziwk2gt6joax42qpzs6eywufvcto7qxm@ts4i3ccdokjr> Autocrypt: addr=git@apitzsch.eu; prefer-encrypt=mutual; keydata=mQINBFZtkcEBEADF2OvkhLgFvPPShI0KqafRlTDlrZw5H7pGDHUCxh0Tnxsj7r1V6N7M8L2ck9GBhoQ9uSNeer9sYJV3QCMs6uIJD8XV60fsLrGZxSnZejYxAmT5IMp7hHZ6EXtgbRBwPUUymfKpMJ55pmyNFBkxWxQA6E33X/rH0ddtGmAsw+g6tOHBY+byBDZrsAZ7MLKqGVaW7IZCQAk4yzO7cLnLVHS2Pk4EOaG+XR/NYQ+jTfMtszD/zSW6hwskGZ6RbADHzCbV01105lnh61jvzpKPXMNTJ31L13orLJyaok1PUfyH0KZp8xki8+cXUxy+4m0QXVJemnnBNW5DG3YEpQ59jXn3I7Eu2pzn2N+NcjqK8sjOffXSccIyz8jwYdhASL5psEvQqZ6t60fv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tQcGESyCltiwGakQ4qytf7kQ4SUYiJ8YQ2E2QU19zUrOkmjq32Be4C3QUYRBloU2l2VyGghZxdShJvNIZvup0ID0BFhcs0+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=1.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD,SPF_HELO_NONE,SPF_PASS autolearn=no 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:26:45 -0700 (PDT) X-Spam-Level: * Hi Jacopo, Am Dienstag, dem 24.10.2023 um 09:52 +0200 schrieb Jacopo Mondi: > Hi Andre' > > On Mon, Oct 23, 2023 at 11:47:53PM +0200, André Apitzsch wrote: > > Set effictive and active sensor pixel sizes as shown in product > > s/effictive/effective > > > brief[1]. > > > > [1]: > > https://www.mouser.com/datasheet/2/897/ProductBrief_IMX214_20150428-1289331.pdf > > > > Signed-off-by: André Apitzsch > > --- > >  drivers/media/i2c/imx214.c | 39 ++++++++++++++++++++++++++++++++-- > > ----- > >  1 file changed, 32 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/media/i2c/imx214.c > > b/drivers/media/i2c/imx214.c > > index bef8dc36e2d0..a2d441cd8dcd 100644 > > --- a/drivers/media/i2c/imx214.c > > +++ b/drivers/media/i2c/imx214.c > > @@ -36,6 +36,14 @@ > >  #define IMX214_EXPOSURE_STEP 1 > >  #define IMX214_EXPOSURE_DEFAULT 0x0c70 > > > > +/* IMX214 native and active pixel array size */ > > +#define IMX214_NATIVE_WIDTH 4224U > > +#define IMX214_NATIVE_HEIGHT 3136U > > +#define IMX214_PIXEL_ARRAY_LEFT 8U > > +#define IMX214_PIXEL_ARRAY_TOP 8U > > +#define IMX214_PIXEL_ARRAY_WIDTH 4208U > > +#define IMX214_PIXEL_ARRAY_HEIGHT 3120U > > + > > I do get slightly different numbers from the datasheet version I have > > The sensor is said to have 4224x3208 total pixels of which 4208x3120 > are active ones. > > The pixel array diagram shows 64 "OPB" (optically black ?) lines, > followed by 8 dummy lines, followed by 3120 valid lines. There are 8 > dummy columns at each side of the 4208 valid ones. > > Now, NATIVE which represents the full pixel array size seems to be > 4224x3208 (other parts of the datasheet only report 3200 lines > though) > > BOUNDS represents the readabale array area, which I presume > corresponds to what is named as 'effective area' by the datasheet. It > excludes the OPB lines at the top of the image and seems to be > represented by (0, 64, 4224, 3160). > > CROP_DEFAULT represents the default crop rectangle which covers the > active pixel area, so it excludes 8 more lines of dummy pixels and 8 > dummy columns, which gives a rectangle (8, 72, 4208, 3120) > > Also note that the driver always reports a TGT_CROP rectangle with > top/left points set to 0. If my understanding is correct, V4L2 > selection targets are defined from the most external target > (TGT_NATIVE in this case), and the driver should be corrected to > initialize the crop rectangle with a top-left corner at (8, 72). > > Does this make sense ? As far as I understood, only the effective and active sizes of three sizes provided in the datasheet (total, effective and active) matter. By comparing the values used in imx219.c (and imx415.c) with the ones in the corresponding datasheets [1,2] I assume, that "effective" matches "NATIVE_SIZE", "active" matches "CROP_DEFAULT" and "total" is ignored. The commit message of 1ed36ecd1459b653cced8929bfb37dba94b64c5d ("media: i2c: imx219: Selection compliance fixes") seems to support me here: > The top/left crop coordinates of the TGT_CROP rectangle were set to > (0, 0) instead of (8, 8) which is the offset from the larger physical > pixel array rectangle. This (8, 8) is half the difference between number of effective and active pixels of imx219[1]. Together with the 8 dummy lines and 8 dummy columns you mentioned, I still think my values are right. But I've just started working with V4L2, so I might be wrong. Could you share the imx214 datasheet with me? Best regards, André [1] https://www.arducam.com/downloads/modules/RaspberryPi_camera/IMX219DS.PDF [2] https://www.sony-semicon.com/files/62/pdf/p-12_IMX415-AAQR_AAMR_Flyer.pdf > > Thanks >   j > > > >  static const char * const imx214_supply_name[] = { > >   "vdda", > >   "vddd", > > @@ -634,14 +642,31 @@ static int imx214_get_selection(struct > > v4l2_subdev *sd, > >  { > >   struct imx214 *imx214 = to_imx214(sd); > > > > - if (sel->target != V4L2_SEL_TGT_CROP) > > - return -EINVAL; > > + switch (sel->target) { > > + case V4L2_SEL_TGT_CROP: > > + mutex_lock(&imx214->mutex); > > + sel->r = *__imx214_get_pad_crop(imx214, sd_state, > > sel->pad, > > + sel->which); > > + mutex_unlock(&imx214->mutex); > > + return 0; > > > > - mutex_lock(&imx214->mutex); > > - sel->r = *__imx214_get_pad_crop(imx214, sd_state, sel- > > >pad, > > - sel->which); > > - mutex_unlock(&imx214->mutex); > > - return 0; > > + case V4L2_SEL_TGT_NATIVE_SIZE: > > + sel->r.top = 0; > > + sel->r.left = 0; > > + sel->r.width = IMX214_NATIVE_WIDTH; > > + sel->r.height = IMX214_NATIVE_HEIGHT; > > + return 0; > > + > > + case V4L2_SEL_TGT_CROP_DEFAULT: > > + case V4L2_SEL_TGT_CROP_BOUNDS: > > + sel->r.top = IMX214_PIXEL_ARRAY_TOP; > > + sel->r.left = IMX214_PIXEL_ARRAY_LEFT; > > + sel->r.width = IMX214_PIXEL_ARRAY_WIDTH; > > + sel->r.height = IMX214_PIXEL_ARRAY_HEIGHT; > > + return 0; > > + } > > + > > + return -EINVAL; > >  } > > > >  static int imx214_entity_init_cfg(struct v4l2_subdev *subdev, > > > > -- > > 2.42.0 > >