From patchwork Tue Sep 22 17:19:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7250251 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 29FA19F40A for ; Wed, 23 Sep 2015 14:39:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D85C20A82 for ; Wed, 23 Sep 2015 14:39:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 647AB20A68 for ; Wed, 23 Sep 2015 14:39:01 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8E894265AED; Wed, 23 Sep 2015 16:39:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B10D52650B4; Wed, 23 Sep 2015 16:33:51 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B459126512A; Tue, 22 Sep 2015 19:20:08 +0200 (CEST) Received: from resqmta-po-10v.sys.comcast.net (resqmta-po-10v.sys.comcast.net [96.114.154.169]) by alsa0.perex.cz (Postfix) with ESMTP id 92C84265011 for ; Tue, 22 Sep 2015 19:19:52 +0200 (CEST) Received: from resomta-po-01v.sys.comcast.net ([96.114.154.225]) by resqmta-po-10v.sys.comcast.net with comcast id LHKo1r00B4s37d401HKr8f; Tue, 22 Sep 2015 17:19:51 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-01v.sys.comcast.net with comcast id LHKm1r00G1LXgTt01HKqLr; Tue, 22 Sep 2015 17:19:51 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 1E6C1A1635; Tue, 22 Sep 2015 11:19:50 -0600 (MDT) From: Shuah Khan To: mchehab@osg.samsung.com, hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, tiwai@suse.de, pawel@osciak.com, m.szyprowski@samsung.com, kyungmin.park@samsung.com, perex@perex.cz, stefanr@s5r6.in-berlin.de, crope@iki.fi, dan.carpenter@oracle.com, tskd08@gmail.com, ruchandani.tina@gmail.com, arnd@arndb.de, chehabrafael@gmail.com, prabhakar.csengg@gmail.com, Julia.Lawall@lip6.fr, elfring@users.sourceforge.net, ricardo.ribalda@gmail.com, chris.j.arges@canonical.com, pierre-louis.bossart@linux.intel.com, gtmkramer@xs4all.nl, clemens@ladisch.de, misterpib@gmail.com, takamichiho@gmail.com, pmatilai@laiskiainen.org, damien@zamaudio.com, daniel@zonque.org, vladcatoi@gmail.com, normalperson@yhbt.net, joe@oampo.co.uk, bugzilla.frnkcg@spamgourmet.com, jussi@sonarnerd.net Date: Tue, 22 Sep 2015 11:19:27 -0600 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1442942391; bh=ELcZrkSeCU8a0NkUNW+VYcrvp40ziZsQNSDtvYma0zM=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=vkK+qp8B0yB5HBmINogmwC9/375zC/OLMaOsGdrZwd3NNiVV2X0Xv9pIRO0pFl7m7 SV1p0wkYz0tYkpuVO0LPKeVADRfnRnhalU2NqxziaBt6/9b5X8cIPaIzjuOf2s/nwb icwYNqttgK+bHvM/Fjf/Himgdadi1UsTUsACqgTsMRzSNUI+S88A64EWBxk0R/K/en UVub7FIRADMwZ9FOGNgpM4SVeK5vA+JrfLrOmXdZz3VTE5uL5hICxjBhDTZDDFZZxR l3fcTJLyH2Ca8nR+pBYCIHNiFplrmAab/skJnqs4aa0Uup03pYxMb6103XekDSc2Oq aKxIFYxa7Ql/A== X-Mailman-Approved-At: Wed, 23 Sep 2015 16:33:44 +0200 Cc: alsa-devel@alsa-project.org, Shuah Khan , linux-media@vger.kernel.org Subject: [alsa-devel] [PATCH v3 08/21] media: v4l-core add v4l_enable/disable_media_tuner() helper functions X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add a new interfaces to be used by v4l-core to invoke enable source and disable_source handlers in the media_device. The enable_source helper function invokes the enable_source handler to find tuner entity connected to the decoder and check is it is available or busy. If tuner is available, link is activated and pipeline is started. The disable_source helper function invokes the disable_source handler to deactivate and stop the pipeline. Signed-off-by: Shuah Khan --- drivers/media/v4l2-core/v4l2-dev.c | 27 +++++++++++++++++++++++++++ include/media/v4l2-dev.h | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 71a1b93..8e93c99 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -230,6 +230,33 @@ struct video_device *video_devdata(struct file *file) } EXPORT_SYMBOL(video_devdata); +int v4l_enable_media_tuner(struct video_device *vdev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_device *mdev = vdev->entity.parent; + int ret; + + if (!mdev || !mdev->enable_source) + return 0; + ret = mdev->enable_source(&vdev->entity, &vdev->pipe); + if (ret) + return -EBUSY; + return 0; +#endif /* CONFIG_MEDIA_CONTROLLER */ + return 0; +} +EXPORT_SYMBOL_GPL(v4l_enable_media_tuner); + +void v4l_disable_media_tuner(struct video_device *vdev) +{ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_device *mdev = vdev->entity.parent; + + if (mdev && mdev->disable_source) + mdev->disable_source(&vdev->entity); +#endif /* CONFIG_MEDIA_CONTROLLER */ +} +EXPORT_SYMBOL_GPL(v4l_disable_media_tuner); /* Priority handling */ diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index acbcd2f..8f1884f 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -86,6 +86,7 @@ struct video_device { #if defined(CONFIG_MEDIA_CONTROLLER) struct media_entity entity; + struct media_pipeline pipe; #endif /* device ops */ const struct v4l2_file_operations *fops; @@ -178,6 +179,9 @@ struct video_device * __must_check video_device_alloc(void); /* this release function frees the vdev pointer */ void video_device_release(struct video_device *vdev); +int v4l_enable_media_tuner(struct video_device *vdev); +void v4l_disable_media_tuner(struct video_device *vdev); + /* this release function does nothing, use when the video_device is a static global struct. Note that having a static video_device is a dubious construction at best. */