From patchwork Thu Mar 29 20:39:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 10316177 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 B64C660383 for ; Thu, 29 Mar 2018 20:37:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A55092A480 for ; Thu, 29 Mar 2018 20:37:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99C8F2A4FA; Thu, 29 Mar 2018 20:37:21 +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 73C7F2A480 for ; Thu, 29 Mar 2018 20:37:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6EAE42671CC; Thu, 29 Mar 2018 22:37:18 +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 562572671DB; Thu, 29 Mar 2018 22:37:15 +0200 (CEST) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0063.outbound.protection.outlook.com [104.47.32.63]) by alsa0.perex.cz (Postfix) with ESMTP id 1EFBD2671B9 for ; Thu, 29 Mar 2018 22:37:11 +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=vaQMbIQ3+oQKmsatioDC7cqUDf/a21ACWV2jKIAHDnY=; b=0K6ET01z8HiY2cld48sJ0DEhGzn1J+CSUJqanwbXe94+M7UvjdSwC3Gi7wsInj7JTDSOcvBFIQrzcH8s3yw9Vw2AEcLvy/WUscjYR3GWjQ1SekKiA476LasAFnXJ7lgbOPeDwG7HI2XDJM+Pna3L1Eo0Bw8LJIf167txn6GCo84= Received: from MWHPR1201CA0017.namprd12.prod.outlook.com (2603:10b6:301:4a::27) by SN1PR12MB0766.namprd12.prod.outlook.com (2a01:111:e400:c45b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Thu, 29 Mar 2018 20:37:07 +0000 Received: from CO1NAM03FT003.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by MWHPR1201CA0017.outlook.office365.com (2603:10b6:301:4a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.10 via Frontend Transport; Thu, 29 Mar 2018 20:37:07 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; suse.de; dkim=none (message not signed) header.d=none; suse.de; 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 CO1NAM03FT003.mail.protection.outlook.com (10.152.80.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.631.7 via Frontend Transport; Thu, 29 Mar 2018 20:37:07 +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; Thu, 29 Mar 2018 15:37:06 -0500 From: Vijendar Mukunda To: , Date: Fri, 30 Mar 2018 02:09:54 +0530 Message-ID: <1522355994-32039-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)(39380400002)(346002)(376002)(396003)(39860400002)(2980300002)(428003)(189003)(199004)(86362001)(186003)(2906002)(305945005)(59450400001)(48376002)(39060400002)(356003)(105586002)(106466001)(26005)(81156014)(81166006)(97736004)(8676002)(77096007)(72206003)(53416004)(426003)(6666003)(336012)(478600001)(36756003)(54906003)(50226002)(5660300001)(8936002)(47776003)(68736007)(110136005)(53936002)(4326008)(7696005)(486005)(2616005)(16586007)(316002)(486005)(476003)(126002)(51416003)(50466002)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0766; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT003; 1:YWF3tEJcL4rWfK9s9ROTRzWVLGS3X89jYRf/elawcfozQl6OVH4MtApSG0bMdhJnopjWOQKIqzvQ6Joo31ybwWLE8BP3+GL8E2V28mzQXaMLRmtkvQtyx+BdJvj3DKt+ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eeb6e48e-df0e-41e9-fba3-08d595b4d6e4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:SN1PR12MB0766; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0766; 3:xm3HMvAtOh42G94+5kQ1tlrvRIXVuENBHfY1QptY5N3GbAIorxK5BG8qszlsNsZEVIEcjrm3akSBaS4g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sNI5/qFktXPRizEwcnNyreAEN19k6BSfVA01vLrno6mIqVR5chD4PhV/OV6P+MqjA3m312boIu2mAaJTW6n4f03b8A021pV2zbvU+yG4XzllnwwJM3WvIAt98JkyUopRahv0KoC5g4zkgBGeV9gCvo+crOCPZ4P5IXMHXdOXFEULgJOcWE6toljV6GYt7aS/JxLbUKn5qPCNRQ25lPZwyxGTQXn6ho8q6OaDmE5wkNIGBf3w765EgJhjqdAF1ham+aMY7xp2RPeojqP+omGYb3qsfB6WviH+XbKVOXZdkHCyFJPgDQrYm8/KX1dHLeqSfcvqZI16kLybKHZ71cE6zG4+t8pZ3L38ecrjPRiCGDA9jrvFfTm6L61ETUia 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)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93003095)(6055026)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:SN1PR12MB0766; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0766; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0766; 4:0IjjEeM3x/7V/h+irFeaREEqcS9rw+AM4EQo6kaLT7UCsRC1a/LTD3mZKwvYPw3E9g9Nj7S71oI2Ez9mNQIvIgcczv5ScQxdKrRqxP2x9eLG1WoUcz3gH2dOuSMpdeKYPgZeg+daxieJ5G3uL8hgHjemXDBgHmr9Ub2Jh14T+gAyAfPNLDnsfBcvns4Jdy9aQG1aBf9chkyvO+U8iE31Cq2HMfllLHqc4mq7XAdYL3eUSIcqckSogHuq7RENc22guXsr9EBHgDtXVuPj0IIZ9fzdqxww2lRfSlTJRlYduIv5lTzs0waj4JCjbKNLVB+F X-Forefront-PRVS: 0626C21B10 X-Microsoft-Exchange-Diagnostics: =?us-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9TSDgnpdEsSzFwpJBCrqdbHms+oJprLr?= =?us-ascii?Q?i8iIbti7CyiFLSZM7kfOUE6jFLFLUkYEV9Ak6lj00+NSyUYqocyBdu0BkAbg?= =?us-ascii?Q?DuPZt1ILn2wzi/cU/IdTDTNsZSTxDsXM7Bu10eAT+bePniHfSCC3ct7T5xi8?= =?us-ascii?Q?NeCZDwjr5MuTRxeRMSoUJocTLETHprk6ruoJnMlpxFfEEo7vuRCjQJsVXpsg?= =?us-ascii?Q?jBUyZUADNoycl6IQrCqhiyFbiAlMCNWCaUzh3Nf4qghdoc5T5WFJNeu+Wjj1?= =?us-ascii?Q?WtvaWiRjJeezouOqnK+tO8eou+NZn3pTnUITdFapj9Mvllf5d+ly84uIq9IR?= =?us-ascii?Q?0bEzUfUS8TdeKU=3D?= X-Microsoft-Antispam-Message-Info: Yda7Gu1SECaJenualfhGUTSsJImxXzvdN6hOlSXeqWdx42hpF2tpzC/GDDjmjaKT7nGUVWF6+5+sqEgVzCX6ls96RqwA1hkomhEY0hLZGjXywctUrn01mLHDK5k7OQdAs76oGc791vT7u6ztq2k/l4QlFUcS143jBP57VwhUyDQXxdpb5Wmd67kdcQMW2cSn X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0766; 6:8gRX4YZ3MBzn/+2aiaDIFfStt0wWxiM/e+RdzbE/ELXYMUF9GpMot1Ae15k2tw11YycTyiX/XYsl/fja8rLrjqG6ohv6ccUGdUVXK6vf54hfVMe9175PPNjBxPttro78e4IKoUkMndqDesarwlpD9DRj48yZErvvWu18fZWRQno0x+0XVv4NhM/QqJ5yigZz/OdAn2NbBx+F0igTwfYnfNrWc7QcFxp2dJc0KIA5F6GjE4XY9Oyp/zRM1i8aPabVZJqZi0dF3nx1T4j0xR5+lxyn8Qm98yKL1EzUnaZF7IyuetazZz8rgzFfJVvDM7xKJO0vsJEZS/1TJBBxT+KEqncYv2pe29nYJ0UCdm6AVH/w1qU23qzUSYGrPvYMgdBg46txujUIiQrjEjsYZvTaqij7YzRcU0vH4GgMbjmn/Twos9/a5Ox9wQDeC4ISiC8H/0HiPyMeF711EHRXZx15ng==; 5:4Vq/ATGgyxBw/k5YZxtqgzzkYZ5y+xpUyvkC+srMiZvf865ofD4g04v1cbj4ul6mkC1gRx1F1k8iM2f77SQHB2X6wRPRuwbQwxcC0LyuO1SdSnlDXa3zgFO0suGkzEcUxUqXDO/VARAB9OwJxfEoRGB7sL2xoDZhv9BI2puYGfc=; 24:wPaLv3K3Jm+llWOaJageXEDWjhMnrRJ4LP3BmJCWLZe70YRur2p63aNk7xddvrhLLNGoOPJtd6n13Ik51pdUmcXGRnROKVBUED7U0v0YDzQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0766; 7:kxHEhMaAqxK1b9lZbk1GEvZCxrjdI7waqnm/bfZHzVbG8SEenxNXBwBGf/dAbE6UE9x4D3TvBcN+Ep62ASieuBo3JnjNqW1WZBIigr4pzwyevM/OiSKfIjAjEuwYX2o48Nu4rnNV2m2SozmNEUk9YY3fu3ok1S/36qCvVoV8NuWpjj35KlG+orkxcJnjBGy+1W3OWrgDf9VVdJqBHvDb4nMZlTXnCi7snWYdjSXOP9td3rA8YF6yWb3lmj3eObJW; 20:exK36bJsAinqpuaecbeHx17Qk3uRsMepak/c0K2TSBd5jgOR36NSgIBLIgqMOWoYpmCPEAhDI8Urw0e3Qkdpb0pPPYt7hgn44un20NPoBWgm0WFfUQN6yI+tAWjDnA6XdWkk7kDuVh1WvMWpuR56UShn3aDZDRbPZiV8JJeROb5s3rAho7VdyP3BpvFc9iRbU8kFaRgZseYgaJmTzCHW9ZkKcVlcluAb8lZmCGl0ORa5BNAUSpDneyIjBX/O52Rs X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2018 20:37:07.1963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eeb6e48e-df0e-41e9-fba3-08d595b4d6e4 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: SN1PR12MB0766 Cc: tiwai@suse.de, lgirdwood@gmail.com, Akshu Agrawal , Vijendar Mukunda , Alexander.Deucher@amd.com 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 v1->v2: fixed kbuild errors --- sound/soc/amd/acp-pcm-dma.c | 116 +++++++++++++++++++++++++++++++++++--------- sound/soc/amd/acp.h | 17 +++++++ 2 files changed, 111 insertions(+), 22 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 540088d..cad995e 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -697,6 +697,9 @@ 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); +#ifdef CONFIG_SND_DESIGNWARE_PCM + struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(prtd->cpu_dai); +#endif struct audio_substream_data *adata = kzalloc(sizeof(struct audio_substream_data), GFP_KERNEL); if (adata == NULL) @@ -710,7 +713,29 @@ static int acp_dma_open(struct snd_pcm_substream *substream) default: runtime->hw = acp_pcm_hardware_playback; } +#ifdef CONFIG_SND_DESIGNWARE_PCM + adata->i2s_play_instance = dev->i2s_instance; +#else + adata->i2s_play_instance = I2S_SP_INSTANCE; +#endif + 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 { +#ifdef CONFIG_SND_DESIGNWARE_PCM + adata->i2s_capture_instance = dev->i2s_instance; +#else + adata->i2s_capture_instance = I2S_SP_INSTANCE; +#endif + 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 +761,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 +785,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 +1051,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 +1145,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 +1235,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..7ad165b 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -4,6 +4,17 @@ #include "include/acp_2_2_d.h" #include "include/acp_2_2_sh_mask.h" +#ifdef CONFIG_SND_DESIGNWARE_PCM +#include "../dwc/local.h" +#endif + +#ifndef I2S_SP_INSTANCE +#define I2S_SP_INSTANCE 0x01 +#endif + +#ifndef I2S_BT_INSTANCE +#define I2S_BT_INSTANCE 0x02 +#endif #define ACP_PAGE_SIZE_4K_ENABLE 0x02 @@ -88,12 +99,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; };