From patchwork Fri Feb 19 00:28:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 8355151 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 63C07C0553 for ; Fri, 19 Feb 2016 00:29:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87BFC203F1 for ; Fri, 19 Feb 2016 00:29:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9186B203EC for ; Fri, 19 Feb 2016 00:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1947424AbcBSA2x (ORCPT ); Thu, 18 Feb 2016 19:28:53 -0500 Received: from mailout.easymail.ca ([64.68.201.169]:51421 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425298AbcBSA2w (ORCPT ); Thu, 18 Feb 2016 19:28:52 -0500 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 1E206E7D1; Thu, 18 Feb 2016 19:28:51 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at mailout.easymail.ca X-Spam-Score: -3.688 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 030+oHO2sWmj; Thu, 18 Feb 2016 19:28:50 -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 A7B7BE7B5; Thu, 18 Feb 2016 19:28:50 -0500 (EST) Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id C13C19F3C2; Thu, 18 Feb 2016 17:28:49 -0700 (MST) From: Shuah Khan To: mchehab@osg.samsung.com, hans.verkuil@cisco.com, inki.dae@samsung.com, sw0312.kim@samsung.com, jh1009.sung@samsung.com, chehabrafael@gmail.com, prabhakar.csengg@gmail.com Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: au0828 enable the right media source when input changes Date: Thu, 18 Feb 2016 17:28:48 -0700 Message-Id: <1455841728-7062-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-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change vidioc_s_input() to enable the media source for the newly selected input. v4l2-core enables source before calling au0828's vidioc_s_input() handler. Hence, when input selection changes, media source for the newly selected input needs to be enabled. Signed-off-by: Shuah Khan --- drivers/media/usb/au0828/au0828-video.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 20696a4..678074d 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -1381,6 +1381,7 @@ static void au0828_s_input(struct au0828_dev *dev, int index) static int vidioc_s_input(struct file *file, void *priv, unsigned int index) { struct au0828_dev *dev = video_drvdata(file); + struct video_device *vfd = video_devdata(file); dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __func__, index); @@ -1393,7 +1394,14 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) return 0; au0828_s_input(dev, index); - return 0; + + /* + * Input has been changed. Disable the media source + * associated with the old input and enable source + * for the newly set input + */ + v4l_disable_media_source(vfd); + return v4l_enable_media_source(vfd); } static int vidioc_enumaudio(struct file *file, void *priv, struct v4l2_audio *a)