From patchwork Mon Jul 2 21:19:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 10502545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5BFC960362 for ; Mon, 2 Jul 2018 22:21:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A3BF28B0A for ; Mon, 2 Jul 2018 22:21:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CC7428C5A; Mon, 2 Jul 2018 22:21:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 895BC28B0A for ; Mon, 2 Jul 2018 22:21:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0AA81267735; Tue, 3 Jul 2018 00:21:19 +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 DF7DF26775E; Tue, 3 Jul 2018 00:21:15 +0200 (CEST) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by alsa0.perex.cz (Postfix) with ESMTP id 29989267714 for ; Tue, 3 Jul 2018 00:21:13 +0200 (CEST) Received: by mail-it0-f67.google.com with SMTP id u4-v6so470497itg.0 for ; Mon, 02 Jul 2018 15:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PeMF3h1zt/7gvJf2rnjuYTUHx/E4hf5cyZB1BDHpYr0=; b=I35IGKIvRHk4wOwC3CrfzWWHQ+PFxwyYxyfyIZwugDljNLWF/xUGuwANhjoRLXlLyd qsF9/JouQt0pPSD1jxg90ZYvSU+ZzOgXSk+6dfsbZn8nVZGRtS7YKRrVgeUBCcPcdn+Z HuPDGoIoBodEfL0C7wz7rxB3VDKYdsPYwZQ9w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PeMF3h1zt/7gvJf2rnjuYTUHx/E4hf5cyZB1BDHpYr0=; b=Iau66QCDA59ejfbVdesOoB7Eh9fflH0oSOOuOK4VZ5o5mTyfzvHEaToWIst226P7UG +/maEGqMrc/26XOSxT/RiioDsl9hrnrOwmg1T5Uq+B4Togb+Ayt3OkdyxeSB9Ogx6F9S R7qJHFA0cYqg4f+wDYqqxlbk+jquAK8K44++GbG/zAJoRtOe9h9LXz2oE4okKNNe+y4j MjmCRUCT1wSOjynj+oPw/jjQiyem0s709rS7nI2L1mqaB+1Or0luwUN2r0MgKqk8G5kv Y1FzUZ7k5ZlQazVGAVYoXjlF93n1ayzi7pWfzS6mtkGUYf22WcrLENzk1q0B2V7iBcMQ Ubvw== X-Gm-Message-State: APt69E3MSstf1IpAHxGtY+mkbgC3dnA/ciR81Io4QB0PxadtHj66Jywf hyEjK8J8oaTy1Xx/IHl51FoqtsDZlWQ= X-Google-Smtp-Source: AAOMgpfd+6pqMpipBtTPgptGRY9MFuRuwC4RiQ0hThH8EeLlgi3aUEzmqsYXwpnJ8nuLZTr5tOs/eA== X-Received: by 2002:a24:6788:: with SMTP id u130-v6mr7164117itc.47.1530566404636; Mon, 02 Jul 2018 14:20:04 -0700 (PDT) Received: from djkurtz2.bld.corp.google.com ([2620:15c:183:0:1cfd:61a5:7215:5f9c]) by smtp.gmail.com with ESMTPSA id h75-v6sm776729ioh.50.2018.07.02.14.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 14:20:04 -0700 (PDT) From: Daniel Kurtz To: Date: Mon, 2 Jul 2018 15:19:51 -0600 Message-Id: <20180702211956.149355-2-djkurtz@chromium.org> X-Mailer: git-send-email 2.18.0.399.gad0ab374a1-goog In-Reply-To: <20180702211956.149355-1-djkurtz@chromium.org> References: <20180702211956.149355-1-djkurtz@chromium.org> Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Takashi Iwai , Daniel Kurtz , Liam Girdwood , Mark Brown , "Mukunda, Vijendar" , Alex Deucher , Guenter Roeck , Akshu Agrawal Subject: [alsa-devel] [PATCH 2/6] ASoC: AMD: Reset bytescount when starting transaction 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 The pointer() callback gets its value by reading the I2S BYTE_COUNT register. This is a 64-bit runnning transaction counter. If a transaction was aborted in the middle of a sample buffer, the counter will stop counting on a number divisible by the buffer size. Since we actually use it as a pointer into an aligned buffer, however, we do want to ensure that it always starts at a number divisible by the buffer size when starting a transaction, hence we reset it whenever starting a transaction. To accomplish this, it wasn't necessary to zero bytescount at the termination of each transaction, so remove this unnecessary code. Signed-off-by: Daniel Kurtz --- sound/soc/amd/acp-pcm-dma.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 4665ae12e74e4..e6f85f2e5ac2a 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -1029,7 +1029,6 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream) static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) { int ret; - u64 bytescount = 0; struct snd_pcm_runtime *runtime = substream->runtime; struct audio_substream_data *rtd = runtime->private_data; @@ -1040,9 +1039,7 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_RESUME: - bytescount = acp_get_byte_count(rtd); - if (rtd->bytescount == 0) - rtd->bytescount = bytescount; + rtd->bytescount = acp_get_byte_count(rtd); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { acp_dma_start(rtd->acp_mmio, rtd->ch1); acp_dma_start(rtd->acp_mmio, rtd->ch2); @@ -1069,7 +1066,6 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) case SNDRV_PCM_TRIGGER_SUSPEND: acp_dma_stop(rtd->acp_mmio, rtd->ch2); ret = acp_dma_stop(rtd->acp_mmio, rtd->ch1); - rtd->bytescount = 0; break; default: ret = -EINVAL;