From patchwork Mon Mar 26 13:12:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 10307781 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 A971160386 for ; Mon, 26 Mar 2018 13:12:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 891FA29494 for ; Mon, 26 Mar 2018 13:12:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C35028DC8; Mon, 26 Mar 2018 13:12:32 +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=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no 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 5AB52296BC for ; Mon, 26 Mar 2018 13:12:31 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0B6C326719A; Mon, 26 Mar 2018 15:12:30 +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 EC30626718D; Mon, 26 Mar 2018 15:12:27 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0064.outbound.protection.outlook.com [104.47.33.64]) by alsa0.perex.cz (Postfix) with ESMTP id B73C026718B for ; Mon, 26 Mar 2018 15:12:25 +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; bh=utd/fLQSICwk+PI0hR6CEaoAriHL4BCoCE2Oa7Yq4Cg=; b=C3YQ4+9bRl/XcGpJT3a1NcyAOvxSU/CaM7MHXbqyGS9eyTeQC8IN2bE+lNV4BHKNmBzF+gzjrywatKl3uCwXauB/kkmRV1AQeZzp3DaQOMYOty7jAMcNfB9Kau4UNdIPZnWLBVNUM8qAxPwHMwKse+a7EB3KuyGvjdLa/nmBVdc= Received: from MWHPR12CA0052.namprd12.prod.outlook.com (2603:10b6:300:103::14) by DM3PR12MB0764.namprd12.prod.outlook.com (2a01:111:e400:5984::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Mon, 26 Mar 2018 13:12:22 +0000 Received: from DM3NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) by MWHPR12CA0052.outlook.office365.com (2603:10b6:300:103::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10 via Frontend Transport; Mon, 26 Mar 2018 13:12:22 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT007.mail.protection.outlook.com (10.152.82.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.631.7 via Frontend Transport; Mon, 26 Mar 2018 13:12:22 +0000 Received: from LinuxHost.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.382.0; Mon, 26 Mar 2018 08:12:21 -0500 From: Vijendar Mukunda To: , , Date: Mon, 26 Mar 2018 18:42:58 +0530 Message-ID: <1522069983-11381-4-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522069983-11381-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1522069983-11381-1-git-send-email-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(396003)(39380400002)(346002)(2980300002)(428003)(199004)(189003)(81156014)(8676002)(305945005)(36756003)(104016004)(97736004)(356003)(8936002)(81166006)(4326008)(106466001)(2201001)(50226002)(336012)(6666003)(426003)(48376002)(50466002)(446003)(68736007)(39060400002)(11346002)(186003)(86362001)(77096007)(2616005)(47776003)(5660300001)(26005)(110136005)(575784001)(2906002)(54906003)(16586007)(76176011)(53936002)(72206003)(105586002)(316002)(51416003)(7696005)(53416004)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0764; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT007; 1:kq3CUPExtSkyieE3i7ebjQgkRW8C8UqdRumQJlr2K3x7oDWWWUUWv4fOJuMagGCWDb2hgcX2ixDuKWHfv7mBRMoU0J6UnIndFnmur5VOKnmoOkGCI3tcGLdZGJS8+DIj X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38daff22-ba98-406b-ccf2-08d5931b3619 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:DM3PR12MB0764; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0764; 3:df2Ue6KEkKXPMszfURebO1T3V/uqR9Yv/Vk+PztyYGLUYZ2stu8w6j7jbLfGXYDQOvPqLFkF1o5Q8zG/ILrn0MUf5AkrUQv2LlNAkqUMkPS2rTTCVutC3WIyi61jD6NuLzai+WQMiYhQ9qyYeio4BOtHeqcJMKQG6utaDS8khXERL3pAG8YASivUoXdhLS8ryk6wI8f7ugjmh1uIaOHYrgbkk+IYOZ5tJbHEhqXgpmh3J3cu3coZ+HrNP7OK3V44t6WFQpEARMdmp6/XbbPsOyQZ5A5CqpuSLHPUoXK9KVJckBikoXGgF4SOABAVGgnCUD04N6usDtYcuQstwTOhpoZZEXihvRtqLoJVk3no3d0=; 25:veUXYn+QdqkoiAea/dtap+l3qKdt8wKjSJ0f7KLCdmi7LYQuAqt/L3zvYUWoOyZWhfDRe2vz9f+tqIfrcbmhG+FHjtFySn9JqTU4RNUys073Sz7kR2Nj7ku8dDxXigx4UZf94YIh4NrGsVSWgpUtXSiFriUEbZaXwZJ5a6K+YBVW86vrlBbW/HCoy18EUqfJ/H1bL/WE1qkoA76sqFfrxmvaNksCJirLwyoypgxXP93t4fxE9VcNCBt4ssFyw4YEpLGvB51sZqrVQnNB9smkDiLOVSwBHH9zDbuBPFupAZuXOT2QS7nLXiBHpuHXGkThEwg7r7T/htKb31LKaly2UQ== X-MS-TrafficTypeDiagnostic: DM3PR12MB0764: X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0764; 31:nFd7KvRObI20r+8JO1Uo7nCjSByoHdiCpkAzMHISDeKoDr+GQptkEAHCAwe8kNiERkGUVKWYZ6VTm+ZGAZGWF6RFeB04eaX8fc/9//rejwYQXT0hhYQS+sX5njgypzA9AoqYl3PGN5CvoMjuZYaShmT8baSg0H+/b1S5nacDrqg35Squy8CG5F5QKF79BUia6F7s6GCCG7PUmvc7niLuzICfdiEz7af+YujZN39puWE=; 20:KtAi/onXIdueSEVYxWyYoZuQQRMzsqmtMGAmzSmjjv8FbnpJTaix8RdroSmmGaqhfpJuEmd1KGba/ib8cA/tY/JlTN8anbco40v25kMZ6F/O4qoBpBxPqJCaw0zy1AEU1OysE0qRegxjY3+jW7XdC0kQnCSjOjhVSJxhLiYtUP9XP5GCPvmbsArrDxRfIzZ5CR5qkqC3zjup7fVLzSosUkMnxTlhZuOv5jL+zXkY/N9PUgrcT/6AuVVW6TsA5qids+p4Dr8bxh/L78/7J+OH7KEqbEh6U1CIDDLSh9Tvb8fJJr5Enx4aBgQI4k+IC00Br4LYkLIsXHnZELcAlEtPKr8DBsJvFqCAhhyLsqbRMeRM+S7gEkxTZZug3Ct0flaLvVTl6OtnBcwIAQvOULdAs+iRfk7LIM/3DFkFTydJ7tLr2+lUEokNUhfhMWmQen1L2iDlmbgEydgyTnEqlN9P+rPRfa8JHa5S1R8DFZJyWRlNyCzySw68giWbnjvUhq2I X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(93006095)(93003095)(3002001)(10201501046)(6055026)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM3PR12MB0764; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0764; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0764; 4:XHAOmchnluNMideVYorCNwi1TqcUUQxdQvtxqqaWLlRjEeegwTy9lhq9bfaYzD6RtedDnQ6ZikDFAACVJ2On6+flaVm4uOlUGIbXeW0HwJnlalJrjL9ChvP2vhC4k+ipWWg8+4Efzng0tSjP8oOAeGJjAe3Q/qSg58KMDoTD4blZjVrF4oNkUVnfwCoKjFHzzy0pSvaLfJzW6Qty24TgwnvMdq/HWszPNdCIiaybEUvZYXGUIYZEf0mOPOdZCx4iCZxG0iAs7SF4RQbt3sFcmQPZm1Y6m629U/UDxj2duwSQpW7yjJwiliBiTymt6zP7 X-Forefront-PRVS: 06237E4555 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR12MB0764; 23:emDSd1O7Qc34vqZCSnljRDFS4ZYysiL4aeJ6I9MzR?= =?us-ascii?Q?qp4hkc3/UAeXi7hjFCPi6MGm0SOW64DeG2EX5AXRVZr+QZTtvV8X1WofVQe9?= =?us-ascii?Q?hf7tJXJM+B6ea0rXdfmu/7P2eIyK0ygtiPiMJ3QJETdeCdFixdsLn5f0UJk6?= =?us-ascii?Q?vVoQ4D5o5PEtJb9cnKKd/Z82qob88f3n6AnfiW+stDcxb6DOzTm5qvQ7s7iX?= =?us-ascii?Q?fIv+/bSKbeQP5QHif7kcRAjqoYQcmYya1d+mGV+UWY273TTI5LFo1rhCg5/8?= =?us-ascii?Q?ac13iw7/D2ueu1NYmlZKywupuLhBOY+4ZSEnrPGfmle/U3I50WZdfn+sGIuF?= =?us-ascii?Q?FAw5k245IReY2wyDyF+UqODO9Z0ywjLuMjFZ6aIAqUNC+nT+3myw8KZJWXna?= =?us-ascii?Q?9O+tbgoV9hv0lNC4pJJcRcKsAGmaYXSraNYmhjINetp05hvUnz2i79FhuMOV?= =?us-ascii?Q?LMY4kxrJJuAdm4x3ZhdibDXFiDxLQs6hCdiJTFbV/nalXvnWMUUxo5arOzon?= =?us-ascii?Q?d7DVPGOqPzxOM8Gc8fFHUPXPbsWLSpVKGZ1yxEKIHroTE5Iu44H9xxuA9xDr?= =?us-ascii?Q?ifsl6LIwgbySvWAkzJCU1WjcGx0eNbDFTiMZnwIMn4wUJ+hP5EorVQ8TbdOv?= =?us-ascii?Q?rBHwtrzrs/OcITzA1aSYeoQvwVekawr9h0TGHXdmkSQsSun4jM0JOctCdsU9?= =?us-ascii?Q?yrmg3wqkttP5IZP5aKxI8OhJyWepzHbGsIMo2IX63SKaFN/M3oOEsgfbo1bF?= =?us-ascii?Q?Uvt7pPrl5m+ADH9mMOyjunvSSBc6tlpraPxY+UarsM171U7dqUjsex3aQHd8?= =?us-ascii?Q?Xg5iM195L0+J7e6p8b/AqAVbTL+AwDbSZHQoNtvGiXa38HLqnmNyLJfo0J+A?= =?us-ascii?Q?DEPHOwjPdt4pf/8iG6e61TQ+vAXp0HZ0kt/MBxXT6BHk8FlBKgwJ6DMZj83x?= =?us-ascii?Q?+AFBQyRVksuaGYmklbKLbv3co3EEFYL8E9MffRDRe8znqcatLoT6HCzEG9qA?= =?us-ascii?Q?e4KzaqAi7ysulEkaAfUveyhtfLroUdzNilEh8XFIbhMLdwo3vW7ApVfluPa9?= =?us-ascii?Q?GK0BBLmOqNcy+JKGGLjfFHZlfxpTfkPkX3LZYdonZL5TR6ptTsUUYnzswUuZ?= =?us-ascii?Q?NA3yTOhFMzF3hTjRWi/SSd/6HU8dwCnXsGv5nRU/ntClgOKs3CGto9PFx1+H?= =?us-ascii?Q?pfsi9Re6/klk8A=3D?= X-Microsoft-Antispam-Message-Info: M86V1sIEdWfokWnINW/Df8RUBRUW9MPOqn2FS7D44yFhYv/K5XxWnoPi93pj8BXvv0b9T/cC+FiJMlJ+px70laNDNeADYyzLcNva22QPYZRX9piMiCRQcJvCDdlBdg9ln+fbEqF6lklcaej3WCvO7LnmKARdgGff2CDLVd+//nI4TyQMiXCdJnT418kKSMbf X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0764; 6:f7ydtmGH68tLqKAgqOVtJYbJFhWZMK9XeTu+EJJ66mLLYbBi7pcUANr9cWve/ocK/BgQ7SfR/g+SWNoO95HbavxiffskVCcleJBdtrov0g/V93AtmM7+ODOULN4kMGXLqtHznTsnPfI+NiJEnHCSBGwXQX6qzf6GSq6PMhq/To4CYAETKXQETEGblMDBlP+wNPpR0438FcJP/WFNK5kST078U/LJCXSSx3ySzqz/m3mnWpiTEJZitqkx8y+juBHq4VuoGAUtmbKDYJLyqMW5Uct7Sq8aL2fKtEtizCn0CmbQx4ZgOj1eSgxS3iqTr+hX8FWjqDzNXNJlKjzSYeTDRp2/SD6ztnTR1qX+FNMDR/1yduCgywNQOZS8KnqkGd/n8kE6rSuPtdgTcqu1IjfKcKrOujrOVt0xacHcS3gz0/Wzw6nHM21Evfy/NrMz8iQ/MQBKoNP4Fuv2VFA3r17ptQ==; 5:6aHmjHUkpRZw9Mejh9tESjQAJg21FwEtzvuB1TBu9Jzh4rZ2vwixT25mo+La06Un40xybFv9U7x5VEjtO4fW7wM8RoL0kyBiYcFuPgHGCyMQb6s7TYsCZ6T38lpAdvNVydMbUDcq1ZOuMEF4x52TPw64f3B1XaS5esg7WSePsFI=; 24:ZLEIWMhIiPzudjPy6aXg4ZccV6cAjYv3QUXsQ+WYaZC+yIZ2i6HhBF2rEmGUg28xhXVt203e576s3EI2EJdtPKaF7M+jjOa5RJXX2L6bSqc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0764; 7:yEF+e55Kf4w5jSuWY9+lfLwC0S7qoyusEFZOus7kCl387kg/bB1zdqLjtTvp0wYEcM9pzSpRRW9xHRR7XV1pc9WwxOnIu3UUyv9F12rbCI/LMuMkdCI5j8Q2n0UZtDDDIjVXeh65uskhh7p8/cxlxWVmrsQKlB/WlodXL5Sea805Qv87nuwIVg1UaGM7utECGiWcRfx/XAl/AAyKP9L9JSOhQ0X767mH9bY5/b/EPyatP4zMb7KT+seGXZ0y/oMn; 20:dvJOlPSHYWM78cnTNGD61+hOhfLeAZqTo6zi5ID6g3iH++Pb8cCnrtgkEhWs4aI/f234hZ5S+ejaJNYf2cZ7MWARllZRbE2yKM1ve+933AX4mtMO49LI5O/6ARO7uMmGE0GPbepjTh6S97MmShxefIRUTiTNWbIY+iTlLcgneTApiEbPco3TC3T1U0A51FGIl66Oxis7YNp51rP2xrFrjr34NZuyOdv0TDxekeYs/oNyEdXcnHiJq6LywR9Cmjoy X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 13:12:22.0572 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38daff22-ba98-406b-ccf2-08d5931b3619 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0764 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, Vijendar Mukunda , lgirdwood@gmail.com, Akshu.Agrawal@amd.com Subject: [alsa-devel] [PATCH 3/8] ASoC: amd: dma descriptor changes for BT I2S Instance 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 As Stoney has SRAM memory limitation ,to support playback & capture on both the I2S controller instances audio buffer size is reduced to 8k. For playback on I2S SP instance sram bank 1 will be used. For capture on I2S SP instance sram bank 2 will be used. For playback on I2S BT instance sram bank 3 will be used. For capture on I2S BT instance sram bank 4 will be used. Signed-off-by: Vijendar Mukunda Reviewed-by: Alex Deucher --- sound/soc/amd/acp-pcm-dma.c | 106 ++++++++++++++++++++++++++++++++++---------- sound/soc/amd/acp.h | 41 +++++++++++++++-- 2 files changed, 120 insertions(+), 27 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index a61c4e0..6da54ab 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -37,7 +37,7 @@ #define MAX_BUFFER (PLAYBACK_MAX_PERIOD_SIZE * PLAYBACK_MAX_NUM_PERIODS) #define MIN_BUFFER MAX_BUFFER -#define ST_PLAYBACK_MAX_PERIOD_SIZE 8192 +#define ST_PLAYBACK_MAX_PERIOD_SIZE 4096 #define ST_CAPTURE_MAX_PERIOD_SIZE ST_PLAYBACK_MAX_PERIOD_SIZE #define ST_MAX_BUFFER (ST_PLAYBACK_MAX_PERIOD_SIZE * PLAYBACK_MAX_NUM_PERIODS) #define ST_MIN_BUFFER ST_MAX_BUFFER @@ -320,42 +320,99 @@ static void config_acp_dma(void __iomem *acp_mmio, u16 ch1, ch2, destination, dma_dscr_idx; if (audio_config->direction == SNDRV_PCM_STREAM_PLAYBACK) { - pte_offset = ACP_PLAYBACK_PTE_OFFSET; - ch1 = SYSRAM_TO_ACP_CH_NUM; - ch2 = ACP_TO_I2S_DMA_CH_NUM; - sram_bank = ACP_SHARED_RAM_BANK_1_ADDRESS; - destination = TO_ACP_I2S_1; - - } else { - pte_offset = ACP_CAPTURE_PTE_OFFSET; - ch1 = SYSRAM_TO_ACP_CH_NUM; - ch2 = ACP_TO_I2S_DMA_CH_NUM; - switch (asic_type) { - case CHIP_STONEY: + switch (audio_config->i2s_play_instance) { + case I2S_BT_INSTANCE: + pte_offset = ACP_ST_I2S_BT_PLAYBACK_PTE_OFFSET; + ch1 = SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM; + ch2 = ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM; sram_bank = ACP_SHARED_RAM_BANK_3_ADDRESS; + destination = TO_BLUETOOTH; break; + case I2S_SP_INSTANCE: default: - sram_bank = ACP_SHARED_RAM_BANK_5_ADDRESS; + switch (asic_type) { + case CHIP_STONEY: + pte_offset = ACP_ST_I2S_SP_PLAYBACK_PTE_OFFSET; + break; + default: + pte_offset = ACP_PLAYBACK_PTE_OFFSET; + } + ch1 = SYSRAM_TO_ACP_CH_NUM; + ch2 = ACP_TO_I2S_DMA_CH_NUM; + sram_bank = ACP_SHARED_RAM_BANK_1_ADDRESS; + destination = TO_ACP_I2S_1; + } + } else { + switch (audio_config->i2s_capture_instance) { + case I2S_BT_INSTANCE: + pte_offset = ACP_ST_I2S_BT_CAPTURE_PTE_OFFSET; + ch1 = ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM; + ch2 = I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM; + sram_bank = ACP_SHARED_RAM_BANK_4_ADDRESS; + destination = FROM_BLUETOOTH; + break; + case I2S_SP_INSTANCE: + default: + pte_offset = ACP_CAPTURE_PTE_OFFSET; + ch1 = SYSRAM_TO_ACP_CH_NUM; + ch2 = ACP_TO_I2S_DMA_CH_NUM; + switch (asic_type) { + case CHIP_STONEY: + sram_bank = ACP_SHARED_RAM_BANK_2_ADDRESS; + break; + default: + sram_bank = ACP_SHARED_RAM_BANK_5_ADDRESS; + } + destination = FROM_ACP_I2S_1; } - destination = FROM_ACP_I2S_1; } acp_pte_config(acp_mmio, audio_config->pg, audio_config->num_of_pages, pte_offset); - if (audio_config->direction == SNDRV_PCM_STREAM_PLAYBACK) - dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; - else - dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH14; + if (audio_config->direction == SNDRV_PCM_STREAM_PLAYBACK) { + switch (audio_config->i2s_play_instance) { + case I2S_BT_INSTANCE: + dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH8; + break; + case I2S_SP_INSTANCE: + default: + dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; + } + } else { + switch (audio_config->i2s_capture_instance) { + case I2S_BT_INSTANCE: + dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH10; + break; + case I2S_SP_INSTANCE: + default: + dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH14; + } + } /* Configure System memory <-> ACP SRAM DMA descriptors */ set_acp_sysmem_dma_descriptors(acp_mmio, audio_config->size, audio_config->direction, pte_offset, ch1, sram_bank, dma_dscr_idx, asic_type); - if (audio_config->direction == SNDRV_PCM_STREAM_PLAYBACK) - dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH13; - else - dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH15; + if (audio_config->direction == SNDRV_PCM_STREAM_PLAYBACK) { + switch (audio_config->i2s_play_instance) { + case I2S_BT_INSTANCE: + dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH9; + break; + case I2S_SP_INSTANCE: + default: + dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH13; + } + } else { + switch (audio_config->i2s_capture_instance) { + case I2S_BT_INSTANCE: + dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH11; + break; + case I2S_SP_INSTANCE: + default: + dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH15; + } + } /* Configure ACP SRAM <-> I2S DMA descriptors */ set_acp_to_i2s_dma_descriptors(acp_mmio, audio_config->size, audio_config->direction, sram_bank, @@ -385,6 +442,9 @@ static void acp_dma_start(void __iomem *acp_mmio, case ACP_TO_I2S_DMA_CH_NUM: case ACP_TO_SYSRAM_CH_NUM: case I2S_TO_ACP_DMA_CH_NUM: + case ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM: + case ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM: + case I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM: dma_ctrl |= ACP_DMA_CNTL_0__DMAChIOCEn_MASK; break; default: diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h index c86bef4..b697dcb 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -11,17 +11,29 @@ #define ACP_PLAYBACK_PTE_OFFSET 10 #define ACP_CAPTURE_PTE_OFFSET 0 +/* Playback and Capture Offset for Stoney */ +#define ACP_ST_I2S_SP_PLAYBACK_PTE_OFFSET 0x04 +#define ACP_ST_I2S_SP_CAPTURE_PTE_OFFSET 0x00 +#define ACP_ST_I2S_BT_PLAYBACK_PTE_OFFSET 0x08 +#define ACP_ST_I2S_BT_CAPTURE_PTE_OFFSET 0x0c + #define ACP_GARLIC_CNTL_DEFAULT 0x00000FB4 #define ACP_ONION_CNTL_DEFAULT 0x00000FB4 #define ACP_PHYSICAL_BASE 0x14000 -/* Playback SRAM address (as a destination in dma descriptor) */ +/* In case of I2S SP controller instance, Stoney uses SRAM bank 1 for + * playback and SRAM Bank 2 for capture where as in case of BT I2S + * Instance ,Stoney uses SRAM Bank 3 for playback & SRAM Bank 4 will + * be used for capture.Carrizo uses I2S SP controller instance.SRAM Banks + * 1,2,3,4 will be used for playback & SRAM Banks 5,6,7,8 will be used + * for capture scenario. + */ #define ACP_SHARED_RAM_BANK_1_ADDRESS 0x4002000 - -/* Capture SRAM address (as a source in dma descriptor) */ -#define ACP_SHARED_RAM_BANK_5_ADDRESS 0x400A000 +#define ACP_SHARED_RAM_BANK_2_ADDRESS 0x4004000 #define ACP_SHARED_RAM_BANK_3_ADDRESS 0x4006000 +#define ACP_SHARED_RAM_BANK_4_ADDRESS 0x4008000 +#define ACP_SHARED_RAM_BANK_5_ADDRESS 0x400A000 #define ACP_DMA_RESET_TIME 10000 #define ACP_CLOCK_EN_TIME_OUT_VALUE 0x000000FF @@ -36,8 +48,10 @@ #define TO_ACP_I2S_1 0x2 #define TO_ACP_I2S_2 0x4 +#define TO_BLUETOOTH 0x3 #define FROM_ACP_I2S_1 0xa #define FROM_ACP_I2S_2 0xb +#define FROM_BLUETOOTH 0xb #define ACP_TILE_ON_MASK 0x03 #define ACP_TILE_OFF_MASK 0x02 @@ -58,6 +72,14 @@ #define ACP_TO_SYSRAM_CH_NUM 14 #define I2S_TO_ACP_DMA_CH_NUM 15 +/* Playback DMA Channels for I2S BT instance */ +#define SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM 8 +#define ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM 9 + +/* Capture DMA Channels for I2S BT Instance */ +#define ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM 10 +#define I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM 11 + #define NUM_DSCRS_PER_CHANNEL 2 #define PLAYBACK_START_DMA_DESCR_CH12 0 @@ -70,6 +92,17 @@ #define CAPTURE_START_DMA_DESCR_CH15 6 #define CAPTURE_END_DMA_DESCR_CH15 7 +/* I2S BT Instance DMA Descriptors */ +#define PLAYBACK_START_DMA_DESCR_CH8 8 +#define PLAYBACK_END_DMA_DESCR_CH8 9 +#define PLAYBACK_START_DMA_DESCR_CH9 10 +#define PLAYBACK_END_DMA_DESCR_CH9 11 + +#define CAPTURE_START_DMA_DESCR_CH10 12 +#define CAPTURE_END_DMA_DESCR_CH10 13 +#define CAPTURE_START_DMA_DESCR_CH11 14 +#define CAPTURE_END_DMA_DESCR_CH11 15 + #define mmACP_I2S_16BIT_RESOLUTION_EN 0x5209 #define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01 #define ACP_I2S_SP_16BIT_RESOLUTION_EN 0x02