From patchwork Mon Sep 17 15:40:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10602971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3A15161F for ; Mon, 17 Sep 2018 15:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1A3828737 for ; Mon, 17 Sep 2018 15:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D55CA2A102; Mon, 17 Sep 2018 15:46:12 +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=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham 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 D54B028737 for ; Mon, 17 Sep 2018 15:46:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5C5EA26787E; Mon, 17 Sep 2018 17:46:08 +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 D9A0526787F; Mon, 17 Sep 2018 17:46:05 +0200 (CEST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0089.outbound.protection.outlook.com [104.47.42.89]) by alsa0.perex.cz (Postfix) with ESMTP id D9745267819 for ; Mon, 17 Sep 2018 17:46:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e0UhGaZEJfn+cSUw7PIpVR+jF8hcOMh7IDOkuhSl5LA=; b=AP3g/q3TAlpAxoOhzqMcn0xhu69fR6zBY8NOEpHKz0F9dan1DCrWO0jl0Q7qNxjUXGRSIcMBXLKxz2rTFo9WXmYfsOHVIoWHrLE/NPAepdaB+IBp8eyPgmeLgSz4R6H5GZ/yVkHom/ILmEgMXwDBBLJYTPXEgTUwiuGkZr6vitQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from amd-chromium.amd.com (165.204.156.251) by MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.17; Mon, 17 Sep 2018 15:45:49 +0000 From: Akshu Agrawal To: Date: Mon, 17 Sep 2018 21:10:34 +0530 Message-Id: <1537198839-15985-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: BM1PR01CA0088.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::28) To MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e2f0101-fe00-4cc1-b8fe-08d61cb4a9d1 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MW2PR12MB2364; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 3:SlvVpr5+YTvi+1uIZL3bl+TivdhJWu9SVu958433SoDsEhHnuqaIt0qpwUDmD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OO5dykFHJ8tZeO1eaEcs55mtMHpVmW9G6QJZckrhsOTme8GDdfaSETBPnGz0mGpgZiYnXAzWQJlTn82Wf2Eq06qhuTTm+yrzgzEqQ+X/PKgION+4AGpO8JE3qZZ/siJX7I6rpLU3VXSyD80CQ7SOUSpQ1fP9fXPhzv4i8Xu9rFyD8a6UuDzPQLNq+pztlD3gSp1kbvKUR+/jZ/IiYCHKWO5u+GeZmW6Smmc3oJc1uOgBFIbHXUMO/YFWQ/5OQ++y6ojI+pYGyHlr/ps/YVo7T0QlHrIYKo+RA; 4:m9ff0d9QDcBIHrADi5MbR1jBooiwQnMdL/bEq08uErkrC0cyVXCsHEQ3oH2Rk0QiEw8+i7ue3SSOroHniNl8bBjFd5WpjbZpbjJUp6pjvB0zYKlYbkPmC3Ee5lljqGIb6qKHu4H7hn1eSRAPTTloRSjMdP4TZha+u8q33CZgIdOwnOYeZcDV5OD4xd1LM3QQfwMiXpmLqLL8DIkAPlo6CdsHwMx7/SHtmONYWBMaBZSmPbKkLARqn//HyXwEwhtoVpl57YRb9y6RJYaUMaShlUsaIo0srZl3mcxZ18hiKjP7HAlefZeuwDoN0JUd6Klj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:MW2PR12MB2364; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2364; X-Forefront-PRVS: 0798146F16 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(346002)(396003)(366004)(376002)(39860400002)(189003)(199004)(6486002)(486006)(5660300001)(86362001)(386003)(956004)(2616005)(476003)(50226002)(81156014)(26005)(81166006)(478600001)(8936002)(7736002)(305945005)(72206003)(50466002)(48376002)(53936002)(68736007)(2906002)(8676002)(16526019)(6666003)(1671002)(44832011)(39060400002)(1857600001)(53416004)(105586002)(51416003)(316002)(106356001)(4326008)(97736004)(16586007)(25786009)(6116002)(3846002)(66066001)(36756003)(14444005)(47776003)(52116002)(7696005)(109986005)(54906003)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2364; H:amd-chromium.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MW2PR12MB2364; 23:XO2pREiE2fxInNHGPXXp9zRS2jf4QjHD8aKQGnrQm?= pslqkaLVlH3TkGklIrBLdZKRksLTYoZV7PDpZXLSrKfMii7rYnsjkuSmr4bl2RECowj7r0Ymqa/AUGzI0+lkKmTrp6sOalZ6l4NjXtCVegJ6EjuTDfE86aHjr/+RS6X1e+K1pEHusxVPu/QGpVfIeS0m/OSVUDI2YUgOItZ0/Kl7MRTRaX+6YQfsjaIZllqw40cE0mz2PCQyFahEEYkjLTurrjTrfWOyXlmtCN10sciY6VmMqm6XugV75ldBVK1plDI/d4u0dIrCivglnrW74CPnv8BMrFc8jgF9xZkHHnaNSartnO/VGRc4Qpeuce1QSI0cy9r/UB3Vl6EVATTFlN1uDYpiIAVrDfZ91p/ZwFhz1sfV4WCQE5EpvXWhR3cyMktpWARYQKiakC/qnlAGQvWar4GpXzQG9iE8FvsmlF5uF/8i5x/QKBdpb7QEBzFPQU3pII5E+e6s7BRfqwa+PEY0iBdGTo/1IZ+k/2P08BWmgRDxxnrvfRUx1O+nICGui34adzGM7g7joZFeaoO3wGSZNQL6byZBp9jFZzxaNwe1RX/tdYG3B/dhvJ64pVytJaRt6oAYkcqEuVKX4nc8CPL9HFGHZ3gZryMgppTNOOyJnGpsIP5MgX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oBl2y6uYu5NTFnanmMtL3SW66DFHVukKB/BnnnWHKe+x74/xLSnYmjVzv4pUsj2BghsC6GC4RciZbJ7gzVAAyOrsl9qHYxPGcYfg/bLMSEpDQTiY/Ibv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2018 15:45:49.6534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e2f0101-fe00-4cc1-b8fe-08d61cb4a9d1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2364 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Takashi Iwai , Liam Girdwood , djkurtz@chromium.org, Mark Brown , "Mukunda, Vijendar" , Alex Deucher , akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH] ASoC: AMD: Fix capture unstable in beginning for some runs 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP alsa_conformance_test -C hw:0,4 -p 1024 --debug would sometime show: TIME_DIFF(s) HW_LEVEL READ RATE 0.000095970 1024 1024 10670001.041992 0.042609555 1024 2048 24032.168372 0.021330364 1024 3072 48006.681930 0.021339559 1024 4096 47985.996337 The issue is that in dma pointer function we can have stale value of the register for current descriptor of channel. The register retains the number of the last descriptor that was transferred. Fix ensures that we report position, 0, till the one period worth of data is transferred. After one period of data, in handler of period completion interrupt we update the config and correct value of descriptor starts reflecting. Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-pcm-dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index c7e972b..f27e20c 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -1050,6 +1050,8 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream) bytescount -= rtd->bytescount; delay = do_div(bytescount, period_bytes); runtime->delay = bytes_to_frames(runtime, delay); + if (bytescount < period_bytes) + pos = 0; } else { buffersize = frames_to_bytes(runtime, runtime->buffer_size); bytescount = acp_get_byte_count(rtd);