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: 7241871 Return-Path: X-Original-To: patchwork-linux-media@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 AD0029F443 for ; Tue, 22 Sep 2015 17:29:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4CC7209D9 for ; Tue, 22 Sep 2015 17:29:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4458209CF for ; Tue, 22 Sep 2015 17:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758775AbbIVR3T (ORCPT ); Tue, 22 Sep 2015 13:29:19 -0400 Received: from resqmta-po-01v.sys.comcast.net ([96.114.154.160]:56250 "EHLO resqmta-po-01v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758774AbbIVR2C (ORCPT ); Tue, 22 Sep 2015 13:28:02 -0400 Received: from resomta-po-01v.sys.comcast.net ([96.114.154.225]) by resqmta-po-01v.sys.comcast.net with comcast id LHKo1r00C4s37d401HKrZP; 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 Cc: Shuah Khan , linux-media@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v3 08/21] media: v4l-core add v4l_enable/disable_media_tuner() helper functions 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=DsyhDC5IyFN+lMy6y6o3WUaWOSScah24vAzSXAjuYUw+9NrWRMqEZC6tAVjY+vbN8 aM3NIofhEz/jqtapc/xnW552xyFTr7oATAhhDXhj2PHarH+tE7i+hsGjL0WI5AaiJ5 W3AllOqTV4m8F4hYRguPVBUSDkYu2FEDzdq9Bn18422i4WIGb8OG9AYu+JDOJqB7MG RpQCkCMMUErbldLZkb5+alzLWsoi84vEc0D1jA9H/NGuUEQ+RFqtLpxOb6Q6e1OfhD W22pfntDSmwykF37DbdCik++hayVr8szsAknQIVE41LTcni20g1SZe2vh2wMp8JfGJ 8cnRAsRAzGcAw== 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 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. */