From patchwork Fri Oct 2 22:07:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 7319231 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 B5986BF90C for ; Fri, 2 Oct 2015 22:08:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3DCC208B1 for ; Fri, 2 Oct 2015 22:08:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0519208AB for ; Fri, 2 Oct 2015 22:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751975AbbJBWH6 (ORCPT ); Fri, 2 Oct 2015 18:07:58 -0400 Received: from resqmta-po-08v.sys.comcast.net ([96.114.154.167]:47707 "EHLO resqmta-po-08v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751914AbbJBWHo (ORCPT ); Fri, 2 Oct 2015 18:07:44 -0400 Received: from resomta-po-05v.sys.comcast.net ([96.114.154.229]) by resqmta-po-08v.sys.comcast.net with comcast id QN7W1r0064xDoy801N7k61; Fri, 02 Oct 2015 22:07:44 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-05v.sys.comcast.net with comcast id QN7f1r0081LXgTt01N7jG1; Fri, 02 Oct 2015 22:07:44 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 15B81A151E; Fri, 2 Oct 2015 16:07:43 -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 15/20] media: au0828 video change to use v4l_enable_media_tuner() Date: Fri, 2 Oct 2015 16:07:27 -0600 Message-Id: <2c8b4a96ea5e03f4f9166da23ebc78dbef0813b5.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=1443823664; bh=JG667HVHKXxQgd7hPmzFhnWmSanHwiGPhBSC9FN+tLw=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=CiARM+nB0mAASmgqGuuCA0egSB69GG1ubSVysEM1fF/4pG9ekJvXMqSTXdNguT7BC 0eBAVvjvAZNwdC6EFLNxqMdRb4HlGVk0kl+6ciCp3Kszk2DrLiquoSf7L4a0t7lQi1 wwPrKY2UeP/SC+IBNMiEN1bMQeX2xOKN+MZ4eUlV7M6/E6+44JWOBIflE7dQHsFnNM Uv7+R7hugGM4jL00Pzlqn1c4Ed0GyXkDhE+gfdNLdJlidPhpudlBee03iexHO21zBc V4CO+L8ajB0L0DvIPKQwjo0QMo8M6a5M2BdQYlMr6IPlZ1UdaEwWbpFxBnWHuUvDL6 Bbi8ZgpHOBMag== 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 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 062730d..6581f79 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -1004,8 +1004,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 @@ -1406,10 +1410,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);