From patchwork Mon Aug 6 07:27:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10556579 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 056F613BB for ; Mon, 6 Aug 2018 07:28:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCC3829210 for ; Mon, 6 Aug 2018 07:28:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C697D29217; Mon, 6 Aug 2018 07:28:51 +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 CF22029216 for ; Mon, 6 Aug 2018 07:28:50 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A85A92677C1; Mon, 6 Aug 2018 09:28:49 +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 C43DC2677C4; Mon, 6 Aug 2018 09:28:46 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0078.outbound.protection.outlook.com [104.47.33.78]) by alsa0.perex.cz (Postfix) with ESMTP id 11DA42677BC for ; Mon, 6 Aug 2018 09:28:43 +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=qPs7Lja3sgj6XDliEo/n7gBVB+Rxkzzc2r2BWyvwKEU=; b=gdK3LXVlPwl6aNRup9RthLJu/ZsJOXlIYmoPaJBe+unDO4eKX5Spzz/jHSVKeCfIz4KiAIoxtVI9QqxOabxjv4mkstQkY/JWkjjVAHe6KRejsdiTgC6ZpI95cZt3x7fGwNeI/zBl7JL1Eb7iAoQzxlMQh1ysmw/wF9uHXjSLnS8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (202.56.249.162) 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.1017.15; Mon, 6 Aug 2018 07:28:33 +0000 From: Akshu Agrawal To: Date: Mon, 6 Aug 2018 12:57:14 +0530 Message-Id: <1533540439-18735-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::27) To MW2PR12MB2364.namprd12.prod.outlook.com (2603:10b6:907:8::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cdc4a1bb-6702-471d-5e58-08d5fb6e3bd7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:MW2PR12MB2364; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 3:gldq6v12FZiDnWa7aY9Gt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+e2/gynsLRbAPHlT6Gcb0OXbsVNJ3mBuba36cRMNni1CywYc7YIO8vx/+Spc1i0kmTc0b/aox6z9OKwIAXfy5VgHBvqbc6f4mrCAQFJ2rO0to4om5simNNR+0CPBHODKJ6lQp9atgnnd/fKvTPWC4RNFnMvTHE4R+rYrstiZ9sK26RbxZZxytWDFGXq4gkMwadiWdOFRjmnSGL5XSSUu4jRPpv89d2J/pGMtonFAM8SZUq4JRzb632D3AFoNQHEwSNxsjG8sQ9cUy5O3EFkUBe1eAfQrSCoRU9Lv7Sq925JnfE/oh6qc0QW4d/NdTiXbtFWZxWTrg3D7pUc4lj+Wl0kLbk7Ou; 4:0YvybLesKGrJeVm209ifplvtsWPQed/BV+qYRSMWLn9gIg8nKeW2FGww+CYmJy/UegrlZZyNlKTH3Kl/XZsxv257KGb6HaL/NLKH0f+ybejFCIIq0X+TH5tdBP1HOMJgPB9Al0WG2fD3N4+e1o33igJ48bzIerrseoFswlhGiMN+0r4c2xIgIOOh/GmGqAiwjd0/Qm5aIz+RngTObGPxtWGk1sAUnOndmPFh66Nr+TYcIvHkTwGwPC6HeJ2c6UsZR/sChMNP4XIgKzeHBmdYFwOPjxmfTyiosE1cg5G+CReFEIIBK94T+LAJrXx0uwsb 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)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2364; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2364; X-Forefront-PRVS: 07562C22DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(396003)(376002)(39860400002)(346002)(366004)(189003)(199004)(6486002)(386003)(86362001)(2906002)(486006)(476003)(186003)(16526019)(105586002)(48376002)(54906003)(217873002)(1671002)(36756003)(52116002)(51416003)(305945005)(7736002)(7696005)(47776003)(26005)(2616005)(956004)(44832011)(66066001)(478600001)(8676002)(316002)(25786009)(4326008)(53416004)(72206003)(97736004)(16586007)(3846002)(6116002)(109986005)(8936002)(53936002)(50466002)(39060400002)(68736007)(5660300001)(50226002)(106356001)(81166006)(6666003)(81156014)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2364; H:akshu-HP-EliteBook-745-G2.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:tIrvHCn5aFwhbg5IFb0G8UrGr3Bx/In5nIfofJzoL?= YVkM0Qt1IJFyuQNdlgG1u2hj1a3wDtEjk9ROANxYcMONyOamW9DBl/+RaiYi+EiQCNLOAQQ6pTHcwFsy6OvsiDmx8+OER+/kIifcGFH9LpxGtmwvbwr7zEIMqI57xkU9d+7SXimkJXa0mWU8sNjStAvz6H9y4OQeukD6z/X35lbHD5oVZxZJxOqwx0bkHDRBTEQqnf7+R2U4AHXo7YLNXI5Qc/P8S2fUOSJ2OP4pPdkmdZq+0Nu4shq5e2onFV32eqEx3+MSZyYVU+O2DQJusLZ6ACfVnkhQqM3dUkjK9DIx4juvcJpzjg+WuY0Y3B6hW55Rf/Vf4ub7czDc85SHAoD5CEhEuuTN3jQ8KuBgaY3QGgieryUY8+309Q8fx+mTScl4xhXxvzlULuqaI5lYdZSJgjhFE9Jvt71VRjd8uk/AZyALh0lSJo4j4wVC+lS/ezEy3jNFerzpPJZtReqnxtDeKCF/RpXbFhdb/WLwj8sAxiFRbDQrBAapPvUcQgRlbShC5os+ogAW7Ae+AdR6rCuakUU1uUYW0LDkxNsRObipqdHm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soft-Exchange-Diagnostics: 1; MW2PR12MB2364; 6:rBNIKEX6c56MX5txXkgpw8rkcjSzyX7TBCbTM83dQxd+FvmNm8JJ1DFgiTN9bzgmwsMWLMEsNAupkm9zArZ520fbN6jy7wnbH8yTCFxeIMnfLN4ALn4CDW/xph9iwIwNIzem3Y9N4AOsUeDO26GuIHFswl619qccd1UUqG1GbRxeZybPSSj7VmhsOfav/ECFrLJEdqXJq14WAVNh3NR7YtPO/wCW0EATodFf9brwOs+39qM0ZiCYTEsL3NOpB983dmL7hQXRnfaIYPN5IJpCGk7G5RQis9Kw7nWurk8iDtO53mlusnMPwaSx/ZwnoJCB4BWHZgPg+eSrcrw2ofrxdcw683SfFX9RlDjH/SZAe4T8c2/Tmqw6GSlDzwQHYfGi2GOauaVwe4aTLlA5jI/my2uWJgE8A0nzKDXQik/0R49102xir+V5XOwhKLFvu3CADtji0snKontiBvK1Y+18Ww==; 5:Ul6mfK2/ahL9uUTEtkqaDMcYduQt/2tNqMybNP0dZTWdxbLrEp0PoFKZ/Lk3BLtPpHIg59sJsIwTXilO/cS/JGJp/NYeBRrm+RzYvQ3VONzMqJLjRFMVfFyosQdCmWiHFdq47yEuYy0VCmEUTA/zP5trtWZ36KdxEF1siXHRw58=; 7:pE0k4PBf1VZMLQuTR4r8qrl8j5AnfEXB3SMglOPYueJh6iI2yHRTXiy7Aajv3LfMOXMR+DCzPMbHY0/gZfFWZA8OZ5C3xWvUhbtzJRgqJtieTKgJMXVarGtA7bK1DOK20msbpejWPb3NbZWYbfqkGAjrmSqPJwLOTWv2y0V9qBCg9NYI6vFSvaUuS4NaaGulR2Awq57BNJ0iz/T253WTDXQpWHZ3GBVTsn5g3PhWoonMXX0TS0bS5Y2249DONndq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2364; 20:+GRGRV5fSvY4xjYczO39hUdHKtG0q+nX8I4ysNWwKgxz67sQWQprWUSzrb57+p5x2HdaYX+JZnp0JbpRdF6p5wqmHgOcgZIZruQ2KMgzILKxCnDVq30O2UjdIAaPeiWFj1FokGd3L4YhT8HE83s8UvSBfB2rmBEsudl1q5r20ialiXLofJkYEg4zLamps0ROSeNOIb/FNFbN0GklVyTFwrWYyu7tox3dxdgLPBRbEuqu/cgD5bvo1/knKad/fOm7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2018 07:28:33.2324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cdc4a1bb-6702-471d-5e58-08d5fb6e3bd7 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, Guenter Roeck Subject: [alsa-devel] [PATCH 1/3] ASoC: AMD: Make ACP->SYSMEM DMA non circular 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 In capture case we don't want ACP to SYSMEM dma to be circular. This is because if an in place DSP filter is applied to captured output then circular DMA can overwrite the filter value with stale data. Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-pcm-dma.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 94bcf69..816abd6 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -400,7 +400,7 @@ static void acp_dma_cap_channel_disable(void __iomem *acp_mmio, } /* Start a given DMA channel transfer */ -static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num) +static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num, bool is_circular) { u32 dma_ctrl; @@ -429,8 +429,11 @@ static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num) break; } - /* circular for both DMA channel */ - dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; + /* enable for ACP to SRAM DMA channel */ + if (is_circular == true) + dma_ctrl |= ACP_DMA_CNTL_0__Circular_DMA_En_MASK; + else + dma_ctrl &= ~ACP_DMA_CNTL_0__Circular_DMA_En_MASK; acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); } @@ -674,6 +677,7 @@ static int acp_deinit(void __iomem *acp_mmio) /* ACP DMA irq handler routine for playback, capture usecases */ static irqreturn_t dma_irq_handler(int irq, void *arg) { + u16 dscr_idx; u32 intr_flag, ext_intr_status; struct audio_drv_data *irq_data; void __iomem *acp_mmio; @@ -705,6 +709,15 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) != 0) { valid_irq = true; + if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_14) == + CAPTURE_START_DMA_DESCR_CH15) + dscr_idx = CAPTURE_END_DMA_DESCR_CH14; + else + dscr_idx = CAPTURE_START_DMA_DESCR_CH14; + config_acp_dma_channel(acp_mmio, ACP_TO_SYSRAM_CH_NUM, dscr_idx, + 1, 0); + acp_dma_start(acp_mmio, ACP_TO_SYSRAM_CH_NUM, false); + snd_pcm_period_elapsed(irq_data->capture_i2ssp_stream); acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) << 16, acp_mmio, mmACP_EXTERNAL_INTR_STAT); @@ -712,6 +725,17 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) if ((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) != 0) { valid_irq = true; + if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_10) == + CAPTURE_START_DMA_DESCR_CH11) + dscr_idx = CAPTURE_END_DMA_DESCR_CH10; + else + dscr_idx = CAPTURE_START_DMA_DESCR_CH10; + config_acp_dma_channel(acp_mmio, + ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, + dscr_idx, 1, 0); + acp_dma_start(acp_mmio, ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, + false); + snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); acp_reg_write((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) << 16, @@ -1053,9 +1077,11 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) acp_dma_cap_channel_enable(rtd->acp_mmio, CAP_CHANNEL1); } + acp_dma_start(rtd->acp_mmio, rtd->ch1, true); + } else { + acp_dma_start(rtd->acp_mmio, rtd->ch1, true); + acp_dma_start(rtd->acp_mmio, rtd->ch2, true); } - acp_dma_start(rtd->acp_mmio, rtd->ch1); - acp_dma_start(rtd->acp_mmio, rtd->ch2); ret = 0; break; case SNDRV_PCM_TRIGGER_STOP: