From patchwork Wed Jul 22 22:42:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 6847651 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 6FAA09F1D4 for ; Wed, 22 Jul 2015 22:43:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C7B5200F2 for ; Wed, 22 Jul 2015 22:43:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE76420465 for ; Wed, 22 Jul 2015 22:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753236AbbGVWnR (ORCPT ); Wed, 22 Jul 2015 18:43:17 -0400 Received: from resqmta-po-06v.sys.comcast.net ([96.114.154.165]:57501 "EHLO resqmta-po-06v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752873AbbGVWm5 (ORCPT ); Wed, 22 Jul 2015 18:42:57 -0400 Received: from resomta-po-08v.sys.comcast.net ([96.114.154.232]) by resqmta-po-06v.sys.comcast.net with comcast id vaiu1q005516pyw01aix42; Wed, 22 Jul 2015 22:42:57 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-08v.sys.comcast.net with comcast id vait1q0041LXgTt01aiv9F; Wed, 22 Jul 2015 22:42:57 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 499BF120449; Wed, 22 Jul 2015 16:42:55 -0600 (MDT) From: Shuah Khan To: mchehab@osg.samsung.com, hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, tiwai@suse.de, sakari.ailus@linux.intel.com, perex@perex.cz, crope@iki.fi, arnd@arndb.de, stefanr@s5r6.in-berlin.de, ruchandani.tina@gmail.com, chehabrafael@gmail.com, dan.carpenter@oracle.com, prabhakar.csengg@gmail.com, chris.j.arges@canonical.com, agoode@google.com, pierre-louis.bossart@linux.intel.com, gtmkramer@xs4all.nl, clemens@ladisch.de, daniel@zonque.org, vladcatoi@gmail.com, misterpib@gmail.com, damien@zamaudio.com, pmatilai@laiskiainen.org, takamichiho@gmail.com, normalperson@yhbt.net, bugzilla.frnkcg@spamgourmet.com, joe@oampo.co.uk, calcprogrammer1@gmail.com, jussi@sonarnerd.net, kyungmin.park@samsung.com, s.nawrocki@samsung.com, kgene@kernel.org, hyun.kwon@xilinx.com, michal.simek@xilinx.com, soren.brinkmann@xilinx.com, pawel@osciak.com, m.szyprowski@samsung.com, gregkh@linuxfoundation.org, skd08@gmail.com, nsekhar@ti.com, boris.brezillon@free-electrons.com, Julia.Lawall@lip6.fr, elfring@users.sourceforge.net, p.zabel@pengutronix.de, ricardo.ribalda@gmail.com Cc: Shuah Khan , linux-media@vger.kernel.org, alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org Subject: [PATCH v2 15/19] media: v4l-core add v4l_enable_media_tuner() to check for tuner availability Date: Wed, 22 Jul 2015 16:42:16 -0600 Message-Id: <1647341b774540fd9afbc7bb58e1a76510893ad4.1437599281.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=1437604977; bh=8kLMsxHKkY86Hi1okMD1sYjx1YrfTCnOTK0E+nfPD9Q=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=RHWahJzis39x2dlvhw1rsHj9lsLObBG3lar4zjXZqFZAdddFumMuBTGctwxt/8sBu P0ph5JhqBjO/eLfa04k9hzzNByUdkfAolMjnmusgobVi4WOY/sLMYXwdYOJchES2iy Vs1EHSj04rIz7hpNfIFKXL5pQty8y/AnMEv86EwVh8MYdfh5nvmf2DYanj0bWzUqjY u95qb1cUca4/1dSC9QmyxH8j5XFW8fnVT2PNTOt9Q7jNR8ncLjh2ltCqn/JRLEHfkC sbkuYDI/nvEwAxcAgxy9zDzQ4tu/DfPrFFOGUghdfjMZN7DH9w3ifcwJvgb8xvgqh+ 3GFeA6Ic07Rvg== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.0 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 interface to be used by v4l-core to invoke enable_source handler in the media_device to find tuner entity connected to the decoder and check is it is available. enable_source handler will activate the link if tuner is available. Signed-off-by: Shuah Khan --- drivers/media/v4l2-core/v4l2-dev.c | 17 +++++++++++++++++ include/media/v4l2-dev.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 71a1b93..00fc71d 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -230,6 +230,23 @@ 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->decoder->parent; + int ret; + + /* decoder */ + if (!mdev || !mdev->enable_source) + return 0; + ret = mdev->enable_source(vdev->decoder); + if (ret) + return -EBUSY; + return 0; +#endif /* CONFIG_MEDIA_CONTROLLER */ + return 0; +} +EXPORT_SYMBOL_GPL(v4l_enable_media_tuner); /* Priority handling */ diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index acbcd2f..eff3852 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_entity *decoder; #endif /* device ops */ const struct v4l2_file_operations *fops; @@ -178,6 +179,8 @@ 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); + /* 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. */