From patchwork Tue Aug 12 03:13:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 4710631 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A342D9F319 for ; Tue, 12 Aug 2014 03:14:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D496C2011B for ; Tue, 12 Aug 2014 03:14:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 019F920115 for ; Tue, 12 Aug 2014 03:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754638AbaHLDOC (ORCPT ); Mon, 11 Aug 2014 23:14:02 -0400 Received: from qmta06.emeryville.ca.mail.comcast.net ([76.96.30.56]:37571 "EHLO qmta06.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753190AbaHLDOA (ORCPT ); Mon, 11 Aug 2014 23:14:00 -0400 Received: from omta01.emeryville.ca.mail.comcast.net ([76.96.30.11]) by qmta06.emeryville.ca.mail.comcast.net with comcast id dfCc1o0010EPchoA6fE0KX; Tue, 12 Aug 2014 03:14:00 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta01.emeryville.ca.mail.comcast.net with comcast id dfDy1o0010MU7Qa8MfDysW; Tue, 12 Aug 2014 03:13:59 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 8E9A840079; Mon, 11 Aug 2014 21:13:57 -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] media: fix au0828 dvb suspend/resume to call dvb_frontend_suspend/resume Date: Mon, 11 Aug 2014 21:13:55 -0600 Message-Id: <1407813235-30435-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=1407813240; bh=uf7gTb+jhdAmyYpVBzOMMDnX3Bh6eWM9k/EIxUNlHiI=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=Nm7Qt8VrvLrpA0YNG63jvJLKrFnu3btcHqKw/rDd8tzB2EcSBHsF24P9LJnxDbbw7 CwOfZSePzIjy5MPUMteal5Mho2x0hcc6bCAYZv2HutK0m3sGJj4UtzyRPk52YbkuRo 1Zr/jMz7dYVhcVhNQUvt+xMxnW9szJNAmoL1V1OX+3HIFAc6oBzLI5na5NUOCwAb/+ +oeYWFFFkADYdYTiX6gP7FK6vY5hji0PJ8eFzuEfoffO5yajAAwCGe6segr1nGdf+5 Usa2SYBNInWVOUYgrI3VCN1sdwsMjaJFgABBg9J8mBcGMUVqiYgc8JYwUjEqNPHNn0 337+ZFqDpToCQ== 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. au0828_dvb_suspend() calls dvb_frontend_suspend() which in turn invokes tuner ops sleep followed by fe ops sleep. au0828_dvb_resume() calls dvb_frontend_resume() which in turn calls fe ops ini follwed by 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 | 37 ++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c index 821f86e..50e7c82 100644 --- a/drivers/media/usb/au0828/au0828-dvb.c +++ b/drivers/media/usb/au0828/au0828-dvb.c @@ -619,35 +619,30 @@ int au0828_dvb_register(struct au0828_dev *dev) void au0828_dvb_suspend(struct au0828_dev *dev) { - struct au0828_dvb *dvb = &dev->dvb; - - if (dvb->frontend && dev->urb_streaming) { - pr_info("stopping DVB\n"); + struct au0828_dvb *dvb; + int rc; - cancel_work_sync(&dev->restart_streaming); + if (dev == NULL) + return; - /* Stop transport */ - mutex_lock(&dvb->lock); - stop_urb_transfer(dev); - au0828_stop_transport(dev, 1); - mutex_unlock(&dvb->lock); - dev->need_urb_start = 1; + dvb = &dev->dvb; + if (dvb->frontend) { + 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; - - if (dvb->frontend && dev->need_urb_start) { - pr_info("resuming DVB\n"); + struct au0828_dvb *dvb; + int rc; - au0828_set_frontend(dvb->frontend); + if (dev == NULL) + return; - /* Start transport */ - mutex_lock(&dvb->lock); - au0828_start_transport(dev); - start_urb_transfer(dev); - mutex_unlock(&dvb->lock); + dvb = &dev->dvb; + if (dvb->frontend) { + rc = dvb_frontend_resume(dvb->frontend); + pr_info("au0828_dvb_resume(): Resuming DVB fe %d\n", rc); } }