From patchwork Mon Jul 4 14:08:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 12905434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47CACC43334 for ; Mon, 4 Jul 2022 14:10:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 93DAD1678; Mon, 4 Jul 2022 16:09:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 93DAD1678 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1656943800; bh=3jkzY91TQas0GBCfbutuanlmBsv9mTMEl0dUVB79uMM=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=al7HWzhh/OjlZBeAO1jtXxPFgmGcZp9lBn6In/9byLNbPUHXJwm/L0SAH+9vCfMY/ 7w7+BukNFQiEXHykKg+uWbR07cBhjz51KOUMcgpNAIfD0FDaSjMPynAPU8+Bk0gpHr ptCm3sf0Wb7u87wzfdTxgVwbRLAlF01IKWFm09xk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 38187F80141; Mon, 4 Jul 2022 16:09:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B40A3F80165; Mon, 4 Jul 2022 16:09:07 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2066.outbound.protection.outlook.com [40.107.243.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 38FAAF80139 for ; Mon, 4 Jul 2022 16:08:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38FAAF80139 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ajiTRRyL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RGBcmB8H6DIXDya0Lf9GBN0MhfRodWneh3tAcHTYt+2DNzTkqpAZDk0fdv/AkLGuHl96MqKQkBOqqBrM+466vQ1648vu2knD0GwvEWOaBZhd0BfD11f6nCUbFrolVIN/Zt2tiGpzF4Jk5fbpev/xOGEWVK5/4WvoOw2CY6sgH+EHyxAGAijHeDUMedUv+u49S2xQVdKPfTm2YrgbM5kjRUtq/u5tvmMgHy53vjQU+XesbzLy7BvmLAUVcbVWAt/hWPzoI46sv4/6xATJpw1J5bCKl6Ot1+RVLmz0nfM87UAWoAXPEUq4v9aHqBeKgR+c3hj+KWUdU2SL4LBrDK4YGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ICABZwNdVzUwLSlk+XuVEOv6wxXrM9NPNXp6PnCGyT0=; b=ZpKm8rREQgpOoy+/KTsAngROu5c0MT01fO+CC4bTc8Mqy68T6YClWbgFhdWTSz4AhmKYqlL83d0BcR3tCk/XjXbO3s8UiWixHrE4KNcHGdwtUsHeZKrqQHjb4/gpr+AWINCEoBsVMT4dzpufYB2MEiIVm+b/Uy4WIuhwNszeeA3epz2AlgFVm97pPCAUY0UhLpuvOFsA3HlnzaP033KHwcH86t8T3tlXX+4i1vy445e5YsdVS+Xb7jzs/O8XJAMIxuVKAlMIkMi9WkEeSXckpM6KpEJ7OXmwQuboUH7ynUyLW/c2oVwb/0H+RrU0m8Q2JnJf6itFOEkhB8Ej1Io27w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ICABZwNdVzUwLSlk+XuVEOv6wxXrM9NPNXp6PnCGyT0=; b=ajiTRRyLKr72i87OoHMJb8xg58YwSukLc59F07P4Lzx5mjRZqZSVixS/dVGa5MCGfgjMVrztPh9crmCF57n2oAwyNMFVhKXuRV5asKQ9oLJt/HWoBT0XkO0/cOClosdG/g+I0dHHxM7cArfoQlxfpS37To1K+aYYb7GrJTRHj3I= Received: from MWH0EPF00056D16.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:1d) by DM6PR12MB2844.namprd12.prod.outlook.com (2603:10b6:5:45::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Mon, 4 Jul 2022 14:08:54 +0000 Received: from CO1NAM11FT063.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::204) by MWH0EPF00056D16.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.2 via Frontend Transport; Mon, 4 Jul 2022 14:08:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT063.mail.protection.outlook.com (10.13.175.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Mon, 4 Jul 2022 14:08:53 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 4 Jul 2022 09:08:52 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 4 Jul 2022 09:08:52 -0500 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Mon, 4 Jul 2022 09:08:48 -0500 From: Vijendar Mukunda To: , Subject: [PATCH RESEND 1/3] ASoC: amd: add I2S MICSP instance support Date: Mon, 4 Jul 2022 19:38:33 +0530 Message-ID: <20220704140837.1215534-1-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e277add-27ca-46f3-b1cb-08da5dc6ba79 X-MS-TrafficTypeDiagnostic: DM6PR12MB2844:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zb99rCbMIuNfaWKC8pEA6weIr8OtRJ28XlB8pAw/r251i178CM9ajvTISLZnKhfnyin8EZqNFQvzM7DAYfslGyFdiaNeqTMLfiCjDr3TW7r+7LNeGhNkyBf8dT+IbtWMVbb+ZJkUfn32JOl1lBUWWyqVV9Q424tDDHZJQA3VTpFIstpfGPAiz+xXIm0X66izQIKs5dVs9Y33Oc+lpbptTSaNSJ7GlUlVbpD+CyX5Sftg97k7w0EcH0nSPuaA2+kAZTYyV3oy/uDzqeFqSTcp/lMMPlnp4EZgjt1GNShtv5zIKNMsUMjKgd/7mS6L3sWmPgRF3koqx/y4vPatMQH12BO6SP0rFYcFw+AM2zxHYXjmsb+3KUIdR4Ui6NHlQHTcODgwZV9O7Ph30RZzE8FXGt+KcoSk3IOidEwHumRX6UjHd9FF9ijrHvIRaALr4Ugh/HLPHp76v2IraWeFiMZ/T7Hw6tDKyFCeGHWEDSxcUn4nZMoqGu8KiAYwwHOqfF7D57hiTJxiV5wI6kQ7NGKO/B5CSxgMASOEzXNJsN/N4DQDtJKe4i42VI9rRa9rn+k4H3iu7IHrUr1YyKz5xrRbCQ9s9x28N54s0qRRZnjBC8nSPCD4CVm1DV7BkH94HGfTgWhzEA8gNAZtSqqHlKAeSiU+JHSUMN3Ul4BAAsHySlZqZZqddnQawtlGAk+uMbLXiNvMXX2B+w7blR3Hb/x299wyCI4ZKMIVPrqdJSEjB17aVr+9HOp+wAG5ZV8VsVgqtFFscbOVC8v9xGtBECt3gma7Wj8LlqGzCFwE8VM7hGzicrmX6HsFf95wM1cqfTvcE/vTPo8DNNEYI4AZDPA5yNJvpX6IFvoN6VjfcRQ4mg3VBmwGduPEQp2YOkOowa/G X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(376002)(136003)(396003)(39860400002)(346002)(36840700001)(40470700004)(46966006)(336012)(47076005)(26005)(82310400005)(186003)(36756003)(2906002)(7416002)(40460700003)(426003)(36860700001)(83380400001)(34020700004)(40480700001)(8936002)(70206006)(5660300002)(8676002)(316002)(4326008)(70586007)(7696005)(478600001)(86362001)(356005)(54906003)(6666004)(81166007)(2616005)(110136005)(1076003)(41300700001)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2022 14:08:53.7916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e277add-27ca-46f3-b1cb-08da5dc6ba79 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2844 Cc: Pierre-Louis Bossart , Sunil-kumar.Dommati@amd.com, open list , Kuninori Morimoto , Meng Tang , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, zhuning@everest-semi.com, Gu Shengxian X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Add I2S MICSP instance support for Stoney variant. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp-pcm-dma.c | 50 +++++++++++++++++++++++++++++++++++-- sound/soc/amd/acp.h | 13 ++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 1cd2e70a57df..198358d28ea9 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -433,6 +433,7 @@ static void acp_dma_start(void __iomem *acp_mmio, u16 ch_num, bool is_circular) case I2S_TO_ACP_DMA_CH_NUM: case ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM: case I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM: + case ACP_TO_I2S_DMA_MICSP_INSTANCE_CH_NUM: dma_ctrl |= ACP_DMA_CNTL_0__DMAChIOCEn_MASK; break; default: @@ -710,6 +711,13 @@ static irqreturn_t dma_irq_handler(int irq, void *arg) acp_mmio, mmACP_EXTERNAL_INTR_STAT); } + if ((intr_flag & BIT(ACP_TO_I2S_DMA_MICSP_INSTANCE_CH_NUM)) != 0) { + valid_irq = true; + snd_pcm_period_elapsed(irq_data->play_i2s_micsp_stream); + acp_reg_write((intr_flag & BIT(ACP_TO_I2S_DMA_MICSP_INSTANCE_CH_NUM)) << 16, + acp_mmio, mmACP_EXTERNAL_INTR_STAT); + } + if ((intr_flag & BIT(ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM)) != 0) { valid_irq = true; snd_pcm_period_elapsed(irq_data->play_i2sbt_stream); @@ -807,7 +815,8 @@ static int acp_dma_open(struct snd_soc_component *component, * stream is not closed */ if (!intr_data->play_i2ssp_stream && !intr_data->capture_i2ssp_stream && - !intr_data->play_i2sbt_stream && !intr_data->capture_i2sbt_stream) + !intr_data->play_i2sbt_stream && !intr_data->capture_i2sbt_stream && + !intr_data->play_i2s_micsp_stream) acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { @@ -867,6 +876,9 @@ static int acp_dma_hw_params(struct snd_soc_component *component, case I2S_BT_INSTANCE: val |= ACP_I2S_BT_16BIT_RESOLUTION_EN; break; + case I2S_MICSP_INSTANCE: + val |= ACP_I2S_MICSP_16BIT_RESOLUTION_EN; + break; case I2S_SP_INSTANCE: default: val |= ACP_I2S_SP_16BIT_RESOLUTION_EN; @@ -876,6 +888,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component, case I2S_BT_INSTANCE: val |= ACP_I2S_BT_16BIT_RESOLUTION_EN; break; + case I2S_MICSP_INSTANCE: case I2S_SP_INSTANCE: default: val |= ACP_I2S_MIC_16BIT_RESOLUTION_EN; @@ -901,6 +914,27 @@ static int acp_dma_hw_params(struct snd_soc_component *component, mmACP_I2S_BT_TRANSMIT_BYTE_CNT_LOW; adata->play_i2sbt_stream = substream; break; + case I2S_MICSP_INSTANCE: + 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_MICSP_INSTANCE_CH_NUM; + rtd->ch2 = ACP_TO_I2S_DMA_MICSP_INSTANCE_CH_NUM; + rtd->sram_bank = ACP_SRAM_BANK_1_ADDRESS; + rtd->destination = TO_ACP_I2S_2; + rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH4; + rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH5; + rtd->byte_cnt_high_reg_offset = + mmACP_I2S_MICSP_TRANSMIT_BYTE_CNT_HIGH; + rtd->byte_cnt_low_reg_offset = + mmACP_I2S_MICSP_TRANSMIT_BYTE_CNT_LOW; + + adata->play_i2s_micsp_stream = substream; + break; case I2S_SP_INSTANCE: default: switch (adata->asic_type) { @@ -939,6 +973,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component, rtd->dma_curr_dscr = mmACP_DMA_CUR_DSCR_11; adata->capture_i2sbt_stream = substream; break; + case I2S_MICSP_INSTANCE: case I2S_SP_INSTANCE: default: rtd->pte_offset = ACP_CAPTURE_PTE_OFFSET; @@ -1160,6 +1195,9 @@ static int acp_dma_close(struct snd_soc_component *component, case I2S_BT_INSTANCE: adata->play_i2sbt_stream = NULL; break; + case I2S_MICSP_INSTANCE: + adata->play_i2s_micsp_stream = NULL; + break; case I2S_SP_INSTANCE: default: adata->play_i2ssp_stream = NULL; @@ -1181,6 +1219,7 @@ static int acp_dma_close(struct snd_soc_component *component, case I2S_BT_INSTANCE: adata->capture_i2sbt_stream = NULL; break; + case I2S_MICSP_INSTANCE: case I2S_SP_INSTANCE: default: adata->capture_i2ssp_stream = NULL; @@ -1197,7 +1236,8 @@ static int acp_dma_close(struct snd_soc_component *component, * another stream is also not active. */ if (!adata->play_i2ssp_stream && !adata->capture_i2ssp_stream && - !adata->play_i2sbt_stream && !adata->capture_i2sbt_stream) + !adata->play_i2sbt_stream && !adata->capture_i2sbt_stream && + !adata->play_i2s_micsp_stream) acp_reg_write(0, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); kfree(rtd); return 0; @@ -1245,6 +1285,7 @@ static int acp_audio_probe(struct platform_device *pdev) audio_drv_data->capture_i2ssp_stream = NULL; audio_drv_data->play_i2sbt_stream = NULL; audio_drv_data->capture_i2sbt_stream = NULL; + audio_drv_data->play_i2s_micsp_stream = NULL; audio_drv_data->asic_type = *pdata; @@ -1333,6 +1374,11 @@ static int acp_pcm_resume(struct device *dev) config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); } if (adata->asic_type != CHIP_CARRIZO) { + if (adata->play_i2s_micsp_stream && + adata->play_i2s_micsp_stream->runtime) { + rtd = adata->play_i2s_micsp_stream->runtime->private_data; + config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); + } if (adata->play_i2sbt_stream && adata->play_i2sbt_stream->runtime) { rtd = adata->play_i2sbt_stream->runtime->private_data; diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h index db80a73aa593..b29bef90f886 100644 --- a/sound/soc/amd/acp.h +++ b/sound/soc/amd/acp.h @@ -55,6 +55,7 @@ #define I2S_SP_INSTANCE 0x01 #define I2S_BT_INSTANCE 0x02 +#define I2S_MICSP_INSTANCE 0x03 #define CAP_CHANNEL0 0x00 #define CAP_CHANNEL1 0x01 @@ -85,6 +86,10 @@ #define I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM 10 #define ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM 11 +/* Playback DMA channels for I2S MICSP instance */ +#define SYSRAM_TO_ACP_MICSP_INSTANCE_CH_NUM 4 +#define ACP_TO_I2S_DMA_MICSP_INSTANCE_CH_NUM 5 + #define NUM_DSCRS_PER_CHANNEL 2 #define PLAYBACK_START_DMA_DESCR_CH12 0 @@ -108,8 +113,15 @@ #define CAPTURE_START_DMA_DESCR_CH11 14 #define CAPTURE_END_DMA_DESCR_CH11 15 +/* I2S MICSP Instance DMA Descriptors */ +#define PLAYBACK_START_DMA_DESCR_CH4 0 +#define PLAYBACK_END_DMA_DESCR_CH4 1 +#define PLAYBACK_START_DMA_DESCR_CH5 2 +#define PLAYBACK_END_DMA_DESCR_CH5 3 + #define mmACP_I2S_16BIT_RESOLUTION_EN 0x5209 #define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01 +#define ACP_I2S_MICSP_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 @@ -149,6 +161,7 @@ struct audio_drv_data { struct snd_pcm_substream *capture_i2ssp_stream; struct snd_pcm_substream *play_i2sbt_stream; struct snd_pcm_substream *capture_i2sbt_stream; + struct snd_pcm_substream *play_i2s_micsp_stream; void __iomem *acp_mmio; u32 asic_type; snd_pcm_sframes_t delay; From patchwork Mon Jul 4 14:08:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 12905435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3E2AC43334 for ; Mon, 4 Jul 2022 14:10:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 908EC1717; Mon, 4 Jul 2022 16:09:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 908EC1717 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1656943830; bh=ZIZVi9QoaTcI9GdUlc+crdu/X4brNti7ELNbXu+oyOo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DHr2mlj6j1+JMQ6PfROuQ1kVaaukE8rQk7KVTQGsCv7FwQ5bXG5UyiX/iguzGg/UR hNnG5FVWiJqz5a59kv4N1D1ATHWlxcvk7zmG1Op9pUBGQ+IqHoDeSgU5gByOGkx3Cd nnVhSEBkkV2B2VHcerpxyyALSiohwiLa/zGSv4ks= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CB292F8016E; Mon, 4 Jul 2022 16:09:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 076FCF8014E; Mon, 4 Jul 2022 16:09:08 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BD61FF8012A for ; Mon, 4 Jul 2022 16:09:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BD61FF8012A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Jzp+O1Hk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1UPducnr7H4I64IV19Aw7U/XXTA5jHSyAq1qPY0JoAh6hiYfbpRZ+mftGhPDcGvGhdRCmHsNdFAFqlXMRlybGOMavHwT9NMBBtHZkTXHxhnSRP5gR1n1TVK/Rrrbsd/dO1qnsX9ATjDScUHUtuhkdIhvdmtYYCcZMEfmAP43X5FQ2auSo8GKWV9Uf4fZcUHaNs79OcvkmJ/Wl1H9cRhONhbI359BQ+DCPOngyiQtBk1d6zadYprwCjGbG0AvroxHyaWl8g/2tklX9DCKMyGLrUgvK6O16/Rwy4AZ0i+/td8NN5lgCnH94xs9pC8z/vfNKjydjjiCyTedBRZHRqq4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SDfxYz3ylHAAfHM5U317utt1dQ0zSoIOoY46/Zl1W9w=; b=BAeOLnIppQwEve4QJju8LAFH862faT8NqakQXCWLAbzxhRzlfAeOOOd0jPRzkpTpJxK5SGoemKb1vz5HoO49wBOnxOACoKogSEQ5oCq5NkKEXcOa25BYGHzeLxsiDrwz1tQMeF3i0pOCjCqe93TdOSWboaWRi5nzyBxfrZKtbFv8Mwz9Lh/dBi03lwz5h1R0KQqLtpY5HSEi2itYUvcpRf3qtNXPc7QRKqqnOKOx+FVR83rWLcEmk6yc5wfTD7kmjAfNKDFKzZ0X6DNF8cm4v/hvgYMw4IxJCOxbF2CZiODuOunx+HAwMpBl1NcF/0oytlXZUwgtj3gCcDcico8Lkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SDfxYz3ylHAAfHM5U317utt1dQ0zSoIOoY46/Zl1W9w=; b=Jzp+O1HkCOT/3MWZhRhOZQkkVpqzQGEAYXqkb/1QAgPsao0IfvNY7rcPWW+TUcDOmPWypPAhGH5WWjIbl5dGmeseZQYTu7DnyGEp3fgdkpwIrmORbx1epQm3rhkYzUrrYBBC2tJoadiNvG6u/nsIIFCHs5sgNsH3pXB9shoZ9j0= Received: from MW4P220CA0019.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::24) by DM6PR12MB2908.namprd12.prod.outlook.com (2603:10b6:5:185::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Mon, 4 Jul 2022 14:08:59 +0000 Received: from CO1NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::43) by MW4P220CA0019.outlook.office365.com (2603:10b6:303:115::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Mon, 4 Jul 2022 14:08:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT010.mail.protection.outlook.com (10.13.175.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Mon, 4 Jul 2022 14:08:58 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 4 Jul 2022 09:08:57 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 4 Jul 2022 09:08:57 -0500 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Mon, 4 Jul 2022 09:08:54 -0500 From: Vijendar Mukunda To: , Subject: [PATCH RESEND V2 2/3] ASoC: amd: add Machine driver for Jadeite platform Date: Mon, 4 Jul 2022 19:38:34 +0530 Message-ID: <20220704140837.1215534-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704140837.1215534-1-Vijendar.Mukunda@amd.com> References: <20220704140837.1215534-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b342eaf9-4653-4d9e-b356-08da5dc6bd83 X-MS-TrafficTypeDiagnostic: DM6PR12MB2908:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H5nrA/+2qcRsgM86Rn+YRgurH9zsH1xxfU0wIgonW5RekuO0CNMevQSiDLFPiun68giHTM0/fp1QDMf5a9XXyRy6wP1fPzSS764MpTEBnRa6loJH6Mz/cCz/UAQmFf4+TcmyXFvlGh7QfZtOL4A4DYEzIqv9uLx1bo61FuuUIfWO1f0gpjzdi0VEZlHG25AdXd3CKAYg4Evt40n6ayJWzXHGYwSdVLr6gtED4qfvZAQnQmcbZaVmHl8onui8a1ddaQJk9nHnUM6D4wCA8+m+tmmnnZZLA/L/HlRe77n42AlumvhgauXfn2KZqZSXFBvFJTwedVO9M5Yj0cLF6vq3FDZtCiAYcrwT+azRRnIlRfXq3vaQgiKkFhTUJCpQhmVfIdDyfKJfYwJe4PYcPxSfWgS7OXH7SA3UjJ6zjYtke4rlGrqmX6Jt9mFATrCTi2kPpM87I9lwOPirOMTiOOEJZHo8xOmakXo9MoUhZUnKTUUqqJbCSfQYMp/Ru4QpFrIjq55zFB/7TY3Fv8vOOJ9DNxNoCw4KXfBEUMeCJWExHqL0Add1Ex02hRkLzwviqGpLUXQoA/KuRtcpLdOopn+grbBK+Yc8KEQpqYJ65AQY0yLOaxPhmsb28ViTeXLFP2rFC1LWfY/Ytrbi/QcBVZE2spl//5vJp7gW+j9wf/xQ7exit6iUmReGbyOWrT8WmCO+q3NL1LNGjx+070i6KhQEStqMrW7SEEn62KsictKYzVdtvKzxgSCFPXyrp3bE0KKy6VaUqLQkmsKM4+jchE/EarXSZXKOgxmyPoTA5TbbkcfdZgTgkYhcLA7C4iMnmyLx4VZ7rjDYi1V4vpAIbx3e21a0v6n2E4GRuil9R0C53IaNEKa6crlaKgTH7AafPELP X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(396003)(39860400002)(376002)(40470700004)(36840700001)(46966006)(2906002)(8936002)(5660300002)(40480700001)(82310400005)(40460700003)(83380400001)(34020700004)(36860700001)(356005)(36756003)(81166007)(82740400003)(4326008)(478600001)(8676002)(70206006)(110136005)(54906003)(316002)(2616005)(1076003)(70586007)(186003)(41300700001)(336012)(6666004)(7696005)(47076005)(426003)(86362001)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2022 14:08:58.8904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b342eaf9-4653-4d9e-b356-08da5dc6bd83 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2908 Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, zhuning@everest-semi.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Add Machine driver for Jadeite platform which uses ES8336 codec. Signed-off-by: Vijendar Mukunda Changes since v1: - as sysclk is fixed, moved code to startup() callback. - Removed unused macros (ST_PLAT_CLK & ST_ES8336_GPIO_QUIRK) from code. --- sound/soc/amd/acp-es8336.c | 324 +++++++++++++++++++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 sound/soc/amd/acp-es8336.c diff --git a/sound/soc/amd/acp-es8336.c b/sound/soc/amd/acp-es8336.c new file mode 100644 index 000000000000..eec3d57092fa --- /dev/null +++ b/sound/soc/amd/acp-es8336.c @@ -0,0 +1,324 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Machine driver for AMD Stoney platform using ES8336 Codec + * + * Copyright 2022 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../codecs/es8316.h" +#include "acp.h" + +#define DUAL_CHANNEL 2 +#define DRV_NAME "acp2x_mach" +#define ST_JADEITE 1 +#define ES8336_PLL_FREQ (48000 * 256) + +static unsigned long acp2x_machine_id; +static struct snd_soc_jack st_jack; +struct device *codec_dev; +struct gpio_desc *gpio_pa; + +static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + if (SND_SOC_DAPM_EVENT_ON(event)) + gpiod_set_value_cansleep(gpio_pa, true); + else + gpiod_set_value_cansleep(gpio_pa, false); + + return 0; +} + +static struct snd_soc_jack_pin st_es8316_jack_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static int st_es8336_init(struct snd_soc_pcm_runtime *rtd) +{ + int ret; + struct snd_soc_card *card; + struct snd_soc_component *codec; + + codec = asoc_rtd_to_codec(rtd, 0)->component; + card = rtd->card; + + ret = snd_soc_card_jack_new_pins(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0, + &st_jack, st_es8316_jack_pins, + ARRAY_SIZE(st_es8316_jack_pins)); + if (ret) { + dev_err(card->dev, "HP jack creation failed %d\n", ret); + return ret; + } + snd_jack_set_key(st_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + ret = snd_soc_component_set_jack(codec, &st_jack, NULL); + if (ret) { + dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); + return ret; + } + return 0; +} + +static const unsigned int st_channels[] = { + DUAL_CHANNEL, +}; + +static const unsigned int st_rates[] = { + 48000, +}; + +static const struct snd_pcm_hw_constraint_list st_constraints_rates = { + .count = ARRAY_SIZE(st_rates), + .list = st_rates, + .mask = 0, +}; + +static const struct snd_pcm_hw_constraint_list st_constraints_channels = { + .count = ARRAY_SIZE(st_channels), + .list = st_channels, + .mask = 0, +}; + +static int st_es8336_codec_startup(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + struct snd_soc_pcm_runtime *rtd; + struct snd_soc_card *card; + struct acp_platform_info *machine; + struct snd_soc_dai *codec_dai; + int ret; + + runtime = substream->runtime; + rtd = asoc_substream_to_rtd(substream); + card = rtd->card; + machine = snd_soc_card_get_drvdata(card); + codec_dai = asoc_rtd_to_codec(rtd, 0); + ret = snd_soc_dai_set_sysclk(codec_dai, 0, ES8336_PLL_FREQ, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(rtd->dev, "can't set codec sysclk: %d\n", ret); + return ret; + } + runtime->hw.channels_max = DUAL_CHANNEL; + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + &st_constraints_channels); + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + &st_constraints_rates); + + machine->play_i2s_instance = I2S_MICSP_INSTANCE; + machine->cap_i2s_instance = I2S_MICSP_INSTANCE; + machine->capture_channel = CAP_CHANNEL0; + return 0; +} + +static const struct snd_soc_ops st_es8336_ops = { + .startup = st_es8336_codec_startup, +}; + +SND_SOC_DAILINK_DEF(designware1, + DAILINK_COMP_ARRAY(COMP_CPU("designware-i2s.2.auto"))); +SND_SOC_DAILINK_DEF(codec, + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-ESSX8336:00", "ES8316 HiFi"))); +SND_SOC_DAILINK_DEF(platform, + DAILINK_COMP_ARRAY(COMP_PLATFORM("acp_audio_dma.1.auto"))); + +static struct snd_soc_dai_link st_dai_es8336[] = { + { + .name = "amdes8336", + .stream_name = "ES8336 HiFi Play", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBP_CFP, + .stop_dma_first = 1, + .dpcm_capture = 1, + .dpcm_playback = 1, + .init = st_es8336_init, + .ops = &st_es8336_ops, + SND_SOC_DAILINK_REG(designware1, codec, platform), + }, +}; + +static const struct snd_soc_dapm_widget st_widgets[] = { + SND_SOC_DAPM_SPK("Speaker", NULL), + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_MIC("Internal Mic", NULL), + + SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM, 0, 0, + sof_es8316_speaker_power_event, + SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), +}; + +static const struct snd_soc_dapm_route st_audio_route[] = { + {"Speaker", NULL, "HPOL"}, + {"Speaker", NULL, "HPOR"}, + {"Headphone", NULL, "HPOL"}, + {"Headphone", NULL, "HPOR"}, + {"MIC1", NULL, "Headset Mic"}, + {"MIC2", NULL, "Internal Mic"}, + {"Speaker", NULL, "Speaker Power"}, +}; + +static const struct snd_kcontrol_new st_mc_controls[] = { + SOC_DAPM_PIN_SWITCH("Speaker"), + SOC_DAPM_PIN_SWITCH("Headphone"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Internal Mic"), +}; + +static const struct acpi_gpio_params pa_enable_gpio = { 0, 0, false }; +static const struct acpi_gpio_mapping acpi_es8336_gpios[] = { + { "pa-enable-gpios", &pa_enable_gpio, 1 }, + { } +}; + +static int st_es8336_late_probe(struct snd_soc_card *card) +{ + struct acpi_device *adev; + int ret; + + adev = acpi_dev_get_first_match_dev("ESSX8336", NULL, -1); + if (adev) + put_device(&adev->dev); + codec_dev = acpi_get_first_physical_node(adev); + if (!codec_dev) + dev_err(card->dev, "can not find codec dev\n"); + + ret = devm_acpi_dev_add_driver_gpios(codec_dev, acpi_es8336_gpios); + + gpio_pa = gpiod_get_optional(codec_dev, "pa-enable", GPIOD_OUT_LOW); + if (IS_ERR(gpio_pa)) { + ret = dev_err_probe(card->dev, PTR_ERR(gpio_pa), + "could not get pa-enable GPIO\n"); + gpiod_put(gpio_pa); + put_device(codec_dev); + } + return 0; +} + +static struct snd_soc_card st_card = { + .name = "acpes8336", + .owner = THIS_MODULE, + .dai_link = st_dai_es8336, + .num_links = ARRAY_SIZE(st_dai_es8336), + .dapm_widgets = st_widgets, + .num_dapm_widgets = ARRAY_SIZE(st_widgets), + .dapm_routes = st_audio_route, + .num_dapm_routes = ARRAY_SIZE(st_audio_route), + .controls = st_mc_controls, + .num_controls = ARRAY_SIZE(st_mc_controls), + .late_probe = st_es8336_late_probe, +}; + +static int st_es8336_quirk_cb(const struct dmi_system_id *id) +{ + acp2x_machine_id = ST_JADEITE; + return 1; +} + +static const struct dmi_system_id st_es8336_quirk_table[] = { + { + .callback = st_es8336_quirk_cb, + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMD"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jadeite"), + }, + }, + { + .callback = st_es8336_quirk_cb, + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "IP3 Technology CO.,Ltd."), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ASN1D"), + }, + }, + { + .callback = st_es8336_quirk_cb, + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Standard"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ASN10"), + }, + }, + {} +}; + +static int st_es8336_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; + + dmi_check_system(st_es8336_quirk_table); + switch (acp2x_machine_id) { + case ST_JADEITE: + card = &st_card; + st_card.dev = &pdev->dev; + break; + default: + return -ENODEV; + } + + platform_set_drvdata(pdev, card); + snd_soc_card_set_drvdata(card, machine); + ret = devm_snd_soc_register_card(&pdev->dev, &st_card); + if (ret) { + return dev_err_probe(&pdev->dev, ret, + "devm_snd_soc_register_card(%s) failed\n", + card->name); + } + return 0; +} + +static int st_es8336_remove(struct platform_device *pdev) +{ + return 0; +} + +#ifdef CONFIG_ACPI +static const struct acpi_device_id st_audio_acpi_match[] = { + {"AMDI8336", 0}, + {}, +}; +MODULE_DEVICE_TABLE(acpi, st_audio_acpi_match); +#endif + +static struct platform_driver st_mach_driver = { + .driver = { + .name = "st-es8316", + .acpi_match_table = ACPI_PTR(st_audio_acpi_match), + .pm = &snd_soc_pm_ops, + }, + .probe = st_es8336_probe, + .remove = st_es8336_remove, +}; + +module_platform_driver(st_mach_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("st-es8316 audio support"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Jul 4 14:08:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 12905436 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 655C3C43334 for ; Mon, 4 Jul 2022 14:10:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9854F173B; Mon, 4 Jul 2022 16:10:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9854F173B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1656943852; bh=O2zRcm8ShDliSqlM1rF6XfD/QKnRrbe672v5EbfSoRY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TXArMfNHUKs1YCg7KvIgAFnZpsprKVsHWghwYs2ZuwK/o0EhdTb4/6oi/PBKS6DA6 j7T2jVWlAQE6SRszTs2w/I1hSsrlLFMzV0UeYzgZw/JTRr6D+9ghqAf6QGxZQSmlot sbgYP1qaGt87PANf8KDqr+zRW7A3mmQDhQqZXnSY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 893ADF8053C; Mon, 4 Jul 2022 16:09:22 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 93E2DF8053D; Mon, 4 Jul 2022 16:09:20 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2041.outbound.protection.outlook.com [40.107.243.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C393FF80538 for ; Mon, 4 Jul 2022 16:09:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C393FF80538 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="va2inCuw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YvYgHWJbogqbLZQJCsUt1d5D25caEqRdAG1D4QJ09ESGhOEeWlifyoyLKC+hWtmGs2R+Oj3T3G3jkew1WP9PW5cXUQzkeoRtndrGSdslaZ1ASFYUO/auXRRW62hovBROW/IRGXZXe62oP5YbZhzdmACpJUwtXMUFWAXhqIjTYA+jnF9FzR7mmHi8NdpWN0LUHfn7/UarpLsLVmm/uItymUgwZGkA1hbk2481DoH0JVp4d2/FKhpAU9R+NsC/Tgk/joVZU5FvmXyLsQQRY+pL/LPwO5foOQItdxyumP5NRzSXFhAWyIjdjH3fUvKTaOaw5nUU+kbuYWiyuj9WQUQVDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fhMzU624SB5hj87G1aAhibZr/Bx7YvAXgVavTMMLvEA=; b=UWp5HXD4w48QTygpCLX9eMollifVhuWalFfweDef6pjdvq4iiB5NfRaX0arJRUY5PyPcV83G9SwVWid4ITYqmcyDhKDpfcUL3JsYfsxAWcA66djoAE/8UtzVsJXXr1Gg9lD7VCIjaXb3lt7YUiyaH0TXoYOSZsrLMOgH2S7Ry5FTJBv75j3yoacOtBo2lsLoEaU56SXdke9NnXLcrG40+1iC1JQByuvGdMLFgGqdHmXhCklq0JaN6Qj5qxuCKIHxMIFaQ9/nF+AIhVmAOiJKNRY5FB3Z8CwvKqTxbxBdPMFyV+cOn7IT+045kgmnBp40tOF303KGoy/hOUxH+WEBJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fhMzU624SB5hj87G1aAhibZr/Bx7YvAXgVavTMMLvEA=; b=va2inCuwju96j2J746eTTMHPJHMwMxoZazQig4duyE64do7A6mLnCRx9R7Wevq+6MsnQY6wUOuof6SMyfcVxNeU4+bIAtBeIpKTNHZZu6vawlO4slamXj983ozmeWT5HH6Xx2ZDGQ3H3B4cKaEhnMU+4CB/iGNthLjz+zKzsB/M= Received: from MWHPR07CA0023.namprd07.prod.outlook.com (2603:10b6:300:116::33) by MWHPR12MB1549.namprd12.prod.outlook.com (2603:10b6:301:10::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.17; Mon, 4 Jul 2022 14:09:05 +0000 Received: from CO1NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:300:116:cafe::4) by MWHPR07CA0023.outlook.office365.com (2603:10b6:300:116::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Mon, 4 Jul 2022 14:09:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT052.mail.protection.outlook.com (10.13.174.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Mon, 4 Jul 2022 14:09:05 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 4 Jul 2022 09:09:04 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 4 Jul 2022 07:09:04 -0700 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Mon, 4 Jul 2022 09:08:59 -0500 From: Vijendar Mukunda To: , Subject: [PATCH RESEND V2 3/3] ASoC: amd: enable machine driver build for Jadeite platform Date: Mon, 4 Jul 2022 19:38:35 +0530 Message-ID: <20220704140837.1215534-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220704140837.1215534-1-Vijendar.Mukunda@amd.com> References: <20220704140837.1215534-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e5d17fd-e897-4e00-8ae0-08da5dc6c171 X-MS-TrafficTypeDiagnostic: MWHPR12MB1549:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wty4eHFsafAu+0pm1u5dm21kJa7pWsXapr0uhNBM8zZS9bEAo8xwgKqWnO0JLzH1GjOscGFlHasZ39g+yeDMam1uh0fy5zTF4ln7tXnGmNXHkFwnYL4stVMvOgt3LdKcZBvRUsb4hWAWzvu+gL5Sm5ChVYMb4NUzkKxOL7pG6yHa0XW0do5jwBtR1BOT0WeHIPRMnZb2sE7p8b5z8PXj0BCB+M1/0sS9lqycTTirkecAhRK0XtBuaVF04jrrbk7BOQP0UXsLHqgkVtbW0p4yyPT+QLrKLRsRL04eTqq/frCDGyEggQAmNjqurTCA8uktVichiIxBa48K4A7J4SB8lXT+zQ9xpQfqf/M5zYToq8FIHGjd9FrGmGarg/SbGuh7Ia5fPucRtAbxeeqY8W+c+Zzr9r9aj4IMfQxLXdg3KtYKQDAcAwrzdyy/4AKBrbyZBV4zPTsC5zlAoZRL7P3ILoHq8VL7OWZwrhntU79f6q3afO3QtD2xZgeXmNMTNaUI4t0e9AkfR4zbjWYPu8brMImOdYSHvshwGlfkptnfKM2yLYWkVKyzSISfcJ29HUUU0IDdbiE9IBmuc0ccN7NFTXV6uSoYRbVO93+M5vLJfPoAJK6nkwvCPPpWR4Jj8sPV4YLRqe/twlzn55jOdKhNOtzpjCr3idkuufc+IUG8bRb5dOSxM3ugP2BqhSEIJWRCn2z8LPW/IPoB5po/7IhW4s/Kq/OKBeb8u49WNG0TBfcdEhWTZeoIUenHF1Zz0VonrqS4TBVtFzRXKhINpaEYJ+ajZForyuaJ1WPK2NnV3ilWa6DvGnl3HURfG41GThQ2eMhUcBD0ZEglKRSrqaQNIo5WlAZjU5kNrqBn52hsQ/3sudpfmh5aRmi0oe5/1qYV X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(376002)(39860400002)(396003)(36840700001)(46966006)(40470700004)(110136005)(54906003)(86362001)(41300700001)(36756003)(82740400003)(356005)(81166007)(34020700004)(36860700001)(316002)(83380400001)(2616005)(82310400005)(6666004)(2906002)(5660300002)(8676002)(1076003)(70586007)(26005)(426003)(336012)(186003)(70206006)(7696005)(7416002)(478600001)(8936002)(40480700001)(40460700003)(47076005)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2022 14:09:05.4823 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e5d17fd-e897-4e00-8ae0-08da5dc6c171 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1549 Cc: Pierre-Louis Bossart , Sunil-kumar.Dommati@amd.com, Lucas Tanure , Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, zhuning@everest-semi.com, Julian Braha , Daniel Baluta , Kai Vehmanen X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Enable machine driver build for Jadeite platform using ES8336 Codec. Signed-off-by: Vijendar Mukunda changes since v1: - Add COMPILE_TEST flag --- sound/soc/amd/Kconfig | 13 +++++++++++++ sound/soc/amd/Makefile | 2 ++ 2 files changed, 15 insertions(+) diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 1381aec23048..c373f0823462 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -23,6 +23,19 @@ config SND_SOC_AMD_CZ_RT5645_MACH help This option enables machine driver for rt5645. +config SND_SOC_AMD_ST_ES8336_MACH + tristate "AMD ST support for ES8336" + select SND_SOC_ACPI + select SND_SOC_ES8316 + depends on SND_SOC_AMD_ACP + depends on ACPI || COMPILE_TEST + depends on I2C || COMPILE_TEST + help + This option enables machine driver for Jadeite platform + using es8336 codec. + Say m if you have such a device. + If unsure select "N". + config SND_SOC_AMD_ACP3x tristate "AMD Audio Coprocessor-v3.x support" depends on X86 && PCI diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile index 4b1f77930a4a..8823f6f28611 100644 --- a/sound/soc/amd/Makefile +++ b/sound/soc/amd/Makefile @@ -2,12 +2,14 @@ acp_audio_dma-objs := acp-pcm-dma.o snd-soc-acp-da7219mx98357-mach-objs := acp-da7219-max98357a.o snd-soc-acp-rt5645-mach-objs := acp-rt5645.o +snd-soc-acp-es8336-mach-objs := acp-es8336.o snd-soc-acp-rt5682-mach-objs := acp3x-rt5682-max9836.o snd-acp-config-objs := acp-config.o obj-$(CONFIG_SND_SOC_AMD_ACP) += acp_audio_dma.o obj-$(CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH) += snd-soc-acp-da7219mx98357-mach.o obj-$(CONFIG_SND_SOC_AMD_CZ_RT5645_MACH) += snd-soc-acp-rt5645-mach.o +obj-$(CONFIG_SND_SOC_AMD_ST_ES8336_MACH) += snd-soc-acp-es8336-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP3x) += raven/ obj-$(CONFIG_SND_SOC_AMD_RV_RT5682_MACH) += snd-soc-acp-rt5682-mach.o obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/