From patchwork Fri Jan 18 08:52:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10769561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC167746 for ; Fri, 18 Jan 2019 08:52:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1122E7D3 for ; Fri, 18 Jan 2019 08:52:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFBF62E801; Fri, 18 Jan 2019 08:52:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F49D2E7D3 for ; Fri, 18 Jan 2019 08:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727768AbfARIwo (ORCPT ); Fri, 18 Jan 2019 03:52:44 -0500 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:58328 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbfARIwM (ORCPT ); Fri, 18 Jan 2019 03:52:12 -0500 Received: by wens.csie.org (Postfix, from userid 1000) id 6BA435F848; Fri, 18 Jan 2019 16:52:09 +0800 (CST) From: Chen-Yu Tsai To: Steve Longerbeam , Mauro Carvalho Chehab , Sakari Ailus Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Maxime Ripard Subject: [PATCH 1/6] media: ov5640: Move test_pattern_menu before ov5640_set_ctrl_test_pattern Date: Fri, 18 Jan 2019 16:52:01 +0800 Message-Id: <20190118085206.2598-2-wens@csie.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190118085206.2598-1-wens@csie.org> References: <20190118085206.2598-1-wens@csie.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The OV5640 has many options for generating test patterns. Unfortunately there is only one V4L2 control for it. Thus the driver would need to list some or all combinations. Move the test_pattern_menu list before the ov5640_set_ctrl_test_pattern function that programs the hardware. This would allow us to add a matching list of values to program into the hardware, while keeping the two lists together for ease of maintenance. Signed-off-by: Chen-Yu Tsai --- drivers/media/i2c/ov5640.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 5a909abd0a2d..8e4e8fa3685f 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2441,6 +2441,11 @@ static int ov5640_set_ctrl_gain(struct ov5640_dev *sensor, bool auto_gain) return ret; } +static const char * const test_pattern_menu[] = { + "Disabled", + "Color bars", +}; + static int ov5640_set_ctrl_test_pattern(struct ov5640_dev *sensor, int value) { return ov5640_mod_reg(sensor, OV5640_REG_PRE_ISP_TEST_SET1, @@ -2585,11 +2590,6 @@ static const struct v4l2_ctrl_ops ov5640_ctrl_ops = { .s_ctrl = ov5640_s_ctrl, }; -static const char * const test_pattern_menu[] = { - "Disabled", - "Color bars", -}; - static int ov5640_init_controls(struct ov5640_dev *sensor) { const struct v4l2_ctrl_ops *ops = &ov5640_ctrl_ops;