From patchwork Fri Oct 2 22:07:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7319141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C5878BEEA4 for ; Fri, 2 Oct 2015 22:07:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1DD3208AA for ; Fri, 2 Oct 2015 22:07:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7780E208B0 for ; Fri, 2 Oct 2015 22:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751883AbbJBWHm (ORCPT ); Fri, 2 Oct 2015 18:07:42 -0400 Received: from resqmta-po-11v.sys.comcast.net ([96.114.154.170]:49918 "EHLO resqmta-po-11v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbbJBWHl (ORCPT ); Fri, 2 Oct 2015 18:07:41 -0400 Received: from resomta-po-19v.sys.comcast.net ([96.114.154.243]) by resqmta-po-11v.sys.comcast.net with comcast id QN7U1r00M5FMDhs01N7ggC; Fri, 02 Oct 2015 22:07:40 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-19v.sys.comcast.net with comcast id QN7f1r0021LXgTt01N7f4Z; Fri, 02 Oct 2015 22:07:40 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 48DB6A163B; Fri, 2 Oct 2015 16:07:38 -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, dan.carpenter@oracle.com, tskd08@gmail.com, arnd@arndb.de, ruchandani.tina@gmail.com, corbet@lwn.net, k.kozlowski@samsung.com, chehabrafael@gmail.com, prabhakar.csengg@gmail.com, elfring@users.sourceforge.net, Julia.Lawall@lip6.fr, p.zabel@pengutronix.de, ricardo.ribalda@gmail.com, labbott@fedoraproject.org, chris.j.arges@canonical.com, pierre-louis.bossart@linux.intel.com, johan@oljud.se, wsa@the-dreams.de, jcragg@gmail.com, clemens@ladisch.de, daniel@zonque.org, gtmkramer@xs4all.nl, misterpib@gmail.com, takamichiho@gmail.com, pmatilai@laiskiainen.org, vladcatoi@gmail.com, damien@zamaudio.com, normalperson@yhbt.net, joe@oampo.co.uk, jussi@sonarnerd.net, calcprogrammer1@gmail.com Cc: Shuah Khan , linux-media@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH MC Next Gen 07/20] media: v4l-core add v4l_enable/disable_media_tuner() helper functions Date: Fri, 2 Oct 2015 16:07:19 -0600 Message-Id: <92211f7d4ac97e27443dddf5a8d35a278ebce26a.1443822799.git.shuahkh@osg.samsung.com> 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=1443823660; bh=1paIAiRLEnivCXPQIkq2m8wG4IttJe22pLlYD5O2Evo=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=KI2k4+ZNmQ/VecZdyX9tWzWTrwY7TRX/JZGy2uCDkJ2wKuLL73qYlQxC8j2Fbc1YT zL6uwqu1A3FehRMHsawY/L+77hM4pGd2URFbKQB4nWLwBQR2l3YWUfixSYo5vE0lay z58V3oc5QTHQZwmrcM/dNlQM6DovKzJUjFOynr1nzl/aWVQZp0phOeeumXHv7EqRdN YPoY/kGuOTNoHcyCgxLmXLSl79R8Qv58qiE6i8yp6HRJfCBE8M9lstTadoOi2nETPG SEG1U+JlK18Fs2uitBOkqnq+3ZYDG5BWXeoxPGSbGnVO5b4yk92Ss8eHX19BqI3EtX +k1pG/4Rry0rw== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 982255d..159e711 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -233,6 +233,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.graph_obj.mdev; + 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.graph_obj.mdev; + + 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 eeabf20..68999a3 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -87,6 +87,7 @@ struct video_device #if defined(CONFIG_MEDIA_CONTROLLER) struct media_entity entity; struct media_intf_devnode *intf_devnode; + struct media_pipeline pipe; #endif /* device ops */ const struct v4l2_file_operations *fops; @@ -176,6 +177,9 @@ void video_unregister_device(struct video_device *vdev); latter can also be used for video_device->release(). */ struct video_device * __must_check video_device_alloc(void); +int v4l_enable_media_tuner(struct video_device *vdev); +void v4l_disable_media_tuner(struct video_device *vdev); + /* this release function frees the vdev pointer */ void video_device_release(struct video_device *vdev);