From patchwork Fri Aug 8 10:43:47 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: 4695311 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 76E3BC0338 for ; Fri, 8 Aug 2014 10:44:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2A952016C for ; Fri, 8 Aug 2014 10:44:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D79282010C for ; Fri, 8 Aug 2014 10:44:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756296AbaHHKn7 (ORCPT ); Fri, 8 Aug 2014 06:43:59 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:49766 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756130AbaHHKnz (ORCPT ); Fri, 8 Aug 2014 06:43:55 -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 1XFheL-0002o7-L1; Fri, 08 Aug 2014 10:43:53 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.80.1) (envelope-from ) id 1XFheG-0000Pp-Bx; Fri, 08 Aug 2014 07:43:48 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH 3/3] au0828: don't let the IR polling thread to run at suspend Date: Fri, 8 Aug 2014 07:43:47 -0300 Message-Id: <1407494627-1555-3-git-send-email-m.chehab@samsung.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407494627-1555-1-git-send-email-m.chehab@samsung.com> References: <1407494627-1555-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 Trying to make au0828 to suspend can do very bad things, as the polling Kthread is not handled. We should disable it during suspend, only re-enabling it at resume. Still, analog and digital TV won't work, as we don't reinit the settings at resume, but at least it won't hang. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/au0828/au0828-core.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index 56025e689442..eb5f2b1b182b 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -285,13 +285,41 @@ static int au0828_usb_probe(struct usb_interface *interface, return retval; } +static int au0828_suspend(struct usb_interface *interface, + pm_message_t message) +{ + struct au0828_dev *dev = usb_get_intfdata(interface); + + if (!dev) + return 0; + + au0828_rc_suspend(dev); + + /* FIXME: should suspend also ATV/DTV */ + + return 0; +} + +static int au0828_resume(struct usb_interface *interface) +{ + struct au0828_dev *dev = usb_get_intfdata(interface); + if (!dev) + return 0; + + au0828_rc_resume(dev); + + /* FIXME: should resume also ATV/DTV */ + + return 0; +} + static struct usb_driver au0828_usb_driver = { .name = DRIVER_NAME, .probe = au0828_usb_probe, .disconnect = au0828_usb_disconnect, .id_table = au0828_usb_id_table, - - /* FIXME: Add suspend and resume functions */ + .suspend = au0828_suspend, + .resume = au0828_resume, }; static int __init au0828_init(void)