Received: by 2002:ab2:78c:0:b0:1ec:b906:25e5 with SMTP id h12csp253201lqe; Fri, 23 Feb 2024 03:31:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXmEYVMTO74I9u2gxGypeIje3USBs/SBGHQPu8HWAdiBqZ8s6eSqllMnKduJTZ8BHiqPSHU4GwkeLHQaa3SE1Yguper6jEKJeqKVPPr9A== X-Google-Smtp-Source: AGHT+IHVeK7nF15MkQJwAa87AwKB4SQevzy39WgfXyNNpMpDwvualXBGRyBmWTlL0e84/AWKX5bx X-Received: by 2002:a05:6808:3c90:b0:3c1:6ce3:ee95 with SMTP id gs16-20020a0568083c9000b003c16ce3ee95mr2246314oib.18.1708687878261; Fri, 23 Feb 2024 03:31:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708687878; cv=pass; d=google.com; s=arc-20160816; b=L6gl6d54i2o8tpzEVDUwCvWMOY6ShGATq3gL9mE+Ibd5CnOqjrbJtWsZI4N5hQRtzT o8dEiAvEDqet7KASfpMFyRmZtALW6XyfMcWfPNRT6l5NoDTlGvp/ZenMBpZtQmp2nAM4 HBidXnZsEGlzzOQb1bZucYRiv9PJD07NUTwwaLgNf69hwkl8yMZdFU0JKpaGfrFBbYgX BvS4+dEN/wy3eeTEaQ8a8EPAL/LHgtHudr+Hwa1AnqN19Dc7gBLLlp8jgn6m1nX3jvDM QCe22+Pc+FBgG357OAKnzUOYwy8ZHYnBAHHo5UDfgeuhlDcAAJV2v9PNBNUAGZQ+wnqi 1YgA== 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=7mMKUb5f2tGHh3LYJZ6Th+bcYoH7iUglELOsBUKNyZ4=; fh=QT+iGvNcZeaNbQRUR4DJ7wLtNyZTa5ZJCEL+R9E9tc8=; b=03j1LTbjAqPuRX9kBrl3r2qWRRQAlWmhc2osO3yywkGyXaoqSS9CcfIkT3VoIzYfw0 BjHysFVUoDid/rfFusQxoTE31Zm1SZ5+GMgaGVdKg3Gcd/M6rn22oi5bSCkq1ELbrdpo UyDIZhpstHruQgjsAEIrjl3yLq6T0CAOOtwcHLXHzEhbrGx9bvVial9YoDr7385n+6ym sQBjzvRwUi43D/FzI5IeC2sZhBvlYWxlGlTXKexoEDrIWAzfvamCx1izj4V6sIQypwzP Im1bMyJE1kEdEYyxUMA65Xx8GfabgJQIGJZI0Pa4d5oAiWDAEXwYxLiLvSi/44+335pP 8dyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hdIFdBbd; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-78220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78220-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 a14-20020a0562140c2e00b0068fdddee980si391535qvd.576.2024.02.23.03.31.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 03:31:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78220-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=hdIFdBbd; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-78220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78220-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 D32F21C20AB4 for ; Fri, 23 Feb 2024 11:31:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CEFD79DB5; Fri, 23 Feb 2024 11:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hdIFdBbd" 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 1E49A5C911; Fri, 23 Feb 2024 11:31:08 +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=1708687870; cv=none; b=BgXEMINKwpN4YZMSNtLAKMZT7lN1LMY91iH6MBqno9mmtmYnonFSX2gHjl23dhMzO5LunGitVlfTgBc1+d0t2GGflPMB1B7U1zFGU6wbfoUI6Raa3mEk6mwPxqFGDizecMB7PLwmO4OFLQcWc9r0MIzOa0rbpXAyFAJF3qtgid8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708687870; c=relaxed/simple; bh=wOUQz5eeBlIh1yOYBEKMmJSEt1nsckcfcWxLMJnrpUk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DBCCZrLntNgZGOweR+R7K7p7H4Eh6zwQMiisoas4qfx2sxfFkjRkIacXrKTZY9aA3T/CGLss8jcV0Mb7HA4hvDrXxOCXMoLmYgJKhVqqueX0Fa4EHzRfUHW4Kq3ITuGk0hzbnfJnFl62cuYI4NeYId8r0B7ZXzhKizXolerjc3U= 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=hdIFdBbd; 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 7DAA62E7; Fri, 23 Feb 2024 12:30:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1708687858; bh=wOUQz5eeBlIh1yOYBEKMmJSEt1nsckcfcWxLMJnrpUk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hdIFdBbdGSqin5//k4Tj5zgUlyJAdidCsSXK3pTNpcaJvMN6hiK41M4EbzUL4Lcn1 LQQ9FyXWWeSz+A26qYMhL/pWtN5FaXNeWp9yfK5bSXgBxn5QiHxmG8gzCfXpxi0W0e qkBmFdSh4NqujWUFz07C1tu711t84gMYZ9WWwxk4= Date: Fri, 23 Feb 2024 13:31:11 +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 14/20] media: i2c: ov4689: Implement manual color balance controls Message-ID: <20240223113111.GR31348@pendragon.ideasonboard.com> References: <20231218174042.794012-1-mike.rudenko@gmail.com> <20231218174042.794012-15-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-15-mike.rudenko@gmail.com> Hi Mikhail, Thank you for the patch. On Mon, Dec 18, 2023 at 08:40:35PM +0300, Mikhail Rudenko wrote: > The OV4689 sensor has separate red and blue gain settings (up to 4x). > Implement appropriate controls in the driver. Default gain values > are not modified. > > Signed-off-by: Mikhail Rudenko Reviewed-by: Laurent Pinchart > --- > drivers/media/i2c/ov4689.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c > index 579362570ba4..b43fb1d7b15f 100644 > --- a/drivers/media/i2c/ov4689.c > +++ b/drivers/media/i2c/ov4689.c > @@ -56,6 +56,13 @@ > #define OV4689_TIMING_FLIP_BOTH (OV4689_TIMING_FLIP_ARRAY |\ > OV4689_TIMING_FLIP_DIGITAL) > > +#define OV4689_REG_WB_GAIN_RED CCI_REG16(0x500c) > +#define OV4689_REG_WB_GAIN_BLUE CCI_REG16(0x5010) > +#define OV4689_WB_GAIN_MIN 1 > +#define OV4689_WB_GAIN_MAX 0xfff > +#define OV4689_WB_GAIN_STEP 1 > +#define OV4689_WB_GAIN_DEFAULT 0x400 > + > #define OV4689_REG_TEST_PATTERN CCI_REG8(0x5040) > #define OV4689_TEST_PATTERN_ENABLE 0x80 > #define OV4689_TEST_PATTERN_DISABLE 0x0 > @@ -632,6 +639,12 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) > case V4L2_CID_DIGITAL_GAIN: > cci_write(regmap, OV4689_REG_DIG_GAIN, ctrl->val, &ret); > break; > + case V4L2_CID_RED_BALANCE: > + cci_write(regmap, OV4689_REG_WB_GAIN_RED, ctrl->val, &ret); > + break; > + case V4L2_CID_BLUE_BALANCE: > + cci_write(regmap, OV4689_REG_WB_GAIN_BLUE, ctrl->val, &ret); > + break; > default: > dev_warn(dev, "%s Unhandled id:0x%x, val:0x%x\n", > __func__, ctrl->id, ctrl->val); > @@ -662,7 +675,7 @@ static int ov4689_initialize_controls(struct ov4689 *ov4689) > > handler = &ov4689->ctrl_handler; > mode = ov4689->cur_mode; > - ret = v4l2_ctrl_handler_init(handler, 13); > + ret = v4l2_ctrl_handler_init(handler, 15); > if (ret) > return ret; > > @@ -709,6 +722,14 @@ static int ov4689_initialize_controls(struct ov4689 *ov4689) > OV4689_DIG_GAIN_MIN, OV4689_DIG_GAIN_MAX, > OV4689_DIG_GAIN_STEP, OV4689_DIG_GAIN_DEFAULT); > > + v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_RED_BALANCE, > + OV4689_WB_GAIN_MIN, OV4689_WB_GAIN_MAX, > + OV4689_WB_GAIN_STEP, OV4689_WB_GAIN_DEFAULT); > + > + v4l2_ctrl_new_std(handler, &ov4689_ctrl_ops, V4L2_CID_BLUE_BALANCE, > + OV4689_WB_GAIN_MIN, OV4689_WB_GAIN_MAX, > + OV4689_WB_GAIN_STEP, OV4689_WB_GAIN_DEFAULT); > + > if (handler->error) { > ret = handler->error; > dev_err(ov4689->dev, "Failed to init controls(%d)\n", ret); -- Regards, Laurent Pinchart