From patchwork Mon May 19 09:23:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 4200631 X-Patchwork-Delegate: tiwai@suse.de 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 8BD37BEEAB for ; Mon, 19 May 2014 09:26:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 985812028D for ; Mon, 19 May 2014 09:26:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 683E5201F2 for ; Mon, 19 May 2014 09:26:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CF293260864; Mon, 19 May 2014 11:26:19 +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.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 07E9F2619E1; Mon, 19 May 2014 11:26:11 +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 A86A4261ADB; Mon, 19 May 2014 11:26:05 +0200 (CEST) Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by alsa0.perex.cz (Postfix) with ESMTP id 4F0FA260864 for ; Mon, 19 May 2014 11:25:57 +0200 (CEST) Received: by mail-pb0-f49.google.com with SMTP id jt11so5606647pbb.22 for ; Mon, 19 May 2014 02:25:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=e3LF1wS/TxF6XoDG+LSkYIN5tuSqfLfQHwSFXCyLBP8=; b=PeElTMYhaCzHmiiYJUnij0EGvipi/hK5h+dHArLFb3w9z8a4f1xW0iXn7JMdumlOBh Y/sH/ODFCksPYkXHdjS/nZOiyAl/BAK8RWJ8Cspn1PfUP93du5WzXIQ8ZQ4R2g/FYi+P G8fnPZWfzzE537YGx4gHihZUcXzBRHVgnFYxaa6nPu9IvzAQeN/F8IxrODIUQYj5soKh JAtl1bvcqBgUkflttLZKU+xOr4gAGAMDuQRoBUsMx/x8yGp5VtB/f4kabnuaXscrEwsX eGHyt6Mli8IaUgdq0Y+Ft+gNkJZR+26Oq3GZWF5WRDsxv/3ua9tePQXmLW/CAC6jJdil pXTg== X-Gm-Message-State: ALoCoQmBwjyLQvfOu1kp/x2g7g3RHGYkfIM7O/JT98uYH1C/oJ/Qjqnmoqu2pAOvAiXihdayKW+e X-Received: by 10.68.203.233 with SMTP id kt9mr26306461pbc.61.1400491555923; Mon, 19 May 2014 02:25:55 -0700 (PDT) Received: from linaro.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id px10sm73143123pac.41.2014.05.19.02.25.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 May 2014 02:25:55 -0700 (PDT) From: Tushar Behera To: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Date: Mon, 19 May 2014 14:53:53 +0530 Message-Id: <1400491433-16860-1-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.9.5 Cc: tiwai@suse.de, lars@metafoo.de Subject: [alsa-devel] [PATCH] ALSA: pcm_dmaengine: Add check during device suspend 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 Currently snd_dmaengine_pcm_trigger() calls dmaengine_pause() unconditinally during device suspend. In case where DMA controller doesn't support PAUSE/RESUME functionality, this call is not able to stop the DMA controller. In this scenario, audio playback doesn't resume after device resume. Calling dmaengine_pause/dmaengine_terminate_all conditionally fixes the issue. It has been tested with audio playback on Samsung platform having PL330 DMA controller which doesn't support PAUSE/RESUME. Signed-off-by: Tushar Behera Acked-by: Lars-Peter Clausen --- sound/core/pcm_dmaengine.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 94d0873..76cbb9e 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -182,6 +182,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream) int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); + struct snd_pcm_runtime *runtime = substream->runtime; int ret; switch (cmd) { @@ -196,6 +197,11 @@ int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd) dmaengine_resume(prtd->dma_chan); break; case SNDRV_PCM_TRIGGER_SUSPEND: + if (runtime->info & SNDRV_PCM_INFO_PAUSE) + dmaengine_pause(prtd->dma_chan); + else + dmaengine_terminate_all(prtd->dma_chan); + break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: dmaengine_pause(prtd->dma_chan); break;