From patchwork Thu Mar 10 05:07:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 8554001 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 DBA869F2B4 for ; Thu, 10 Mar 2016 05:08:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 030B0200E1 for ; Thu, 10 Mar 2016 05:08:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E417C202EB for ; Thu, 10 Mar 2016 05:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935127AbcCJFIS (ORCPT ); Thu, 10 Mar 2016 00:08:18 -0500 Received: from mailout.easymail.ca ([64.68.201.169]:33736 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbcCJFHP (ORCPT ); Thu, 10 Mar 2016 00:07:15 -0500 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id B255CE955; Thu, 10 Mar 2016 00:07:14 -0500 (EST) X-Quarantine-ID: X-Virus-Scanned: Debian amavisd-new at mailout.easymail.ca X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Score: -3.691 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (easymail-mailout.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dcJ54PCZEyZ3; Thu, 10 Mar 2016 00:07:14 -0500 (EST) Received: from mail.gonehiking.org (c-73-181-52-62.hsd1.co.comcast.net [73.181.52.62]) by mailout.easymail.ca (Postfix) with ESMTPA id 50061E936; Thu, 10 Mar 2016 00:07:14 -0500 (EST) Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id E01B79F373; Wed, 9 Mar 2016 22:07:13 -0700 (MST) From: Shuah Khan To: mchehab@osg.samsung.com, hans.verkuil@cisco.com, chehabrafael@gmail.com, javier@osg.samsung.com, inki.dae@samsung.com, jh1009.sung@samsung.com, sakari.ailus@linux.intel.com Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] media: add change_source handler function pointer Date: Wed, 9 Mar 2016 22:07:07 -0700 Message-Id: <779a882295f11b1a7ab1ac4851f467f2d1b3470d.1457585839.git.shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add change_source handler function pointer to struct media_device. Using the change_source handler, driver can disable current source and enable new one in one step when user selects a new input. Signed-off-by: Shuah Khan --- include/media/media-device.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/media/media-device.h b/include/media/media-device.h index df74cfa..d9867ed 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -309,9 +309,11 @@ struct media_entity_notify { * @pm_count_walk: Graph walk for power state walk. Access serialised using * graph_mutex. * - * @source_priv: Driver Private data for enable/disable source handlers + * @source_priv: Driver Private data for enable/disable/change source + * handlers * @enable_source: Enable Source Handler function pointer * @disable_source: Disable Source Handler function pointer + * @change_source: Change Source Handler function pointer * * @link_notify: Link state change notification callback * @@ -326,14 +328,22 @@ struct media_entity_notify { * be unique. * * @enable_source is a handler to find source entity for the - * sink entity and activate the link between them if source + * sink entity and activate the link between them if source * entity is free. Drivers should call this handler before * accessing the source. * * @disable_source is a handler to find source entity for the - * sink entity and deactivate the link between them. Drivers + * sink entity and deactivate the link between them. Drivers * should call this handler to release the source. * + * @change_source is a handler to find source entity for the + * sink entity and deactivate the link between them. Once the + * existing link is deactivated, it will find and activate the + * source for the sink for the newly selected input. Drivers + * should call this handler to change the source when user + * changes input. Using change_source helps not loose the hold + * on the media resource when a new input is selected. + * * Note: 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. @@ -381,6 +391,8 @@ struct media_device { int (*enable_source)(struct media_entity *entity, struct media_pipeline *pipe); void (*disable_source)(struct media_entity *entity); + int (*change_source)(struct media_entity *entity, + struct media_pipeline *pipe); int (*link_notify)(struct media_link *link, u32 flags, unsigned int notification);