From patchwork Mon Mar 26 13:12:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 10307779 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 BC404600F6 for ; Mon, 26 Mar 2018 13:12:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C6CD296B9 for ; Mon, 26 Mar 2018 13:12:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91008296BD; Mon, 26 Mar 2018 13:12:17 +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 666B4296B9 for ; Mon, 26 Mar 2018 13:12:16 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4CF36267063; Mon, 26 Mar 2018 15:12:15 +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 62705267076; Mon, 26 Mar 2018 15:12:12 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0070.outbound.protection.outlook.com [104.47.37.70]) by alsa0.perex.cz (Postfix) with ESMTP id 1B3BC266FA1 for ; Mon, 26 Mar 2018 15:12:09 +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=Lg1aXMWLBuR+eP9KW/n1qPfE7WCKB5h87XotfpWObO8=; b=TMDwlYb/gaBkDFKz7vRoMYe0Yl5AHSxZoAPCuqftErwBWMs/VQ5junyxDlVhL9SAJ5rIRd6+SGExk07+ybMYYexp/Q+SVZipuWhA71Ol1JSIShKAJDgs2GnuJlIUjerMRb3EPL/POOmJb2U7+y6xIlW4BLh/jOFjTntUwy739HY= Received: from BN6PR1201CA0002.namprd12.prod.outlook.com (2603:10b6:405:4c::12) by CY1PR12MB0760.namprd12.prod.outlook.com (2a01:111:e400:59d1::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:07 +0000 Received: from DM3NAM03FT046.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::205) by BN6PR1201CA0002.outlook.office365.com (2603:10b6:405:4c::12) 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:06 +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 DM3NAM03FT046.mail.protection.outlook.com (10.152.83.87) 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:06 +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:05 -0500 From: Vijendar Mukunda To: , , Date: Mon, 26 Mar 2018 18:42:57 +0530 Message-ID: <1522069983-11381-3-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)(39380400002)(376002)(346002)(396003)(39860400002)(2980300002)(428003)(189003)(199004)(81166006)(81156014)(8676002)(8936002)(76176011)(50226002)(478600001)(59450400001)(97736004)(7696005)(186003)(77096007)(26005)(104016004)(47776003)(105586002)(53936002)(53416004)(72206003)(51416003)(4326008)(39060400002)(54906003)(50466002)(48376002)(110136005)(16586007)(2616005)(446003)(316002)(11346002)(86362001)(36756003)(6666003)(2906002)(336012)(356003)(68736007)(2201001)(106466001)(426003)(5660300001)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0760; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT046; 1:Cmy4FSINHk57slDGR5qoZaQB3iB4PuX+9ZIAQc46J/DVMALhfd0hZyT9bcIeaEM5mWafhnHOkV/IuoCGPMjVtGy2WnbTaXT6+iaDeTnmXdjs7juqh5ouMUkRDtM0yY84 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c19479e6-b33a-42f1-de31-08d5931b2ca7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR12MB0760; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB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qqFOX+ygtzyHrYZclawQv7E1gvnxSh5Tiy5vBmWt0zivtxQL+5ZyMaaA4fHLiCZIALAokdmEC7dZHv36Xua8M2jsGppuvQcPD/uF+hYzAs9H+ufaWBnDTBajqRvTudC9cSN+c1BkJjSXnAuyeMHHzwoyL0BgnoJgMGA1kUvjuYZVyw5iOwHaUrWWMua/48oR+bF5WCXhzzbQMme3Knn5/qvfU8dCmSupxf4Lw837zSSRrv8042iJQbx/BwyqdApmJaXlLzGVjXdLNZhyh+ixphnbbeJI/rqMfK23fqhB96UEzZImPszK37ad/vzosJFVYJSDALK2goXYcwfPW3jbtMELPE6vDJrKeEzA4jM5CVw5nXOtxtsWeZ/GoxIJHE4VyVfWWygeCBMERPM+P5Umkzk5RWaI0X6gJSwL1RNk0qlUWSpQO3pNHc7kYBJUAI0bMSfcFV3So/mfmeN7+Yy79eFqRSGRoBFCuj 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:CY1PR12MB0760; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0760; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0760; 4:tjqSvbrFzvyljV3J5+KC27r2WICjimeLJ5YxfQ2IK8oSMFBItIMMUo7Q5kc1/dXLoHqamGy9SAx7TNAGWXR5V4LwHCXfDCYqssm0Q0/Vn9DDNh94Y4OvjKq1QsNhYUGZdrBbLepQq/9tGklzeWBxIxdR0EierdXrClXO2sHxTZ1lXVF0Zw0zZFmU/P3HARmi2NNyDnjqda7zIzok0TWUQkYFnwy8x8n7OjNDPr4HQMDGTRU3nmwUj58NDYT+IMyf7661nliw3EWegfHBC9NpA83YWi3koTgmznW/WrSpUsGTKHPAUGd6coD3+7REty+W X-Forefront-PRVS: 06237E4555 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0760; 23:iczsO8PrR2G282//BGcU/outmxTfL3odPBq1h6Zj2?= =?us-ascii?Q?lGUB4DrdhvLEvjl0i5M8ocX4KyBWPW/BKPGqDlxBn6DsAUtSjKp80pZLv2rv?= =?us-ascii?Q?AweVX6Y4rKdTEha2SQ5eFsacPsEQyMTC25ur6/mFFYU/pwIJyqDNkGIo/jo1?= =?us-ascii?Q?/HJW12vvw5NBRzZj8tRpqGawjyNxjT+eKcvNGbtmZSDUFS3z0uRFBA0qpsnz?= =?us-ascii?Q?Lv5ezIykFEyxIFpSgbXWh7lQYhw69VDgb/oB0ZntRr+f/1lrc5wMcfDod2yy?= =?us-ascii?Q?U1FxOoforqqWYEFBXEnh401ySEF+X4h2Mt/uAP6T0hZyyocOockQidhSKKoa?= =?us-ascii?Q?6dZl8mZ8wCh8zJX7BucgDIexrYUDpiVxAtzCReMPzzjegZS5QTAvKK+036kO?= =?us-ascii?Q?oK8XeJftRRRhv4btTN6yMoaNVyIpehLfLttjzrkoIDEUVYSvjR+iSxsxifoc?= =?us-ascii?Q?lH9VGljeHosWJT8eclrMn68Syqio+MrAy7i9cct50Ofy9AlEJ1k2xyURpTH0?= =?us-ascii?Q?ZqcsimUJbIfuE0CXdx+iBgYr+NMNIGMf+7D+Ki/m4UFo4fnWz6uKkCFAgG8N?= =?us-ascii?Q?6kDjzOPbSICGuSa86Aw76jebthSPeDezXzC2izhUEAXW/YbXZH+blWbW7wSr?= =?us-ascii?Q?Ov7tWj9iP6uOFDW+pc7m0KYt66W7N1B63Xt9D5XxlQm82EC7aOKM4FgH5dCH?= =?us-ascii?Q?1Hh1gGC29jfbnlpTLtbu09kY7UkQzZwxTH2tx6sozvLEj1/240865k4ZpWQ7?= =?us-ascii?Q?px1syKPuuBRTq9pIECWfSdp0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S-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 13:12:06.2579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c19479e6-b33a-42f1-de31-08d5931b2ca7 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: CY1PR12MB0760 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, Vijendar Mukunda , lgirdwood@gmail.com, Akshu Agrawal Subject: [alsa-devel] [PATCH 2/8] 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 With in ACP, There are three I2S controllers can be configured/enabled ( I2S SP, I2S MICSP, I2S BT). Default enabled I2S controller instance is I2S SP. This patch provides required changes to support I2S BT controller Instance. Signed-off-by: Vijendar Mukunda Signed-off-by: Akshu Agrawal Reviewed-by: Alex Deucher --- sound/soc/amd/acp-pcm-dma.c | 106 +++++++++++++++++++++++++++++++++++--------- sound/soc/amd/acp.h | 7 +++ 2 files changed, 91 insertions(+), 22 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 540088d..a61c4e0 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -697,6 +697,7 @@ static int acp_dma_open(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *prtd = substream->private_data; struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); struct audio_drv_data *intr_data = dev_get_drvdata(component->dev); + struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(prtd->cpu_dai); struct audio_substream_data *adata = kzalloc(sizeof(struct audio_substream_data), GFP_KERNEL); if (adata == NULL) @@ -710,7 +711,21 @@ static int acp_dma_open(struct snd_pcm_substream *substream) default: runtime->hw = acp_pcm_hardware_playback; } + adata->i2s_play_instance = dev->i2s_instance; + if (adata->i2s_play_instance == I2S_SP_INSTANCE) + adata->i2ssp_renderbytescount = 0; + else if (adata->i2s_play_instance == I2S_BT_INSTANCE) + adata->i2sbt_renderbytescount = 0; + else + return -EINVAL; } else { + adata->i2s_capture_instance = dev->i2s_instance; + if (adata->i2s_capture_instance == I2S_SP_INSTANCE) + adata->i2ssp_capturebytescount = 0; + else if (adata->i2s_capture_instance == I2S_BT_INSTANCE) + adata->i2sbt_capturebytescount = 0; + else + return -EINVAL; switch (intr_data->asic_type) { case CHIP_STONEY: runtime->hw = acp_st_pcm_hardware_capture; @@ -736,11 +751,20 @@ 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. @@ -751,7 +775,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, @@ -1010,34 +1041,49 @@ 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; } @@ -1089,6 +1135,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; @@ -1177,6 +1225,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 ba01510..c86bef4 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -4,6 +4,7 @@ #include "include/acp_2_2_d.h" #include "include/acp_2_2_sh_mask.h" +#include "../dwc/local.h" #define ACP_PAGE_SIZE_4K_ENABLE 0x02 @@ -88,12 +89,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; };