Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp26596lqi; Wed, 6 Mar 2024 09:07:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU8ZmPRRjbGxJVylgGyS51r+6IEPy4rG4jQsRKRdL2dhhhxvLDJ8aLn4bL+cSDCynvqx+TKJN86Yo2sysK1+DFNb0nfZyHtrEhFEXjM3A== X-Google-Smtp-Source: AGHT+IFQH2gC2ihgJF/Wr8n2Z5K+VHSWJL6uqZokvTC3Of1pmJi9ilqn6KhOt9f3mr/5ccSosvJJ X-Received: by 2002:a17:906:3b0d:b0:a45:b773:2e14 with SMTP id g13-20020a1709063b0d00b00a45b7732e14mr1758709ejf.47.1709744834994; Wed, 06 Mar 2024 09:07:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709744834; cv=pass; d=google.com; s=arc-20160816; b=bY+kIcBWJJtwysVfkbxbYZu1T0EseuTU0dPbrnq/ZKnqLTdvxJ5hW6PqoXWwefKadr JaL8geKMRfRsBZn1SIjIZegn/h2sQAFIi97uM9A/nYnXbAWuewIqEBWcA/Xi36/RDlg/ N/gID91QJizBU1MXbjALquUc/5JzFxij31vjDjHJQqJnMF+JSjgDWgDVkp0raL+Hhpsk JwVxdX9DGkR47MFAZst3b7OGcopH06f9ja/ha5LEkie7b/nj7bMfcb85CDvy4r5gM9zm xSPwYrP+Xt8qr1pDpBtsvROSLHtSH4gKpUrCoAHb/NFGmLKDjGrVLSQfYr/42Z8TAp8E p52Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:message-id:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=YhNJJYtPVvh0p5UzT2rr2JHqQiwcfDzHJSqfk8Hq6WQ=; fh=0v2lKvXD3QmgNLtW1fD8oIfWQ+UAa1fpgWNyd/yatfQ=; b=nMq4ZnQIWqESwaFo8CKyc8XcdODgvFDiTegIGlQ0to1A84ttKVChWiBMSmmLr9dz0n J3jAY3+YVLK5lCeJ+LpHfic7koLFKXbb4pqiG8N6fxXx5Fc4uJ199JwikRUDd46okZsd mZEy0POUtivNBGVIx+HshTNOCnV+mm0qIf+B4k6wZNjoaZmHYODwoUwXcpWTxYy9ZUVs 0+BG3JRpXR5U9VNKo7LpQJOXY/16gtoh0Vk99fFS7/3pnnY8SD5F6tqPkX+QsEjL+VWz F2zwvujzC2Y7oOZM6E86xY7nql4B0M+onrQqrVVGf0UTHFL+DeQ/Ybu+C/b92teqjjvv /cQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="m/sf+qfo"; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-94306-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94306-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qb25-20020a1709077e9900b00a43ffe05cc4si6261565ejc.106.2024.03.06.09.07.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 09:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94306-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="m/sf+qfo"; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-94306-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94306-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E1B211F28C84 for ; Wed, 6 Mar 2024 17:00:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C29F13BACF; Wed, 6 Mar 2024 16:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="m/sf+qfo" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E346137900; Wed, 6 Mar 2024 16:59:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709744365; cv=none; b=Gwl98bbroKSCsuFeLAowm46C0DcekjgPVH5XGH0FS0xll3UfmQLxxgq/9AFrer+T94xYyCEyAuONzU/Va7P7zWcbA7XDzXEWQL46l/Q8ygvWK7932hawgCIitUg1zDArgPI/N+B4Go3f5Yl0/W3WJYefRpLahN7Dty4Ze4mJgnw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709744365; c=relaxed/simple; bh=6efTsE/s//lWZT89K6OgZlxZVqIp94KG4aarsCx7d0A=; h=Content-Type:MIME-Version:In-Reply-To:References:Subject:From:Cc: To:Date:Message-ID; b=tD6qP5do+zKPDbVb/bcjAdiqF68v6s1rzSDJ9/7OC2IFpqqteLfUf8ZLKxUABYNBuJHv/maRed0e0O9kaLwATp3WSiP4u/lj4+B2C7j7SqqQh6x8GuL+Na1aBCvkACedJBqOChQ0cM5WgI5gOz7f32ATqPScGeagoYh5pPTqrkg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=m/sf+qfo; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com 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 DFF10BD1; Wed, 6 Mar 2024 17:59:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1709744344; bh=6efTsE/s//lWZT89K6OgZlxZVqIp94KG4aarsCx7d0A=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=m/sf+qfoZeWnpt8ODHesHI9DNUOB1o3YkMqeKhYJoxHji+F6nk+EqOKlzYd56YAuX O0WOa5dsH+bZ29Cox2IUxDVydwwqeXCFhGh7EkjdFmkbbFbJIxd4JV/iH8aiAnI5Ej elUCBnXHRgRsXJrxLphY4pSuZo+GnjjR9mi13llU= Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240306081038.212412-6-umang.jain@ideasonboard.com> References: <20240306081038.212412-1-umang.jain@ideasonboard.com> <20240306081038.212412-6-umang.jain@ideasonboard.com> Subject: Re: [PATCH 5/5] media: imx335: Limit analogue gain value From: Kieran Bingham Cc: Alexander Shiyan , Mauro Carvalho Chehab , Sakari Ailus , open list , Umang Jain To: Umang Jain , linux-media@vger.kernel.org Date: Wed, 06 Mar 2024 16:59:19 +0000 Message-ID: <170974435963.362031.17853243017273896294@ping.linuxembedded.co.uk> User-Agent: alot/0.10 Quoting Umang Jain (2024-03-06 08:10:38) > The sensor gain (both analog and digital) are controlled by a > single gain value where: > - 0dB to 30dB correspond to analog gain > - 30.3dB to 72dB correspond to digital gain > (with 0.3dB step) >=20 > Hence, limit the analogue gain value to 100. > For digital gain, support can be added later if needed. >=20 > Signed-off-by: Umang Jain I think this makes the behaviour more consistent with expectations from userspace for the ANALOGUE_GAIN. Reviewed-by: Kieran Bingham > --- > drivers/media/i2c/imx335.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c > index c00e0c2be3f3..701bd5318b45 100644 > --- a/drivers/media/i2c/imx335.c > +++ b/drivers/media/i2c/imx335.c > @@ -45,7 +45,7 @@ > /* Analog gain control */ > #define IMX335_REG_AGAIN CCI_REG8(0x30e8) > #define IMX335_AGAIN_MIN 0 > -#define IMX335_AGAIN_MAX 240 > +#define IMX335_AGAIN_MAX 100 > #define IMX335_AGAIN_STEP 1 > #define IMX335_AGAIN_DEFAULT 0 > =20 > @@ -1169,6 +1169,14 @@ static int imx335_init_controls(struct imx335 *imx= 335) > IMX335_EXPOSURE_STEP, > IMX335_EXPOSURE_DEFAULT); > =20 > + /* > + * The sensor has an analog gain and a digital gain, both control= led > + * through a single gain value, expressed in 0.3dB increments. Va= lues > + * from 0.0dB (0) to 30.0dB (100) apply analog gain only, higher = values > + * up to 72.0dB (240) add further digital gain. Limit the range to > + * analog gain only, support for digital gain can be added separa= tely > + * if needed. > + */ > imx335->again_ctrl =3D v4l2_ctrl_new_std(ctrl_hdlr, > &imx335_ctrl_ops, > V4L2_CID_ANALOGUE_GAIN, > --=20 > 2.43.0 >