From patchwork Fri Feb 16 07:33:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 10224119 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 11699603EE for ; Fri, 16 Feb 2018 07:32:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00D2E283E7 for ; Fri, 16 Feb 2018 07:32:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E779028844; Fri, 16 Feb 2018 07:32: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=-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 E6A5C283E7 for ; Fri, 16 Feb 2018 07:32:50 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B8EB1267D66; Fri, 16 Feb 2018 08:32:17 +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 0694D267D6E; Fri, 16 Feb 2018 08:32:16 +0100 (CET) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0046.outbound.protection.outlook.com [104.47.40.46]) by alsa0.perex.cz (Postfix) with ESMTP id 74601267D84 for ; Fri, 16 Feb 2018 08:32:13 +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=h9oeA5TuCMHzZDNI6P7TZ6FP5O2/9LxDxTxtl0nQ0ew=; b=itD3C6I8rdgR/kK/49glC41gBAYe3TzZCSAcYEhpz3VVtyZAauMz6naRmI++H72vUiLzo2hx91Yie81S/t+jEXvS2ARJP8HFpWaR4hgMnMXGQrZC9SCDxBnFraA3YVbWMnMgD6IYX4GWljIG50DVvCvjzRJvY+4r1zRKk/PhCnk= Received: from CY1PR12CA0056.namprd12.prod.outlook.com (2a01:111:e400:c42b::24) by DM5PR12MB1241.namprd12.prod.outlook.com (2603:10b6:3:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Fri, 16 Feb 2018 07:32:08 +0000 Received: from BY2NAM03FT005.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::201) by CY1PR12CA0056.outlook.office365.com (2a01:111:e400:c42b::24) 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:07 +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 SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT005.mail.protection.outlook.com (10.152.84.94) 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:07 +0000 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 16 Feb 2018 01:32:06 -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:02 +0800 From: Vijendar Mukunda To: , , Date: Fri, 16 Feb 2018 13:03:48 +0530 Message-ID: <1518766434-7911-4-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)(39860400002)(346002)(376002)(396003)(39380400002)(2980300002)(428003)(199004)(189003)(305945005)(47776003)(5660300001)(97736004)(53936002)(59450400001)(26005)(478600001)(4326008)(186003)(316002)(77096007)(336011)(36756003)(68736007)(16586007)(39060400002)(110136005)(8676002)(54906003)(81166006)(2906002)(106466001)(8936002)(50226002)(2201001)(81156014)(105586002)(86362001)(356003)(50466002)(72206003)(48376002)(53416004)(7696005)(6666003)(76176011)(2950100002)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1241; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT005; 1:XjCrxNNH16iYSz/q4k0MQcN1LURQeIQF3ZXGHr50cYSPx9llrfz7lPAfUj01C4duYoT9vC8ImZ1j8Vzi+piFWOWn9nZLWb5d80nvcOzdz1KzEyjhGwYv8rdPbOUJZO/l X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36384bb9-3810-44fb-5016-08d5750f6241 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DM5PR12MB1241; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1241; 3:vauOwaeJPNZiPf5lUrV+05diu4PBw4mbi24gNuYpt/nJJdNMm1CwpLfLdgnERop1trwysgb+IQsCdBw3oTOJrkYVgvJ6v8ZmHMWwodH25vnL8oaAesd1Z9TG3BEk8hj2/RStf1GVjTKC1nFam8yOYD6URKJivynvg7lPiCM9BSyTuATTi6qe88Z4lkpRa1bW3HhyPBOXQQOnIRfqGY1LOkQB7j4r5T+0yWpYqlH3FrJiNNdBGUAxnGrzPfdYtj+0kysdcX1x+2dr3CksYrx9T7FfuUMFC+Iu6ZVlF6jNn8n5M5bhvZIfOZkK3BwpBSWTi9nu+poxV/0vjb86Lt9SGppOpt5BszE592KjKE3zEig=; 25:AE75J8dyS7a7xe1yHFv+VDba6EbMbRmm+tDh/kKhg4TZFr/CHLys4fqFc/l/Pd8H8cJEIDhWJb6KLbrdNoK9Of9lrjEEYCd9eSDE4DuPjG5XTNs24fh1fYZPJ9r53Bf7V62GkxEzpvTOyClz2c6K6Pa6fPvgIMeWgjzMTxRYWeI7IqbCFETAlmjIa93xZU3sR1bUI3bdnS/Y5JgqqTguFhZl5MPTGGMwZ0D/n+Jzj8WAgjoQ/wyf2ZC785AZuxFSwsppU+KAiiADoN9Xs+v7+s6wX0KJS9HgoKFonrssiA+zA0Uko0eqRGfjhET6b7lmGYr6b0PStz6YtIhBhZ0yKg== X-MS-TrafficTypeDiagnostic: DM5PR12MB1241: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1241; 31:TNO3ypGAp23GIS6rrLI99bhu8caUGHbzesKi8lYahsY8XFdX3F4iqkxlbWN7kT5J4DFyH4BvxuzwEulXNz1AkKPOyN2r+yKmldr/N+5BNCtueO1nuYMkLJVREH30aZGtxb3poScOIq886Ajv7QLkZ32TG9j7J5aktPFduoGkQqU8kFs3BmADEnDJ11MfRUevhd6WSgnkhMF/ZlCCHaXr32kcNUQJm5uSDCj39p3K2sA=; 20:66LJPrwz+PT2L+xwGySsj/fd3P8nvk8XAZHYLjWxvwXXYiatd5XrZyjLmqhgI4KnF11hxarPY0MjC92oWMKb5C7uLUQ8I0qYgZintt9nIedUx9NytkuSl04Up77K65CJqDY54n26gc+GOpmcHh/4RVAUe04lPBb293SWN47m5lUfak5jDfOKnJR1CrcqzrbAsysC+jUYF4zxyJfRaJEcfOB3Y9M7hEOyjWoAlUsuxVij9jjFT5RqaoypmoKIXiZYUUdPwftq2GNwhybB6AG1x2Z6OxbQQQ4fQ/ArgwSaYcs/C4bR6g4lDqKbOpStr89DbZWlRs3H6Gk43x54Epsvu5PClhGY4nMutrrVXABd0uhvgYb+NRvyjMMmVYf+Or0P5A9Vk2CQBb+PYG+CRt3riIU2zd6zHCfV4K0jWZDKEZY8norfGQAEeDUTIZe+lEScRd3JH4bvYl3R2w0dSXZsgNKINF2UahF4jhnpcButeUjZ36kjB69wTSRROGKYUZKc 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)(93006095)(93003095)(3231101)(944501161)(3002001)(10201501046)(6055026)(6041288)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR12MB1241; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1241; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1241; 4:2jg+SANFGCDaClEAdRg2aV2zygq066PuNaf539v+jQPa3uZ+LvDbPx16ZVGehSmnoURkDGQdSdT3l76QCv4pXfXmz8HBTZbkXYdzc7wn/BYiVd0J00mKziqGW+04bK8QNmNCeOfxQj7s/tvPhgG167OqMY5BOyqCbt7Wv+8zB/Kw7bWf3xkcUrOV3W5J0x/XmkSsNLeee0Z3chCx5ZPxkNlniJGCeOiXHQpPSbxLcc9gDdFJb9QSZiSRpD3RKAtKkFDjbKeDG74sCPNdsy1UWKoXg06J/3j5t8TjibjgUgvey5oe4oM03WTzhZiHFcsh X-Forefront-PRVS: 0585417D7B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1241; 23:stg8Rqr+d2ViJD9dP0VXO1Ho/rz4ojMP9aert2Qq+?= =?us-ascii?Q?hFsQ45/9UnxNoLPwo3d8fgJ5z3ALvKnXosX2BOqKPUd5p8B4uTZuZhq9Ao4M?= =?us-ascii?Q?QYl+Dh1aHpPqtC+9xkd3Q9qbQhYj6MWn2zaY5u0UbpEgn/lzTx0KmbTacTOf?= =?us-ascii?Q?R/1Owo9lzIAKXtd5Nps2E5LqOGIDtjFewVjb7a/K0Tug3zEUILHhrk3tumj8?= =?us-ascii?Q?yRzkAbkOqK51UNnpCoucZQUUCUjjVFqOV5FwgxGQ484irwmdnfl/OqM/jnoI?= =?us-ascii?Q?NiY3Eee18oV0X7H30OlWgf0y/21WMQsfnDWBTKqvP33OyhRm7stIjQCLESjO?= =?us-ascii?Q?2H2xeH7JLPKR5cne4WxXUR6QYLsooBqXyPGoAMZncea5bZpr0dlANRSZltwS?= =?us-ascii?Q?8CSmvEY/Cr0BXYePVZsQX2YnAwQRLD6vakqEoMZ3iqgMTU/voYtIu/+XDFhT?= =?us-ascii?Q?Ffis7rrx+nHWroCzsKZMMN6sNSWq4ta8Y8Z8MNqD8k3zuoKMJk+vE+nS341m?= =?us-ascii?Q?lbhURgTcdMilSqC9O15KP03xscDLMdZSnQDtuvSNoplzwjG2I9fl8yp0oeaM?= =?us-ascii?Q?m/EIKSv5oB3yDwD3wqlKDmU8I4kaOsP/mt5IVv0kEH9mOxMkugp96GYNA/RJ?= =?us-ascii?Q?CjYwaIC7vti77TG7rvNFhbQcINHsMf9bz4lYjinHeyVKuLuF8e/2Ow48gAAI?= =?us-ascii?Q?fEYKjpDHM1j1m8EH9xl27UdLqiaGzuJLVftD+S9vyGC88ZpY1rf05iUrkl2L?= =?us-ascii?Q?2HeLMTovRMTh00zdx/od2beIU59ff6QYQGr3MZRI1dJGwHo4suwhueuzhi/Q?= =?us-ascii?Q?pt25ST/vSoeZt9E/kYyAwoyrzlQylN7ZrHTt/2gcJZd+02ySGKlrObYkHNlQ?= =?us-ascii?Q?3ToZOhbkZuUEKMb9imXCNrYewPAS5kpHeaIKkbKZokkfAIflHKC8wUTN1CPl?= =?us-ascii?Q?lAchvbs2pCM0x/mxWaa61adJCYrXPQJ1UnLOi73K+WctzU8heCWwpriQJDZw?= =?us-ascii?Q?51byjT6N15FD3ZKQmj8EwIpaxLqwXAjhuqdRHuaFHf36YyxrFaZ8KVELj1KA?= =?us-ascii?Q?4VVa6Vql0YXwAR7suqnZnjdpaBBSQfpOy/osb17u2yN+0z5J49m4Ma72YDm4?= =?us-ascii?Q?KloY4nbIi0=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1241; 6:BsFmDhm8a+VTUJNIcTYDtkiv2SxFhTNa4EjbfOeu3Ia3jOF3/2qkjfbKrkO7wYOzxYPatz3vN27A3BSTeu7jh1lRfG+tQ/bf31uw95gbjf5t/XMbYtHlcYTptnz8mjhEsDwe733ddbVeKpvwG6gegRaVKeJ2w7BiqGHY2WLHeKdZjLfxZZYsVolDPZT60csSjmonZh6tc4hZQpFPpVusJwlsNvYC3C/4yzxwbcbJJ2318Q1i30wSF/ujZzxznkd8NiUW44U2aWZjGHIWPgQ0lzpCF0u98xv3f+WK3bsnuLjrvSazij7BgEv3/7VdBSTOTt0HzJt/mn1VwPEcJ7KrzYShgo3EZDmIao6jU2HAXEE=; 5:soGe68ZttSgmMj7umgQxsyzYMXN7x8WQLuVdNGQUOpm8p9jfpVBLT7GEpCMvCFvnuTwwO302zY6Sx7LbayPgjtIe7OsetGCQ4y4MgXRhpJtjkOIDGV/L73RQjxKYG8fZ6OjUblbBJI8fpEFeWoAJXFQ55gerO1STo1Ta8Anny7M=; 24:Pu68UD8pHI0xfqDBoaEuEXNCNjV/fUDq7UExdhpAK4yoLrbxEniGBfC7zi6i0ELy5kUQe1vXAvJs3MeJHgsb0zOWfE0YGjldcC3Rn7qQdvE=; 7:zzon+CYRtSkvmkqsbf7TuAcNHbYgPv1HNgpdyVog0jk3jB99MKqdLE0wwF3/pB6cbBV3DnbfQjqXZCDAK5QS75rGpXbDkn/QjSpHISLprwF31XAwAI+rMft6kySKMvYW5NU/r39YTvx6hheJ+qo8eTg2PHA9wE38Xnag1pFrWld4FnP7/Kve97HgqSdtxxwVeM7xyVF0Jy8r0ZpZO8CPWyPDDNY8L3QsEY4qKkMPrWp0MBWI8hPYLIY9B15OHtYo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1241; 20:QIsNehPY51ez2c4z3Hrl2vSY6yZeG61bTg+ni7kU1IuaNNfuQIwNhitTs5L27liojdfsXA7iCShGjPXaTKpSCcBlz/tqT8nWwN2Ob5aS+mbRCm7JTHW+JomOPYN5oDw3E7/yOEaOBggfyxCoLz/fXEetcEf0R/L1wxhUn+H5ObIveXGoQrXWCvZokshrpXIX+ElEu7z4pwM7HbuSyS2ZwX731uzbHIYecy94neVkolWpVI2eo7G9gUcm7UpocLPc X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2018 07:32:07.4481 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36384bb9-3810-44fb-5016-08d5750f6241 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: DM5PR12MB1241 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, Akshu Agrawal , lgirdwood@gmail.com, Vijendar Mukunda Subject: [alsa-devel] [PATCH 3/9] ASoC: amd: dma driver changes for BT I2S controller 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 Implemented dma driver changes to support BT I2S controller instance. Signed-off-by: Vijendar Mukunda Signed-off-by: Akshu Agrawal Reviewed-by: Alex Deucher --- sound/soc/amd/acp-pcm-dma.c | 103 +++++++++++++++++++++++++++++++++++--------- sound/soc/amd/acp.h | 8 ++++ 2 files changed, 90 insertions(+), 21 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 91c4775..963ffa7 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -717,7 +717,23 @@ static int acp_dma_open(struct snd_pcm_substream *substream) default: runtime->hw = acp_pcm_hardware_playback; } + if (strcmp(prtd->cpu_dai->name, "designware-i2s.1.auto") == 0) { + adata->i2s_play_instance = I2S_SP_INSTANCE; + adata->i2ssp_renderbytescount = 0; + } + if (strcmp(prtd->cpu_dai->name, "designware-i2s.3.auto") == 0) { + adata->i2s_play_instance = I2S_BT_INSTANCE; + adata->i2sbt_renderbytescount = 0; + } } else { + if (strcmp(prtd->cpu_dai->name, "designware-i2s.2.auto") == 0) { + adata->i2s_capture_instance = I2S_SP_INSTANCE; + adata->i2ssp_capturebytescount = 0; + } + if (strcmp(prtd->cpu_dai->name, "designware-i2s.4.auto") == 0) { + adata->i2s_capture_instance = I2S_BT_INSTANCE; + adata->i2sbt_capturebytescount = 0; + } switch (intr_data->asic_type) { case CHIP_STONEY: runtime->hw = acp_st_pcm_hardware_capture; @@ -743,11 +759,19 @@ static int acp_dma_open(struct snd_pcm_substream *substream) * This enablement is not required for another stream, if current * stream is not closed */ - if (!intr_data->play_i2ssp_stream && !intr_data->capture_i2ssp_stream) + if (!intr_data->play_i2ssp_stream && !intr_data->capture_i2ssp_stream && + !intr_data->play_i2sbt_stream && !intr_data->capture_i2sbt_stream) acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - intr_data->play_i2ssp_stream = substream; + switch (adata->i2s_play_instance) { + case I2S_BT_INSTANCE: + intr_data->play_i2sbt_stream = substream; + break; + case I2S_SP_INSTANCE: + default: + intr_data->play_i2ssp_stream = substream; + } /* For Stoney, Memory gating is disabled,i.e SRAM Banks * won't be turned off. The default state for SRAM banks is ON. * Setting SRAM bank state code skipped for STONEY platform. @@ -758,7 +782,14 @@ static int acp_dma_open(struct snd_pcm_substream *substream) bank, true); } } else { - intr_data->capture_i2ssp_stream = substream; + switch (adata->i2s_capture_instance) { + case I2S_BT_INSTANCE: + intr_data->capture_i2sbt_stream = substream; + break; + case I2S_SP_INSTANCE: + default: + intr_data->capture_i2ssp_stream = substream; + } if (intr_data->asic_type != CHIP_STONEY) { for (bank = 5; bank <= 8; bank++) acp_set_sram_bank_state(intr_data->acp_mmio, @@ -1004,34 +1035,48 @@ static int acp_dma_close(struct snd_pcm_substream *substream) struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); struct audio_drv_data *adata = dev_get_drvdata(component->dev); - kfree(rtd); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - adata->play_i2ssp_stream = NULL; - /* For Stoney, Memory gating is disabled,i.e SRAM Banks - * won't be turned off. The default state for SRAM banks is ON. - * Setting SRAM bank state code skipped for STONEY platform. - * added condition checks for Carrizo platform only - */ - if (adata->asic_type != CHIP_STONEY) { - for (bank = 1; bank <= 4; bank++) - acp_set_sram_bank_state(adata->acp_mmio, bank, - false); + switch (rtd->i2s_play_instance) { + case I2S_BT_INSTANCE: + adata->play_i2sbt_stream = NULL; + break; + case I2S_SP_INSTANCE: + default: + adata->play_i2ssp_stream = NULL; + /* For Stoney, Memory gating is disabled,i.e SRAM Banks + * won't be turned off. The default state for SRAM banks is ON. + * Setting SRAM bank state code skipped for STONEY platform. + * added condition checks for Carrizo platform only + */ + if (adata->asic_type != CHIP_STONEY) { + for (bank = 1; bank <= 4; bank++) + acp_set_sram_bank_state(adata->acp_mmio, bank, + false); + } } } else { - adata->capture_i2ssp_stream = NULL; - if (adata->asic_type != CHIP_STONEY) { - for (bank = 5; bank <= 8; bank++) - acp_set_sram_bank_state(adata->acp_mmio, bank, - false); + switch (rtd->i2s_capture_instance) { + case I2S_BT_INSTANCE: + adata->capture_i2sbt_stream = NULL; + break; + case I2S_SP_INSTANCE: + default: + adata->capture_i2ssp_stream = NULL; + if (adata->asic_type != CHIP_STONEY) { + for (bank = 5; bank <= 8; bank++) + acp_set_sram_bank_state(adata->acp_mmio, + bank, false); + } } } /* Disable ACP irq, when the current stream is being closed and * another stream is also not active. */ - if (!adata->play_i2ssp_stream && !adata->capture_i2ssp_stream) + if (!adata->play_i2ssp_stream && !adata->capture_i2ssp_stream && + !adata->play_i2sbt_stream && !adata->capture_i2sbt_stream) acp_reg_write(0, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); + kfree(rtd); return 0; } @@ -1083,6 +1128,8 @@ static int acp_audio_probe(struct platform_device *pdev) audio_drv_data->play_i2ssp_stream = NULL; audio_drv_data->capture_i2ssp_stream = NULL; + audio_drv_data->play_i2sbt_stream = NULL; + audio_drv_data->capture_i2sbt_stream = NULL; audio_drv_data->asic_type = *pdata; @@ -1171,6 +1218,20 @@ static int acp_pcm_resume(struct device *dev) adata->capture_i2ssp_stream->runtime->private_data, adata->asic_type); } + if (adata->asic_type != CHIP_CARRIZO) { + if (adata->play_i2sbt_stream && + adata->play_i2sbt_stream->runtime) { + config_acp_dma(adata->acp_mmio, + adata->play_i2sbt_stream->runtime->private_data, + adata->asic_type); + } + if (adata->capture_i2sbt_stream && + adata->capture_i2sbt_stream->runtime) { + config_acp_dma(adata->acp_mmio, + adata->capture_i2sbt_stream->runtime->private_data, + adata->asic_type); + } + } acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); return 0; } diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h index 27803b2..366474f 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -70,6 +70,8 @@ #define CAPTURE_END_DMA_DESCR_CH15 7 #define mmACP_I2S_16BIT_RESOLUTION_EN 0x5209 +#define I2S_SP_INSTANCE 1 +#define I2S_BT_INSTANCE 3 enum acp_dma_priority_level { /* 0x0 Specifies the DMA channel is given normal priority */ ACP_DMA_PRIORITY_LEVEL_NORMAL = 0x0, @@ -86,12 +88,18 @@ struct audio_substream_data { uint64_t size; u64 i2ssp_renderbytescount; u64 i2ssp_capturebytescount; + u64 i2sbt_renderbytescount; + u64 i2sbt_capturebytescount; void __iomem *acp_mmio; + u16 i2s_play_instance; + u16 i2s_capture_instance; }; struct audio_drv_data { struct snd_pcm_substream *play_i2ssp_stream; struct snd_pcm_substream *capture_i2ssp_stream; + struct snd_pcm_substream *play_i2sbt_stream; + struct snd_pcm_substream *capture_i2sbt_stream; void __iomem *acp_mmio; u32 asic_type; };