From patchwork Fri Oct 2 22:07:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7320111 Return-Path: X-Original-To: patchwork-alsa-devel@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 0DDBFBEEA4 for ; Sat, 3 Oct 2015 07:24:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 283EC20859 for ; Sat, 3 Oct 2015 07:24:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id F3F5720851 for ; Sat, 3 Oct 2015 07:24:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1618A266B1A; Sat, 3 Oct 2015 09:24:35 +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 5A136261A2C; Sat, 3 Oct 2015 09:23:05 +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 53BF32669C7; Sat, 3 Oct 2015 00:07:51 +0200 (CEST) Received: from resqmta-po-09v.sys.comcast.net (resqmta-po-09v.sys.comcast.net [96.114.154.168]) by alsa0.perex.cz (Postfix) with ESMTP id BD562266997 for ; Sat, 3 Oct 2015 00:07:39 +0200 (CEST) Received: from resomta-po-12v.sys.comcast.net ([96.114.154.236]) by resqmta-po-09v.sys.comcast.net with comcast id QN7U1r00656HXL001N7eJ8; Fri, 02 Oct 2015 22:07:38 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-12v.sys.comcast.net with comcast id QN7d1r0031LXgTt01N7diy; Fri, 02 Oct 2015 22:07:38 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 192AEA154E; Fri, 2 Oct 2015 16:07:36 -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 Date: Fri, 2 Oct 2015 16:07:15 -0600 Message-Id: <7138deae9f47108f44577c3ba9479774c2eda79b.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=1443823658; bh=vyLIshhQSlAs5esFqJNr5dAk7QTNRjSlpySi/3Ewrvo=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=lmSoEWZgGUAYSaOZ4om7GsRs5rTjiLJTYOXDsLWodmvhCs2jT9AELf+77V4RuFtjP AKBDTKODP2LmBgF9IVqlBf85d9Xch8QQ5RCOOg93rCW+LX4RHzVSS+umxdkGGa6MRn RqkY/zjviu6p1sYl8jelmf+Vsh5T8FF1VO9/act65OcFICfQ95uKGt5q1aE+Or85Hn LyU+JH3JfJHAkvhNhRgkFG0g0hdm9PxrSneWTbgwHSPFVhmLKpQbMJXEXKyuCPXeeX 7oNWHBQXfvXCu5EttUrj0Cv0BKrCPSKAp9QXYb0Y2s1JIS24PVH7MejIZ8TQ9q3afR Gl4ihhy/+5jhQ== X-Mailman-Approved-At: Sat, 03 Oct 2015 09:23:02 +0200 Cc: alsa-devel@alsa-project.org, Shuah Khan , linux-media@vger.kernel.org Subject: [alsa-devel] [PATCH MC Next Gen 03/20] media: Media Controller enable/disable source handler API 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 new fields to struct media_device to add enable_source, and disable_source handlers, and source_priv to stash driver private data that is need to run these handlers. The enable_source handler finds source entity for the passed in entity and check if it is available, and activate the link using __media_entity_setup_link() interface. Bridge driver is expected to implement and set these handlers and private data when media_device is registered or when bridge driver finds the media_device during probe. This is to enable the use-case to find tuner entity connected to the decoder entity and check if it is available, and activate it and start pipeline between the source and the entity. The disable_source handler deactivates the link and stops the pipeline. This handler can be invoked from the media core (v4l-core, dvb-core) as well as other drivers such as ALSA that control the media device. Signed-off-by: Shuah Khan --- include/media/media-device.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/media/media-device.h b/include/media/media-device.h index bc53f4f..9a53b19 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -101,6 +101,25 @@ struct media_device { /* Serializes graph operations. */ struct mutex graph_mutex; + /* Handlers to find source entity for the sink entity and + * check if it is available, and activate the link using + * media_entity_setup_link() interface and start pipeline + * from the source to the entity. + * Bridge driver is expected to implement and set the + * handler when media_device is registered or when + * bridge driver finds the media_device during probe. + * Bridge driver sets source_priv with information + * necessary to run enable/disable source handlers. + * + * Use-case: find tuner entity connected to the decoder + * entity and check if it is available, and activate the + * using media_entity_setup_link() if it is available. + */ + void *source_priv; + int (*enable_source)(struct media_entity *entity, + struct media_pipeline *pipe); + void (*disable_source)(struct media_entity *entity); + int (*link_notify)(struct media_link *link, u32 flags, unsigned int notification); };