From patchwork Tue Sep 22 17:19:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7250431 Return-Path: X-Original-To: patchwork-alsa-devel@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 946729F380 for ; Wed, 23 Sep 2015 14:46:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A23420AC7 for ; Wed, 23 Sep 2015 14:46:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6A72F20ACD for ; Wed, 23 Sep 2015 14:46:44 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9895426668F; Wed, 23 Sep 2015 16:46:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 89847265727; Wed, 23 Sep 2015 16:34:02 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 56664265176; Tue, 22 Sep 2015 19:20:35 +0200 (CEST) Received: from resqmta-po-11v.sys.comcast.net (resqmta-po-11v.sys.comcast.net [96.114.154.170]) by alsa0.perex.cz (Postfix) with ESMTP id 6C3362650C0 for ; Tue, 22 Sep 2015 19:19:58 +0200 (CEST) Received: from resomta-po-09v.sys.comcast.net ([96.114.154.233]) by resqmta-po-11v.sys.comcast.net with comcast id LHKZ1r00A52QWKC01HKype; Tue, 22 Sep 2015 17:19:58 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-09v.sys.comcast.net with comcast id LHKw1r00K1LXgTt01HKwmS; Tue, 22 Sep 2015 17:19:57 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 59474A1633; Tue, 22 Sep 2015 11:19:56 -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 Date: Tue, 22 Sep 2015 11:19:35 -0600 Message-Id: <436ac597ac9a29169e9d5ce0f1bc5206cd5edc39.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=1442942398; bh=/gEKRXlbDv1U+GhZJpyEfxn6tc5g/rgaDna/ILrpKcA=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=dVy/30aKrIIYwRKS7Z4Zn9sVhUb1OFPbcnoYn+wGaWFpiO2+fStrYvitSDVb/Qqw+ cJByJ/Ic0ST8ap1qMF3Lf+LT6CvErdwpzqaA3iJwcCK2J1rQ5sSxTtsClkMKUIh64W lx6FfCHoPqA3v+nO8zK/u8xE41jDXH1HKE4mQhsiCNCZ6TgaZUC4EfMha+EjnFoavS lD3fP9DAv70wWf3CqCEbkRxDuB0c8eZTcTGC8ddKxX+rnphhYAvdXquWdP6xWOpX3U QkvIHRiNId2kNp+d+P0No5zo/TEsafnSG8suvcgZamnWasfQhtp3IWAstGDTyh6gJV p2Eb/7gKK7erQ== X-Mailman-Approved-At: Wed, 23 Sep 2015 16:33:44 +0200 Cc: alsa-devel@alsa-project.org, Shuah Khan , linux-media@vger.kernel.org Subject: [alsa-devel] [PATCH v3 16/21] media: au0828 video change to use v4l_enable_media_tuner() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP au0828 is changed to use v4l_enable_media_tuner() to check for tuner availability from vidioc_g_tuner(), and au0828_v4l2_close(), before changing tuner settings. If tuner isn't free, return busy condition from vidioc_g_tuner() and in au0828_v4l2_close() tuner is left untouched without powering down to save energy. Signed-off-by: Shuah Khan --- drivers/media/usb/au0828/au0828-video.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index b63ae78..6680aeb 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -1005,8 +1005,12 @@ static int au0828_v4l2_close(struct file *filp) goto end; if (dev->users == 1) { - /* Save some power by putting tuner to sleep */ - v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0); + /* Save some power by putting tuner to sleep, if it is free */ + /* What happens when radio is using tuner?? */ + ret = v4l_enable_media_tuner(vdev); + if (ret == 0) + v4l2_device_call_all(&dev->v4l2_dev, 0, core, + s_power, 0); dev->std_set_in_tuner_core = 0; /* When close the device, set the usb intf0 into alt0 to free @@ -1407,10 +1411,16 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) { struct au0828_dev *dev = video_drvdata(file); + struct video_device *vfd = video_devdata(file); + int ret; if (t->index != 0) return -EINVAL; + ret = v4l_enable_media_tuner(vfd); + if (ret) + return ret; + dprintk(1, "%s called std_set %d dev_state %d\n", __func__, dev->std_set_in_tuner_core, dev->dev_state);