Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3049268imm; Fri, 24 Aug 2018 09:37:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZYprgoiH93LPpXZ7mGDpPzgfUW8++B/isbXD54NoN+yXzTKtFx+5F1h4FPLOn8c4IqmEOE X-Received: by 2002:a62:1391:: with SMTP id 17-v6mr2774830pft.34.1535128676227; Fri, 24 Aug 2018 09:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535128676; cv=none; d=google.com; s=arc-20160816; b=Pg93RkcF/MPTtoMnDX11MAD9ZshCsuwuZ25PNUnT61hey1aOBRDZOQLgS4iDhS3QM0 50W+/vzWjifJ4PnSiQE46LvT+vTy0I5kNVR0wnnM63+U49CX/R15mPHnqdd5aOWLlfvS oV/wi2M+BRK1DBwK0jvzUqMomwvybZL/78GYy5eRjoZ6jUEIOI1NAcSBZ/776YiXyVkv sAet0g07euYtk80Su0sU3BgQ/cj5yCGGbSfvfb/tUZOtS/m7D3JgNqp//SIegA+hTFFN xhoBFlZHl123YmM/PWLQmEktIDkbhRtxHbJ+a2WORxOf/osaTX3RO8NdOhW0rXQyGGsp fbKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=LnQiHMdhEYWQyZFYywduCnV0WIuhpQSBzUBfjClZJKQ=; b=kgx10zsvZBeRxfb/KC+jJHK8GfXOV0qgf7MvwaYUcnhLLESxbIM8Hfb8OcGhnQR617 cERQkWZ1G6u9FxBVeC/H/eotOWKCz6tQsAc63FdIM0IoVd5w9OXIdt1/Franj3q1PMVD SrqVlBHKbE1hPxC/Q/cJkqwXg+rqd4lLBH14GJ6lryUfAfkZCGfmmz1h+4xzBiT5TG0B +ZbXQ3eU9Wb1aMR/L47zAUNMui7sBpLWLwph/eOx+JQY388td00WyS3FZT6DxlBRKBU+ /hXC+uyl241jshUDLEZp2sGTWbwUQB5xB5Ws7jXoI4ANJ5PIOhHJBNeIecrK8Kr/KiXu volg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22-v6si8049834pfl.220.2018.08.24.09.37.41; Fri, 24 Aug 2018 09:37:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728318AbeHXULy (ORCPT + 99 others); Fri, 24 Aug 2018 16:11:54 -0400 Received: from srv-hp10-72.netsons.net ([94.141.22.72]:48424 "EHLO srv-hp10-72.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728001AbeHXULe (ORCPT ); Fri, 24 Aug 2018 16:11:34 -0400 Received: from [109.168.11.45] (port=58220 helo=pc-ceresoli.dev.aim) by srv-hp10.netsons.net with esmtpa (Exim 4.91) (envelope-from ) id 1ftF49-00EAi1-50; Fri, 24 Aug 2018 18:36:05 +0200 From: Luca Ceresoli To: linux-media@vger.kernel.org Cc: Luca Ceresoli , Leon Luo , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org Subject: [PATCH 2/7] media: imx274: rearrange sensor startup register tables Date: Fri, 24 Aug 2018 18:35:20 +0200 Message-Id: <20180824163525.12694-3-luca@lucaceresoli.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180824163525.12694-1-luca@lucaceresoli.net> References: <20180824163525.12694-1-luca@lucaceresoli.net> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - srv-hp10.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: srv-hp10.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: srv-hp10.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rearrange the imx274_start_ register tables to better match the datasheet and slightly simplify code: - collapes tables 1 and 2, they are applied one after each other and together they implement the fixed part 1 of the startup procedure in the datasheet - while there, cleanup comments - rename tables 3 and 4 -> 2 and 3, coherently with the datasheet Signed-off-by: Luca Ceresoli --- drivers/media/i2c/imx274.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index 4f629e4e53fd..9b524de08470 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -349,20 +349,14 @@ static const struct reg_8 imx274_mode5_1280x720_raw10[] = { */ static const struct reg_8 imx274_start_1[] = { {IMX274_STANDBY_REG, 0x12}, - {IMX274_TABLE_END, 0x00} -}; -/* - * imx274 second step register configuration for - * starting stream - */ -static const struct reg_8 imx274_start_2[] = { - {0x3120, 0xF0}, /* clock settings */ - {0x3121, 0x00}, /* clock settings */ - {0x3122, 0x02}, /* clock settings */ - {0x3129, 0x9C}, /* clock settings */ - {0x312A, 0x02}, /* clock settings */ - {0x312D, 0x02}, /* clock settings */ + /* PLRD: clock settings */ + {0x3120, 0xF0}, + {0x3121, 0x00}, + {0x3122, 0x02}, + {0x3129, 0x9C}, + {0x312A, 0x02}, + {0x312D, 0x02}, {0x310B, 0x00}, @@ -407,20 +401,20 @@ static const struct reg_8 imx274_start_2[] = { }; /* - * imx274 third step register configuration for + * imx274 second step register configuration for * starting stream */ -static const struct reg_8 imx274_start_3[] = { +static const struct reg_8 imx274_start_2[] = { {IMX274_STANDBY_REG, 0x00}, {0x303E, 0x02}, /* SYS_MODE = 2 */ {IMX274_TABLE_END, 0x00} }; /* - * imx274 forth step register configuration for + * imx274 third step register configuration for * starting stream */ -static const struct reg_8 imx274_start_4[] = { +static const struct reg_8 imx274_start_3[] = { {0x30F4, 0x00}, {0x3018, 0xA2}, /* XHS VHS OUTUPT */ {IMX274_TABLE_END, 0x00} @@ -708,10 +702,6 @@ static int imx274_mode_regs(struct stimx274 *priv) if (err) return err; - err = imx274_write_table(priv, imx274_start_2); - if (err) - return err; - err = imx274_write_table(priv, priv->mode->init_regs); return err; @@ -733,7 +723,7 @@ static int imx274_start_stream(struct stimx274 *priv) * give it 1 extra ms for margin */ msleep_range(11); - err = imx274_write_table(priv, imx274_start_3); + err = imx274_write_table(priv, imx274_start_2); if (err) return err; @@ -743,7 +733,7 @@ static int imx274_start_stream(struct stimx274 *priv) * give it 1 extra ms for margin */ msleep_range(8); - err = imx274_write_table(priv, imx274_start_4); + err = imx274_write_table(priv, imx274_start_3); if (err) return err; -- 2.17.1