Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1456745pxk; Fri, 2 Oct 2020 09:59:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjqQ0M+fu8IAXQtvPoYGmyNcBDeddZi9uGWxy84iTNOfI1zdKympsfopgGxFa1NVbtWRxX X-Received: by 2002:a17:906:b146:: with SMTP id bt6mr3152234ejb.287.1601657948113; Fri, 02 Oct 2020 09:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601657948; cv=none; d=google.com; s=arc-20160816; b=rZsHmqk+Et/1CCeYGpXMW293pSQxIrlWk4cwcVUO/fqKZ4qI9Zqtaq3cnqL2zqerHx r+GH/lY8Bns6ZtG/Iaobbu52q6dMAgv80tNhtzOw+NMLVNES90jRBmfq/yeV1p/+8Znn TLF79VOyfLd8UprbqiIk9gOQcyZWrSMYRQtFwHIk1OztnxFaPeOSINfyPh5mOHru6iUM uFvmkDJrtg9LNyqkJlClBgKJjh1aqc8SLSHlnaQDHZtxZieVcvGL23qCE+Ue90UtAeW2 1LXuNnGtBs/kYxCyJvvZiv6g6BezCwfJ0UhBcZNlNeeWHO07Ydtu8sDwtIlM5Ie0eLyo 3f5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=xB2jWtiY4RRiPAhcnwEIcqj9nSfbjlIMnh2YSZCzZL0=; b=cBz+lgneIGd0xUkXiygztoA9QwQ3Y9ZSzmqzzGL8PVsi4qvBGYwfA9sDrpmIXaz+tG vF7rEpf6AKyrFF2oTV/kY3MCbx9fYwp1Gj0hMVN96DcJrqMpZkDfASSP/csUwXrR73h/ zWhwsWeQwPWzt5vk54eoF5iRKVYJ8JRX3egXyo66nx0R5jOP8gZFvdrynGWepNikluAL WeLzVU0DdVUQb8gd5ljPj0C8lFpg8qmCOk337dKZrdms/5qOlAfHPTESrj48HLXBChiG nXrSN0SxTBwJ0su+x5wa0Wx2c94gm6lBM8keqLzAtsKkeHSqxasCGiCHLQneSienPG2k J6nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si1447696edf.9.2020.10.02.09.58.45; Fri, 02 Oct 2020 09:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387908AbgJBQ5O (ORCPT + 99 others); Fri, 2 Oct 2020 12:57:14 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:22687 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725991AbgJBQ5L (ORCPT ); Fri, 2 Oct 2020 12:57:11 -0400 X-IronPort-AV: E=Sophos;i="5.77,328,1596466800"; d="scan'208";a="58562623" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 03 Oct 2020 01:57:09 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D08894007F4C; Sat, 3 Oct 2020 01:57:07 +0900 (JST) From: Lad Prabhakar To: Jacopo Mondi , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v7 3/3] media: i2c: ov772x: Add test pattern control Date: Fri, 2 Oct 2020 17:56:56 +0100 Message-Id: <20201002165656.16744-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201002165656.16744-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20201002165656.16744-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for test pattern control supported by the sensor. Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Jacopo Mondi --- drivers/media/i2c/ov772x.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c index 6b46ad493bf7..b7e10c34ef59 100644 --- a/drivers/media/i2c/ov772x.c +++ b/drivers/media/i2c/ov772x.c @@ -227,7 +227,7 @@ /* COM3 */ #define SWAP_MASK (SWAP_RGB | SWAP_YUV | SWAP_ML) -#define IMG_MASK (VFLIP_IMG | HFLIP_IMG) +#define IMG_MASK (VFLIP_IMG | HFLIP_IMG | SCOLOR_TEST) #define VFLIP_IMG 0x80 /* Vertical flip image ON/OFF selection */ #define HFLIP_IMG 0x40 /* Horizontal mirror image ON/OFF selection */ @@ -425,6 +425,7 @@ struct ov772x_priv { const struct ov772x_win_size *win; struct v4l2_ctrl *vflip_ctrl; struct v4l2_ctrl *hflip_ctrl; + unsigned int test_pattern; /* band_filter = COM8[5] ? 256 - BDBASE : 0 */ struct v4l2_ctrl *band_filter_ctrl; unsigned int fps; @@ -540,6 +541,11 @@ static const struct ov772x_win_size ov772x_win_sizes[] = { }, }; +static const char * const ov772x_test_pattern_menu[] = { + "Disabled", + "Vertical Color Bar Type 1", +}; + /* * frame rate settings lists */ @@ -809,6 +815,9 @@ static int ov772x_s_ctrl(struct v4l2_ctrl *ctrl) } return ret; + case V4L2_CID_TEST_PATTERN: + priv->test_pattern = ctrl->val; + return 0; } return -EINVAL; @@ -1107,6 +1116,8 @@ static int ov772x_set_params(struct ov772x_priv *priv, val ^= VFLIP_IMG; if (priv->hflip_ctrl->val) val ^= HFLIP_IMG; + if (priv->test_pattern) + val |= SCOLOR_TEST; ret = regmap_update_bits(priv->regmap, COM3, SWAP_MASK | IMG_MASK, val); if (ret < 0) @@ -1442,6 +1453,10 @@ static int ov772x_probe(struct i2c_client *client) priv->band_filter_ctrl = v4l2_ctrl_new_std(&priv->hdl, &ov772x_ctrl_ops, V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0); + v4l2_ctrl_new_std_menu_items(&priv->hdl, &ov772x_ctrl_ops, + V4L2_CID_TEST_PATTERN, + ARRAY_SIZE(ov772x_test_pattern_menu) - 1, + 0, 0, ov772x_test_pattern_menu); priv->subdev.ctrl_handler = &priv->hdl; if (priv->hdl.error) { ret = priv->hdl.error; -- 2.17.1