From patchwork Mon Sep 10 08:06:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10593673 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 0A908921 for ; Mon, 10 Sep 2018 08:07:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF4AE28CE2 for ; Mon, 10 Sep 2018 08:07:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E27CF28DF1; Mon, 10 Sep 2018 08:07:49 +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 E19EE28CE2 for ; Mon, 10 Sep 2018 08:07:48 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CC1A626787C; Mon, 10 Sep 2018 10:07:47 +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 10C87266E0E; Mon, 10 Sep 2018 10:07:46 +0200 (CEST) Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730085.outbound.protection.outlook.com [40.107.73.85]) by alsa0.perex.cz (Postfix) with ESMTP id EFE33266E0E for ; Mon, 10 Sep 2018 10:07: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=AGjJk1WhGgn2rOQ6EvhKwmOPXAMeK6A4IVGBURYf9zo=; b=t+GjDU4jMv9G3hoMTzUn7XRvgveNfGwe+EJJOsZxWlyCxchsGELzk+8mgj8drd/hGW8h5IFDSY8kb96zZndSTNWyNyfXyDkOAH0rmH5HIuLqo//m0QOfTXnmFwBBC+JGbQfE+DCRuuOaM4tJoKoKXu2LHWno/wlQP5/L+RJ/Hig= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (165.204.156.251) by BL0PR12MB2355.namprd12.prod.outlook.com (2603:10b6:207:4c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Mon, 10 Sep 2018 08:07:33 +0000 From: Akshu Agrawal To: Date: Mon, 10 Sep 2018 13:36:30 +0530 Message-Id: <1536566815-3271-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1536566815-3271-1-git-send-email-akshu.agrawal@amd.com> References: <1536566815-3271-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: PN1PR0101CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::25) To BL0PR12MB2355.namprd12.prod.outlook.com (2603:10b6:207:4c::33) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43fc20f9-8e03-47d5-5963-08d616f47b5b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193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fh4toA7KKcRe+voAIL/g6s9gsKO9j6u/4bSgOXjW5Yv4Knvj0luv/oUayKFlXLwaBxmm6S6a+WGWlC9OffZHdklauy5T23SX+70yGm+5CEzLyIRYxZg8UlPW9UBWQjs/4e33QnG1kJ2EO7PVL1CBcuB2397Z8UJrfQUVyOTzmRbdAUt7o2DtPhB64jTtBJ3Wrmj3Rl2hp4/G8otnGQaoXI+lz1IS5NTwmbbjADBd0oHoIarTVRCJHB0X/YPOb4bqSynIaTEdmJ/mDmBa00SdbTJvMNk/wORHOC6wvC6MfK02ktNJaYDJvy2X+2xg9s/5EH+wIZePvNZv7nlpTLbdF5n4E0jnUqutEIeoyKF9oOaU1fS9lXV7GNylSMPlL3iguxDeEKNWq7t8KlkClasLjO8zbp5ZT9C9nK; 4:V+yT7fiaPdK43I0lJa1QSRj0zxECCmOiLJGYNoWDZU5ueAoSlag3ayHjhO1+5vhEDel425QQOskNMoUzvEwcBOApUqVzFnBl1t5OsgUdttAk0y0/0pWIRrZSudI8pCTksvZ1bGCSsd5JfWApKTBj8cRdfGJ9cBZPH2l+gm7o+fYYwH2HhS4GI2SftfhdHo6zG88ayWHxBa2MgreD61und67XszOcim74IPTVaQb5HlMFrJsHbGO86TqSkfjVU9aXsCq6YLAnJXQJpwnKvGACZWwT9LW6wfCZaubpcgKKzHdj7yzbdrfZ0jUveVvEtu+k 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)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201708071742011)(7699050); SRVR:BL0PR12MB2355; BCL:0; PCL:0; RULEID:; SRVR:BL0PR12MB2355; X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(396003)(136003)(366004)(346002)(199004)(189003)(50226002)(81156014)(86362001)(81166006)(54906003)(109986005)(36756003)(476003)(105586002)(39060400002)(2616005)(446003)(26005)(51416003)(11346002)(956004)(53416004)(386003)(1671002)(66066001)(53936002)(7696005)(52116002)(3846002)(6116002)(47776003)(8676002)(68736007)(6486002)(16526019)(486006)(186003)(478600001)(2906002)(48376002)(316002)(4326008)(97736004)(5660300001)(7736002)(305945005)(25786009)(76176011)(16586007)(14444005)(8936002)(72206003)(44832011)(50466002)(106356001)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR12MB2355; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL0PR12MB2355; 23:IYRoRAhfvh4IAbGATnOEhkyr7NSUFqLLIhY8f/6rS?= vAxqwrFrxlsBXsavIVP77JfsaLeWAfEU3UCCHtSpI24wQ0JRWFow3L37mR1Wy9xqgHAoOLw94Z2rAzOtb9+o5PdhybzlJ4MBFzZhyyMc7tsDzp6tIMsYgeF7GH/dEa3olEJYPV2B5NElxJRWs39xNmQhe3kVkJ7vWk42sNmDQe6gcplF69NexD19iSP17VhZ605VnlmLaCI4KnlJZoQ7n+nGUv2i/zjpfgirMoc3a+dOJhB/Tqv9mldwU2NR3BRS8kIgp1k3F8qcvnPJQX5rjRvYFgNOs5wwoy1bSdLINLG+LwkfSZzR5Y+eV3q1waTrCxmq6xhPcHm+1mAYRtV1kwpkP6F00AjNfVBFh4EBD2P1hC/MJPi+HioEXSYUiM4UdlVpVvYplMwgJMhaHsQEwwRVW/EOOGRNj2TSfOY3OH2w2TbS5OPwUWitA+GEIIqKQe/e5zPz+mu/6filRBj6kw6QfUiQjL+sMhZFyEbzJTHQLzi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change-Diagnostics: 1; BL0PR12MB2355; 20:Jb+B/zyl+5Sw0EgNBDrrmIorjjQmbEJGQfcKKo8D3PB8j+OPr7AFVIwmT29E+IFA90Vity5dMrLtm/s0yte2ttNKRZOf/zDiNfB1SPvOoAo3PesoXDnIXwiN5AgVRX3SUziW0I8pTqQdlTD3lSzkYln85KXxKd+xi5KrIPkl9QZV+SKUoNsXwscIK/eFlWnX0qeSRR2skvpT9b57RzkL2sM+xJunemNNoOTXA8IhOjg3y6TKROPmoTH6k6RHBXMh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2018 08:07:33.0200 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43fc20f9-8e03-47d5-5963-08d616f47b5b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2355 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 2/2] ASoC: AMD: Ensure reset bit is cleared before configuring 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 HW register descriptions says: "DMA Channel Reset...Software must confirm that this bit is cleared before reprogramming any of the channel configuration registers." There could be cases where dma stop errored out leaving dma channel in reset state. We need to ensure that before the start of another dma, channel is out of the reset state. Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-pcm-dma.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index e359938..77b265b 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -184,6 +185,24 @@ static void config_dma_descriptor_in_sram(void __iomem *acp_mmio, acp_reg_write(descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data); } +static void pre_config_reset(void __iomem *acp_mmio, u16 ch_num) +{ + u32 dma_ctrl; + int ret; + + /* clear the reset bit */ + dma_ctrl = acp_reg_read(acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; + acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + /* check the reset bit before programming configuration registers */ + ret = readl_poll_timeout(acp_mmio + ((mmACP_DMA_CNTL_0 + ch_num) * 4), + dma_ctrl, + !(dma_ctrl & ACP_DMA_CNTL_0__DMAChRst_MASK), + 100, ACP_DMA_RESET_TIME); + if (ret < 0) + pr_err("Failed to clear reset of channel : %d\n", ch_num); +} + /* * Initialize the DMA descriptor information for transfer between * system memory <-> ACP SRAM @@ -236,6 +255,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio, config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, &dmadscr[i]); } + pre_config_reset(acp_mmio, ch); config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL, @@ -275,6 +295,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size, config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, &dmadscr[i]); } + pre_config_reset(acp_mmio, ch); /* Configure the DMA channel with the above descriptore */ config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL,