From patchwork Sun Aug 10 00:47:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 4703781 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 3B49DC033A for ; Sun, 10 Aug 2014 00:48:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64E1720149 for ; Sun, 10 Aug 2014 00:48:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D01720155 for ; Sun, 10 Aug 2014 00:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751931AbaHJArt (ORCPT ); Sat, 9 Aug 2014 20:47:49 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:55299 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575AbaHJArh (ORCPT ); Sat, 9 Aug 2014 20:47:37 -0400 Received: from [187.57.189.12] (helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1XGHIL-0002yD-P8; Sun, 10 Aug 2014 00:47:34 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.80.1) (envelope-from ) id 1XGHIE-00039n-8j; Sat, 09 Aug 2014 21:47:26 -0300 From: Mauro Carvalho Chehab Cc: Shuah Khan , Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH v2 07/18] [media] au0828: Add suspend code for DVB Date: Sat, 9 Aug 2014 21:47:13 -0300 Message-Id: <1407631644-11990-8-git-send-email-m.chehab@samsung.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407631644-11990-1-git-send-email-m.chehab@samsung.com> References: <1407631644-11990-1-git-send-email-m.chehab@samsung.com> To: unlisted-recipients:; (no To-header on input) 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 The scheduled work should be cancelled during suspend. At resume time, we need to set the frontend again. So, add such logic to the driver. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/au0828/au0828-core.c | 2 ++ drivers/media/usb/au0828/au0828-dvb.c | 31 ++++++++++++++++++++++++++++++- drivers/media/usb/au0828/au0828.h | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) mode change 100644 => 100755 drivers/media/usb/au0828/au0828-dvb.c diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index 87340a8af7d7..26ec50539dc4 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -290,6 +290,7 @@ static int au0828_suspend(struct usb_interface *interface, return 0; au0828_rc_suspend(dev); + au0828_dvb_suspend(dev); /* FIXME: should suspend also ATV/DTV */ @@ -309,6 +310,7 @@ static int au0828_resume(struct usb_interface *interface) au0828_gpio_setup(dev); au0828_rc_resume(dev); + au0828_dvb_resume(dev); /* FIXME: should resume also ATV/DTV */ diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c old mode 100644 new mode 100755 index d8b5d9480279..7b6e71065aa4 --- a/drivers/media/usb/au0828/au0828-dvb.c +++ b/drivers/media/usb/au0828/au0828-dvb.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -618,3 +617,33 @@ int au0828_dvb_register(struct au0828_dev *dev) return 0; } + +void au0828_dvb_suspend(struct au0828_dev *dev) +{ + struct au0828_dvb *dvb = &dev->dvb; + + if (dvb && 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); + } +} + +void au0828_dvb_resume(struct au0828_dev *dev) +{ + struct au0828_dvb *dvb = &dev->dvb; + + if (dvb && dev->urb_streaming) { + au0828_set_frontend(dvb->frontend); + + /* Start transport */ + mutex_lock(&dvb->lock); + au0828_start_transport(dev); + start_urb_transfer(dev); + mutex_unlock(&dvb->lock); + } +} diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h index fd0916e20323..d32234353096 100644 --- a/drivers/media/usb/au0828/au0828.h +++ b/drivers/media/usb/au0828/au0828.h @@ -316,6 +316,8 @@ void au0828_analog_unregister(struct au0828_dev *dev); /* au0828-dvb.c */ extern int au0828_dvb_register(struct au0828_dev *dev); extern void au0828_dvb_unregister(struct au0828_dev *dev); +void au0828_dvb_suspend(struct au0828_dev *dev); +void au0828_dvb_resume(struct au0828_dev *dev); /* au0828-vbi.c */ extern struct videobuf_queue_ops au0828_vbi_qops;