From patchwork Wed Jun 29 18:00:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 102635 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 25C1BB6F59 for ; Thu, 30 Jun 2011 02:55:46 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qby2Y-00038w-HG; Wed, 29 Jun 2011 16:55:03 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qby2X-0002a0-HA; Wed, 29 Jun 2011 16:55:01 +0000 Received: from newsmtp5.atmel.com ([204.2.163.5] helo=sjogate2.atmel.com) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qby1A-0002FW-Tl for linux-arm-kernel@lists.infradead.org; Wed, 29 Jun 2011 16:53:42 +0000 Received: from meyreuil.atmel.fr ([10.159.254.132]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id p5TGo3SL001590; Wed, 29 Jun 2011 09:50:04 -0700 (PDT) Received: from bendor.rfo.atmel.com ([10.159.245.201]) by meyreuil.atmel.fr (8.11.7p1+Sun/8.11.7) with ESMTP id p5TGr6a10838; Wed, 29 Jun 2011 18:53:06 +0200 (MEST) From: Nicolas Ferre To: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com, lrg@ti.com Subject: [PATCH 5/5] ASoC: atmel_ssc_dai: PM: actually stopping clock on suspend/resume Date: Wed, 29 Jun 2011 20:00:19 +0200 Message-Id: X-Mailer: git-send-email 1.7.3 In-Reply-To: <1309370419-22810-1-git-send-email-nicolas.ferre@atmel.com> References: <1309370419-22810-1-git-send-email-nicolas.ferre@atmel.com> In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110629_125337_297047_DC6DB9F5 X-CRM114-Status: GOOD ( 10.41 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Nicolas Ferre , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Stop SSC clock on suspend/resume cycle checking if the controller is actually initialized. This will save power while sleeping. Signed-off-by: Nicolas Ferre Signed-off-by: Uwe Kleine-König --- sound/soc/atmel/atmel_ssc_dai.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 9412fc3..43cce80 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -631,12 +631,10 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream, #ifdef CONFIG_PM static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai) { - struct atmel_ssc_info *ssc_p; + struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id]; if (!cpu_dai->active) - return 0; - - ssc_p = &ssc_info[cpu_dai->id]; + goto out; /* Save the status register before disabling transmit and receive */ ssc_p->ssc_state.ssc_sr = ssc_readl(ssc_p->ssc->regs, SR); @@ -652,6 +650,11 @@ static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai) ssc_p->ssc_state.ssc_tcmr = ssc_readl(ssc_p->ssc->regs, TCMR); ssc_p->ssc_state.ssc_tfmr = ssc_readl(ssc_p->ssc->regs, TFMR); +out: + if (ssc_p->initialized) { + pr_debug("atmel_ssc_dai: suspend - stop clock\n"); + clk_disable(ssc_p->ssc->clk); + } return 0; } @@ -659,14 +662,17 @@ static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai) static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai) { - struct atmel_ssc_info *ssc_p; + struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id]; u32 cr; + if (ssc_p->initialized) { + pr_debug("atmel_ssc_dai: resume - restart clock\n"); + clk_enable(ssc_p->ssc->clk); + } + if (!cpu_dai->active) return 0; - ssc_p = &ssc_info[cpu_dai->id]; - /* restore SSC register settings */ ssc_writel(ssc_p->ssc->regs, TFMR, ssc_p->ssc_state.ssc_tfmr); ssc_writel(ssc_p->ssc->regs, TCMR, ssc_p->ssc_state.ssc_tcmr);