From patchwork Sat Feb 22 00:50:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3700811 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 7BB759F382 for ; Sat, 22 Feb 2014 00:56:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2D1C2018B for ; Sat, 22 Feb 2014 00:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C09BC2018A for ; Sat, 22 Feb 2014 00:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753696AbaBVA4u (ORCPT ); Fri, 21 Feb 2014 19:56:50 -0500 Received: from qmta05.emeryville.ca.mail.comcast.net ([76.96.30.48]:48892 "EHLO qmta05.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753185AbaBVA4u (ORCPT ); Fri, 21 Feb 2014 19:56:50 -0500 Received: from omta03.emeryville.ca.mail.comcast.net ([76.96.30.27]) by qmta05.emeryville.ca.mail.comcast.net with comcast id VBqm1n0020b6N64A5CqloM; Sat, 22 Feb 2014 00:50:45 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta03.emeryville.ca.mail.comcast.net with comcast id VCqk1n00C0MU7Qa8PCqkBG; Sat, 22 Feb 2014 00:50:45 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 15C0C40437; Fri, 21 Feb 2014 17:50:44 -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 2/6] media: em28xx-audio - implement em28xx_ops: suspend/resume hooks Date: Fri, 21 Feb 2014 17:50:14 -0700 Message-Id: <38a429856e5ef8a93a4e2b29066f3f36cceeec8a.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=1393030245; bh=c1yTS5GVP1IO9T6x75FA4QMSmjJHUlLm8ZkCKcUtZ1Y=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=kOFov0Y4FWtKUBXzCjQ1XMY7tkWrVXAAd17xIGkBdTowSZb8Y+yfTIZ9vRDHX28eW aKN3q/863SijjtNBV7MPXhbX2+r+fUaE+hSJ4Kh26pm3wc++8sTg72rt14RnfXfe04 UKEmGkMJBktaETsZxQxlIghaDPTCI+bTCiI2X8TziHopb2wht7x0gFzv0UG/65YRLB UOS8BFgSz1gGk+LaC6Vjw/wv/LwDVK/7d8fNoKTU8p0iRp+1BwqbM5llv7wJ6KH5YE rTMq2GXdckqCCdYyyPEONGncEKxgGmLya0VCxfrqorI2Xc/payUuifX3r36HL7BCiS cTZqKYipGBEYw== 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=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 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-audio.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 05e9bd1..a4d159d 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -989,11 +989,41 @@ static int em28xx_audio_fini(struct em28xx *dev) return 0; } +static int em28xx_audio_suspend(struct em28xx *dev) +{ + if (dev == NULL) + return 0; + + if (!dev->has_alsa_audio) + return 0; + + em28xx_info("Suspending audio extension"); + em28xx_deinit_isoc_audio(dev); + atomic_set(&dev->stream_started, 0); + return 0; +} + +static int em28xx_audio_resume(struct em28xx *dev) +{ + if (dev == NULL) + return 0; + + if (!dev->has_alsa_audio) + return 0; + + em28xx_info("Resuming audio extension"); + /* Nothing to do other than schedule_work() ?? */ + schedule_work(&dev->wq_trigger); + return 0; +} + static struct em28xx_ops audio_ops = { .id = EM28XX_AUDIO, .name = "Em28xx Audio Extension", .init = em28xx_audio_init, .fini = em28xx_audio_fini, + .suspend = em28xx_audio_suspend, + .resume = em28xx_audio_resume, }; static int __init em28xx_alsa_register(void)