From patchwork Thu Mar 10 02:15:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 33422 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84) (envelope-from ) id 1adq94-0003Qw-LR; Thu, 10 Mar 2016 02:16:10 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-7) with esmtp id 1adq92-0008Qj-0E; Thu, 10 Mar 2016 03:16:10 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933055AbcCJCPo (ORCPT + 1 other); Wed, 9 Mar 2016 21:15:44 -0500 Received: from mailout.easymail.ca ([64.68.201.169]:33207 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754346AbcCJCPn (ORCPT ); Wed, 9 Mar 2016 21:15:43 -0500 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 76789E8F0; Wed, 9 Mar 2016 21:15:41 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at mailout.easymail.ca X-Spam-Flag: NO X-Spam-Score: -3.691 X-Spam-Level: X-Spam-Status: No, score=-3.691 required=5 tests=[ALL_TRUSTED=-1.8, AWL=0.016, BAYES_00=-2.599, DNS_FROM_AHBL_RHSBL=0.692] 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 TW3xJunUxqsT; Wed, 9 Mar 2016 21:15:40 -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 C3608E884; Wed, 9 Mar 2016 21:15:40 -0500 (EST) Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 1963F9F14A; Wed, 9 Mar 2016 19:15:40 -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, sw0312.kim@samsung.com, jh1009.sung@samsung.com Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: au0828 disable tuner to demod link in au0828_media_device_register() Date: Wed, 9 Mar 2016 19:15:38 -0700 Message-Id: <1457576138-8728-1-git-send-email-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.5.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.3.10.20615 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __MULTIPLE_RCPTS_TO_X5 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' Disable tuner to demod link in au0828_media_device_register(). This step should be done after dvb graph is created. Signed-off-by: Shuah Khan --- drivers/media/usb/au0828/au0828-core.c | 26 ++++++++++++++++++++++++++ drivers/media/usb/au0828/au0828-video.c | 20 +------------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index 7fc3dba..5dc82e8 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -456,6 +456,7 @@ static int au0828_media_device_register(struct au0828_dev *dev, { #ifdef CONFIG_MEDIA_CONTROLLER int ret; + struct media_entity *entity, *demod = NULL, *tuner = NULL; if (!dev->media_dev) return 0; @@ -479,6 +480,31 @@ static int au0828_media_device_register(struct au0828_dev *dev, */ au0828_media_graph_notify(NULL, (void *) dev); } + + /* + * Find tuner and demod to disable the link between + * the two to avoid disable step when tuner is requested + * by video or audio. Note that this step can't be done + * until dvb graph is created during dvb register. + */ + media_device_for_each_entity(entity, dev->media_dev) { + if (entity->function == MEDIA_ENT_F_DTV_DEMOD) + demod = entity; + else if (entity->function == MEDIA_ENT_F_TUNER) + tuner = entity; + } + /* Disable link between tuner and demod */ + if (tuner && demod) { + struct media_link *link; + + list_for_each_entry(link, &demod->links, list) { + if (link->sink->entity == demod && + link->source->entity == tuner) { + media_entity_setup_link(link, 0); + } + } + } + /* register entity_notify callback */ dev->entity_notify.notify_data = (void *) dev; dev->entity_notify.notify = (void *) au0828_media_graph_notify; diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 5f7c8be..aeaf27e 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -657,7 +657,7 @@ static int au0828_create_media_graph(struct au0828_dev *dev) #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev = dev->media_dev; struct media_entity *entity; - struct media_entity *tuner = NULL, *decoder = NULL, *demod = NULL; + struct media_entity *tuner = NULL, *decoder = NULL; int i, ret; if (!mdev) @@ -671,9 +671,6 @@ static int au0828_create_media_graph(struct au0828_dev *dev) case MEDIA_ENT_F_ATV_DECODER: decoder = entity; break; - case MEDIA_ENT_F_DTV_DEMOD: - demod = entity; - break; } } @@ -729,21 +726,6 @@ static int au0828_create_media_graph(struct au0828_dev *dev) break; } } - - /* - * Disable tuner to demod link to avoid disable step - * when tuner is requested by video or audio - */ - if (tuner && demod) { - struct media_link *link; - - list_for_each_entry(link, &demod->links, list) { - if (link->sink->entity == demod && - link->source->entity == tuner) { - media_entity_setup_link(link, 0); - } - } - } #endif return 0; }