From patchwork Tue Apr 24 03:04:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 10358587 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 9FF1E6038F for ; Tue, 24 Apr 2018 03:04:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C62F28BD3 for ; Tue, 24 Apr 2018 03:04:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FC2128BD9; Tue, 24 Apr 2018 03:04:02 +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=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham 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 8FEC528BD3 for ; Tue, 24 Apr 2018 03:04:00 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3C34C267681; Tue, 24 Apr 2018 05:03:59 +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 34750267681; Tue, 24 Apr 2018 05:03:57 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0051.outbound.protection.outlook.com [104.47.37.51]) by alsa0.perex.cz (Postfix) with ESMTP id 23857266E30 for ; Tue, 24 Apr 2018 05:03:53 +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=r4cXfUhmmwYrBwEjWtUAGtL3YcurFcNnDWc4CCWIVx4=; b=195Cd5wVbzHl9nJJk+SpbWXYeaDJ3f6BHyz+F1IyCxJtzkb0NPD9o30Ot/QVh6wwGibp0iDp65qRxj2eUiph+qZ5mK1Rzq2xIMHk/ZyhI7ZikbeiBFF5XdbGNZBG0cMaWDdG0JMzEyqx40V0DkrK9TAOLkAWpVfmg8XcYQjjnuU= Received: from DM5PR12CA0064.namprd12.prod.outlook.com (2603:10b6:3:103::26) by DM2PR12MB0330.namprd12.prod.outlook.com (2a01:111:e400:50d0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.17; Tue, 24 Apr 2018 03:03:49 +0000 Received: from DM3NAM03FT058.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by DM5PR12CA0064.outlook.office365.com (2603:10b6:3:103::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.696.12 via Frontend Transport; Tue, 24 Apr 2018 03:03:49 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; roeck-us.net; dkim=none (message not signed) header.d=none; roeck-us.net; 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 DM3NAM03FT058.mail.protection.outlook.com (10.152.82.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.696.11 via Frontend Transport; Tue, 24 Apr 2018 03:03:49 +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, 23 Apr 2018 22:03:21 -0500 From: Vijendar Mukunda To: Date: Tue, 24 Apr 2018 08:34:38 +0530 Message-ID: <1524539088-9043-3-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524539088-9043-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1524539088-9043-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)(39860400002)(396003)(346002)(376002)(2980300002)(428003)(189003)(199004)(9170700003)(305945005)(36756003)(6666003)(105586002)(5660300001)(106466001)(53416004)(7416002)(72206003)(76176011)(2906002)(54906003)(478600001)(86362001)(51416003)(7696005)(575784001)(59450400001)(77096007)(426003)(8936002)(476003)(2616005)(356003)(48376002)(8676002)(186003)(11346002)(16586007)(316002)(446003)(104016004)(4326008)(26005)(1671002)(126002)(39060400002)(50226002)(486006)(109986005)(50466002)(47776003)(53936002)(81166006)(336012)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0330; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT058; 1:vgNnpLIydx1zhabpUUZnvZiaOgDrdo6gcXDRNCkBGxZv93mS8p9TbSmTykl2by3NJ+HS67IW+Hj8cl3DmQMXc5YF18GNGlOtYxjWA4lZoNhhwWFXkO+KeFUxIjeVX3Is X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:DM2PR12MB0330; X-Microsoft-Exchange-Diagnostics: 1; DM2PR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9qI+b2/4B0+KzNENw7SFkeGaVpGyGERSXUf1mpDFDVlNvMzfBbYSZaJsYes9rH1NyYgyiucmXdDj0U5iJa+5r3rMRov4dGOZsaXOxsX+pg01secViYpX5uLNMlm+3FaxAUe1vOwurgvaVVBrfh6Zc5Fy9qO04yZ3GWSdEQhPBJ+u2bBEwYbkDZDexGxFoKuO50eR59cPKfQvv96vWC/PpgtW5vTBE7AyHyx/kFUcZ/F9ujJ6EO15rIHo5eOIl78Lk7nsUH0yGYLBsHa3ZQ+thXBoy34VKmNNGmLpuaK7it3oIpkHBKfKjkbiKCJx59Fx5qyytJfva13Y7QB9c1xXhYuG188y0vyWw1u4ogjQuW5zLV2qnBMvSaK493h+EYdI0ggtwPBSX9XtVWaNYjKaz3iyf9kqxCtSRKJe+oigicV8wgno2pfojVhwyjxsUFryXdNSwMa4VaG38 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)(3231232)(944501410)(52105095)(10201501046)(3002001)(93006095)(93003095)(6055026)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:DM2PR12MB0330; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0330; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0330; 4:i4GTGTdPS2s70SUH3K7QpX44IZtsvSxrxeI6B6/nCKy4NkRzRb+d9IUXq56L+XO44KV8qcgLT/tseL2QM0H3TY0Kb1Op881hbHZUlKf7p6GdkRfeRqloC6TDtywIV2zkSHQN5K21nan7Z1HJ7Q915WNrOZt3zjt1mDLfcYIYBUbkPREhwTa/Hptuqrvz5lprqSLyB8QKVD1FbDMClKfp25wszMuUnWvwBq4L6NtP5ErhoOwEXFSU+1YB7UdQop0jYT/627krXomZwlXK7fnp8M5hT2sFVU1heyJZYOQFxoGo1su5PrXwe+3QZdt+mUdW X-Forefront-PRVS: 0652EA5565 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0330; 23:/U6ioSLhCioeSq41H3xwajszvCSzeLXokUz9h2RSW?= =?us-ascii?Q?sDy5NxUHQQIXbaUft73+LE/+d5Q2noJ+W3f4TkDVfL09cfHVVWSUI/0hmqDj?= =?us-ascii?Q?Dd51bgEOu0YSBjnxNoHAWJhd8vY0jIyKbGU6N4aBhrj5X3IVr6yJA7CQ3/MJ?= =?us-ascii?Q?LgLAo7gK9CphSJyVtWC+9AMEB1/l/AVOicQ1i8iBpw4j2O1FINoIUBFoE4tZ?= =?us-ascii?Q?/wM5xSCAe26EgIcFZU/Wxz4SR5q00efvZIbrIflTrd51BoyeNJQtTbnyej8n?= =?us-ascii?Q?kyneF3apKl/tD6w3JXNf5JmWHEQfqGknmvYUuSupAHFnooR3vrJQj90U3PZx?= =?us-ascii?Q?EFji5V++wK6ppuNosj1ZiyXrRxXlnRREwdlOamHpsUkkEwdso0ZKh7fllmIZ?= =?us-ascii?Q?D0iHjXaC0v3qv6CMAwMVohGL/zMKZ20ANNOW9l4mpHm7TGhSzGo3Pa7Bxl7A?= =?us-ascii?Q?Dp6mYdf31PTwCYZSzwfkqTqWP022UV/AeVRW8dcfH7U1k9gTYJ5zD/Drllkn?= =?us-ascii?Q?YRFOcz5HGA+G922vhsLfhC23OFLJvRlXbBm8urhpX4YQPlj65EUFXOR5L9i1?= =?us-ascii?Q?bj+Vxm8DlV+at6k+fEcouhXm3qTVua47bdMRHFr5lcrq+otBXv9P8LU57zWo?= =?us-ascii?Q?qRrq0wLOitXj3EzsagYMdOchMomtp+CyxjSvm0l99LTntE0fzc7jByEmC9AB?= =?us-ascii?Q?0xqy4dw9+X8E/Rig/+TkfzOpOTKb1YLfkENXoyP2ArSksIoeTTv/4fRSfDu8?= =?us-ascii?Q?/1b8sC3eSv46OJfX9Z+SYhqtKEBMKpOga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T1jDRVZYOS+8/0RFBgeteuPvj+esH3fZslou+NT1/iFdu6QoIzeGjwbp X-MS-Office365-Filtering-Correlation-Id: e48cc60f-54e4-4d3d-ae43-08d5a99000c3 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2018 03:03:49.1314 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e48cc60f-54e4-4d3d-ae43-08d5a99000c3 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: DM2PR12MB0330 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Kuninori Morimoto , Liam Girdwood , Greg Kroah-Hartman , Takashi Iwai , Jason Clinton , Mark Brown , Vijendar Mukunda , Alex Deucher , Akshu Agrawal , Guenter Roeck Subject: [alsa-devel] [PATCH v3 3/3] ASoC: amd: dma driver 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 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 --- v1->v2: defined i2s instance macros in acp header file v2->v3: sqaushed previous patch series and spilt changes into two patches ( acp dma driver code cleanup patch and bt i2s specific changes patch) sound/soc/amd/acp-da7219-max98357a.c | 23 ++++ sound/soc/amd/acp-pcm-dma.c | 255 +++++++++++++++++++++++++++-------- sound/soc/amd/acp.h | 40 ++++++ 3 files changed, 261 insertions(+), 57 deletions(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index 0f16f6d..4a0653f 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -35,6 +35,7 @@ #include #include +#include "acp.h" #include "../codecs/da7219.h" #include "../codecs/da7219-aad.h" @@ -43,6 +44,7 @@ static struct snd_soc_jack cz_jack; struct clk *da7219_dai_clk; +extern int bt_pad_enable; static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) { @@ -126,6 +128,9 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = { static int cz_da7219_startup(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_platform_info *machine = snd_soc_card_get_drvdata(card); /* * On this platform for PCM device we support stereo @@ -137,6 +142,7 @@ static int cz_da7219_startup(struct snd_pcm_substream *substream) snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); + machine->i2s_instance = I2S_BT_INSTANCE; return da7219_clk_enable(substream); } @@ -147,6 +153,11 @@ static void cz_da7219_shutdown(struct snd_pcm_substream *substream) static int cz_max_startup(struct snd_pcm_substream *substream) { + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_platform_info *machine = snd_soc_card_get_drvdata(card); + + machine->i2s_instance = I2S_SP_INSTANCE; return da7219_clk_enable(substream); } @@ -157,6 +168,11 @@ static void cz_max_shutdown(struct snd_pcm_substream *substream) static int cz_dmic_startup(struct snd_pcm_substream *substream) { + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_platform_info *machine = snd_soc_card_get_drvdata(card); + + machine->i2s_instance = I2S_SP_INSTANCE; return da7219_clk_enable(substream); } @@ -260,10 +276,16 @@ static int cz_probe(struct platform_device *pdev) { int ret; struct snd_soc_card *card; + struct acp_platform_info *machine; + machine = devm_kzalloc(&pdev->dev, sizeof(struct acp_platform_info), + GFP_KERNEL); + if (!machine) + return -ENOMEM; card = &cz_card; cz_card.dev = &pdev->dev; platform_set_drvdata(pdev, card); + snd_soc_card_set_drvdata(card, machine); ret = devm_snd_soc_register_card(&pdev->dev, &cz_card); if (ret) { dev_err(&pdev->dev, @@ -271,6 +293,7 @@ static int cz_probe(struct platform_device *pdev) cz_card.name, ret); return ret; } + bt_pad_enable = device_property_read_bool(&pdev->dev, "bt-pad-enable"); return 0; } diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 4a4bbdf..864bd6a 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -37,12 +37,14 @@ #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 #define DRV_NAME "acp_audio_dma" +bool bt_pad_enable = false; +EXPORT_SYMBOL(bt_pad_enable); static const struct snd_pcm_hardware acp_pcm_hardware_playback = { .info = SNDRV_PCM_INFO_INTERLEAVED | @@ -357,6 +359,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: @@ -519,6 +524,13 @@ static int acp_init(void __iomem *acp_mmio, u32 asic_type) val &= ~ACP_SOFT_RESET__SoftResetAud_MASK; acp_reg_write(val, acp_mmio, mmACP_SOFT_RESET); + /* For BT instance change pins from UART to BT */ + if (bt_pad_enable) { + val = acp_reg_read(acp_mmio, mmACP_BT_UART_PAD_SEL); + val |= ACP_BT_UART_PAD_SELECT_MASK; + acp_reg_write(val, acp_mmio, mmACP_BT_UART_PAD_SEL); + } + /* initiailize Onion control DAGB register */ acp_reg_write(ACP_ONION_CNTL_DEFAULT, acp_mmio, mmACP_AXI2DAGB_ONION_CNTL); @@ -637,6 +649,24 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) acp_mmio, mmACP_EXTERNAL_INTR_STAT); } + if ((intr_flag & BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) != 0) { + valid_irq = true; + if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_9) == + PLAYBACK_START_DMA_DESCR_CH9) + dscr_idx = PLAYBACK_END_DMA_DESCR_CH8; + else + dscr_idx = PLAYBACK_START_DMA_DESCR_CH8; + config_acp_dma_channel(acp_mmio, + SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, + dscr_idx, 1, 0); + acp_dma_start(acp_mmio, SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM, + false); + snd_pcm_period_elapsed(irq_data->play_i2sbt_stream); + acp_reg_write((intr_flag & + BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) << 16, + acp_mmio, mmACP_EXTERNAL_INTR_STAT); + } + if ((intr_flag & BIT(I2S_TO_ACP_DMA_CH_NUM)) != 0) { valid_irq = true; if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_15) == @@ -659,6 +689,31 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) acp_mmio, mmACP_EXTERNAL_INTR_STAT); } + if ((intr_flag & BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) != 0) { + valid_irq = true; + if (acp_reg_read(acp_mmio, mmACP_DMA_CUR_DSCR_11) == + CAPTURE_START_DMA_DESCR_CH11) + dscr_idx = CAPTURE_END_DMA_DESCR_CH10; + else + dscr_idx = CAPTURE_START_DMA_DESCR_CH10; + config_acp_dma_channel(acp_mmio, + ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, + dscr_idx, 1, 0); + acp_dma_start(acp_mmio, ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM, + false); + acp_reg_write((intr_flag & + BIT(I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM)) << 16, + acp_mmio, mmACP_EXTERNAL_INTR_STAT); + } + + if ((intr_flag & BIT(ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM)) != 0) { + valid_irq = true; + snd_pcm_period_elapsed(irq_data->capture_i2sbt_stream); + acp_reg_write((intr_flag & + BIT(ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM)) << 16, + acp_mmio, mmACP_EXTERNAL_INTR_STAT); + } + if (valid_irq) return IRQ_HANDLED; else @@ -715,7 +770,8 @@ 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); return 0; } @@ -734,6 +790,8 @@ static int acp_dma_hw_params(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); + struct snd_soc_card *card = prtd->card; + struct acp_platform_info *pinfo = snd_soc_card_get_drvdata(card); runtime = substream->runtime; rtd = runtime->private_data; @@ -741,35 +799,70 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream, if (WARN_ON(!rtd)) return -EINVAL; + rtd->i2s_instance = pinfo->i2s_instance; if (adata->asic_type == CHIP_STONEY) { val = acp_reg_read(adata->acp_mmio, mmACP_I2S_16BIT_RESOLUTION_EN); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - val |= ACP_I2S_SP_16BIT_RESOLUTION_EN; - else - val |= ACP_I2S_MIC_16BIT_RESOLUTION_EN; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_BT_INSTANCE: + val |= ACP_I2S_BT_16BIT_RESOLUTION_EN; + break; + case I2S_SP_INSTANCE: + default: + val |= ACP_I2S_SP_16BIT_RESOLUTION_EN; + } + } else { + switch (rtd->i2s_instance) { + case I2S_BT_INSTANCE: + val |= ACP_I2S_BT_16BIT_RESOLUTION_EN; + break; + case I2S_SP_INSTANCE: + default: + val |= ACP_I2S_MIC_16BIT_RESOLUTION_EN; + } + } acp_reg_write(val, adata->acp_mmio, mmACP_I2S_16BIT_RESOLUTION_EN); } if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - switch (adata->asic_type) { - case CHIP_STONEY: - rtd->pte_offset = ACP_ST_PLAYBACK_PTE_OFFSET; + switch (rtd->i2s_instance) { + case I2S_BT_INSTANCE: + rtd->pte_offset = ACP_ST_BT_PLAYBACK_PTE_OFFSET; + rtd->ch1 = SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM; + rtd->ch2 = ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM; + rtd->sram_bank = ACP_SRAM_BANK_3_ADDRESS; + rtd->destination = TO_BLUETOOTH; + rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH8; + rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH9; + rtd->byte_cnt_high_reg_offset = + mmACP_I2S_BT_TRANSMIT_BYTE_CNT_HIGH; + rtd->byte_cnt_low_reg_offset = + mmACP_I2S_BT_TRANSMIT_BYTE_CNT_LOW; + adata->play_i2sbt_stream = substream; break; + case I2S_SP_INSTANCE: default: - rtd->pte_offset = ACP_PLAYBACK_PTE_OFFSET; + switch (adata->asic_type) { + case CHIP_STONEY: + rtd->pte_offset = ACP_ST_PLAYBACK_PTE_OFFSET; + break; + default: + rtd->pte_offset = ACP_PLAYBACK_PTE_OFFSET; + } + rtd->ch1 = SYSRAM_TO_ACP_CH_NUM; + rtd->ch2 = ACP_TO_I2S_DMA_CH_NUM; + rtd->sram_bank = ACP_SRAM_BANK_1_ADDRESS; + rtd->destination = TO_ACP_I2S_1; + rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH12; + rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH13; + rtd->byte_cnt_high_reg_offset = + mmACP_I2S_TRANSMIT_BYTE_CNT_HIGH; + rtd->byte_cnt_low_reg_offset = + mmACP_I2S_TRANSMIT_BYTE_CNT_LOW; + adata->play_i2ssp_stream = substream; } - rtd->ch1 = SYSRAM_TO_ACP_CH_NUM; - rtd->ch2 = ACP_TO_I2S_DMA_CH_NUM; - rtd->sram_bank = ACP_SRAM_BANK_1_ADDRESS; - rtd->destination = TO_ACP_I2S_1; - rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH12; - rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH13; - rtd->byte_cnt_high_reg_offset = - mmACP_I2S_TRANSMIT_BYTE_CNT_HIGH; - rtd->byte_cnt_low_reg_offset = mmACP_I2S_TRANSMIT_BYTE_CNT_LOW; - adata->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. @@ -781,23 +874,42 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream, bank, true); } } else { - rtd->pte_offset = ACP_CAPTURE_PTE_OFFSET; - rtd->ch1 = SYSRAM_TO_ACP_CH_NUM; - rtd->ch2 = ACP_TO_I2S_DMA_CH_NUM; - switch (adata->asic_type) { - case CHIP_STONEY: - rtd->sram_bank = ACP_SRAM_BANK_2_ADDRESS; + switch (rtd->i2s_instance) { + case I2S_BT_INSTANCE: + rtd->pte_offset = ACP_ST_BT_CAPTURE_PTE_OFFSET; + rtd->ch1 = ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM; + rtd->ch2 = I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM; + rtd->sram_bank = ACP_SRAM_BANK_4_ADDRESS; + rtd->destination = FROM_BLUETOOTH; + rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH10; + rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH11; + rtd->byte_cnt_high_reg_offset = + mmACP_I2S_BT_RECEIVE_BYTE_CNT_HIGH; + rtd->byte_cnt_low_reg_offset = + mmACP_I2S_BT_RECEIVE_BYTE_CNT_LOW; + adata->capture_i2sbt_stream = substream; break; + case I2S_SP_INSTANCE: default: - rtd->sram_bank = ACP_SRAM_BANK_5_ADDRESS; + rtd->pte_offset = ACP_CAPTURE_PTE_OFFSET; + rtd->ch1 = SYSRAM_TO_ACP_CH_NUM; + rtd->ch2 = ACP_TO_I2S_DMA_CH_NUM; + switch (adata->asic_type) { + case CHIP_STONEY: + rtd->sram_bank = ACP_SRAM_BANK_2_ADDRESS; + break; + default: + rtd->sram_bank = ACP_SRAM_BANK_5_ADDRESS; + } + rtd->destination = FROM_ACP_I2S_1; + rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH14; + rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH15; + rtd->byte_cnt_high_reg_offset = + mmACP_I2S_RECEIVED_BYTE_CNT_HIGH; + rtd->byte_cnt_low_reg_offset = + mmACP_I2S_RECEIVED_BYTE_CNT_LOW; + adata->capture_i2ssp_stream = substream; } - rtd->destination = FROM_ACP_I2S_1; - rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH14; - rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH15; - rtd->byte_cnt_high_reg_offset = - mmACP_I2S_RECEIVED_BYTE_CNT_HIGH; - rtd->byte_cnt_low_reg_offset = mmACP_I2S_RECEIVED_BYTE_CNT_LOW; - adata->capture_i2ssp_stream = substream; if (adata->asic_type != CHIP_STONEY) { for (bank = 5; bank <= 8; bank++) acp_set_sram_bank_state(adata->acp_mmio, @@ -987,24 +1099,39 @@ static int acp_dma_close(struct snd_pcm_substream *substream) struct audio_drv_data *adata = dev_get_drvdata(component->dev); 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_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_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); + } } } @@ -1012,7 +1139,8 @@ static int acp_dma_close(struct snd_pcm_substream *substream) * 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); @@ -1067,6 +1195,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; @@ -1123,6 +1253,7 @@ static int acp_pcm_resume(struct device *dev) { u16 bank; int status; + struct audio_substream_data *rtd; struct audio_drv_data *adata = dev_get_drvdata(dev); status = acp_init(adata->acp_mmio, adata->asic_type); @@ -1142,9 +1273,8 @@ static int acp_pcm_resume(struct device *dev) acp_set_sram_bank_state(adata->acp_mmio, bank, true); } - config_acp_dma(adata->acp_mmio, - adata->play_i2ssp_stream->runtime->private_data, - adata->asic_type); + rtd = adata->play_i2ssp_stream->runtime->private_data; + config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); } if (adata->capture_i2ssp_stream && adata->capture_i2ssp_stream->runtime) { @@ -1153,9 +1283,20 @@ static int acp_pcm_resume(struct device *dev) acp_set_sram_bank_state(adata->acp_mmio, bank, true); } - config_acp_dma(adata->acp_mmio, - adata->capture_i2ssp_stream->runtime->private_data, - adata->asic_type); + rtd = adata->capture_i2ssp_stream->runtime->private_data; + config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); + } + if (adata->asic_type != CHIP_CARRIZO) { + if (adata->play_i2sbt_stream && + adata->play_i2sbt_stream->runtime) { + rtd = adata->play_i2sbt_stream->runtime->private_data; + config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); + } + if (adata->capture_i2sbt_stream && + adata->capture_i2sbt_stream->runtime) { + rtd = adata->capture_i2sbt_stream->runtime->private_data; + config_acp_dma(adata->acp_mmio, rtd, 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 62695ed..9cd3e96 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -13,6 +13,8 @@ /* Playback and Capture Offset for Stoney */ #define ACP_ST_PLAYBACK_PTE_OFFSET 0x04 #define ACP_ST_CAPTURE_PTE_OFFSET 0x00 +#define ACP_ST_BT_PLAYBACK_PTE_OFFSET 0x08 +#define ACP_ST_BT_CAPTURE_PTE_OFFSET 0x0c #define ACP_GARLIC_CNTL_DEFAULT 0x00000FB4 #define ACP_ONION_CNTL_DEFAULT 0x00000FB4 @@ -46,8 +48,13 @@ #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 I2S_SP_INSTANCE 0x01 +#define I2S_BT_INSTANCE 0x02 #define ACP_TILE_ON_MASK 0x03 #define ACP_TILE_OFF_MASK 0x02 @@ -68,6 +75,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 @@ -80,9 +95,23 @@ #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 ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01 #define ACP_I2S_SP_16BIT_RESOLUTION_EN 0x02 +#define ACP_I2S_BT_16BIT_RESOLUTION_EN 0x04 +#define ACP_BT_UART_PAD_SELECT_MASK 0x1 + enum acp_dma_priority_level { /* 0x0 Specifies the DMA channel is given normal priority */ ACP_DMA_PRIORITY_LEVEL_NORMAL = 0x0, @@ -95,6 +124,7 @@ struct audio_substream_data { struct page *pg; unsigned int order; u16 num_of_pages; + u16 i2s_instance; u16 direction; u16 ch1; u16 ch2; @@ -113,10 +143,20 @@ struct audio_substream_data { 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; }; +/* + * this structure used for platform data transfer between machine driver + * and dma driver + */ +struct acp_platform_info { + u16 i2s_instance; +}; + union acp_dma_count { struct { u32 low;