Message ID | 20231211175023.1680247-7-mike.rudenko@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7269655vqy; Mon, 11 Dec 2023 10:57:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFci8Y3hPHjeogVXa1GuDhMCr79d1oxNdKSNtKz1xy9hciMYVNe2MIpg2niHCWIhJ4TRuwh X-Received: by 2002:a05:6a00:460f:b0:6ce:4866:f388 with SMTP id ko15-20020a056a00460f00b006ce4866f388mr2861430pfb.24.1702321031324; Mon, 11 Dec 2023 10:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702321031; cv=none; d=google.com; s=arc-20160816; b=vpAa/ByOH/IRXMU0wzVKBWKrxTMdCpgdI6iwYp1T7Z0zKe65MyfLOFbDPLnVoKOknN VLvNVILp9FwMs+u/S4kTP+OdMyJBCjxRoKdAXUsGXFFeisSSPepjA2Q2c+ywZw+ctC+V RyRqycFvVlxaXtb7lupT32npled2ausEK/lwJXgrhM81d1V7sa/pSDusyAfOQoO0wMZN BGweJwpmPXeRxO/tbt+MyIshdL7vxC3nrHcnEqEwgmc+AOWIrrJ9HSI6Qg2L22sE8kz7 C3DuHCyvwJUff7mvjEnWuay+bpc/yQi7h6ePROW6XTK9F16+e1gP21sGwwUHedyMR1h7 WIJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vPJtRqKNEOg0N5Ytto1LWF17klynRrR8m/oK9rsOY4A=; fh=fWwPNk1JCACPIViZY2QlWlGqVImCQC9sYxd2Gp7QPV0=; b=lQxvmHsRr19TTR8vijAE8tjeSESoVc+pVaEWxCX88+FCrzoKrbg+t+pGYuyas2hJaD XFMlvlSQnD57eS9e0HlOvLyrIZzYRzVuT0uGzwPWoAOLypc0X/4eHjiLkUNxqOQyXdTq nbL32p5O+2KrO3h43/bEbbPcPyvTYLnnFzLhhS03la6g/PpW6tClJ9goTdqNEcG5IFBU 9oLu+KRzab3dr0Pa7t11pu43jR8Pjdrj0XEVWNVnPNxxU267LHuag+qYRQ7rgXGV2/i6 /ulMT+1FtB5gn/SAbbl8FFlkkVD9p33gWzdyuuWr/s44VSu3r/IqjB0HuklajVYkWUPh sJJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="hg/i0+kd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id fi26-20020a056a00399a00b006cb8cbc9bb8si6498860pfb.284.2023.12.11.10.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 10:57:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="hg/i0+kd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9144E80BEDF0; Mon, 11 Dec 2023 10:57:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344632AbjLKS4o (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 13:56:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345116AbjLKRuq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 12:50:46 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA9BC7; Mon, 11 Dec 2023 09:50:52 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c9ea37ac87so65520551fa.3; Mon, 11 Dec 2023 09:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702317050; x=1702921850; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vPJtRqKNEOg0N5Ytto1LWF17klynRrR8m/oK9rsOY4A=; b=hg/i0+kdPHNu4Q1yaFRuUqpcqAmXiphnA43I6syZ/t3dKBwF5WDgXypTfxuTC9CB/g 4c60x43Z7nQVGftfs+kIiYXGLStgTPpFvduztz5Al+x8ZINUQKBu2Lu9IPCRZINMjjY0 6rw35P5UUifAZqI03SufKRWGB6BAw/JAVQwx71HAoCBympbN+qKOAXp1tvW4fyWKK+GK ARZn305BwYElt3tH3mk/+4hYxGseF+SrZijo7UV9Lf5a8pyQKdoTi99JQukev4B6FAbQ wOcG45M2qKBMxebAi7B/bRttzcQfYCiiQFZ4oG9VoVDaNYi81m9Ox/SqlUL1R2aH9aUh vAdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702317050; x=1702921850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vPJtRqKNEOg0N5Ytto1LWF17klynRrR8m/oK9rsOY4A=; b=RcUT+AeH5QnwMiCw8o6/EY9f7aD6tkAGhcbMLuqZXWU4NwQgAWrCjBEINsKQYQb6sq dq3ON0zZfEuJl7f4As2odd5+FpcY14RqfPRALBxiTEgNEae+G2XvDSEr3NYpTyPz7CDr iQgL0hI5EtGZ+8VXYKNVM2UbtB7z7Xw5c5uNTgS3o4Y54povhTKdiTK6fZD5RFDP0Onn 8QPZMc/hWm2APRgYbDQV//46k5LD6nbPd75xRGeS+uZfNktQG4kIZ22F+KDSp0oZnCAp Y3+r5gy+P2ZKzA3Yv9qYvglw6YpDznpdYs5sXmR99NDY/eHb3ealafDefof7JWIxI0af 6Jyg== X-Gm-Message-State: AOJu0YyFifiEAXI2rbr0K8qlUhpEHQrGfQ7fujQJm9UlgGm+tC6sYM/8 cyMZODGXl8YcSW48PJbRf/xCcnp68i2ZivNr X-Received: by 2002:a2e:a907:0:b0:2cc:2751:a6b7 with SMTP id j7-20020a2ea907000000b002cc2751a6b7mr815528ljq.21.1702317050576; Mon, 11 Dec 2023 09:50:50 -0800 (PST) Received: from localhost ([83.149.246.185]) by smtp.gmail.com with ESMTPSA id h23-20020a2ea497000000b002c9c21d01c2sm1261702lji.101.2023.12.11.09.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:50:50 -0800 (PST) From: Mikhail Rudenko <mike.rudenko@gmail.com> To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sakari Ailus <sakari.ailus@linux.intel.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Jacopo Mondi <jacopo@jmondi.org>, Tommaso Merciai <tommaso.merciai@amarulasolutions.com>, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, Dave Stevenson <dave.stevenson@raspberrypi.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Mikhail Rudenko <mike.rudenko@gmail.com> Subject: [PATCH 06/19] media: i2c: ov4689: Set gain in one 16 bit write Date: Mon, 11 Dec 2023 20:50:09 +0300 Message-ID: <20231211175023.1680247-7-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211175023.1680247-1-mike.rudenko@gmail.com> References: <20231211175023.1680247-1-mike.rudenko@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 11 Dec 2023 10:57:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785010129839566327 X-GMAIL-MSGID: 1785012977817653355 |
Series |
Omnivision OV4689 refactoring and improvements
|
|
Commit Message
Mikhail Rudenko
Dec. 11, 2023, 5:50 p.m. UTC
According to the datasheet, bits 0-7 of the AEC LONG GAIN
register (0x3508) map to bits 8-15 of the gain value and no masking is
required. Thus set analogue gain in a single 16-bit write instead of
two 8-bit writes.
Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
drivers/media/i2c/ov4689.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index 42700ecfbe0e..5392f650960c 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -32,11 +32,7 @@ #define OV4689_EXPOSURE_STEP 1 #define OV4689_VTS_MAX 0x7fff -#define OV4689_REG_GAIN_H CCI_REG8(0x3508) -#define OV4689_REG_GAIN_L CCI_REG8(0x3509) -#define OV4689_GAIN_H_MASK 0x07 -#define OV4689_GAIN_H_SHIFT 8 -#define OV4689_GAIN_L_MASK 0xff +#define OV4689_REG_GAIN CCI_REG16(0x3508) #define OV4689_GAIN_STEP 1 #define OV4689_GAIN_DEFAULT 0x80 @@ -613,14 +609,7 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) break; case V4L2_CID_ANALOGUE_GAIN: ret = ov4689_map_gain(ov4689, val, &sensor_gain); - - cci_write(regmap, OV4689_REG_GAIN_H, - (sensor_gain >> OV4689_GAIN_H_SHIFT) & - OV4689_GAIN_H_MASK, &ret); - - cci_write(regmap, OV4689_REG_GAIN_L, - sensor_gain & OV4689_GAIN_L_MASK, - &ret); + cci_write(regmap, OV4689_REG_GAIN, sensor_gain, &ret); break; case V4L2_CID_VBLANK: cci_write(regmap, OV4689_REG_VTS,