From patchwork Sat Feb 22 00:50:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3700821 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 775A9BF13A for ; Sat, 22 Feb 2014 00:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CC182018B for ; Sat, 22 Feb 2014 00:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBDDA2018A for ; Sat, 22 Feb 2014 00:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754076AbaBVA4x (ORCPT ); Fri, 21 Feb 2014 19:56:53 -0500 Received: from qmta15.emeryville.ca.mail.comcast.net ([76.96.27.228]:58439 "EHLO qmta15.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753732AbaBVA4w (ORCPT ); Fri, 21 Feb 2014 19:56:52 -0500 X-Greylist: delayed 365 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Feb 2014 19:56:52 EST Received: from omta23.emeryville.ca.mail.comcast.net ([76.96.30.90]) by qmta15.emeryville.ca.mail.comcast.net with comcast id VCSi1n0041wfjNsAFCqaFT; Sat, 22 Feb 2014 00:50:34 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta23.emeryville.ca.mail.comcast.net with comcast id VCqm1n0010MU7Qa8jCqmcy; Sat, 22 Feb 2014 00:50:46 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id D11E240437; Fri, 21 Feb 2014 17:50:45 -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 3/6] media: em28xx-dvb - implement em28xx_ops: suspend/resume hooks Date: Fri, 21 Feb 2014 17:50:15 -0700 Message-Id: <74266fe7e75a22f009fbf0b1e58df359f19cfee4.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=1393030234; bh=dORonfolTD9Zfmk6UU2flBeCBIvl+/6HopmHHmvRmjI=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=c9248UOlMU2vlvbxpKr9D6EbAkkdRV2XYeMTkh+d0mNFBga3rrWL65kprFk5D710M RvJl9/3OXGenYw1c8r1NiKkZqLajxZSh/fAMRodmrEh7aEwz2DiieVqgNv3HW2U3Au KPgxEH91h+/SIWcZZqt4AzAwHZqSqJX0wd7kyXFPywFz982EvSEwi9xZt6mQ4FaxOS HbmM0CiToGFgo5n03e+ReDeVk5Xg/fTUAVzbUFP5nI4YVyUPizSTSD63f9RS5zJqk6 AK9O7ZFNfyvqYC6dHjGR5cLPu15xe7tFO0oGxO9heiC7wTcHZwwpYyGP1oFZzjVmkS vlrhbwy3VKB8g== 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-dvb.c | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index a0a669e..736b674 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1492,11 +1492,68 @@ static int em28xx_dvb_fini(struct em28xx *dev) return 0; } +static int em28xx_dvb_suspend(struct em28xx *dev) +{ + int ret = 0; + + if (dev->is_audio_only) + return 0; + + if (!dev->board.has_dvb) + return 0; + + em28xx_info("Suspending DVB extension"); + if (dev->dvb) { + struct em28xx_dvb *dvb = dev->dvb; + + if (dvb->fe[0]) { + ret = dvb_frontend_suspend(dvb->fe[0]); + em28xx_info("fe0 suspend %d", ret); + } + if (dvb->fe[1]) { + dvb_frontend_suspend(dvb->fe[1]); + em28xx_info("fe1 suspend %d", ret); + } + } + + return 0; +} + +static int em28xx_dvb_resume(struct em28xx *dev) +{ + int ret = 0; + + if (dev->is_audio_only) + return 0; + + if (!dev->board.has_dvb) + return 0; + + em28xx_info("Resuming DVB extension"); + if (dev->dvb) { + struct em28xx_dvb *dvb = dev->dvb; + + if (dvb->fe[0]) { + ret = dvb_frontend_resume(dvb->fe[0]); + em28xx_info("fe0 resume %d", ret); + } + + if (dvb->fe[1]) { + ret = dvb_frontend_resume(dvb->fe[1]); + em28xx_info("fe1 resume %d", ret); + } + } + + return 0; +} + static struct em28xx_ops dvb_ops = { .id = EM28XX_DVB, .name = "Em28xx dvb Extension", .init = em28xx_dvb_init, .fini = em28xx_dvb_fini, + .suspend = em28xx_dvb_suspend, + .resume = em28xx_dvb_resume, }; static int __init em28xx_dvb_register(void)