From patchwork Fri May 23 05:38:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4228171 Return-Path: X-Original-To: patchwork-alsa-devel@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 0FE53BF90B for ; Fri, 23 May 2014 05:39:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D30C20397 for ; Fri, 23 May 2014 05:39:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 129CB2038F for ; Fri, 23 May 2014 05:39:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1FC8A2656C6; Fri, 23 May 2014 07:39:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 725CB26564D; Fri, 23 May 2014 07:39:17 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A8D77265677; Fri, 23 May 2014 07:39:15 +0200 (CEST) Received: from mail-qg0-f44.google.com (mail-qg0-f44.google.com [209.85.192.44]) by alsa0.perex.cz (Postfix) with ESMTP id 16A4126563E for ; Fri, 23 May 2014 07:39:06 +0200 (CEST) Received: by mail-qg0-f44.google.com with SMTP id i50so7346650qgf.3 for ; Thu, 22 May 2014 22:39:06 -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; bh=mDViqK7LPnikHPeo4aG5iNJhg6QYapNlutNOfKKCtEY=; b=ghtL6+w4WQ5OQQ5or7a05GAPdXSLTxObYscunLW5VqmZF0Ic8FQjIzD16aKkqQmOW4 suw5QcYCsoK0w5zBh2zlzTI4yv/4KGbD3vFMS1pTtb/HV3GAdkcC0uklAT7Dct3+7gD+ JLf4neAGIS0PGqQNBCj+WZ23PxSVjSJ1ZMModTcV/ncC4ShXuHdT3vVnuISozFqJGhpO vyARXcAxn6xaSh0Z3yshANYkKKdN+QltefPfqzbX0rnJcxH59Y5tmDuy0GMJ9jguSWtj d+hBBNZjIVQCjBOT4U932i8nACSgG8CXFdYRyV6Ix1adVUnNIlbnbj0/A4YiAi6IfC41 +SBQ== X-Received: by 10.140.82.113 with SMTP id g104mr2994179qgd.55.1400823546386; Thu, 22 May 2014 22:39:06 -0700 (PDT) Received: from localhost.localdomain ([177.194.43.224]) by mx.google.com with ESMTPSA id q16sm1328997qga.42.2014.05.22.22.39.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 22:39:06 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Fri, 23 May 2014 02:38:56 -0300 Message-Id: <1400823536-31708-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.3.2 Cc: Fabio Estevam , alsa-devel@alsa-project.org, timur@tabi.org, shawn.guo@freescale.com Subject: [alsa-devel] [PATCH] ASoC: fsl_ssi: Add suspend/resume support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Doing a suspend/resume sequence while playing an audio track in the backgroung causes broken audio right after resume: root@freescale /$ aplay clarinet.wav & root@freescale /home$ Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono root@freescale /home$ echo mem > /sys/power/state PM: Syncing filesystems ... done. Freezing user space processes ... (elapsed 0.002 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. Suspending console(s) (use no_console_suspend to debug) PM: suspend of devices complete after 37.082 msecs PM: suspend devices took 0.040 seconds PM: late suspend of devices complete after 4.234 msecs PM: noirq suspend of devices complete after 4.618 msecs Disabling non-boot CPUs ... PM: noirq resume of devices complete after 4.013 msecs PM: early resume of devices complete after 4.000 msecs PM: resume of devices complete after 68.907 msecs PM: resume devices took 0.070 seconds Restarting tasks ... Suspended. Trying resume. Failed. Restarting stream. Done. Suspended. Trying resume. Failed. Restarting stream. Done. Suspended. Trying resume. Failed. Restarting stream. Done. Suspended. Trying resume. Failed. Restarting stream. Done. Suspended. Trying resume. Failed. Restarting stream. Done. Suspended. Trying resume. Failed. Restarting stream. Done. Suspended. Trying resume. Failed. Restarting stream. Done. .... Add SNDRV_PCM_TRIGGER_RESUME/SUSPEND cases so that we can gracefully handle system suspend/resume. Signed-off-by: Fabio Estevam Acked-by: Shawn Guo --- sound/soc/fsl/fsl_ssi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index f233d91..090f449 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -874,6 +874,7 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd, switch (cmd) { case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) fsl_ssi_tx_config(ssi_private, true); @@ -882,6 +883,7 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd, break; case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) fsl_ssi_tx_config(ssi_private, false);