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: 7319301 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 2B6B7BEEA4 for ; Fri, 2 Oct 2015 22:08:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47AC7208AE for ; Fri, 2 Oct 2015 22:08:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4DCAC208AA for ; Fri, 2 Oct 2015 22:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751936AbbJBWIh (ORCPT ); Fri, 2 Oct 2015 18:08:37 -0400 Received: from resqmta-po-02v.sys.comcast.net ([96.114.154.161]:40485 "EHLO resqmta-po-02v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbbJBWHj (ORCPT ); Fri, 2 Oct 2015 18:07:39 -0400 Received: from resomta-po-12v.sys.comcast.net ([96.114.154.236]) by resqmta-po-02v.sys.comcast.net with comcast id QN7N1r00656HXL001N7ePb; 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 Cc: Shuah Khan , linux-media@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH MC Next Gen 03/20] media: Media Controller enable/disable source handler API 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=NoeJ78l9nWprdaTYXP9it70DEaKJLAfEY4A/78LU9D598KtAd9KXa+l5VnykP69tv o6VrVb+fvmGwy7lCtQnzlrEvNnnCkwFDsgGrmTTSNasBMga8/wTRZ1pb+cYL6WyZRE VqY7x0vUQ3c3ki5FWmv011rFv8mzsrzYSacdOu2x4qyzau+qQQBwV90UFGvtYedw52 SM/NhsF/i4rCWk/GSxtidfK6wzSFMEDKAyugFDONrrT3N33S6Ecg/WC+uOu5WK3TQy WTgAsOf1INvAuDspTdpaGWHSfcc0F14e5ZfT7P4h2f8304Oer3n/Wp6LnoWzACgXFQ XNJ5uFW8VIZpQ== 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 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); };