From patchwork Mon Mar 5 09:35:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10258497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2ED6B60365 for ; Mon, 5 Mar 2018 09:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E212289B1 for ; Mon, 5 Mar 2018 09:40:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12B08289B7; Mon, 5 Mar 2018 09:40:21 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88D0B289B2 for ; Mon, 5 Mar 2018 09:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VfQ0Ar9SZrGqxW9j5zTB7n6MFG9ToycTt39A67sIsug=; b=WjiPAGzPbHgaWbEaeysVuOOv7R jTFRLtMK1lbQdWp0bysHuOpLJk3ECG7NnWIubvylbdbVqe24Zwb5kn8EXP71FZWuscczE1M5b9Ayw lX4JvnAG5GEtoKvAk/Sodbf+cBtXCkS0Nt8FeVgMlfuyTi2bw3ZKVD+hjKmtxOgRz3JsgATPX2OUw RRAwSqQYatI6MlEgrHdWetZngARmBZTA/4brEL8ur5yIlMEcV2O+GkyxV1pRvaEkbb3Cz4VayHRQ5 Rb1GoL1Lu3ti1m8xt6WvE7P8mC1WjqWH56vWopAXMA5evPbWBaPhhRF4faxU9ezDqY/8zPcoYqMom RjMgs3IQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esmbL-00072w-Fm; Mon, 05 Mar 2018 09:40:11 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esmXU-0004Wu-2y for linux-arm-kernel@lists.infradead.org; Mon, 05 Mar 2018 09:36:23 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 99C6820881; Mon, 5 Mar 2018 10:35:49 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 32F8820883; Mon, 5 Mar 2018 10:35:39 +0100 (CET) From: Maxime Ripard To: Yong Deng Subject: [PATCH 7/7] media: sun6i: Expose controls on the v4l2_device Date: Mon, 5 Mar 2018 10:35:34 +0100 Message-Id: <20180305093535.11801-8-maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180305093535.11801-1-maxime.ripard@bootlin.com> References: <1519697113-32202-1-git-send-email-yong.deng@magewell.com> <20180305093535.11801-1-maxime.ripard@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180305_013612_901028_A2B0F064 X-CRM114-Status: GOOD ( 11.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mylene Josserand , Thomas Petazzoni , Maxime Ripard , Chen-Yu Tsai , Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Maxime Ripard --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 8 ++++++++ drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h | 2 ++ drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index a93bc25ff372..26d57e6053df 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -729,7 +729,15 @@ static int sun6i_csi_v4l2_init(struct sun6i_csi *csi) media_device_init(&csi->media_dev); + ret = v4l2_ctrl_handler_init(&csi->ctrl_handler, 0); + if (ret) { + dev_err(csi->dev, "V4L2 controls handler init failed (%d)\n", + ret); + goto clean_media; + } + csi->v4l2_dev.mdev = &csi->media_dev; + csi->v4l2_dev.ctrl_handler = &csi->ctrl_handler; ret = v4l2_device_register(csi->dev, &csi->v4l2_dev); if (ret) { dev_err(csi->dev, "V4L2 device registration failed (%d)\n", diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h index c1a1e3aefaa8..c0e8b14073d1 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h @@ -8,6 +8,7 @@ #ifndef __SUN6I_CSI_H__ #define __SUN6I_CSI_H__ +#include #include #include @@ -33,6 +34,7 @@ struct sun6i_csi_config { struct sun6i_csi { struct device *dev; + struct v4l2_ctrl_handler ctrl_handler; struct v4l2_device v4l2_dev; struct media_device media_dev; diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c index c74565d15014..bf7c0d1d1d47 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -497,6 +498,11 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = { .vidioc_prepare_buf = vb2_ioctl_prepare_buf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, + + .vidioc_log_status = v4l2_ctrl_log_status, + .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, + }; /* -----------------------------------------------------------------------------