From patchwork Fri Feb 16 07:33:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 10224121 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 63FC9603EE for ; Fri, 16 Feb 2018 07:33:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5356E29095 for ; Fri, 16 Feb 2018 07:33:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 473C1290B3; Fri, 16 Feb 2018 07:33:05 +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 28F2429095 for ; Fri, 16 Feb 2018 07:33:04 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 14335267D79; Fri, 16 Feb 2018 08:32:24 +0100 (CET) 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 A4BF7267D91; Fri, 16 Feb 2018 08:32:20 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0085.outbound.protection.outlook.com [104.47.34.85]) by alsa0.perex.cz (Postfix) with ESMTP id 37A1A267D81 for ; Fri, 16 Feb 2018 08:32:16 +0100 (CET) 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=juj0i4vC7HrHjgiL/P5FrIkJa77TL1SqqrlI74EZjKQ=; b=tpC4Ep1IN+GNI54XU76+NiGzAYusuDamEqMYoP75VKhdQGXDGtL623QnJFSmVny7pW1G0s3MOtFcplQosAhhZGr4cbNDHRlnU3j84lX4xGBlmzLVUE/2Oc6YL9qn2sfHe6DwKLSLP/uFbDIWvaYYTV7Tdfj5ML2OxD/hXCtC9s8= Received: from CY1PR12CA0077.namprd12.prod.outlook.com (10.163.230.45) by BY2PR12MB0259.namprd12.prod.outlook.com (10.162.83.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Fri, 16 Feb 2018 07:32:13 +0000 Received: from BY2NAM03FT051.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::205) by CY1PR12CA0077.outlook.office365.com (2a01:111:e400:c42b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.506.18 via Frontend Transport; Fri, 16 Feb 2018 07:32:12 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT051.mail.protection.outlook.com (10.152.85.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.19 via Frontend Transport; Fri, 16 Feb 2018 07:32:12 +0000 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 16 Feb 2018 01:32:11 -0600 Received: from LinuxHost.amd.com (10.129.12.246) by SCYBEXDAG03.amd.com (10.34.11.13) with Microsoft SMTP Server id 14.3.382.0; Fri, 16 Feb 2018 15:32:07 +0800 From: Vijendar Mukunda To: , , Date: Fri, 16 Feb 2018 13:03:49 +0530 Message-ID: <1518766434-7911-5-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518766434-7911-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1518766434-7911-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)(346002)(396003)(39860400002)(376002)(39380400002)(2980300002)(428003)(189003)(199004)(2906002)(4326008)(48376002)(305945005)(356003)(478600001)(50226002)(86362001)(36756003)(575784001)(39060400002)(68736007)(97736004)(8676002)(77096007)(76176011)(26005)(106466001)(50466002)(105586002)(7696005)(53416004)(336011)(186003)(5660300001)(51416003)(47776003)(2950100002)(8936002)(16586007)(316002)(6666003)(2201001)(54906003)(53936002)(110136005)(81156014)(81166006)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0259; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT051; 1:Nio0yJEnUMmMYHNnA5Rp0qIe1y8onZGR+oOZyLqWWMSnSeAw0jQ9zcvf1C2XIKcO8fDpfMGdr7yTE/BRKPq3bM+fXg+KYulQkcJbmeDpSuSjZdCEVyHSyl4f9XbZSHOG X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6a62e5c-767f-46c2-4b2c-08d5750f6531 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR12MB0259; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0259; 3:pNZiPg0gyHB/Kol6VKg7IR9Im9cgIjx+XglewkdrYncRN4eU0qbgT0Nj4sezwVNsNXB4XlAQSl7P/eBUJDWWgpDoMCx7Pm7njQTS0d+Zg++sBk3m7LkbK6BuqTqZyg0p7IgKqk1p+vSbRXxpAk7pWZU+XdTlXc1AJUrBCg+oJcHfwOBaRz218IFXdXxr0VuhCBPRNphSY+eenunHxYJoIu94PYMrF0uJ5N5s9CathTMrTd4TYMrUeQ2fO0lXpH6Jmt+G7/65MWtE7Abe3HV+0z0XXXU6SL6eXWXrq2MiiAVQMLxKEiLvNK1l6M06wJ8vhnM4bdfBPYU4IMJduXsuwOwpoKiXkM+YaCN9uGBNrFc=; 25:+NWO4cg041bxxKRRy7WKCWqxtfDV/Xeh+E8hyWQZDHqwcbv9RESIXEyIG/dk7WFqthUSAn2vfD11At9L/YhLW+TGOjfGnk7/dclHZ5BPovTuTFMnu9fu1BGChUYHMszV6Y+zYIbE1BCR0N8Gms9Zf5HB0t0oQtqF8UMLv9h5ghZdHzVqS6RY6x29I2Q36q/JVOF3fZfr1cEk1GwDJTxFNlEpDesWWtrmFw9bM9OK59SLv/8X/ccGaqQiTP9vUdmTgT692TH8viuDKrFH15A3/uMfXg+HLnlYiBNjTXA+HUuYlU9I3nZUy6h7lnQp0+drAblogbBWLTH0OS9QTzhZmw== X-MS-TrafficTypeDiagnostic: BY2PR12MB0259: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0259; 31:+vkDFaH1JfLgSIXLQUiqR+MYwROJdiHxhpOmMaOlPkw7yh8nZND5YZjZOKOzNK+a87Lz/+kmYNEny0gQa7vR7mIgG9iBrgWlw1WMxBWLW0KNNJyLVuk/NIAiRra/Wl19Rn50ZMSuBTfMcloVG8jG1doezAYVWOrk65OzJPhnQo7x+SLw8gwui4TZ4kq/qmYd7v8fbRK+3nSfeijIqqeEIcxW/p6/c1vtMccqcRVGvsM=; 20:JNgAUjMClXdC9uweOKWHYVJbvp36UXbJEwG50L+DaYxf/Z1E6UhNk5mEhlOG8ARrIi9gC6FdRmKwLvLUMLgYnUrGEJoH7BA/IO4j26ofX54qZ1jNkwHJSRmkDmq99xZF4Vlmr4N2zDtxnGbpevi0XFQ63EeIgYTN4leWruth/4WVey73F18gf4ps0Vk+jCC9WzCFWAp2Ohzp7j1xRpsTmu7sPRnFvVKP5U19S8hDO1SQgWAz0iWmqyJ4N6KkqnmwZRxKojnGuTY78zNFR/sOY2rnX7ic+9do94Q1x52TEqdXScjjKNa2BfEPpUuKPeOmCyG5DPC68+jQZOaZVC4shDxCd++WzNym4cy2iObjoi8Hk4r4fWoD9G41UptbTcaBcb4liBHDkKVIQL3kZl2GXb2fp5yF/OcRlYcnWJ5D1y6wXTLt+s9R1bjVBqlvFdXrVrr7Jpq9UNCLfe4maxrpIeKOn7aqRpQBWqU0Ma+m6oZZYmILwikbQZ5jejEnm3Ab X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(2400082)(944501161)(3002001)(93006095)(93003095)(6055026)(6041288)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:BY2PR12MB0259; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0259; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0259; 4:sDoGKAcSjy3S6mL61sQ2SBAHhhGuLAY8l1OXizcQmzd/tQCXFxPaAjKYKQ9aLR+JGw2QKcHBOjPkJeMUQxB5kcCepQP/KHTZZZ2F9n98pa8wcPNg00OTTEGgLYCJ1QezulBk2a7BsceiBhPSdrCrIXRRxI3WDntiQDU0zQ2WPg/38pYxKW4yo8VMfHpGVb0f4Q20BNT0FomZ1EggdywvQQSnmoAmjnZo9q5N40FHYwYl+3UJmX9dVkRe+BhFK6ieE06mWVtyRErO9r2tvBYHOp8IfPwoA5qIdDndet9buGEKiHlYzVK15le0w3ORAWac X-Forefront-PRVS: 0585417D7B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0259; 23:c5XkYQQb9dFGWinZAhV8YHnACvvdqx72+cvs7Luag?= =?us-ascii?Q?GADJhJE7c/HwBvrywETM3O4forcd7bpdX2s1MF1NBYIhQo3XcIBMEXMhrnCI?= =?us-ascii?Q?ikdR7InaVkiTtckF3fq+RjTPyLft9gWsUJpGoOGwmTf9H+MxdoE99ikHOeFX?= =?us-ascii?Q?tiHOtFwzvaKIEpbPtiybW5jAHL66DFIgd5AIMxzAHEr/LmP14sRTiTZDzx2U?= =?us-ascii?Q?RNbttB04qevMY1FJgUduR0+Edg9czESXkJ972TrtatGJAdJaRmQLU8VAykad?= =?us-ascii?Q?52trIJrm361+RuvYTAsMIV48qRA6m8Pu39q4tA0PHa7HGdRlewRFT/6OZflT?= =?us-ascii?Q?AcxMgzHezY4it+gAsVDmmnnY7IR0IdlRllqC1hSctSk4H6ZS+/7idc0nW9dE?= =?us-ascii?Q?d+dA6MBjLf92TWPmeFaLJcz3FP2gQ+EXC8Qf7bCGYZ8x7B2DUJ4SYW2UUMH3?= =?us-ascii?Q?EZBIWbpFoguR1mG7KKNTwmHKKOUx/4AgWSe9A9K7pD5cCNHs4jzioIQttqQT?= =?us-ascii?Q?DYzFPYwPKBePhHjWtFgd8t7NgWKhVDv9el2yMGaC75F2TyAUIlfnjK6lhaoQ?= =?us-ascii?Q?Gg+iwl/YXNx0T1tTDLNgR1YJVEDLjzDsQMIsoOqZK2iubYDjy7zdaONWEIk/?= =?us-ascii?Q?O1R31mU/FCWddyEuQnaOsU3xq60isMK36vaShHHWc5CSxSGhhpVV8VjTLQNI?= =?us-ascii?Q?QQWa8DOKgqLSkVxR1zawQhsYBCjMjVL1xJu3nPDJ133FU3Erox+nR22PNCz1?= =?us-ascii?Q?0/nX5/AlzsPSI0rcLhsvDjf4FW+8tqe5rSonlYOx5f6okXQ1Bp6RVjl4kyTc?= =?us-ascii?Q?E54Ij8Ta+gbskl+m/SKxJLvo7dSIpMNelVqRoXVKeTATdMk14WaZiwVPWllb?= =?us-ascii?Q?nR1EPGvZyYnM3Xf5MrqZj7Nu9SFklGe+D8dIzoFzHzPSWBfztyOhbTvsnAcd?= =?us-ascii?Q?5x+Osf5qBIOJcv0wrKY5pe430tNxG7H6FfmXahZfw9FTKg7kDzm6ivb3Q8tQ?= =?us-ascii?Q?bz3ZQeRrZRhgawRg12ifqmz4XwhppK9PgGxAnZHrnfKKrdu9jZo/oUCTO1pp?= =?us-ascii?Q?jsl9OhMCOt9MuRE1BBgdzX0Ddut2iF2izMZOV5dzc0ItdYZrTXcgpPWKrrrc?= =?us-ascii?Q?tv4N4o+Llc=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0259; 6:7dwCN/ZuUxjzNID2Dihrgt6VhTqLil791uew3yMecUI1X8jzl4Aarb7jNtWR2pP2RU+jH/CEJVxgYUbQ8Ad5hltkfNRdyO8RGxOwNnl/DeHTt2u+LLkK6ZEPYD5KlU2HaFw75GRX7IBvs+WjLIkXTx3btXj1rD5L8pSR4bQ1CFDpCIx3cE+5QfW28KBJXOZ926nUKOlELNieKtcgS91aMqBPzXryZT62bUL9hQ0otepbvHz0OE0bLi/QTaHiSRy3OeuJFRP6k1T70PZJ+9S4Oalq8juCzVp+QLQDo9ws2Vuql5XFk0k0gH7LP9ih7ZNW+bsCmvf6xccDxYBwP5HQ71wWXVFo1F1BC0foY3WZcpA=; 5:4zToe6s7DwmjGMM6UfElO4Ea6x9Ilt/tY3vhMAU/iPm4Pj+1kLRqYRTY8b7WQABV5cWWiPl1+Xc7m4NM5VQN/8bEZf++m3PE48/Q9hFvxyYyCwnqWA/LcZ0Ee4cJhAdF0Q9oJw4/zaLlqEvz+dV9YDXqT81HGl/Bw+qThXWBw9U=; 24:K41CGv3cO4pLuqOdsECscIEPwJT0uizf0SOkLnVfcKRm+6zVKwGIIUGy+GcSvYrJusS3KRGBoJam6z83HWMM5ntkMP2Ya1l9OMBCshB4DBw=; 7:QfRw6711IKfqBp8LF+jDFMDfJ32q3nOIoimUYlRNcOwrf9XofJPGNlUaryhvrj24eRjzrqG+7NTGjH34JH1izhCJlGwJwd4cDgQzYOTReHJFAsu7TrEk2RFK/aWQuPN2uITaHRP4Qj8Gux63sDyKb+x4eCn+pUdISmNLLYFo0iNV0e2genI35T44eKHLoaD7lXEP6MEuJoM4Z5XhrWeSAuin6sHzpJ8vHG4e+n6DQ67ahO0gu4oEIQql7nPiNv1S SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0259; 20:wynUunncv7RTcuq+kPr/giCucOT03VVWC/7LPFKKLNIVAzX49VvBMxRIieVWgHuM4r/57Z8omwaN5tYb4fXcAUnytgdVTw7aUF06hfhshKoOxCGj5KTXnjygKeH+MAL0H7/u6pHnjZktP5Rk4VtygjivOG1x6/wqooZ7O4MHm1nAtVf4EN6yh1F2ZqXXo35h+74d03c62YaYoPC3+O5yCHF4W2MmCpMGDKwXJ6qdvFNwdH8f5xGlIMoABJmWBgdV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2018 07:32:12.4075 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6a62e5c-767f-46c2-4b2c-08d5750f6531 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0259 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, lgirdwood@gmail.com, Vijendar Mukunda Subject: [alsa-devel] [PATCH 4/9] 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 963ffa7..aaee70f 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 366474f..0292433 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -10,17 +10,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 @@ -35,8 +47,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 @@ -57,6 +71,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 @@ -69,6 +91,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 I2S_SP_INSTANCE 1 #define I2S_BT_INSTANCE 3