From patchwork Mon Mar 19 06:40:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 10291689 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 D4EFE602C2 for ; Mon, 19 Mar 2018 06:38:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C38DF29149 for ; Mon, 19 Mar 2018 06:38:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B70872914B; Mon, 19 Mar 2018 06:38:39 +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 9610A29149 for ; Mon, 19 Mar 2018 06:38:38 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7024C26731A; Mon, 19 Mar 2018 07:38:36 +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 C728B26737B; Mon, 19 Mar 2018 07:38:34 +0100 (CET) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0056.outbound.protection.outlook.com [104.47.40.56]) by alsa0.perex.cz (Postfix) with ESMTP id 16971267299 for ; Mon, 19 Mar 2018 07:38:29 +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=cGvEfbEx9WyByfWBHJB2fWqNipsdEq4t+LeartuxAVY=; b=ceqnjtFCR+emiw9rb3lyKx6eDs+zEDgrBdaj1g9Y7V2QfoYyKkSaCqFP7vfgb6GB0Z1RTX/6b1sDRkl5U1qNjzPfu5nQcQxhyrw/2q+WNGTpfIx0Ws5AtBnYVeEs7XLmTFbqCDkmhv/Pbrkbvkw25SIN02SfSmu2HRjgt2lNkk0= Received: from BN4PR12CA0011.namprd12.prod.outlook.com (10.164.241.21) by CY1PR12MB0028.namprd12.prod.outlook.com (10.160.158.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Mon, 19 Mar 2018 06:38:26 +0000 Received: from DM3NAM03FT035.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::206) by BN4PR12CA0011.outlook.office365.com (2603:10b6:403:2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.14 via Frontend Transport; Mon, 19 Mar 2018 06:38:25 +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 DM3NAM03FT035.mail.protection.outlook.com (10.152.82.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.567.18 via Frontend Transport; Mon, 19 Mar 2018 06:38:24 +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, 19 Mar 2018 01:38:22 -0500 From: Vijendar Mukunda To: , Date: Mon, 19 Mar 2018 12:10:36 +0530 Message-ID: <1521441636-18933-1-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 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)(396003)(376002)(346002)(39380400002)(2980300002)(428003)(189003)(199004)(59450400001)(4326008)(50226002)(48376002)(50466002)(106466001)(97736004)(356003)(305945005)(5660300001)(39060400002)(81156014)(81166006)(6666003)(47776003)(105586002)(8676002)(68736007)(316002)(110136005)(16586007)(54906003)(186003)(51416003)(86362001)(8936002)(53416004)(336012)(426003)(2906002)(36756003)(53936002)(7696005)(72206003)(478600001)(26005)(77096007)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0028; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT035; 1:6OoSkZvkP/MGAXCetvEJ+LvpsuabK24YLQBWLlt1VxBOYt59YVc5H29Wj79+tq+bx6xlJpRWoZKmqtBtVHhWBpdP+ZRZAhHsC/mYCeCjOCwnuQHeRuUsc2TXElfD1mzc X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5528819e-1626-497d-da2c-08d58d64044b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR12MB0028; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0028; 3:BLYP5dnSzOfgMhjNp6elFPCkkhIpiInE0sIY7YV/ebqTt0R/stE6GpjpXu+qnvu0ln3aiGtCOkEWkuIf03eQKIVy3tCn/RUyCeEkg+xrGgf33sOq80S7jW4iP4VQ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Qadyz1bCK3GHTPiiwzw2i7Vzq2Rs7OsJNtIJ0e8PidPcckpNKFgOo3AA9lCz5nXtob4qhaHahtNtUcnqF6UYHjGKo0+9GDWIyCayVSb+QuWW2vZv1HyM26I7ZCMYjj7eqrzi4e9zRctIFxxgCnZ4vsFDn+Mduen8zFnT7C/6RtN74BRVePa583D3OGVCZ3s/rG+LZpDJd8ma7efYWx2+VGly4Si8O4H7isa9jiK+r6XDM+C4cNKnV7Q7Kkd9dfaRZmg1Yy2PmnShAhsjmFoyTjhq+WbAOY2sHIT7jZEkQI0WVLFtPEF5hZVuRJD0JJ 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)(5005006)(8121501046)(10201501046)(93006095)(93003095)(3002001)(3231221)(944501244)(52105095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:CY1PR12MB0028; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0028; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0028; 4:binqFpHOQMOK1IoEluZ+PGXa15VODJFCNPfOdlOIngJnovbgg4g0PhhDNUe3TTUIBToept8AReiNSI7OF3ecJPZTU7wQHvn9ygEotFqik8WMCMyblYOqFMIlgLskQMVurVAjCjn0NBBKOKsIHybkZ35fV2coBCgjSxFMGjN76QN6tpDt9OwOyR4+zKcBk7Ar8MlwumGi/A9SMEPDkyFuXLn8u/5RTccrTgXukexxhaANdJp7vPWRfma/m9e0kjx+1KZ5i9kxu4hGHukKyO+/74dXeUfeC5BjZ4aroY2wCsSgmaXRbzTPl7vn9gjKaoL4 X-Forefront-PRVS: 06167FAD59 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0028; 23:Dz5xl7NLS1AgF2WRe5B/PnpckxAK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QtMcHgCvJFxWr2Yp70CabdRN+sBhv4oygoGJiQVsre115fbi7eI+av2mAOQHccLCxurB4SgtJW26P9N9kWcuEd+DUvJMZVUDRfJE27zLs2w=; 7:S4Uytm1lC8sORgTU2ABxKdHoygW2Sbnfqmu1o+ZnB3WVkHt6eg/W8v0uYiinJrw1qIZVm343WXOFLVIRiSdXhpH4/X2MA2YYCUPfqYzoDVvTFYt7lo/Krku4Sn5TYl2ILfsOrM8VWgxCK+uXw74VrvOjQqUHYJHL5SqfBR9zdkH5l+ZALJSxW9a5wpoOovs7KdjRJvuM5t3xlix7F3DwR9jpasZaD1qMRb7P8ApDNbdjuRuiyzWk9Oc+5qDzbd+y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0028; 20:2spylZuod6wvHcEi+Vu67E+Vgo+zF3jMqcx5xZw/wKFEMNJFcRKKls3kEbFT5M6wG4LuP12UKZBYzi7hvSle/LP5zJptgEsD8dUQP3hqxs6YEj8S4JSToG78DARDzP3F7gg2iEyQuZHxaen+5M9EarRQ5MSgxeXSX8n/hdvNmGHbny6UsJd5NSgtJpnXAK1rvp+lnksBLY2qMSBXWXLH9upKRN2EcEakawnecSvKa5d2ppLD7PMo32JuLPY3K4Nn X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2018 06:38:24.8775 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5528819e-1626-497d-da2c-08d58d64044b 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: CY1PR12MB0028 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, Akshu Agrawal , lgirdwood@gmail.com, Vijendar Mukunda Subject: [alsa-devel] [PATCH V2] 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 | 10 +++++ 2 files changed, 94 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..8bc78cc 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -4,6 +4,8 @@ #include "include/acp_2_2_d.h" #include "include/acp_2_2_sh_mask.h" +#include +#include "../dwc/local.h" #define ACP_PAGE_SIZE_4K_ENABLE 0x02 @@ -72,6 +74,8 @@ #define mmACP_I2S_16BIT_RESOLUTION_EN 0x5209 #define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01 #define ACP_I2S_SP_16BIT_RESOLUTION_EN 0x02 +#define I2S_SP_INSTANCE 1 +#define I2S_BT_INSTANCE 2 enum acp_dma_priority_level { /* 0x0 Specifies the DMA channel is given normal priority */ ACP_DMA_PRIORITY_LEVEL_NORMAL = 0x0, @@ -88,12 +92,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; };