From patchwork Mon Jan 17 11:58:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Kumar Pandey X-Patchwork-Id: 12715339 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 19AA2C433F5 for ; Mon, 17 Jan 2022 12:01:19 +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 2E5B517A1; Mon, 17 Jan 2022 13:00:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2E5B517A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642420877; bh=BRRMK8CbWJPZYWFy5O8oWIxSHoX4KhqAM/SwRySgKsY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=q/fcuv4AtJVgsG2EkLeAnCzJpTXRWr2LHtYMQZo3wBYHINbIHs9Q7QCbHse4OAANj mB0iN6u65iM7L/01CDK2pNO2dtzj0kPZ5NcTqvVF2JURULtj8/P4qxdRnh20sH6bZC IKhGWbFbAnkHlLYgZ8wdCCMOGn2gQACnj7jiGwVc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 55311F8025D; Mon, 17 Jan 2022 13:00:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0DD75F8047B; Mon, 17 Jan 2022 13:00:19 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) (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 A7D70F80100 for ; Mon, 17 Jan 2022 13:00:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A7D70F80100 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="UvjXaNDn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LE9jGOqiuq6CHp/UiZzGmvO/n8wCWLO8FXf6HLac5BYNFhrIcH2kakwASr6262eRg+lqeEr/tLjujToPnljXB9QEwPF2AXuiDOg3FyXWHunqxkpQ6ZfH0W9Hm7io8Hg8bFZR9jZpLzNq7uVa7jAJn1/eJSXJEciw9TvXWm3ujANH3al9vl+NCjLU8LHNfzRyfZ+fFW7x/7wBp5XpEOjwPmEyM6FVkVZAsu2z3hXDHSXEd9Ixw6BDVpTR9S0S+dSGN9Dilz8eZ1BHzzgWy/dObvPrMkXx/qMuDI3UFkJPYhXjXjvci7s5Hw83zYM+CvCo3uf15WVfY8AaeMmcdRFo9g== 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=LvlHiRQL+8FDbFBTeRUsx7PYZCf4wLPQL0b6Nn8KidY=; b=bamTVBPe5Z1K1/zg4PBp0Hj9TjGisowkbldhn9TzWSYwgZ2A00cFRynqG6niE46jXC9OC3hi5EGIjNdPyhCoCoATM1GcDgiwbD8qXcCu3CxV47whc8kT4Ebh369EYlINROxpR/LeJAeYF1B6L4GOSUSqtqhdepF4sYL2/K26/U4//BUBPPNefpd62uXENCJkZ7VW2ZlWHMOM0+VHnpUGkpK+b3VDgXFrcEVy1xxvh4h/8gmXT5/blWvQHU6FaNF4wyDquAfv9+bvUk6NPOaGjCRGadhMPiv8X/yJQ6vaVolROx8hb6UKpdKxqBoe4wp/zsHSXpKhXa2B77pGyt2YEQ== 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=LvlHiRQL+8FDbFBTeRUsx7PYZCf4wLPQL0b6Nn8KidY=; b=UvjXaNDnrMAzo2GNICr8LxJX8+HPs9X3Epv4NlIAuvx32A7aQXM8EUuko81S2i3R5bHY9j7rcUIBaTXV6nPUShwh1ROuTEyf17cMu2EMMTYhfA8yjS7xNpFWNbHDXSPlP6kdLu/piw8mDGbHh8Kjl7r1H9xtC1MRsVPLYt8ekmU= Received: from MWHPR1601CA0012.namprd16.prod.outlook.com (2603:10b6:300:da::22) by BN6PR12MB1442.namprd12.prod.outlook.com (2603:10b6:405:f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Mon, 17 Jan 2022 12:00:00 +0000 Received: from CO1NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:300:da:cafe::ae) by MWHPR1601CA0012.outlook.office365.com (2603:10b6:300:da::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 11:59: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; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT032.mail.protection.outlook.com (10.13.174.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 11:59:59 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.18; Mon, 17 Jan 2022 05:59:58 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 05:59:58 -0600 Received: from chrome.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 05:59:54 -0600 From: Ajit Kumar Pandey To: , Subject: [PATCH v3 1/6] ASoC: amd: acp: Add generic support for PDM controller on ACP Date: Mon, 17 Jan 2022 17:28:49 +0530 Message-ID: <20220117115854.455995-2-AjitKumar.Pandey@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> References: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c559f3a-dc94-4199-395d-08d9d9b0e313 X-MS-TrafficTypeDiagnostic: BN6PR12MB1442:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nincPhbjzzLXXTY5lYu6xMf3qd9jJbzAVwrMnZ6J0T+1dnah8zfBI+9fAAgvJrjjjb4UYXRBUyi/Pt4kdqbhOiJXaaTbXEPbkNQmabBM2RuexsRXwaHX8rQvKUGrXfji68V0sjGeADo5McAwxb4LzWdAbsCl31EZNzzC0TWAst0voAtM4uPVJP4YUcQSgrqPLoC8lGcikEkdsgsKdNx9o9k86CC5oAIXQu3pKC1is6c+lkwP4k19q4Ok+JoV5Vh4xE8wx7o4U6XsOXYcHiWvF6iNs6Lp7lQKle1zrpUlsQovJm0FF7iFynzh2nTWWwmFbTl0oUhe+13MeN4uRTjULhoI9HLZYGCUtwdM5a7m+bYlpc9TId2FT/IUSDEGN2tdNW2sKEkWAdqmgrQqIW5QxgX3s9odGsYL9phSa0LMc4D4b8IqG0yaWPEgE/5sdevbscHDJS6FSCsVUbS4xIze/rXWWk0JqFFw5H6crZHrUv8bMHrlFD+LAT+Oofh1/SiZ71EM4Nu6mnGLCPPtReI8vFuMlw5nq8XUAW1zePy3bWiZZ8FMo2sZgZeSubIyufn6YrY86Y4KZMYdXAjFtq4UCLTFULqc2n871rTQ+7kbtK8fbz68ZLfTfe7LlGcwlaIU6USRkTnur+RXWO+Wa0nz0pOVZsX/20qYe9ECSLXFBy5iANuGQLAOKjtn0ERYwZP2RtXSoasvSlkNZ6DwhzLfYy8XvPTwHOib6pw24hTOwQs3xGUApFxdpG9LpknFrQeV3wl14PJ5weB9jTdDfDEBaF4V2oosf0FfYy2WQUQe9KUHygjYWeTmdtabwflcN4mu 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:(4636009)(36840700001)(46966006)(40470700002)(7696005)(47076005)(70206006)(86362001)(186003)(6666004)(110136005)(26005)(40460700001)(316002)(82310400004)(54906003)(83380400001)(70586007)(5660300002)(36756003)(508600001)(81166007)(426003)(356005)(1076003)(2616005)(8676002)(2906002)(4326008)(36860700001)(8936002)(336012)(41533002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 11:59:59.5076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c559f3a-dc94-4199-395d-08d9d9b0e313 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: CO1NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1442 Cc: Sunil-kumar.Dommati@amd.com, Geert Uytterhoeven , Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , V sujith kumar Reddy , Arnd Bergmann , Vijendar.Mukunda@amd.com, Alexander.Deucher@amd.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 driver module for PDM controller on ACP IP block. Expose dai ops to configure ACP_WOV_PDM_BLOCK registers on ACP. Such dai ops will be used by platform specific driver module to register dmic related dai with ASoC. Signed-off-by: Ajit Kumar Pandey --- sound/soc/amd/acp/Kconfig | 3 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-pdm.c | 193 +++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 9 +- sound/soc/amd/acp/chip_offset_byte.h | 20 +++ 5 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 sound/soc/amd/acp/acp-pdm.c diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index d5838df3064b..2e6d0259f2e9 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -15,6 +15,9 @@ config SND_SOC_AMD_ACP_COMMON if SND_SOC_AMD_ACP_COMMON +config SND_SOC_AMD_ACP_PDM + tristate + config SND_SOC_AMD_ACP_I2S tristate diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index 16c144c2965c..66cac95432f6 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -7,6 +7,7 @@ #common acp driver snd-acp-pcm-objs := acp-platform.o snd-acp-i2s-objs := acp-i2s.o +snd-acp-pdm-objs := acp-pdm.o #platform specific driver snd-acp-renoir-objs := acp-renoir.o @@ -18,6 +19,7 @@ snd-acp-sof-mach-objs := acp-sof-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o +obj-$(CONFIG_SND_SOC_AMD_ACP_PDM) += snd-acp-pdm.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o diff --git a/sound/soc/amd/acp/acp-pdm.c b/sound/soc/amd/acp/acp-pdm.c new file mode 100644 index 000000000000..424c6e0bb9d6 --- /dev/null +++ b/sound/soc/amd/acp/acp-pdm.c @@ -0,0 +1,193 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2022 Advanced Micro Devices, Inc. +// +// Authors: Ajit Kumar Pandey +// Vijendar Mukunda +// + +/* + * Generic Hardware interface for ACP Audio PDM controller + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "amd.h" + +#define DRV_NAME "acp-pdm" + +#define PDM_DMA_STAT 0x10 +#define PDM_DMA_INTR_MASK 0x10000 +#define PDM_DEC_64 0x2 +#define PDM_CLK_FREQ_MASK 0x07 +#define PDM_MISC_CTRL_MASK 0x10 +#define PDM_ENABLE 0x01 +#define PDM_DISABLE 0x00 +#define DMA_EN_MASK 0x02 +#define DELAY_US 5 +#define PDM_TIMEOUT 1000 +#define ACP_REGION2_OFFSET 0x02000000 + +static int acp_dmic_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct acp_stream *stream = substream->runtime->private_data; + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + u32 physical_addr, size_dmic, period_bytes; + unsigned int dmic_ctrl; + + /* Enable default DMIC clk */ + writel(PDM_CLK_FREQ_MASK, adata->acp_base + ACP_WOV_CLK_CTRL); + dmic_ctrl = readl(adata->acp_base + ACP_WOV_MISC_CTRL); + dmic_ctrl |= PDM_MISC_CTRL_MASK; + writel(dmic_ctrl, adata->acp_base + ACP_WOV_MISC_CTRL); + + period_bytes = frames_to_bytes(substream->runtime, + substream->runtime->period_size); + size_dmic = frames_to_bytes(substream->runtime, + substream->runtime->buffer_size); + + physical_addr = stream->reg_offset + MEM_WINDOW_START; + + /* Init DMIC Ring buffer */ + writel(physical_addr, adata->acp_base + ACP_WOV_RX_RINGBUFADDR); + writel(size_dmic, adata->acp_base + ACP_WOV_RX_RINGBUFSIZE); + writel(period_bytes, adata->acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); + writel(0x01, adata->acp_base + ACPAXI2AXI_ATU_CTRL); + + return 0; +} + +static int acp_dmic_dai_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + unsigned int dma_enable; + int ret = 0; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + dma_enable = readl(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); + if (!(dma_enable & DMA_EN_MASK)) { + writel(PDM_ENABLE, adata->acp_base + ACP_WOV_PDM_ENABLE); + writel(PDM_ENABLE, adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); + } + + ret = readl_poll_timeout_atomic(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE, + dma_enable, (dma_enable & DMA_EN_MASK), + DELAY_US, PDM_TIMEOUT); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + dma_enable = readl(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((dma_enable & DMA_EN_MASK)) { + writel(PDM_DISABLE, adata->acp_base + ACP_WOV_PDM_ENABLE); + writel(PDM_DISABLE, adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); + + } + + ret = readl_poll_timeout_atomic(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE, + dma_enable, !(dma_enable & DMA_EN_MASK), + DELAY_US, PDM_TIMEOUT); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +static int acp_dmic_hwparams(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hwparams, struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + unsigned int channels, ch_mask; + + channels = params_channels(hwparams); + switch (channels) { + case 2: + ch_mask = 0; + break; + case 4: + ch_mask = 1; + break; + case 6: + ch_mask = 2; + break; + default: + dev_err(dev, "Invalid channels %d\n", channels); + return -EINVAL; + } + + if (params_format(hwparams) != SNDRV_PCM_FORMAT_S32_LE) { + dev_err(dai->dev, "Invalid format:%d\n", params_format(hwparams)); + return -EINVAL; + } + + writel(ch_mask, adata->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS); + writel(PDM_DEC_64, adata->acp_base + ACP_WOV_PDM_DECIMATION_FACTOR); + + return 0; +} + +static int acp_dmic_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct acp_stream *stream = substream->runtime->private_data; + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + u32 ext_int_ctrl; + + stream->dai_id = DMIC_INSTANCE; + stream->irq_bit = BIT(PDM_DMA_STAT); + stream->pte_offset = ACP_SRAM_PDM_PTE_OFFSET; + stream->reg_offset = ACP_REGION2_OFFSET; + + /* Enable DMIC Interrupts */ + ext_int_ctrl = readl(adata->acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_int_ctrl |= PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, adata->acp_base + ACP_EXTERNAL_INTR_CNTL); + + return 0; +} + +static void acp_dmic_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + u32 ext_int_ctrl; + + /* Disable DMIC interrrupts */ + ext_int_ctrl = readl(adata->acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_int_ctrl |= ~PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, adata->acp_base + ACP_EXTERNAL_INTR_CNTL); +} + +const struct snd_soc_dai_ops acp_dmic_dai_ops = { + .prepare = acp_dmic_prepare, + .hw_params = acp_dmic_hwparams, + .trigger = acp_dmic_dai_trigger, + .startup = acp_dmic_dai_startup, + .shutdown = acp_dmic_dai_shutdown, +}; +EXPORT_SYMBOL_NS_GPL(acp_dmic_dai_ops, SND_SOC_ACP_COMMON); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_ALIAS(DRV_NAME); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 8eee3d34774b..567355209a5c 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -17,8 +17,9 @@ #define I2S_SP_INSTANCE 0x00 #define I2S_BT_INSTANCE 0x01 +#define DMIC_INSTANCE 0x02 -#define MEM_WINDOW_START 0x4000000 +#define MEM_WINDOW_START 0x4080000 #define ACP_I2S_REG_START 0x1242400 #define ACP_I2S_REG_END 0x1242810 @@ -38,6 +39,7 @@ #define ACP_SRAM_SP_CP_PTE_OFFSET 0x100 #define ACP_SRAM_BT_PB_PTE_OFFSET 0x200 #define ACP_SRAM_BT_CP_PTE_OFFSET 0x300 +#define ACP_SRAM_PDM_PTE_OFFSET 0x400 #define PAGE_SIZE_4K_ENABLE 0x2 #define I2S_SP_TX_MEM_WINDOW_START 0x4000000 @@ -96,6 +98,7 @@ struct acp_dev_data { }; extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops; +extern const struct snd_soc_dai_ops acp_dmic_dai_ops; int asoc_acp_i2s_probe(struct snd_soc_dai *dai); int acp_platform_register(struct device *dev); @@ -131,6 +134,10 @@ static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int high = readl(adata->acp_base + ACP_I2S_RX_LINEARPOSITIONCNTR_HIGH); low = readl(adata->acp_base + ACP_I2S_RX_LINEARPOSITIONCNTR_LOW); break; + case DMIC_INSTANCE: + high = readl(adata->acp_base + ACP_WOV_RX_LINEARPOSITIONCNTR_HIGH); + low = readl(adata->acp_base + ACP_WOV_RX_LINEARPOSITIONCNTR_LOW); + break; default: dev_err(adata->dev, "Invalid dai id %x\n", dai_id); return -EINVAL; diff --git a/sound/soc/amd/acp/chip_offset_byte.h b/sound/soc/amd/acp/chip_offset_byte.h index c7f77e975dc7..e38589a142e9 100644 --- a/sound/soc/amd/acp/chip_offset_byte.h +++ b/sound/soc/amd/acp/chip_offset_byte.h @@ -73,4 +73,24 @@ #define ACP_BTTDM_ITER 0x280C #define ACP_BTTDM_TXFRMT 0x2810 +/* Registers from ACP_WOV_PDM block */ + +#define ACP_WOV_PDM_ENABLE 0x2C04 +#define ACP_WOV_PDM_DMA_ENABLE 0x2C08 +#define ACP_WOV_RX_RINGBUFADDR 0x2C0C +#define ACP_WOV_RX_RINGBUFSIZE 0x2C10 +#define ACP_WOV_RX_LINKPOSITIONCNTR 0x2C14 +#define ACP_WOV_RX_LINEARPOSITIONCNTR_HIGH 0x2C18 +#define ACP_WOV_RX_LINEARPOSITIONCNTR_LOW 0x2C1C +#define ACP_WOV_RX_INTR_WATERMARK_SIZE 0x2C20 +#define ACP_WOV_PDM_FIFO_FLUSH 0x2C24 +#define ACP_WOV_PDM_NO_OF_CHANNELS 0x2C28 +#define ACP_WOV_PDM_DECIMATION_FACTOR 0x2C2C +#define ACP_WOV_PDM_VAD_CTRL 0x2C30 +#define ACP_WOV_BUFFER_STATUS 0x2C58 +#define ACP_WOV_MISC_CTRL 0x2C5C +#define ACP_WOV_CLK_CTRL 0x2C60 +#define ACP_PDM_VAD_DYNAMIC_CLK_GATING_EN 0x2C64 +#define ACP_WOV_ERROR_STATUS_REGISTER 0x2C68 + #endif From patchwork Mon Jan 17 11:58:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Kumar Pandey X-Patchwork-Id: 12715340 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 93967C433EF for ; Mon, 17 Jan 2022 12:01:36 +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 D014417B0; Mon, 17 Jan 2022 13:00:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D014417B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642420894; bh=33h2PEdJ01sNA0ETJVSY3RAO1uf2hfF7MSaDGWq7ZMc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KGetA1Gc8FRMN8Oq0rC1Ob9cXT75PpQwUntuh6aiZzG4ifG2UmuDxXnfaiO3+8T6c ZOoknLZwvM7H9YYJnfXqTQ4RETZDJrJ+GVTBBE62cL9YhWinKkH7lg8LhxIf1QlHSC DPliv45qr+jXmn6EBerAdW+K1EJfxorNAMq2qOb8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DCF70F80507; Mon, 17 Jan 2022 13:00:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 60339F8025D; Mon, 17 Jan 2022 13:00:19 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2050.outbound.protection.outlook.com [40.107.92.50]) (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 4DB9DF800EB for ; Mon, 17 Jan 2022 13:00:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4DB9DF800EB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="n20tEt4S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LB7FWlMlFPbzAe/1VLSXuB2uXv20Pou++2v6u5VRjfavd5zkR9CX8ujghQFfQOYKCDU+z642Zq360NGq0Id+zbsfGfPYW6K/Ewx2gR0Hnlk1rxLPhUTz/xdpDmljfN7HNpsrxH0pNpw/EmsANhs//hCo+pxoJba1ZWcn9b3p5o83eR6ycbJ1gO6exFmfhKjfof7OoBITHRbdoqf9eX8Bb3tB6l9/IBfydRes0QTb7FLx/5AnvoRQOZyELkMxVG2kSEKwOqC1mGzBtj8v3fyCeTySREoTdJixm04ETjBvDlCi1nev79JtJrQpcy1E/iSAMEMUeo6BHRPsZqUOHXFmkw== 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=2m1RzSnqEB7lEjWdke8awBRfdhrc7YeH/cC/s43plRo=; b=gQEju43+pwsnpaSRrG16VvDfAOYSCqs0nOnLMGhqY2C5d/Jn+bmKBUmkWcDsJD4Fx7SK1R0iSKkqEJGV6J6PPttWjcA5Xi7M4K/o4+ECHs1y7U3l6bB+H7VHhgwW49Iyqalm/dryRYVwvqQudGsLT7d66tccHJjkqHPimDQ6ts8eW6uqt5SlsjfpbPCpfwkE5J/LUYdFKErTmXrbF1MmhhJ0yL1A/XwhNVL1dLdE6VEvMmfjsy/eai3VsCVYPuZ64qtqQ9AdbSzc7/o+qJ8fPXBKJzTDWZ3+4stUqa3/PpyWuw5UeCz6q20UZIVR1lJ6o5rZqDs9Eugi5+w9px893g== 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=2m1RzSnqEB7lEjWdke8awBRfdhrc7YeH/cC/s43plRo=; b=n20tEt4S7GNBmfB4ccOmuihrcMDo/k70xxVKjJtE+s7cAYMgTNYiUVug4qS/DtVRynCBk8jyXOW3zFDZOre2Cr+KUiyTZrl+ff2gQcVeDdZH1Zwy4cUzMwsH124fjTNV5vsp9nLvZwLw3GfOYtFt3Pv6vrDG/eAj5yczfox3Zkc= Received: from DS7PR05CA0020.namprd05.prod.outlook.com (2603:10b6:5:3b9::25) by DM6PR12MB2667.namprd12.prod.outlook.com (2603:10b6:5:42::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12; Mon, 17 Jan 2022 12:00:09 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::f8) by DS7PR05CA0020.outlook.office365.com (2603:10b6:5:3b9::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7 via Frontend Transport; Mon, 17 Jan 2022 12:00:09 +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=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:00:09 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 06:00:09 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 04:00:08 -0800 Received: from chrome.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 06:00:04 -0600 From: Ajit Kumar Pandey To: , Subject: [PATCH v3 2/6] ASoC: amd: acp: Add PDM controller based dmic dai for Renoir Date: Mon, 17 Jan 2022 17:28:50 +0530 Message-ID: <20220117115854.455995-3-AjitKumar.Pandey@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> References: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f50909c1-ea48-4acd-5a6d-08d9d9b0e914 X-MS-TrafficTypeDiagnostic: DM6PR12MB2667:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MIp6lc4GCYEFu5ZJ43/1LnEXdUxma3nD/acBPiMR2fBHAyExu1DRRfRGXym7VHtIMpyBx3PbRmzxdVGr76q563wm57sKr1EqlhcScHoGRWx6hgJ0u7ynrAstjuCMzvonNt7z7J+irfS3Q0LWGE1Ipr9Vm+BqDZTfBNXiGDbyZlgSUxr1XXwyPpO02cpSKarAnQCNf12CYWBQCgiakKOitVxt9X3s6b2OIzFq5/ZDa3fuF932ZiuhB2mpufB0b2RtLBcoe8N3C0Zf3B48LUgry6AoZsudBTwoQW4hWW1sNWtNrxYPEHV0Dw/TsVLEenT688P622gTldw1lQWpo9/6i+UT4hutUS/HX1VQ6EPYKz/QdV3L6nmBXBubwQ9IkDsGyuAsp+6xM8WTar5NZS2Lov3zZq+xslsjXSSA1BK9zp1WDqk0rEZgZWJyy8EyWvszbzTWg6NgT1rTl0Ge4+e3gU1BpvXiujMgyflFbq6+iSyhv6vkZWZF1oULNbivuWK9HTtKngwyU2SVJ+5TqXfc03CSNo3uKetqUzgEIdQkCxR/Z27MZCAF6n88lJNhmFsPuQNjoh2p/QbUfylwDy7x4sOTd/A4bnhxFbIfrgTP7nFxRAhyHNcEAUn0SolvC4fGEmQ+QzeNbti1/8J0+ImDCLoYccJEiRHZwlY8KQ31kSEbnJU5VslKUbVECbBbOUX5hFMBuIJcT8Pm6hBQg6KKbi+EGnV9tAd5IQ3MGmao8Rl91YPV2h3CQ7KjwWpr/9sqO0SjGW75Ltse+ZREdTO0Oqndndi63RxTMaXon+IreQs= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(40470700002)(36840700001)(70206006)(5660300002)(336012)(186003)(426003)(26005)(1076003)(36860700001)(86362001)(2616005)(83380400001)(8936002)(508600001)(81166007)(8676002)(2906002)(36756003)(4326008)(356005)(54906003)(47076005)(110136005)(82310400004)(40460700001)(7696005)(70586007)(6666004)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 12:00:09.6751 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f50909c1-ea48-4acd-5a6d-08d9d9b0e914 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2667 Cc: Sunil-kumar.Dommati@amd.com, Geert Uytterhoeven , Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , V sujith kumar Reddy , Arnd Bergmann , Vijendar.Mukunda@amd.com, Alexander.Deucher@amd.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" Renoir ACP IP has a PDM controller block. Add DMIC dai instance in dai_driver struct to enable dmic capture support on Renoir platform. Signed-off-by: Ajit Kumar Pandey --- sound/soc/amd/acp/Kconfig | 1 + sound/soc/amd/acp/acp-renoir.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index 2e6d0259f2e9..f4ca7843391b 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -29,6 +29,7 @@ config SND_AMD_ASOC_RENOIR tristate "AMD ACP ASOC Renoir Support" select SND_SOC_AMD_ACP_PCM select SND_SOC_AMD_ACP_I2S + select SND_SOC_AMD_ACP_PDM depends on X86 && PCI help This option enables Renoir I2S support on AMD platform. diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index 9b321a055b52..770a57a0677b 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -97,6 +97,19 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { .ops = &asoc_acp_cpu_dai_ops, .probe = &asoc_acp_i2s_probe, }, +{ + .name = "acp-pdm-dmic", + .id = DMIC_INSTANCE, + .capture = { + .rates = SNDRV_PCM_RATE_8000_48000, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 48000, + }, + .ops = &acp_dmic_dai_ops, +}, }; static int renoir_audio_probe(struct platform_device *pdev) From patchwork Mon Jan 17 11:58:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Kumar Pandey X-Patchwork-Id: 12715341 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 6160AC433F5 for ; Mon, 17 Jan 2022 12:01:53 +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 9B1A5171F; Mon, 17 Jan 2022 13:01:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B1A5171F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642420911; bh=44YJJ9gc14Ke4mqqluYzCFB5OmR+m85m6qOM6BGPqXw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iUW9gb7TdtC25njgU+249YYDgJc3AUQx8l2kAVGdNssk9K7N4G6yrJh+ZZY0nfna3 QUiADhY8cVFTertlSreMc6vfHZHPz3PofjIH9iiPxCAN5n0xZ1B5dWTCJKrJEtJxWO hJ073kP9lBX0rcme/8/KJ1sPOXFHB9sL0uXqszAY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6F819F80518; Mon, 17 Jan 2022 13:00:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64D81F800EB; Mon, 17 Jan 2022 13:00:41 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) (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 812DAF800EB for ; Mon, 17 Jan 2022 13:00:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 812DAF800EB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="rHCAsVcP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mwCtWmbe7Uvrpfn3PdIL3TwEiVaHU7uR5I1NvuP5xXV6P+2KybbsayhMOty0PUmJ22tUb17B1PuEBvy4Xbfd5Y+aLJMLqOmG/ZqXegPIL9X0hQXj9Wjvp6vsWiO11ZLCcZKGaTyXPvuKobz4qLCgD5uYAa5Z5eoNFAM5+EI+DRfOQd8RWtl0lKGmxUQAE33D4D7rM6wH9UzGwYOc1f9ZCRxvsqYR7zaCVCxXB0167rRSxVIFyAbKntW/taXW+HSoiW7YJs4EN6xLzuJfKPKILUFeiFoAssvFYBltx8G1wB2v07T9ze8RlEqLa0rJTuHBC/eChCA7q3Fatm/8/4Fu0A== 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=W5U3bsfdnoHO5g/naWEGDz+6a+Ao8x5Ce25soFqKtsA=; b=bQYbxagnVx8zzEfMLo9G4lJDmuZfYQdYkMxgU+teO6NEZtxftBwb0N3UuneNkAZG8k2AA9FpHytZ53/rGV/bLLbXkWSwshFBEheaB375+jEGOtjvPjzdPpCSl38iGtGYkfbxMghOqow7+k+aI3iXvqUHUUAPX1fH4zJaNI3j7W/GVdmtC1bzbg9LLO1GOtEIoTfDRnjuVZKKhwGtb4o3S8+oqCP8gDxxPsBIOyNz1a0p5dxycmQaDLtic7NpuirnuiIk5ZBMpvED6OsI+WyeLOdvlr4CZ0/OpBoRznws1WqWUYS7hBX6kgYdnZEnf7rHQRd7gueB70p06b01gByqfQ== 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=W5U3bsfdnoHO5g/naWEGDz+6a+Ao8x5Ce25soFqKtsA=; b=rHCAsVcPD0+1eVyeLAHgz/pSv0qSvag0YaZ4J0GS+aXojJlHM772tz7zAgOTr87l2TvCqYqf/u05mJXs/sDkdKQDk6cWFqnx42s41DPlLB+vgfa98lXmjwVAYTBOGNgS45KCpUAn889ljIz7/+xV8TR/473E5U09093lNNaI9cc= Received: from DM5PR20CA0007.namprd20.prod.outlook.com (2603:10b6:3:93::17) by BY5PR12MB4818.namprd12.prod.outlook.com (2603:10b6:a03:1b4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Mon, 17 Jan 2022 12:00:28 +0000 Received: from DM6NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:3:93:cafe::36) by DM5PR20CA0007.outlook.office365.com (2603:10b6:3:93::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10 via Frontend Transport; Mon, 17 Jan 2022 12:00:27 +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=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT035.mail.protection.outlook.com (10.13.172.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:00:27 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 06:00:27 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 06:00:26 -0600 Received: from chrome.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 06:00:22 -0600 From: Ajit Kumar Pandey To: , Subject: [PATCH v3 3/6] ASoC: amd: acp: Add generic PCI driver module for ACP device Date: Mon, 17 Jan 2022 17:28:51 +0530 Message-ID: <20220117115854.455995-4-AjitKumar.Pandey@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> References: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44f821a8-f462-4201-6847-08d9d9b0f3e0 X-MS-TrafficTypeDiagnostic: BY5PR12MB4818:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:227; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WfOvWZvEM+6CPH73HBWNyMBNpoKdwM77oxaCJuAwNv/a5+pq1jfbB0biseaWBfoFZuSxpJAOA8kzScbCZ7m/F8flriQDZidynW5dq5MqUQaRFar19zuJuutDU5aPZiRqJapn2CmcSu28qmim7jRTKwsatwc2H/BMlkV6RZSiqDlvKnvDUOoqu14mJnEx6YVUcMD33yXu/ltGcfBVIFPrN1jOmBNuOTtGOBeTXi57bEpdbsWEosV0cY1cpaT5UQYJPJIp75YY4rm6LysVWgq66K4WPHMvmw4nvW4ytcqBzLzO+esdnZZDdSAWeZ3suM+5VKlp86WT2CKRSMzq0Jlqt1tBkaH5Tc3v2ksCdJknRKi0SzvuNLZrgx6+QYlnJkaVDf6i6u3+cWsxRASZHMawq4rzqu7+izW9cY21WavkUDnCEG+f3HfevlzodKOL8+4FahkoE0/3Hgk0km+fiFRsY1Ob/zoiicqqpb4d4h7TMnDYBtB8fA1Ia/aaIA1Geqze9lHdHTDgG/DDZhFx6pgrtOO6OfavD63bM1Y4PKB8nysRglo3gxF1dtuOmMmkDXZBTULP1ugSNuItmSjaPP5cF+5/WbSdkG7isQaF1re/kwbtZjFhf5cQt/k1tv2XsbMinWmA1/ULPfQw/qkrJE4g6q8BdDTVQfzfPeAR0tulBnArfJVps00D/klbAYo+lZyM1fQBq3N9Ee+IbLFzmm4ZJFwlA1ddDUnvQMowOLrO4oRViAPkb4hX6AGolyDdtTIGkswpyOZ6A40D+5m27Ur9yuTMBkE+v5+bHz4JwkYq6i1+vl/oK00JVMT3nYiwTrLz1rKo9QxJOwfTeeWOoWKGiw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(40470700002)(46966006)(8936002)(86362001)(5660300002)(36860700001)(7696005)(2616005)(426003)(508600001)(186003)(26005)(8676002)(47076005)(36756003)(82310400004)(40460700001)(336012)(2906002)(6666004)(4326008)(70586007)(70206006)(7416002)(356005)(110136005)(54906003)(83380400001)(81166007)(316002)(1076003)(41533002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 12:00:27.7896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44f821a8-f462-4201-6847-08d9d9b0f3e0 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4818 Cc: Pierre-Louis Bossart , Sunil-kumar.Dommati@amd.com, Geert Uytterhoeven , Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , V sujith kumar Reddy , Arnd Bergmann , Ranjani Sridharan , Vijendar.Mukunda@amd.com, Alexander.Deucher@amd.com, Daniel Baluta 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" Audio Co-processor or ACP IP block on AMD's SOC is connected via PCI bus interface, hence needs to be register as a PCI device. We have same PCI device ID across multiple SOC's but with different revision id for PCI hw. Add a generic PCI driver module for ACP that registers ACP as a PCI device and also register a platform device based on pci revision id. Any SOC's specific configuration for ACP block will be done in platform driver probe. We have added an initial support for ACP revision id 3 or ACP3X device. Signed-off-by: Ajit Kumar Pandey --- sound/soc/amd/acp/Kconfig | 6 ++ sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-pci.c | 160 ++++++++++++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 14 ++++ sound/soc/amd/mach-config.h | 1 + 5 files changed, 183 insertions(+) create mode 100644 sound/soc/amd/acp/acp-pci.c diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index f4ca7843391b..626e4a5cb06a 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -25,6 +25,12 @@ config SND_SOC_AMD_ACP_PCM tristate select SND_SOC_ACPI if ACPI +config SND_SOC_AMD_ACP_PCI + tristate "AMD ACP PCI Driver Support" + depends on X86 && PCI + help + This options enables generic PCI driver for ACP device. + config SND_AMD_ASOC_RENOIR tristate "AMD ACP ASOC Renoir Support" select SND_SOC_AMD_ACP_PCM diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index 66cac95432f6..657ddfadf0bb 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -8,6 +8,7 @@ snd-acp-pcm-objs := acp-platform.o snd-acp-i2s-objs := acp-i2s.o snd-acp-pdm-objs := acp-pdm.o +snd-acp-pci-objs := acp-pci.o #platform specific driver snd-acp-renoir-objs := acp-renoir.o @@ -20,6 +21,7 @@ snd-acp-sof-mach-objs := acp-sof-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o obj-$(CONFIG_SND_SOC_AMD_ACP_PDM) += snd-acp-pdm.o +obj-$(CONFIG_SND_SOC_AMD_ACP_PCI) += snd-acp-pci.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c new file mode 100644 index 000000000000..340e39d7f420 --- /dev/null +++ b/sound/soc/amd/acp/acp-pci.c @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2022 Advanced Micro Devices, Inc. All rights reserved. +// +// Authors: Ajit Kumar Pandey + +/* + * Generic PCI interface for ACP device + */ + +#include +#include +#include +#include +#include + +#include "amd.h" +#include "../mach-config.h" + +#define DRV_NAME "acp_pci" + +#define ACP3x_REG_START 0x1240000 +#define ACP3x_REG_END 0x125C000 + +static struct platform_device *dmic_dev; +static struct platform_device *pdev; + +static const struct resource acp3x_res[] = { + { + .start = 0, + .end = ACP3x_REG_END - ACP3x_REG_START, + .name = "acp_mem", + .flags = IORESOURCE_MEM, + }, + { + .start = 0, + .end = 0, + .name = "acp_dai_irq", + .flags = IORESOURCE_IRQ, + }, +}; + +static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) +{ + struct platform_device_info pdevinfo; + struct device *dev = &pci->dev; + const struct resource *res_acp; + struct acp_chip_info *chip; + struct resource *res; + unsigned int flag, addr, num_res, i; + int ret; + + flag = snd_amd_acp_find_config(pci); + if (flag != FLAG_AMD_LEGACY) + return -ENODEV; + + chip = devm_kzalloc(&pci->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + if (pci_enable_device(pci)) { + dev_err(&pci->dev, "pci_enable_device failed\n"); + return -ENODEV; + } + + ret = pci_request_regions(pci, "AMD ACP3x audio"); + if (ret < 0) { + dev_err(&pci->dev, "pci_request_regions failed\n"); + return -ENOMEM; + } + + pci_set_master(pci); + + switch (pci->revision) { + case 0x01: + res_acp = acp3x_res; + num_res = ARRAY_SIZE(acp3x_res); + chip->name = "acp_asoc_renoir"; + chip->acp_rev = ACP3X_DEV; + break; + default: + dev_err(dev, "Unsupported device revision:0x%x\n", pci->revision); + return -EINVAL; + } + + dmic_dev = platform_device_register_data(dev, "dmic-codec", PLATFORM_DEVID_NONE, NULL, 0); + if (IS_ERR(dmic_dev)) { + dev_err(dev, "failed to create DMIC device\n"); + return PTR_ERR(dmic_dev); + } + + addr = pci_resource_start(pci, 0); + chip->base = devm_ioremap(&pci->dev, addr, pci_resource_len(pci, 0)); + + res = devm_kzalloc(&pci->dev, sizeof(struct resource) * num_res, GFP_KERNEL); + if (!res) { + platform_device_unregister(dmic_dev); + return -ENOMEM; + } + + for (i = 0; i < num_res; i++, res_acp++) { + res[i].name = res_acp->name; + res[i].flags = res_acp->flags; + res[i].start = addr + res_acp->start; + res[i].end = addr + res_acp->end; + if (res_acp->flags == IORESOURCE_IRQ) { + res[i].start = pci->irq; + res[i].end = res[i].start; + } + } + + memset(&pdevinfo, 0, sizeof(pdevinfo)); + + pdevinfo.name = chip->name; + pdevinfo.id = 0; + pdevinfo.parent = &pci->dev; + pdevinfo.num_res = num_res; + pdevinfo.res = &res[0]; + pdevinfo.data = chip; + pdevinfo.size_data = sizeof(*chip); + + pdev = platform_device_register_full(&pdevinfo); + if (IS_ERR(pdev)) { + dev_err(&pci->dev, "cannot register %s device\n", pdevinfo.name); + platform_device_unregister(dmic_dev); + ret = PTR_ERR(pdev); + } + + return ret; +}; + +static void acp_pci_remove(struct pci_dev *pci) +{ + if (dmic_dev) + platform_device_unregister(dmic_dev); + if (pdev) + platform_device_unregister(pdev); +} + +/* PCI IDs */ +static const struct pci_device_id acp_pci_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, ACP_PCI_DEV_ID)}, + { 0, } +}; +MODULE_DEVICE_TABLE(pci, acp_pci_ids); + +/* pci_driver definition */ +static struct pci_driver snd_amd_acp_pci_driver = { + .name = KBUILD_MODNAME, + .id_table = acp_pci_ids, + .probe = acp_pci_probe, + .remove = acp_pci_remove, +}; +module_pci_driver(snd_amd_acp_pci_driver); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_ALIAS(DRV_NAME); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 567355209a5c..8fd38bf4d3bd 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -12,9 +12,14 @@ #define __AMD_ACP_H #include +#include #include +#include + #include "chip_offset_byte.h" +#define ACP3X_DEV 3 + #define I2S_SP_INSTANCE 0x00 #define I2S_BT_INSTANCE 0x01 #define DMIC_INSTANCE 0x02 @@ -70,6 +75,12 @@ #define ACP_MAX_STREAM 6 +struct acp_chip_info { + char *name; /* Platform name */ + unsigned int acp_rev; /* ACP Revision id */ + void __iomem *base; /* ACP memory PCI base */ +}; + struct acp_stream { struct snd_pcm_substream *substream; int irq_bit; @@ -106,6 +117,9 @@ int acp_platform_unregister(struct device *dev); int acp_machine_select(struct acp_dev_data *adata); +/* Machine configuration */ +int snd_amd_acp_find_config(struct pci_dev *pci); + static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction) { u64 byte_count, low = 0, high = 0; diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h index feb3756d9ac4..0a54567a2841 100644 --- a/sound/soc/amd/mach-config.h +++ b/sound/soc/amd/mach-config.h @@ -14,6 +14,7 @@ #define FLAG_AMD_SOF BIT(1) #define FLAG_AMD_SOF_ONLY_DMIC BIT(2) +#define FLAG_AMD_LEGACY BIT(3) #define ACP_PCI_DEV_ID 0x15E2 From patchwork Mon Jan 17 11:58:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Kumar Pandey X-Patchwork-Id: 12715342 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 D0BD2C433FE for ; Mon, 17 Jan 2022 12:02:09 +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 0C61817C2; Mon, 17 Jan 2022 13:01:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0C61817C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642420928; bh=Xmj8IBhELT9pvzIVbMTVjvHCyW+oTuiqVsZdQfSuOqk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fGdhpoKPY9Chs3KiPBHRzxVvBB+E4SWAr3Wh3lXsRZ9iq7LyHkBeP1reGZ1iW6QeN VdR0+yMxUYMhAOQOgUR6vPv+UZ0OOeLOsny91FzMU4URL/6fbXnctQpKCzwQOZUBPx iGzxuZsQKRw4VQB2eAclgbjct3gsRX7zp3VBpNsE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0D859F80100; Mon, 17 Jan 2022 13:00:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DFC09F80519; Mon, 17 Jan 2022 13:00:53 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2070.outbound.protection.outlook.com [40.107.237.70]) (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 B0E36F80100 for ; Mon, 17 Jan 2022 13:00:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B0E36F80100 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="YNPTeOby" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEDLw9WP9pIBuwpXCDrBK6DUqa6eIqeaTCLMd0wI8QlnGUcTWKlSy14XsZiQBBBILeKxWuTMUN24giJRWvTVX5ZQNHwaBUCOctRjmdb4ApsTAk21OPWYqFGd2tsyWKPrn5w8QrEI6npIMnWAzx8exjjKBn9cr4K8kgEkkkH0FcVnBaFNW3UAuiq3+h7QTfHd+oMmN1XHrTf2EGYVyF6Ox1CG3pZc7CcAU+8kAiXmmrpppoYadGbVlvoJDUt5ZIC0oLiYWYaRm/rQQWu7qmTQs0/5YUB5j+44Dhn3hTN5l+rpa3rhnHEpvDBs+cG4AaCEh3aAhYFiHoH7hUGa5n3Exg== 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=TzTcVMMMj0ErWsJGvbWFv8c2Fr5u5NMCvMAdDQFTLrM=; b=FvYcwMR7KSP8Jyhz1hs8/Ol/WYl/Thzhfn8fpRPXYQYbHh5stb3nWEgF09CPDLYeCVS35ytWoG5c6aR3VueKx8ZAOYv04JDrHjK9o5Xw1USdMWOnq7bIg+VjHQuQZkbvaaronHRNCzTZhxigaY7CEPcDnyc/0ExkZx3kCRE35LKS/OFXG5D7tQ0MqSjiQ/QEIUtr3xDnnrzvctNyXW1HBUPJy1kk9xpzsBH+AN/GpWMfgK8++16nNfA6Vt6+bd3IaMH+3vYM3zAZvHXlsdto+YlLRLE+IX77W0yaftkrkE7QhY4uS5Io1AXu+doRD+L65j2cTLA87rn9pLlXxN7Yvg== 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=TzTcVMMMj0ErWsJGvbWFv8c2Fr5u5NMCvMAdDQFTLrM=; b=YNPTeObyXEF/3sz1zlI3XITv6AoTlwxKmym2v8Lz8/g9YFK5UuumhSQ6TTHk2hmtryLxvrennJwHnSCxgjm/TvCr/YGciEBgcIpAtJiUVHyHih+oJEkYyHHcGZ17LJUU8lDMmxRWktCtRQp/lHOEbUJry0WAYh+B3iEt34wXFmQ= Received: from MWHPR12CA0056.namprd12.prod.outlook.com (2603:10b6:300:103::18) by CH2PR12MB3831.namprd12.prod.outlook.com (2603:10b6:610:29::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Mon, 17 Jan 2022 12:00:38 +0000 Received: from CO1NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:300:103:cafe::7b) by MWHPR12CA0056.outlook.office365.com (2603:10b6:300:103::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:00:38 +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; 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.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:00:38 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.18; Mon, 17 Jan 2022 06:00:37 -0600 Received: from chrome.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 06:00:34 -0600 From: Ajit Kumar Pandey To: , Subject: [PATCH v3 4/6] ASoC: amd: acp: Add ACP init()/deinit() callback for Renoir. Date: Mon, 17 Jan 2022 17:28:52 +0530 Message-ID: <20220117115854.455995-5-AjitKumar.Pandey@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> References: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 939d054b-65f9-477e-b084-08d9d9b0fa5e X-MS-TrafficTypeDiagnostic: CH2PR12MB3831:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1388; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YMo/fRZ+wDMNzdpf8U5Xhg9PPkK/XhCEorN97no/wF1MlQfAFdM8LOlrgZ6FVSEOBW9qzZcU7Y1dkJYoII0GxFzpFOlROWBhBpk3MqKtlP8Z/7dLBtzcKrLnK518wewGKC96YY6qvaSjApvPUJVCMvpJQv0NMascUbi6R+pYNmptiZ2a3gMzfEsilt+szjRczA6xEYKCQghTRTw4DM6l8vm0r4fs3R+WK+xK2yY2cuYQGhkBOqbTLSKFFckYqe2yrtF2MeicgeuKFnlW8+7lCsx65qt39DyjvvStXXKAhSaSVf6Int1zvHsqiE3s40/bCwK//2miPbnapBvUlqnlF5jpF6AW/d1SjTMJsgp9INCmD3WCsqvPdFTKdbMAObQxrtsjYLfj1aYOLTwfU1+4dCXOP48kLAGuUWpVtGIExPCwWygITwI7bvp8s/rwfIqFrCqoWAwUVUaK58IrAhNlOwgswVu6WC6z00ckti4sDkXv8P5ip1z44UvfS7Lacnku3f6R/iDednssWrklhsv6Rjr/DSWuBT4qtvAmSvO1WhMsHn/Yrm08yLDTpCliy/oMkG739XRJw/JmXoamIqjaFETYAZve33pluvv7V2HgAtVf20WJcxhovApjqCkfJfC9s0m38TStAoMp5o8xElk47H9VLvy+ApSEu2dgqHUoWvecjXNjRP4H4BnakL3Zg1gw4FQ2R/43mCnQ69ZPnkIrW3a9wYyfrwXVTIg07bn91+lP0LCkm4STh20BjcflCdkt7JaBGbj0DtnepNcJa4tWe9tJK9TroE9ToJJ9jLjuohQ= 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:(4636009)(40470700002)(46966006)(36840700001)(508600001)(36860700001)(5660300002)(86362001)(316002)(110136005)(54906003)(47076005)(70206006)(70586007)(83380400001)(7696005)(186003)(2616005)(356005)(6666004)(426003)(336012)(36756003)(2906002)(8676002)(8936002)(4326008)(1076003)(82310400004)(26005)(40460700001)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 12:00:38.5898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 939d054b-65f9-477e-b084-08d9d9b0fa5e 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: CH2PR12MB3831 Cc: Sunil-kumar.Dommati@amd.com, Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Vijendar.Mukunda@amd.com, Alexander.Deucher@amd.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" ACP hardware has PGFSM control registers that can be configured to power On/Off the ACP IP block. Add acp init()/de_init() callbacks in renoir platform driver probe()/remove() respectively to power on and off ACP IP block on ACP3X device. Signed-off-by: Ajit Kumar Pandey --- sound/soc/amd/acp/acp-renoir.c | 147 +++++++++++++++++++++++++++ sound/soc/amd/acp/chip_offset_byte.h | 6 ++ 2 files changed, 153 insertions(+) diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index 770a57a0677b..d06ad5ce7fec 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -25,6 +25,20 @@ #define DRV_NAME "acp_asoc_renoir" +#define ACP_SOFT_RST_DONE_MASK 0x00010001 + +#define ACP_PWR_ON_MASK 0x01 +#define ACP_PWR_OFF_MASK 0x00 +#define ACP_PGFSM_STAT_MASK 0x03 +#define ACP_POWERED_ON 0x00 +#define ACP_PWR_ON_IN_PROGRESS 0x01 +#define ACP_POWERED_OFF 0x02 +#define DELAY_US 5 +#define ACP_TIMEOUT 500 + +#define ACP_ERROR_MASK 0x20000000 +#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF + static struct snd_soc_acpi_codecs amp_rt1019 = { .num_codecs = 1, .codecs = {"10EC1019"} @@ -112,11 +126,130 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { }, }; +static int acp3x_power_on(void __iomem *base) +{ + u32 val; + + val = readl(base + ACP_PGFSM_STATUS); + + if (val == ACP_POWERED_ON) + return 0; + + if ((val & ACP_PGFSM_STAT_MASK) != ACP_PWR_ON_IN_PROGRESS) + writel(ACP_PWR_ON_MASK, base + ACP_PGFSM_CONTROL); + + return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, !val, DELAY_US, ACP_TIMEOUT); +} + +static int acp3x_power_off(void __iomem *base) +{ + u32 val; + + writel(ACP_PWR_OFF_MASK, base + ACP_PGFSM_CONTROL); + + return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, + (val & ACP_PGFSM_STAT_MASK) == ACP_POWERED_OFF, + DELAY_US, ACP_TIMEOUT); +} + +static int acp3x_reset(void __iomem *base) +{ + u32 val; + int ret; + + writel(1, base + ACP_SOFT_RESET); + + ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, + DELAY_US, ACP_TIMEOUT); + if (ret) + return ret; + + writel(0, base + ACP_SOFT_RESET); + + return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); +} + +static void acp3x_enable_interrupts(void __iomem *base) +{ + u32 ext_intr_ctrl; + + writel(0x01, base + ACP_EXTERNAL_INTR_ENB); + ext_intr_ctrl = readl(base + ACP_EXTERNAL_INTR_CNTL); + ext_intr_ctrl |= ACP_ERROR_MASK; + writel(ext_intr_ctrl, base + ACP_EXTERNAL_INTR_CNTL); +} + +static void acp3x_disable_interrupts(void __iomem *base) +{ + writel(ACP_EXT_INTR_STAT_CLEAR_MASK, base + ACP_EXTERNAL_INTR_STAT); + writel(0x00, base + ACP_EXTERNAL_INTR_ENB); +} + +static int rn_acp_init(void __iomem *base) +{ + int ret; + + /* power on */ + ret = acp3x_power_on(base); + if (ret) + return ret; + + writel(0x01, base + ACP_CONTROL); + + /* Reset */ + ret = acp3x_reset(base); + if (ret) + return ret; + + acp3x_enable_interrupts(base); + + return 0; +} + +static int rn_acp_deinit(void __iomem *base) +{ + int ret = 0; + + acp3x_disable_interrupts(base); + + /* Reset */ + ret = acp3x_reset(base); + if (ret) + return ret; + + writel(0x00, base + ACP_CONTROL); + + /* power off */ + ret = acp3x_power_off(base); + if (ret) + return ret; + + return 0; +} static int renoir_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct acp_chip_info *chip; struct acp_dev_data *adata; struct resource *res; + int ret; + + chip = dev_get_platdata(&pdev->dev); + if (!chip || !chip->base) { + dev_err(&pdev->dev, "ACP chip data is NULL\n"); + return -ENODEV; + } + + if (chip->acp_rev != ACP3X_DEV) { + dev_err(&pdev->dev, "Un-supported ACP Revision %d\n", chip->acp_rev); + return -ENODEV; + } + + ret = rn_acp_init(chip->base); + if (ret) { + dev_err(&pdev->dev, "ACP Init failed\n"); + return -EINVAL; + } adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) @@ -155,6 +288,20 @@ static int renoir_audio_probe(struct platform_device *pdev) static int renoir_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct acp_chip_info *chip; + int ret; + + chip = dev_get_platdata(&pdev->dev); + if (!chip || !chip->base) { + dev_err(&pdev->dev, "ACP chip data is NULL\n"); + return -ENODEV; + } + + ret = rn_acp_deinit(chip->base); + if (ret) { + dev_err(&pdev->dev, "ACP de-init Failed\n"); + return -EINVAL; + } acp_platform_unregister(dev); return 0; diff --git a/sound/soc/amd/acp/chip_offset_byte.h b/sound/soc/amd/acp/chip_offset_byte.h index e38589a142e9..88f6fa597cd6 100644 --- a/sound/soc/amd/acp/chip_offset_byte.h +++ b/sound/soc/amd/acp/chip_offset_byte.h @@ -14,6 +14,12 @@ #define ACPAXI2AXI_ATU_CTRL 0xC40 #define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_5 0xC20 #define ACPAXI2AXI_ATU_BASE_ADDR_GRP_5 0xC24 + +#define ACP_PGFSM_CONTROL 0x141C +#define ACP_PGFSM_STATUS 0x1420 +#define ACP_SOFT_RESET 0x1000 +#define ACP_CONTROL 0x1004 + #define ACP_EXTERNAL_INTR_ENB 0x1800 #define ACP_EXTERNAL_INTR_CNTL 0x1804 #define ACP_EXTERNAL_INTR_STAT 0x1808 From patchwork Mon Jan 17 11:58:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Kumar Pandey X-Patchwork-Id: 12715343 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 06EDFC433F5 for ; Mon, 17 Jan 2022 12:02:27 +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 52E2817D5; Mon, 17 Jan 2022 13:01:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 52E2817D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642420945; bh=n5eHGMl0zb2nIiQRI6ccweHq2sPweyjQrjpTcd7MYQg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fwlIykg+4NOEEVTOOl1eTJtEyaaxEkg3WHB5YKun9GwFzLBk6W9Uvrvz3nPemOnME ZU4imygFJRPz0mqEfddm9PwuQF7mewvj3j4swyXYn5Ye9+uttsZmobCAAw9Mpj4kGO 6Dp/Ne4KCPqk40lBt2KrCGRu2b1rTNiORVEv3g0g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D4FF3F80254; Mon, 17 Jan 2022 13:01:04 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AE30AF80249; Mon, 17 Jan 2022 13:01:02 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2084.outbound.protection.outlook.com [40.107.243.84]) (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 3F1EEF80249 for ; Mon, 17 Jan 2022 13:00:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3F1EEF80249 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="DZnitXcn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxsgAyRp+T1xQ6yqWO87wEWesHQGh9AkdmfuL9Dy4D9BdnFVFPZKQG74uakauUiIge+1KVdH5InhHCHOD3AzIG++1pWmxuKqTzkdxMUmBMXqRJTcdHAc3Gycl8eqJ08Kvt8r0cZGkw9sR1zHoT2fI4TdVAsM0dNcHdHHF/pm8G7VjGtRkJCvCZOuC+nm/n4zGrkGxetnlx6wnXsmozZy0Q1RJBMcxR1bvKWC/d1+JD8y0BQci6QYpYAAJCyzRPkpLd3dDDh7irAiy5wxxd9e+HnCEaCmTJnbVOpF02HLnmSLZqpzqJ8N0jC3czrZwMqTQNDblpNXgqF+0lnuZcnbYg== 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=OXDcSj3NhHz8Yy5J8tGL976lb9dugtbIoOjOGzrwwTU=; b=aXikpEWaX7OoBLmiozMTKZCOmCjWfpBFXywvhrTnBjxeLz4t19hg1Fm8OF02Ot0aPkOXmBP198D/0KlYIT2LYoJkePWtIfP+uuXgq2/1uc8yGXVqxUGVFJh2IzU1uf3NuGK5BU46SMkFlqpCpEsWAAu/YE7q1Tk44qHqAPUhM0J95x++CwJa8koPO7HRomamUMxfOpJiIqrvQMWVVcY3TXIgyOSUZQliIRCk6KYpC9inI6GXgDSXb+hfNR/3G3w325bmw2QCu9RwMuEtSmE1x4aXGm72agSpqTbcz7EWOadBpNZybpLhxkTAF+lqjyt+EFxfs4TgZRzh9mNGmLc7Ww== 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=OXDcSj3NhHz8Yy5J8tGL976lb9dugtbIoOjOGzrwwTU=; b=DZnitXcnH14FuT1mQF1ICHagqM/3Izazsi6Ti3qKQoMzqT4ZSWgoBwFhVQUbOVi6eCN3+Of1sLNmCgqngoenkA5AKPt85UT/+j6e8uoUZ8C8au/nhbCAmyuZ41lT50yEx4CXK94aNfqObft1W74iSh5JjtsdRrCoRCAK0lNurRU= Received: from MWHPR11CA0026.namprd11.prod.outlook.com (2603:10b6:300:115::12) by MN2PR12MB3007.namprd12.prod.outlook.com (2603:10b6:208:d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Mon, 17 Jan 2022 12:00:52 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:300:115:cafe::e1) by MWHPR11CA0026.outlook.office365.com (2603:10b6:300:115::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:00:52 +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; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:00:52 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.18; Mon, 17 Jan 2022 06:00:49 -0600 Received: from chrome.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 06:00:46 -0600 From: Ajit Kumar Pandey To: , Subject: [PATCH v3 5/6] ASoC: amd: acp: acp-legacy: Add DMIC dai link support for Renoir Date: Mon, 17 Jan 2022 17:28:53 +0530 Message-ID: <20220117115854.455995-6-AjitKumar.Pandey@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> References: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb7f2f2b-b68b-47a4-0491-08d9d9b1027e X-MS-TrafficTypeDiagnostic: MN2PR12MB3007:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zo3e8W1WHaMS7TGfS3EX/LM9FUlrP3ZXdiXhLL9wlaEzgp5X+etn/GZOlHJmLB14D9XG6BwBVtOHPrwIGkCS5xvgM0xpIeq8Rs7YcDFWa2ykKzTTSBwRtoOdT/cKy9TQl/bz95aBFPlx8olnmZzwXI1d4yj0EQ8Q1fk5Dz4jayBiSKjEnXfnunigDrjajLFV8bL1JWTm3Iqx53aHDKtCDHv9PEmr97LFxWDxLwj+v7qtzYfGpQYgin9MKPO9QC3r8+K90eImuQ+uzpGRpJFaXepWKBTT3akicrGQnw2wBWkaw0AF4ICzPXdvGWMK+ktJZ19avfyU4kci0IhpxydXCpGUqw8Y0lxAB5uuhVGPCdwEvBVP/jOXFuJs2Mgh0emSsePZc4GoaQn2ALIOGcZRhz1b3muF12dNZFDo9eHwEo3CQrInOkLX4ESE6fXwEE9zyPqGTBKV9CUG02vmURxFz+M3fPi/J05p2SFfFFB2TXcnQIOPB6NlsMLGo8ESuMwnfcVYYDe8jfz04fkbIZMGlonG2AK5I0UJTMZWO8TzZiurQo383ouenaY/bX/CNUV+NZdAwewxKCr4qTVaQjr2koLJyp8X9K8erfGAd558OP8t4dTTabCCl8olV4ItfBuLhQOfK98PuY2lfW8PpajHL8dVIVE0A+iZH0J03MFMeEN/B1TmEH/dSqzyA/4HizwwFyv2QAJrDz9mgUo2A+viRRcybYooNCG23t/Bcc6T9gpUy0KpURwSVh3kDjUUfZazUkG+mpbXgML1FSiP05lds7GKNcXvr2tGfem6RiXaHz0= 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:(4636009)(40470700002)(36840700001)(46966006)(2616005)(110136005)(336012)(186003)(426003)(36860700001)(508600001)(70206006)(70586007)(316002)(8676002)(54906003)(40460700001)(82310400004)(8936002)(1076003)(47076005)(81166007)(4326008)(6666004)(86362001)(5660300002)(7696005)(83380400001)(356005)(2906002)(26005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 12:00:52.2169 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb7f2f2b-b68b-47a4-0491-08d9d9b1027e 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: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3007 Cc: Sunil-kumar.Dommati@amd.com, Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , V sujith kumar Reddy , Vijendar.Mukunda@amd.com, Alexander.Deucher@amd.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 DMIC related dai link for pdm-dmic dai on Renoir platform with generic dmic codec dai. Signed-off-by: Ajit Kumar Pandey --- sound/soc/amd/acp/acp-legacy-mach.c | 4 ++-- sound/soc/amd/acp/acp-mach-common.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c index 0ad1cf41b308..91140d15691b 100644 --- a/sound/soc/amd/acp/acp-legacy-mach.c +++ b/sound/soc/amd/acp/acp-legacy-mach.c @@ -23,10 +23,10 @@ static struct acp_card_drvdata rt5682_rt1019_data = { .hs_cpu_id = I2S_SP, .amp_cpu_id = I2S_SP, - .dmic_cpu_id = NONE, + .dmic_cpu_id = DMIC, .hs_codec_id = RT5682, .amp_codec_id = RT1019, - .dmic_codec_id = NONE, + .dmic_codec_id = DMIC, .gpio_spkr_en = EN_SPKR_GPIO_GB, }; diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index c9caade5cb74..b45442a56c40 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -438,6 +438,8 @@ SND_SOC_DAILINK_DEF(sof_sp, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp"))); SND_SOC_DAILINK_DEF(sof_dmic, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic"))); +SND_SOC_DAILINK_DEF(pdm_dmic, + DAILINK_COMP_ARRAY(COMP_CPU("acp-pdm-dmic"))); int acp_sofdsp_dai_links_create(struct snd_soc_card *card) { @@ -613,6 +615,25 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card) links[i].ops = &acp_card_maxim_ops; links[i].init = acp_card_maxim_init; } + i++; + } + + if (drv_data->dmic_cpu_id == DMIC) { + links[i].name = "acp-dmic-codec"; + links[i].id = DMIC_BE_ID; + if (drv_data->dmic_codec_id == DMIC) { + links[i].codecs = dmic_codec; + links[i].num_codecs = ARRAY_SIZE(dmic_codec); + } else { + /* Use dummy codec if codec id not specified */ + links[i].codecs = dummy_codec; + links[i].num_codecs = ARRAY_SIZE(dummy_codec); + } + links[i].cpus = pdm_dmic; + links[i].num_cpus = ARRAY_SIZE(pdm_dmic); + links[i].platforms = platform_component; + links[i].num_platforms = ARRAY_SIZE(platform_component); + links[i].dpcm_capture = 1; } card->dai_link = links; From patchwork Mon Jan 17 11:58:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Kumar Pandey X-Patchwork-Id: 12715344 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 983DAC433F5 for ; Mon, 17 Jan 2022 12:02:52 +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 DA39017AC; Mon, 17 Jan 2022 13:02:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DA39017AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642420970; bh=6tWRe2vdR0RnVjupHgL96fCMoT6p0ScGlqEa1H7IEz0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NQ8hUvcTMEsLruaeo3ERTi1G1fp8zHsObeCmCj6iM7syqxwgl+Mibr2/WShXWdSm1 ADESspvEQ8DA9IqQHWIGbV6RBS3d6h7t5ZwOMw/i0mAviMw7ITEsJEknkR4Xlbd4DR j+DBXQKzQJvsbFQscaePD+IF/juz85lgsEnOGoDE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7494CF80524; Mon, 17 Jan 2022 13:01:10 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 59CD3F80525; Mon, 17 Jan 2022 13:01:09 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2048.outbound.protection.outlook.com [40.107.223.48]) (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 C5695F80520 for ; Mon, 17 Jan 2022 13:01:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C5695F80520 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="pUStLqZL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LD+dQGOmeTda+osJoySqDZY4dxlqxvZdqIyEHzViIlluzU1PgNOgur1/UBK9m7ZuvqFj2JsNN7KZVjt2zNO5ARErwUsnRL6H8HitVckWxntk92sne4s/rHM2nmIRl8IGDN5nxaX6QAhtjRDQ/ASSi9wGNsE+ROYvQZfyNRcjuBr8ly9WmsHX7QEKNy3mhHGRqW5i2aw9rcQA0d0Pq28pLY8V+RF8JKlhVwnYansxUFOgy/GXYpFEUef2f0pu9rwKjM+Fxitv5AC8xhBATptb3KuZ10mIAEdJS+1ZwsY0v0JcxQAglxSNwBCx/O9XVUjjqcmhMiioIw9Lv2DIxB8YAw== 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=9URmZK4WDlDfGl56FMDRzO0wB/peXbORuTdb2xPX0hg=; b=n5xaTLIKaNQ2M21KbsPrR57JWzAkk1KuaUSZBTBIMLyu+8OwAN/Dx857Wj71gYcktRrzXQzzRsqcRph9pJpfKtnRDsZLk2sDljfb/pdUBAamlHOyRYmO2kt4dibZAVu5cAiqmeZZ41lHoJlRHcXPAPzKPUAli70Q69YWLOjcaNEW/j5aDedZPes1wD+XVL+sLXNu4vMLRRNEsOu+DDeGU4OpTWO6yAuXpc9ciTfgH5dIFLkk3SCUFPCebo7FEU2U8ScC2wzKbPrral8y1dKIvF0p0IIMCXM/NBKSPCWWd0n/lxZ1l2EAwRgr/tU5K+m2SvVrdBgfgyZMlJDxV6x+5Q== 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=9URmZK4WDlDfGl56FMDRzO0wB/peXbORuTdb2xPX0hg=; b=pUStLqZLX7lUtEEiNP2FeqJDzZlJmhVIbQJZgbhOHlf7xAWV6JHdI1J3nwDwHUIsNrAe/wvLmWfTr1F5J2faWTUpRfdV2C2X1uNdUWV4mIXv8bKM3uR3BVHzWL9iNjY2vwmnpgLYZkLzfPSUOvlUozUqISLG/1/0rFct4q35HS0= Received: from MW4PR03CA0312.namprd03.prod.outlook.com (2603:10b6:303:dd::17) by BYAPR12MB2901.namprd12.prod.outlook.com (2603:10b6:a03:138::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Mon, 17 Jan 2022 12:01:01 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dd:cafe::60) by MW4PR03CA0312.outlook.office365.com (2603:10b6:303:dd::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12 via Frontend Transport; Mon, 17 Jan 2022 12:01:01 +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; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4888.9 via Frontend Transport; Mon, 17 Jan 2022 12:01:00 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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.18; Mon, 17 Jan 2022 06:01:00 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 17 Jan 2022 04:00:59 -0800 Received: from chrome.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.18 via Frontend Transport; Mon, 17 Jan 2022 06:00:55 -0600 From: Ajit Kumar Pandey To: , Subject: [PATCH v3 6/6] ASoC: amd: renoir: Add check for acp configuration flags Date: Mon, 17 Jan 2022 17:28:54 +0530 Message-ID: <20220117115854.455995-7-AjitKumar.Pandey@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> References: <20220117115854.455995-1-AjitKumar.Pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aabc68ad-2fd8-4160-5244-08d9d9b107b4 X-MS-TrafficTypeDiagnostic: BYAPR12MB2901:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dCv+P9dxWCEoIZ2+Shhb8Y8RYqWdlBSwxdlfkp2kgUhkPVypo1Dt3Uvk3LgbYfB8A4MwYBJfHtGQ3k+OYflUtHyPZgYbNfkBBC0Hrn1ngt4uHY03TKEPaXwMUNEIEjhnwVxeITrGf7q0HalSXFf1wVBdtO/ZObXFboNLuQtV3Br5QvQl0Ibd/quORnxeSnjS8dRhKMUsipJZy/lKu++bhoEMdqYIKjUcCslCEj8DX0CNwlq5z3AYXA0iw3xMZwsu5kMIBnfq7ql/zK+K23Vu+JPfsBYlQngPB+/iohkx7YPhumyAuOuxuk8911fTZCIrly79MfMYL3yHuyajnLBdoH+0QQuDH9Vz9WOx2bvKVAQCU9FtHgw/CpZnxaqYIMSchampbkP9Nrfwp+aiHzWGWLuVO1PbWcb35hVkaJxDu/wlu6PTbC06jFa7lMdLaNNO2WEnlP3RHQB+WlMwO5XV4Q6ZXTZK0zCg6pNppVcp9b+PRymrzKs/oXBtfwZ9pG4/09QTwKwBQRfQoZ9lZIBH/8UOMFyMpSh1S71l/bXXKH4tNv7+JQ7oTGFXFd1jTQLJNILfbU9mMHG8ndktfwoc6V6tw1mlqb41D5BxFYxLd4sPbSg0G95wsnw+YZQVteS2jXbFifUH0WQA+VbDJfjss1QtjFo7+8vLw7xdPyjbD2896iu91zNsLwq/jNcgTeplVda9zrDz8sroGnLqE10z4H1tAuzvJarn5ftJmu6rkcfevDfhKTcorD1cn18/wqYL093/AvGhMSNA2mqWleQ2EWeRkPGMaMTDVZGQdg9ur+U= 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:(4636009)(40470700002)(46966006)(36840700001)(81166007)(316002)(7696005)(5660300002)(110136005)(47076005)(2616005)(426003)(83380400001)(40460700001)(4326008)(70206006)(70586007)(336012)(1076003)(86362001)(26005)(36860700001)(2906002)(8936002)(82310400004)(54906003)(36756003)(508600001)(7416002)(356005)(186003)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2022 12:01:00.9614 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aabc68ad-2fd8-4160-5244-08d9d9b107b4 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: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2901 Cc: Pierre-Louis Bossart , Sunil-kumar.Dommati@amd.com, Kai Vehmanen , Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Mario Limonciello , Vijendar.Mukunda@amd.com, Alexander.Deucher@amd.com, Mark Pearson , Julian Braha , Lucas Tanure 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" We have SOF and generic ACP support enabled for Renoir platforms on some machines. Since we have same PCI id used for probing, add check for machine configuration flag to avoid conflict with newer pci drivers. Such machine flag has been initialized via dmi match on few Chrome machines. If no flag is specified probe and register older platform device. Signed-off-by: Ajit Kumar Pandey --- sound/soc/amd/Kconfig | 1 + sound/soc/amd/renoir/rn-pci-acp3x.c | 7 ++++++- sound/soc/amd/renoir/rn_acp3x.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 7a9e45094f37..1381aec23048 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -44,6 +44,7 @@ config SND_SOC_AMD_RV_RT5682_MACH config SND_SOC_AMD_RENOIR tristate "AMD Audio Coprocessor - Renoir support" + select SND_AMD_ACP_CONFIG depends on X86 && PCI help This option enables ACP support for Renoir platform diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c index 7b8040e812a1..b3812b70f5f9 100644 --- a/sound/soc/amd/renoir/rn-pci-acp3x.c +++ b/sound/soc/amd/renoir/rn-pci-acp3x.c @@ -212,10 +212,15 @@ static int snd_rn_acp_probe(struct pci_dev *pci, acpi_integer dmic_status; #endif const struct dmi_system_id *dmi_id; - unsigned int irqflags; + unsigned int irqflags, flag; int ret, index; u32 addr; + /* Return if acp config flag is defined */ + flag = snd_amd_acp_find_config(pci); + if (flag) + return -ENODEV; + /* Renoir device check */ if (pci->revision != 0x01) return -ENODEV; diff --git a/sound/soc/amd/renoir/rn_acp3x.h b/sound/soc/amd/renoir/rn_acp3x.h index 14620399d766..ca586603d720 100644 --- a/sound/soc/amd/renoir/rn_acp3x.h +++ b/sound/soc/amd/renoir/rn_acp3x.h @@ -88,3 +88,6 @@ static inline void rn_writel(u32 val, void __iomem *base_addr) { writel(val, base_addr - ACP_PHY_BASE_ADDRESS); } + +/* Machine configuration */ +int snd_amd_acp_find_config(struct pci_dev *pci);