From patchwork Tue Sep 22 17:19:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7241841 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 40588BEEC1 for ; Tue, 22 Sep 2015 17:29:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C6CA209C3 for ; Tue, 22 Sep 2015 17:29:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DFEF209EB for ; Tue, 22 Sep 2015 17:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758789AbbIVR3W (ORCPT ); Tue, 22 Sep 2015 13:29:22 -0400 Received: from resqmta-po-03v.sys.comcast.net ([96.114.154.162]:37762 "EHLO resqmta-po-03v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758766AbbIVR2C (ORCPT ); Tue, 22 Sep 2015 13:28:02 -0400 Received: from resomta-po-06v.sys.comcast.net ([96.114.154.230]) by resqmta-po-03v.sys.comcast.net with comcast id LHKj1r0074yXVJQ01HKqon; Tue, 22 Sep 2015 17:19:50 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-06v.sys.comcast.net with comcast id LHKp1r00E1LXgTt01HKp3o; Tue, 22 Sep 2015 17:19:50 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 77A32A153E; Tue, 22 Sep 2015 11:19:47 -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 04/21] media: Media Controller enable/disable source handler API Date: Tue, 22 Sep 2015 11:19:23 -0600 Message-Id: <2cf8f0b5ea1c63c3897a82d430a993e2af646220.1442937669.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=1442942390; bh=rP5uKegohZRrlx7Mx5mUbvZ0SqB8d5Wj8Wh4BW0wVlU=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=I8sqP4B2HzVTFE/B5y4houo2SSzBszzcU2jEtXoWNkQ702Dqu1xFobrxfOYca1cmN Fn1NDc6Ayq3r8n2CrSv0aEGWiWOcaohM8J511ONJxGB4dVPW2ILXT91Y4ZhTa7tjL6 FRi5kjKTlxiwTJIUGd/UFtBCVU+cmMronlTokENBcLozMNW7rEuiO09i2DhtZN+Tbi omY11ZJIDBzHQRa48K6f+edC6Qn1p7S/SaQ3vKAOO+J9RO9KrQZM6is82PkNyuiHs7 T41Gfj+TKfYwcYkbsj3hnf61qIDPrHAAY9aL2wUyuSumsh11ORcHtyumvK3rzR1Jw1 wxfyMyyqown0A== 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 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/media/media-device.h b/include/media/media-device.h index a3854f6..117c169 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -84,6 +84,24 @@ 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); };