Received: by 2002:ab2:78c:0:b0:1ec:b906:25e5 with SMTP id h12csp252856lqe; Fri, 23 Feb 2024 03:30:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXNN/V5wAHIiLIU99NbRQFb/oJntk4FAd7l6m34IuNgu3gDk9NFnx7Eu6srXugW6JIJbHX2xVMazhnJGdUQUeQoAOixu/OqvSJ8XELuww== X-Google-Smtp-Source: AGHT+IFHEGwkab7Q1R2tfmWNCJzTdV1Bwdl1PsOQ37eFI44dNfOCgqf/etVjWSC0B9JWLB74ch+e X-Received: by 2002:ac8:5d55:0:b0:42d:b723:a7a with SMTP id g21-20020ac85d55000000b0042db7230a7amr1904221qtx.22.1708687828892; Fri, 23 Feb 2024 03:30:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708687828; cv=pass; d=google.com; s=arc-20160816; b=M9sXUn6M3s2HTvdueHk6DgorZIHnCGGM+UI7rJDOJdEmXjF651TdCpE2lKZzpVNGr3 xltpxjlH7BAcSQlhDo5VquXZY8SJmf5RHLFLhvQbdYVYT8sP4APTxKkayAds9HrePg+f ygcHuauWU/MlghMsI8efKXWVkyDYS0qiQo638xCjaBwQoYpdmpD17MAqVywrN+9QAvfx pXzAGUiqdzNZ+EnVrr+OxDNX+Jeu9eOCkOghW+cgP6NqpUzFxxyNa1EnRS5/tdzrH/xb R9Ex2B8R1NAPdUu56eBG4I8iUpPmjL5I7w/+pKWxhrt6zeT5y8n6qVYeZtshRV0bPOrI WiMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kzp7cNyQCnBxzSATHnJIyqqD/DqLJfEBt7E/q0wbP/o=; fh=QT+iGvNcZeaNbQRUR4DJ7wLtNyZTa5ZJCEL+R9E9tc8=; b=ZS8W49U1CaOpVYrnvPILZszWBnqNvzRVhh6sugZWbHc1ge+jhpxlPBOcrT4o2+kzW7 nbKyfqSWHn+uEs2uUd4JYDHa+Jz3zOAFDrwL4kLo4ZWxRDMeFLDmLHfmw7N7sUMbmmLM OYEgHxPbGt5X7RlPg8JCs2AspyYooYf53NpJ1QpB4buBd1lUAxQkolLrMP5kroflJRAB qcnMK4E6Ps5ydGI7hCnR+xvgzl/iVhKiqrE5GsmZN2Y3fx0Z61BS4ZVLtAZtc1xBuAPg WVkw5748+8Q2w3SFhtHHhdNAgUKCUQV7JP5eQ25gPYQGFUuKsTbSX9CqTaPhVCPawtZb N84g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=rPjDAoWc; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-78218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78218-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d4-20020ac85ac4000000b0042db67f6b41si16094046qtd.602.2024.02.23.03.30.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 03:30:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=rPjDAoWc; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-78218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78218-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D099D1C22151 for ; Fri, 23 Feb 2024 11:30:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC7F778B5F; Fri, 23 Feb 2024 11:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rPjDAoWc" 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 99E075C911; Fri, 23 Feb 2024 11:30:04 +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=1708687806; cv=none; b=PXKNKmFVkstqm4LvjH4mCp5wsQwZdf8dxbliDYzdjssofNacooXdJ3607ljWkE/8kIEDzm6CkukypNf6gJZ9GEYdvkdT5levv2ENNM1iAZs/SDTF+/I+7S+tXmzrKitBWLpSnDcWIDVU74MxMGqnHLnNQJY5eR802BpeusLgZx4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708687806; c=relaxed/simple; bh=sRCQO7RgeHDKkHCU1kxMeMy3uw8Xi1J+ZxGRQNaYUcU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Cvpf6vjbGs3yYr/YQFP2LtRQeVOddNiPg0Q45KBCyS3fyr5oRG+1ie+utInUXDDzWc+OQi7j2+d+3Tbw4h9iEHCBgay/HxLbn+HdPDerSr/NUaxAafEm7Ni0odzosbPggW6HPTLaFZ94RHZTAbXGTgf3ZhGD9RwSdx4dBAncbS4= 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=rPjDAoWc; 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 (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D3D362E7; Fri, 23 Feb 2024 12:29:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1708687794; bh=sRCQO7RgeHDKkHCU1kxMeMy3uw8Xi1J+ZxGRQNaYUcU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rPjDAoWc5pQn7WOZrzCCb/5X0o7B+XiUunlbrAVbQiQSXTGrDp2prI77cFL4FrSQz ZQ7z5b0h7UrEimNNMHwIser5cs2A9/40YqN9gW4iZ68e+NoW9fgjAJhb0zTY/qNSn3 dqHBlp/VJq9WhUxcuUOjet+2dGPYXxABrwxlp4kI= Date: Fri, 23 Feb 2024 13:30:06 +0200 From: Laurent Pinchart To: Mikhail Rudenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab Subject: Re: [PATCH v2 13/20] media: i2c: ov4689: Implement digital gain control Message-ID: <20240223113006.GQ31348@pendragon.ideasonboard.com> References: <20231218174042.794012-1-mike.rudenko@gmail.com> <20231218174042.794012-14-mike.rudenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231218174042.794012-14-mike.rudenko@gmail.com> Hi Mikhail, Thank you for the patch. On Mon, Dec 18, 2023 at 08:40:34PM +0300, Mikhail Rudenko wrote: > The OV4689 sensor supports digital gain up to 16x. Implement > corresponding control in the driver. Default digital gain value is not > modified by this patch. > > Signed-off-by: Mikhail Rudenko Reviewed-by: Laurent Pinchart > --- > drivers/media/i2c/ov4689.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c > index 6cf986bf305d..579362570ba4 100644 > --- a/drivers/media/i2c/ov4689.c > +++ b/drivers/media/i2c/ov4689.c > @@ -35,6 +35,12 @@ > #define OV4689_GAIN_STEP 1 > #define OV4689_GAIN_DEFAULT 0x80 > > +#define OV4689_REG_DIG_GAIN CCI_REG16(0x352a) > +#define OV4689_DIG_GAIN_MIN 1 > +#define OV4689_DIG_GAIN_MAX 0x7fff > +#define OV4689_DIG_GAIN_STEP 1 > +#define OV4689_DIG_GAIN_DEFAULT 0x800 > + > #define OV4689_REG_HTS CCI_REG16(0x380c) > #define OV4689_HTS_DIVIDER 4 > #define OV4689_HTS_MAX 0x7fff > @@ -131,7 +137,6 @@ static const struct cci_reg_sequence ov4689_2688x1520_regs[] = { > > /* AEC PK */ > {CCI_REG8(0x3503), 0x04}, /* AEC_MANUAL gain_input_as_sensor_gain_format = 1 */ > - {CCI_REG8(0x352a), 0x08}, /* DIG_GAIN_FRAC_LONG dig_gain_long[14:8] = 0x08 (2x) */ > > /* ADC and analog control*/ > {CCI_REG8(0x3603), 0x40}, > @@ -624,6 +629,9 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) > OV4689_TIMING_FLIP_MASK, > ctrl->val ? 0 : OV4689_TIMING_FLIP_BOTH, &ret); > break; > + case V4L2_CID_DIGITAL_GAIN: > + cci_write(regmap, OV4689_REG_DIG_GAIN, ctrl->val, &ret); > + break; > default: > dev_warn(dev, "%s Unhandled id:0x%x, val:0x%x\n", > __func__, ctrl->id, ctrl->val); > @@ -654,7 +662,7 @@ static int ov4689_initialize_controls(struct ov4689 *ov4689) > > handler = &ov4689->ctrl_handler; > mode = ov4689->cur_mode; > - ret = v4l2_ctrl_handler_init(handler, 12); > + ret = v4l2_ctrl_handler_init(handler, 13); > if (ret) > return ret; > > @@ -697,6 +705,10 @@ static int ov4689_initialize_controls(struct ov4689 *ov4689) > v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); > v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); > > + v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_DIGITAL_GAIN, > + OV4689_DIG_GAIN_MIN, OV4689_DIG_GAIN_MAX, > + OV4689_DIG_GAIN_STEP, OV4689_DIG_GAIN_DEFAULT); > + > if (handler->error) { > ret = handler->error; > dev_err(ov4689->dev, "Failed to init controls(%d)\n", ret); -- Regards, Laurent Pinchart