From patchwork Mon Jul 1 08:39:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 2806551 Return-Path: X-Original-To: patchwork-linux-arm@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 BBC1E9F3EB for ; Mon, 1 Jul 2013 09:16:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B6DA20123 for ; Mon, 1 Jul 2013 09:16:16 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD2852010C for ; Mon, 1 Jul 2013 09:16:14 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UtZjQ-0004L1-80; Mon, 01 Jul 2013 08:45:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UtZft-0003QB-SC; Mon, 01 Jul 2013 08:41:29 +0000 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UtZf5-0003G3-78 for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2013 08:40:40 +0000 Received: by mail-wg0-f43.google.com with SMTP id z11so3472908wgg.10 for ; Mon, 01 Jul 2013 01:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=C8rmZeQ6hVvpU+6/S3qfjdMexEN1oPS8ZetOofxdtcE=; b=MWQuuSmevon720BFbCkx+Js8miOwq++LYMcSbuByKkMDOToueTXoRFNOpmANqWauE5 QJ0zetcnnsa9UrfnjtasgbAKbZnAUPg8D1kXqXxmVDFHRlpyVUi+a484q0v1BWVWF9D8 bjMQmAfik1mn2ocaMkJPGzGpR/UzRXlXSS96GtpQ2WEuZPau2p55JhNOjShhjWFH2YVK kFErgXHe626OYzlhnhjqkoaVioYZ3VI2f0MiuCzjtSYV20/LqEJGpjSzIsoBVDuT36sx R0O/QM6jUZWSeuzcixdmJwV8oemYTpLC8NbM+WNiJz0TiezqkfJy0VVoU+0hKhDCeUWd s/Ww== X-Received: by 10.180.182.229 with SMTP id eh5mr11279980wic.63.1372668017332; Mon, 01 Jul 2013 01:40:17 -0700 (PDT) Received: from lnx-rg.pr (lyon.paratronic.fr. [213.41.177.106]) by mx.google.com with ESMTPSA id h8sm14786574wie.1.2013.07.01.01.40.15 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Jul 2013 01:40:16 -0700 (PDT) From: Richard Genoud To: devicetree-discuss@lists.ozlabs.org Subject: [RFC PATCH 10/13] sound: atmel_ssc_dai: PM: actually stopping clock on suspend/resume Date: Mon, 1 Jul 2013 10:39:35 +0200 Message-Id: <1372667978-4718-11-git-send-email-richard.genoud@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1372667978-4718-1-git-send-email-richard.genoud@gmail.com> References: <1372667978-4718-1-git-send-email-richard.genoud@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130701_044039_430458_F90CB065 X-CRM114-Status: GOOD ( 12.28 ) X-Spam-Score: -2.0 (--) 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.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 From: Nicolas Ferre 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 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index f3fdfa0..14da27a 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -659,12 +659,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); @@ -680,6 +678,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; } @@ -687,14 +690,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);