From patchwork Tue May 24 18:50:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gardiner X-Patchwork-Id: 813212 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4OIq01C003602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 May 2011 18:52:21 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4OIpxwP023956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 May 2011 13:51:59 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id p4OIpvAQ028434 for ; Tue, 24 May 2011 13:51:57 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 5F77580774 for ; Tue, 24 May 2011 13:51:23 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id DDECB80636 for ; Tue, 24 May 2011 13:50:34 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id p4OIoWCf013984 for ; Tue, 24 May 2011 13:50:32 -0500 (CDT) Received: from psmtp.com (na3sys009amx161.postini.com [74.125.149.87]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id p4OIoVtc012468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 May 2011 13:50:31 -0500 Received: from na3sys009aog112.obsmtp.com ([209.85.220.176]) (using TLSv1) by na3sys009amx161.postini.com ([74.125.148.10]) with SMTP; Tue, 24 May 2011 14:50:32 EDT Received: from mail-vx0-f176.google.com ([209.85.220.176]) (using TLSv1) by na3sys009aob112.postini.com ([74.125.148.12]) with SMTP ID DSNKTdv99GymyH01NLx8hoX9lCeXqdf74IYh@postini.com; Tue, 24 May 2011 11:50:31 PDT Received: by mail-vx0-f176.google.com with SMTP id 37so6072722vxa.7 for ; Tue, 24 May 2011 11:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nanometrics.ca; s=google; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=WKw74iRrO5V35T5trqhglHGvXH5YdHLRqrNvZk7l7xA=; b=Bgi2ydXOxK+5EjJqRGIEl70I8s2ax73Xlfdy7FHHcYo0Z/5wIkeH1C7+HHYQQXcKDw 57pcP+DR8yMo9W7BH2OgQ03xTotE5SYF7TSXlXUGuIvspV/rKkI5EahmSW0QT652o0Tm 883f7oeZCsdI8TWLNIgkBPYORKOh0aB1HV6bg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=nanometrics.ca; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=QPi/OYghm6uA5TfUL6OGwEl0F8vfzgTAv0blo3axpYMwcL254VVKKllmCTJXxUa4oP WCCOqPckpnmd8MN671BXG0x8q3niZt7ffoWHCcSSxQ6DWP9CZcpc4djUn2i6fF+jSGcj sCvLZCUV1o7Y+DFr0SHOPW+PstTBoX0IB0z8w= Received: by 10.220.180.137 with SMTP id bu9mr869414vcb.178.1306263028043; Tue, 24 May 2011 11:50:28 -0700 (PDT) Received: from localhost.localdomain ([206.191.47.130]) by mx.google.com with ESMTPS id d18sm1646004vcs.40.2011.05.24.11.50.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 May 2011 11:50:27 -0700 (PDT) From: Ben Gardiner To: Mark Brown , Sekhar Nori , Liam Girdwood , alsa-devel@alsa-project.org, davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 4/6] ASoC: davinci-pcm: fix audible glitch on 2nd ping-pong playback Date: Tue, 24 May 2011 14:50:18 -0400 Message-Id: X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: Steven Faludi X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 24 May 2011 18:52:21 +0000 (UTC) The release of the dma channels was being performed in prepare and there was a edma_resume call for the asp-channel only being executed on START, RESUME and PAUSE_RELEASE. The mcasp on da850evm with ping-pong buffers enabled was exhibiting an audible glitch on every playback after the first. It was determined through trial and error that the following two changes fix this problem: 1) Move the edma_start calls from prepare to trigger and 2) reverse the order of starting the asp and ram channels. Signed-off-by: Ben Gardiner Reviewed-by: Steven Faludi CC: Troy Kisky --- sound/soc/davinci/davinci-pcm.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 9b5a9bf..5d9269a 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -544,6 +544,13 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd) switch (cmd) { case SNDRV_PCM_TRIGGER_START: + edma_start(prtd->asp_channel); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + prtd->ram_channel >= 0) { + /* copy 1st iram buffer */ + edma_start(prtd->ram_channel); + } + break; case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: edma_resume(prtd->asp_channel); @@ -582,11 +589,6 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream) print_buf_info(prtd->asp_link[0], "asp_link[0]"); print_buf_info(prtd->asp_link[1], "asp_link[1]"); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - /* copy 1st iram buffer */ - edma_start(prtd->ram_channel); - } - edma_start(prtd->asp_channel); return 0; } prtd->period = 0; @@ -596,7 +598,6 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream) edma_read_slot(prtd->asp_link[0], &prtd->asp_params); edma_write_slot(prtd->asp_channel, &prtd->asp_params); davinci_pcm_enqueue_dma(substream); - edma_start(prtd->asp_channel); return 0; }