Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1647424pxk; Fri, 2 Oct 2020 15:27:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL6bevtQLKnUrfZdnPunG27+W8weao5AMW1Jlm61sc/RYECfeZ8DMq6fTKNw+hvI1kfhaP X-Received: by 2002:aa7:cf05:: with SMTP id a5mr5090093edy.313.1601677632273; Fri, 02 Oct 2020 15:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601677632; cv=none; d=google.com; s=arc-20160816; b=KJSS7ZYGau+W6UsJI0IBDUZJnNwleS8eBLTh/PFkqBeBVke6dijnsfNNiF2vQTB88A FgrIJ5g67Dt/S8sglikQ5x3TI9x967aNF+SNyP70h0xlWw2zZAaFEpx+1e0rQvhzao0u haIBHGOUU/g+IAKOdFuP13m33i/9JXEHDBPDxWjBTSe3p+XbQdJ2Rwi0227aFHAlP762 8+/eyfVSHxMmMPdYsPmrmcRLwgugJ7/hoIfxDxYf/08b5qc3GE79UlXDXhlYXUkpbTKG R+7Z5sssMTz6WOiQ8my5LTBZZWPzQz4q9HZFqLrLk7E8QFIHsV9WFr0aAYVeUxHf4mrw 5uIQ== 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=lPhz/440ijSXQVPho21GAxYSWrd0Akfbq6fp/kxRJhY=; b=nH4Xy6XE9dbJafVUHNuz9rT18Q70HEiNut9wmKbbKWIakyvUrSSiN67tJSfx5rqdTG CDIx8XpfQgr2YleRQMk8fF86gwnNlkm8/QGmoQ2lIOLoyJd822P5x2TEnuZ5Z03tj0+q P2ahxOLdMTIeSUxBWP8XOX9IUywhB3k+JKNcaEf13xZraTQ2+E4lArNGdrpvgE4XSoan nTntqXZDStL6KmUsg6X1maMrlH8WHbzh1P51qAGLFSCWTMxUzebyvZThzr8eRjtL3wWh 9zndRSGLaKmRUqdfFqo+59m4mfVpkCiVHv8LRaDvywyPBAvwbobPtZp9WaaWQQiCcrvE +Bgg== 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 ss5si1234754ejb.737.2020.10.02.15.26.50; Fri, 02 Oct 2020 15:27:12 -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 S1725648AbgJBWXo (ORCPT + 99 others); Fri, 2 Oct 2020 18:23:44 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:56531 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725797AbgJBWXk (ORCPT ); Fri, 2 Oct 2020 18:23:40 -0400 X-IronPort-AV: E=Sophos;i="5.77,329,1596466800"; d="scan'208";a="58790192" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 03 Oct 2020 07:23:39 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id B9E6540062C6; Sat, 3 Oct 2020 07:23:37 +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 v8 3/3] media: i2c: ov772x: Add test pattern control Date: Fri, 2 Oct 2020 23:23:23 +0100 Message-Id: <20201002222323.21736-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201002222323.21736-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20201002222323.21736-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 86e542b77ee5..d94cf2d39c2a 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 */ @@ -810,6 +816,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; @@ -1108,6 +1117,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) @@ -1444,6 +1455,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