From patchwork Mon Nov 12 16:00:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10678905 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 F2AAD13BF for ; Mon, 12 Nov 2018 16:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2B772A19B for ; Mon, 12 Nov 2018 16:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D73AB2A1AB; Mon, 12 Nov 2018 16:01:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 7722C2A1A5 for ; Mon, 12 Nov 2018 16:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729548AbeKMBzK (ORCPT ); Mon, 12 Nov 2018 20:55:10 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40689 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbeKMBzK (ORCPT ); Mon, 12 Nov 2018 20:55:10 -0500 Received: by mail-pl1-f195.google.com with SMTP id q19-v6so4544623pll.7 for ; Mon, 12 Nov 2018 08:01:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Plw2j8OS1X8iF/GyUkO2E6X190z3HVgcPI+AO3CQ5f0=; b=VnLvJd2+65R35do1xdx+xN6Wm+oqAtopFVOuiXvZy2JkQ11gNK2jPK2S8w1UhAJSCu s7V/UZrBUYNnTe31UKvufLQVDsOpTQ25wleyCF7E5VcfDIgVs3adEulxioqmX1h//05R vSuph4GQ6gnaKbrj8K+9wxe4GIULhrvVj3mRw7lGiD3cL5yol6c3oiAx1Cm3gLxqaw0Z 91G/ugjqSp4nCviMAwU3U33uML97ecSPwI+ita6xUzBywv9DkEMUmeEBCZXxEgMo6TzY RRl6I27fNR3j59ENGysG08DNHDzvdb6hB8lbRSFg9q696EiNxMufbtx2aXa2fgsnEqLy NBwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Plw2j8OS1X8iF/GyUkO2E6X190z3HVgcPI+AO3CQ5f0=; b=Yqa+pjZFTBbcjjH9/HVEYGnTevc+85Yj9IvcuUHb5ierIHeFTL+FgNhydZkb7/fINg qu27MqrFasHtFGWKnKkKoU0O9A8sExwpeepfRBlAA5LFEKAPt0LFM2c0TNciXeE7ffui mXBCyyMFG1WfF2We1cDsDhSu4C0mzuG7VYf1j2VDZlSlKe7r6csE719agwC2bwQVUytZ 4/4jdruRfDkbYfmVOTkVpVpJYd5AagiR0acp3d+KkVHIVM7eQMconB++VlagQji7J/4s jVkRy4o9TLZ389JrSb7BmZ4fh6Lw3LkIgdbcnvcKguVOjDJH8ccIFnKjSyZuyOSr0zpj efYw== X-Gm-Message-State: AGRZ1gL/32TnGLW9uLIah4JthsQUjzVhxM2vsnnJzgKzz9TXTIetWvNd pcZyAaJO8GiQg0JecabPQKZHHwvq X-Google-Smtp-Source: AJdET5c8+VtShaemsD2SNBvedJBoVQcpp9KSzM8Zq0A5xu3XyB7zFPrqxY5LwNW/qQ1t7casw2h+Ug== X-Received: by 2002:a17:902:124:: with SMTP id 33-v6mr1448249plb.287.1542038479007; Mon, 12 Nov 2018 08:01:19 -0800 (PST) Received: from mita-MS-7A45.lan ([240f:34:212d:1:4c9:76a6:795e:e9ef]) by smtp.gmail.com with ESMTPSA id v74-v6sm26777610pfk.12.2018.11.12.08.01.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 08:01:18 -0800 (PST) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control Date: Tue, 13 Nov 2018 01:00:50 +0900 Message-Id: <1542038454-20066-4-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542038454-20066-1-git-send-email-akinobu.mita@gmail.com> References: <1542038454-20066-1-git-send-email-akinobu.mita@gmail.com> 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 ov2640 has the test pattern generator features. This makes use of it through V4L2_CID_TEST_PATTERN control. Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/ov2640.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index 20a8853..4992d77 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c @@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client) return ret; } +static const char * const ov2640_test_pattern_menu[] = { + "Disabled", + "Color bar", +}; + /* * functions */ @@ -740,6 +745,9 @@ static int ov2640_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_HFLIP: val = ctrl->val ? REG04_HFLIP_IMG : 0x00; return ov2640_mask_set(client, REG04, REG04_HFLIP_IMG, val); + case V4L2_CID_TEST_PATTERN: + val = ctrl->val ? COM7_COLOR_BAR_TEST : 0x00; + return ov2640_mask_set(client, COM7, COM7_COLOR_BAR_TEST, val); } return -EINVAL; @@ -1184,12 +1192,16 @@ static int ov2640_probe(struct i2c_client *client, v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; mutex_init(&priv->lock); - v4l2_ctrl_handler_init(&priv->hdl, 2); + v4l2_ctrl_handler_init(&priv->hdl, 3); priv->hdl.lock = &priv->lock; v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); + v4l2_ctrl_new_std_menu_items(&priv->hdl, &ov2640_ctrl_ops, + V4L2_CID_TEST_PATTERN, + ARRAY_SIZE(ov2640_test_pattern_menu) - 1, 0, 0, + ov2640_test_pattern_menu); priv->subdev.ctrl_handler = &priv->hdl; if (priv->hdl.error) { ret = priv->hdl.error;