From patchwork Sat Feb 22 00:50:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3700831 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 B4748BF13A for ; Sat, 22 Feb 2014 00:56:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EEBB42018B for ; Sat, 22 Feb 2014 00:56:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 272072018A for ; Sat, 22 Feb 2014 00:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753777AbaBVA4y (ORCPT ); Fri, 21 Feb 2014 19:56:54 -0500 Received: from qmta14.emeryville.ca.mail.comcast.net ([76.96.27.212]:38317 "EHLO qmta14.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753798AbaBVA4x (ORCPT ); Fri, 21 Feb 2014 19:56:53 -0500 Received: from omta11.emeryville.ca.mail.comcast.net ([76.96.30.36]) by qmta14.emeryville.ca.mail.comcast.net with comcast id VCe91n0080mlR8UAECqn3P; Sat, 22 Feb 2014 00:50:47 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta11.emeryville.ca.mail.comcast.net with comcast id VCqm1n00f0MU7Qa8XCqnEV; Sat, 22 Feb 2014 00:50:47 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 6615741103; Fri, 21 Feb 2014 17:50:46 -0700 (MST) From: Shuah Khan To: m.chehab@samsung.com Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, shuahkhan@gmail.com Subject: [RFC] [PATCH 4/6] media: em28xx-input - implement em28xx_ops: suspend/resume hooks Date: Fri, 21 Feb 2014 17:50:16 -0700 Message-Id: <5dc00d657718dfefedb35b055abd13997afd6979.1393027856.git.shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1393030247; bh=ubXuWdpItyR/mKYppYyrDloLYXJ2ZAmt5zI3M1avYbE=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=PSD5un6zeHoygkfpMazzuX1c5NHvtzMzs1r8qyQCOG2ukCYpq5u1JGNKeqcg4r4cn ni4iL4mOd3R0X7OlLOg0Gvgk/zsixO53639eev9gEttLZPd7VcFCwTsI7HfXx2we1k MpGqbT+v4Wv8K1e3q1Glss3Dj5qxmN7qA4kwWZK8wY0D2ToLhtBCV6ugpl3aIK6YGl KUlxagh8kBbUcGmK0woVQ0ghOLqROUlkrMyHGl2kgeuJf0Myy6XNpWcsh5Tf3WHs85 PF0igtdXv/RRdA5LfF6TY9R6yzAeP20kU11FTk8x+opxC9P2emAJn4xcVujlGZHxMu eKHL9iAKmocZg== 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.8 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 Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will invoke em28xx_ops: suspend and resume hooks for all its extensions from its suspend() and resume() interfaces. Signed-off-by: Shuah Khan --- drivers/media/usb/em28xx/em28xx-input.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 18f65d8..1227309 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -827,11 +827,46 @@ static int em28xx_ir_fini(struct em28xx *dev) return 0; } +static int em28xx_ir_suspend(struct em28xx *dev) +{ + struct em28xx_IR *ir = dev->ir; + + if (dev->is_audio_only) + return 0; + + em28xx_info("Suspending input extension"); + cancel_delayed_work_sync(&ir->work); + cancel_delayed_work_sync(&dev->buttons_query_work); + /* is canceling delayed work sufficient or does the rc event + kthread needs stopping? kthread is stopped in + ir_raw_event_unregister() */ + return 0; +} + +static int em28xx_ir_resume(struct em28xx *dev) +{ + struct em28xx_IR *ir = dev->ir; + + if (dev->is_audio_only) + return 0; + + em28xx_info("Resuming input extension"); + /* if suspend calls ir_raw_event_unregister(), the should call + ir_raw_event_register() */ + schedule_delayed_work_sync(&ir->work); + if (dev->num_button_polling_addresses) + schedule_delayed_work(&dev->buttons_query_work, + msecs_to_jiffies(dev->button_polling_interval)); + return 0; +} + static struct em28xx_ops rc_ops = { .id = EM28XX_RC, .name = "Em28xx Input Extension", .init = em28xx_ir_init, .fini = em28xx_ir_fini, + .suspend = em28xx_ir_suspend, + .resume = em28xx_ir_resume, }; static int __init em28xx_rc_register(void)