Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1501419rda; Mon, 23 Oct 2023 14:51:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZTvYjqe54Pb4zUDOlsvej4elDJin255HeL8z12IKOEGQZBs0YPnjCY7qQviEKqbatDNY3 X-Received: by 2002:a05:6a20:8e0f:b0:160:58f5:693b with SMTP id y15-20020a056a208e0f00b0016058f5693bmr972723pzj.44.1698097867805; Mon, 23 Oct 2023 14:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698097867; cv=none; d=google.com; s=arc-20160816; b=C+2j4XGu0jBwNoFWR0cBFcU4F6g3N0sEiIYhbRM1BRupb2xPMrCfC2QamwmzHftApB DOQPUqWTyB0i9tb7cRdlxINt2c797ldH229sxmS7N2B3x/z9688picIC2ZB+SnV1vTW4 +336oKFgIJj+EKi2FUUzx7Ra82UAOlgfRg/1Lveh9aRjnrjxfuJUeAbhHxrrUcsrpy9u NlfNmdCWHHrK83NabgbQzWJGg1fBI9zv9LuIKPeW/OuL9DBxR4mVd8c2BIT6VZrKCqls Q3aNYjLWPKRdvgs4kIN3JY0zKQDjmsKtuBh134d7twwiBMkgZFbeeexVT9FbAtSYRZTA aR2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=vgnquDODJh0Bumd4uVhwWrsoPUmOHur4QQeopR137RI=; fh=p+mi5Td8bOurAzEd8CdVTJhDRtapyUXUHLHoRH6vUVQ=; b=e8ZWgdgxtv26o31h9dBMoO1kzGlO4wBjb67TFPm5nIZdWh2TrfQcqmzC3rPvgbxULo NFC7qVJ+ANbdj/cA+brK4ZYE0buazt2DAiQrx6ZQWvl08QTdcG7rasxrxqdU1csht8Q1 TiZZ8Vs/Rc2fHUFeus95QkojztdukqEvnpYH4t7hyUcKPB6wbis9KmQSdPG4HDICWtyK VhsXwZ0wAu/c95w5jPXfEwt8Arw0m5in6oj0NufuVSInbrz6welfDkx0ZC5WpLjXr1Oh PqJ4REvrNvJQz3OjsEOnZQ4wTsuzOIyrSNnWEsFnWibXgGI3v9cqi6JzOPl4v1/WBSf2 kwFQ== 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:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b69-20020a633448000000b00588fe3d83b3si7088776pga.408.2023.10.23.14.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:51:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 069EC807BA35; Mon, 23 Oct 2023 14:50:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233420AbjJWVto (ORCPT + 99 others); Mon, 23 Oct 2023 17:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbjJWVtj (ORCPT ); Mon, 23 Oct 2023 17:49:39 -0400 Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.18.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83276BD for ; Mon, 23 Oct 2023 14:49:32 -0700 (PDT) Received: from [92.206.139.21] (helo=note-book.lan) by smtprelay01.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qv2nh-0004Kz-1P; Mon, 23 Oct 2023 23:49:29 +0200 From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Date: Mon, 23 Oct 2023 23:47:53 +0200 Subject: [PATCH 4/4] media: i2c: imx214: Add sensor's pixel matrix size MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231023-imx214-v1-4-b33f1bbd1fcf@apitzsch.eu> References: <20231023-imx214-v1-0-b33f1bbd1fcf@apitzsch.eu> In-Reply-To: <20231023-imx214-v1-0-b33f1bbd1fcf@apitzsch.eu> To: Ricardo Ribalda , Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Mailer: b4 0.12.3 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-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Mon, 23 Oct 2023 14:50:12 -0700 (PDT) Set effictive and active sensor pixel sizes as shown in product 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 + 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