From patchwork Wed Aug 13 18:52:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 4720431 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37D18C0338 for ; Wed, 13 Aug 2014 18:53:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67CA9201BF for ; Wed, 13 Aug 2014 18:53:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83A7B200E5 for ; Wed, 13 Aug 2014 18:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752001AbaHMSwp (ORCPT ); Wed, 13 Aug 2014 14:52:45 -0400 Received: from qmta01.emeryville.ca.mail.comcast.net ([76.96.30.16]:36156 "EHLO qmta01.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbaHMSwp (ORCPT ); Wed, 13 Aug 2014 14:52:45 -0400 Received: from omta08.emeryville.ca.mail.comcast.net ([76.96.30.12]) by qmta01.emeryville.ca.mail.comcast.net with comcast id eJbf1o0020FhH24A1Jskzg; Wed, 13 Aug 2014 18:52:44 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta08.emeryville.ca.mail.comcast.net with comcast id eJsi1o00M0MU7Qa8UJsixD; Wed, 13 Aug 2014 18:52:43 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id BBEA041121; Wed, 13 Aug 2014 12:52:41 -0600 (MDT) From: Shuah Khan To: m.chehab@samsung.com, ttmesterr@gmail.com, dheitmueller@kernellabs.com, cb.xiong@samsung.com, yongjun_wei@trendmicro.com.cn Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] media: fix au0828 dvb suspend/resume to call dvb_frontend_suspend/resume Date: Wed, 13 Aug 2014 12:52:39 -0600 Message-Id: <1407955959-7901-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.9.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1407955964; bh=aGkxclkQxGMLD1EC26R6qBz4u8bf+Ed3PZYAzLDpt6s=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=bP8yluEbJBtumIJUjNRcZBvX6bUXZKobDcSIVfFgNBtqzq3ia8vwtyQHQGq0rjyQN 9gFQrvObKC551gz6NOlA93c1ITautp6nPZM7KbJ22wsJVozyMnC9nXz5whm04EVn2p UhmQnxJMXx7egCKj/z189V6emFmV16bPAsCwhqAF92HXi6U7STESv2LCcjamoZcVGr 7Q63kD34UZlx9NZAJE6fV4hlSkp2scBOlILZe1F31qJWjmUGjStCF28RFaYni1+Nv1 nefm6ci484aLnSM2hLDNsr8FdzASwbhpjZG3i5Pl4eOUbrTs3aUIebV01ipagHzeH1 wVa3xcAvvz2cg== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 doesn't resume correctly and TV tuning fails with xc_set_signal_source(0) failed message. Change au0828 dvb suspend and resume interfaces to suspend and resume frontend during suspend and resume respectively. dvb_frontend_suspend() suspends tuner and fe using tuner and fe ops. dvb_frontend_resume() resumes fe and tuner using fe and tuner ops ini before waking up the frontend. With this change HVR950Q suspend and resume work when system gets suspended when digital function is tuned to a channel and with active TV stream, and after resume it went right back to active TV stream. Signed-off-by: Shuah Khan --- drivers/media/usb/au0828/au0828-dvb.c | 47 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c index 821f86e..4bd9d68 100644 --- a/drivers/media/usb/au0828/au0828-dvb.c +++ b/drivers/media/usb/au0828/au0828-dvb.c @@ -620,34 +620,39 @@ int au0828_dvb_register(struct au0828_dev *dev) void au0828_dvb_suspend(struct au0828_dev *dev) { struct au0828_dvb *dvb = &dev->dvb; + int rc; - if (dvb->frontend && dev->urb_streaming) { - pr_info("stopping DVB\n"); - - cancel_work_sync(&dev->restart_streaming); - - /* Stop transport */ - mutex_lock(&dvb->lock); - stop_urb_transfer(dev); - au0828_stop_transport(dev, 1); - mutex_unlock(&dvb->lock); - dev->need_urb_start = 1; + if (dvb->frontend) { + if (dev->urb_streaming) { + cancel_work_sync(&dev->restart_streaming); + /* Stop transport */ + mutex_lock(&dvb->lock); + stop_urb_transfer(dev); + au0828_stop_transport(dev, 1); + mutex_unlock(&dvb->lock); + dev->need_urb_start = 1; + } + /* suspend frontend - does tuner and fe to sleep */ + rc = dvb_frontend_suspend(dvb->frontend); + pr_info("au0828_dvb_suspend(): Suspending DVB fe %d\n", rc); } } void au0828_dvb_resume(struct au0828_dev *dev) { struct au0828_dvb *dvb = &dev->dvb; + int rc; - if (dvb->frontend && dev->need_urb_start) { - pr_info("resuming DVB\n"); - - au0828_set_frontend(dvb->frontend); - - /* Start transport */ - mutex_lock(&dvb->lock); - au0828_start_transport(dev); - start_urb_transfer(dev); - mutex_unlock(&dvb->lock); + if (dvb->frontend) { + /* resume frontend - does fe and tuner init */ + rc = dvb_frontend_resume(dvb->frontend); + pr_info("au0828_dvb_resume(): Resuming DVB fe %d\n", rc); + if (dev->need_urb_start) { + /* Start transport */ + mutex_lock(&dvb->lock); + au0828_start_transport(dev); + start_urb_transfer(dev); + mutex_unlock(&dvb->lock); + } } }