From: Mario Limonciello <mario.limonciello@amd.com>
To: Vijendar Mukunda <Vijendar.Mukunda@amd.com>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.com, Basavaraj.Hiregoudar@amd.com,
Sunil-kumar.Dommati@amd.com, venkataprasad.potturu@amd.com,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/21] ASoC: amd: acp70: add acp pci driver for ACP7.0 and ACP7.1 platforms
Date: Thu, 19 Dec 2024 11:23:36 -0600 [thread overview]
Message-ID: <e805eb22-9177-47c2-84d6-c32d93571a44@amd.com> (raw)
In-Reply-To: <20241219054857.2070420-3-Vijendar.Mukunda@amd.com>
On 12/18/2024 23:48, Vijendar Mukunda wrote:
> ACP is a PCI audio device.
> This patch adds common PCI driver to bind to this device and get PCI
> resources for ACP7.0 & ACP7.1 platforms.
>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> ---
> sound/soc/amd/acp70/acp70.h | 33 +++++++++++
> sound/soc/amd/acp70/pci-acp70.c | 100 ++++++++++++++++++++++++++++++++
> 2 files changed, 133 insertions(+)
> create mode 100644 sound/soc/amd/acp70/acp70.h
> create mode 100644 sound/soc/amd/acp70/pci-acp70.c
>
> diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h
> new file mode 100644
> index 000000000000..28a46f0c2026
> --- /dev/null
> +++ b/sound/soc/amd/acp70/acp70.h
> @@ -0,0 +1,33 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * ACP 7.0 platform Common header file
> + *
> + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
> + */
> +
> +#include <sound/acp70_chip_offset_byte.h>
> +
> +#define ACP_DEVICE_ID 0x15E2
> +#define ACP70_REG_START 0x1240000
> +#define ACP70_REG_END 0x125C000
> +#define ACP70_PCI_REV 0x70
> +#define ACP71_PCI_REV 0x71
> +
> +/**
> + * struct acp70_dev_data - acp pci driver context
> + * @acp70_base: acp mmio base
> + * @acp_lock: used to protect acp common registers
> + * @addr: pci ioremap address
> + * @reg_range: ACP reigister range
> + * @acp_rev : ACP PCI revision id
> + */
> +
> +struct acp70_dev_data {
> + void __iomem *acp70_base;
> + struct mutex acp_lock; /* protect shared registers */
> + u32 addr;
> + u32 reg_range;
> + u32 acp_rev;
> +};
> +
> +int snd_amd_acp_find_config(struct pci_dev *pci);
> diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c
> new file mode 100644
> index 000000000000..23e47f619bd7
> --- /dev/null
> +++ b/sound/soc/amd/acp70/pci-acp70.c
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * AMD common ACP PCI driver for ACP7.0 & ACP7.1 platforms
> + *
> + * Copyright 2024 Advanced Micro Devices, Inc.
> + */
> +
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include "../mach-config.h"
> +
> +#include "acp70.h"
> +
> +static int snd_acp70_probe(struct pci_dev *pci,
> + const struct pci_device_id *pci_id)
> +{
> + struct acp70_dev_data *adata;
> + u32 addr, flag;
> + int ret;
> +
> + /* Return if acp config flag is defined */
> + flag = snd_amd_acp_find_config(pci);
> + if (flag)
> + return -ENODEV;
> +
> + /* Pink Sardine device check */
> + switch (pci->revision) {
> + case ACP70_PCI_REV:
> + case ACP71_PCI_REV:
> + break;
> + default:
> + dev_dbg(&pci->dev, "acp70 pci device not found\n");
> + return -ENODEV;
> + }
> + if (pci_enable_device(pci)) {
> + dev_err(&pci->dev, "pci_enable_device failed\n");
> + return -ENODEV;
> + }
> +
> + ret = pci_request_regions(pci, "AMD ACP6.2 audio");
Presumably this should be "ACP7.x audio"
> + if (ret < 0) {
> + dev_err(&pci->dev, "pci_request_regions failed\n");
> + goto disable_pci;
> + }
> + adata = devm_kzalloc(&pci->dev, sizeof(struct acp70_dev_data),
> + GFP_KERNEL);
> + if (!adata) {
> + ret = -ENOMEM;
> + goto release_regions;
> + }
> +
> + addr = pci_resource_start(pci, 0);
> + adata->acp70_base = devm_ioremap(&pci->dev, addr,
> + pci_resource_len(pci, 0));
> + if (!adata->acp70_base) {
> + ret = -ENOMEM;
> + goto release_regions;
> + }
> + adata->addr = addr;
> + adata->reg_range = ACP70_REG_END - ACP70_REG_START;
> + adata->acp_rev = pci->revision;
> + pci_set_master(pci);
> + pci_set_drvdata(pci, adata);
> + mutex_init(&adata->acp_lock);
> + return 0;
> +release_regions:
> + pci_release_regions(pci);
> +disable_pci:
> + pci_disable_device(pci);
> +
> + return ret;
> +}
> +
> +static void snd_acp70_remove(struct pci_dev *pci)
> +{
> + pci_release_regions(pci);
> + pci_disable_device(pci);
> +}
> +
> +static const struct pci_device_id snd_acp70_ids[] = {
> + { PCI_DEVICE(PCI_VENDOR_ID_AMD, ACP_DEVICE_ID),
Do you still need to specify the device ID since you already have a
class entry in this table below?
> + .class = PCI_CLASS_MULTIMEDIA_OTHER << 8,
> + .class_mask = 0xffffff },
> + { 0, },
> +};
> +MODULE_DEVICE_TABLE(pci, snd_acp70_ids);
> +
> +static struct pci_driver ps_acp70_driver = {
> + .name = KBUILD_MODNAME,
> + .id_table = snd_acp70_ids,
> + .probe = snd_acp70_probe,
> + .remove = snd_acp70_remove,
> +};
> +
> +module_pci_driver(ps_acp70_driver);
> +
> +MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
> +MODULE_DESCRIPTION("AMD ACP7.0 PCI driver");
> +MODULE_LICENSE("GPL");
next prev parent reply other threads:[~2024-12-19 17:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 5:48 [PATCH 00/21] ASoC: amd: acp70: add soundwire and acp pdm support Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 01/21] ASoC: amd: add register header file for ACP7.0 platform Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 02/21] ASoC: amd: acp70: add acp pci driver for ACP7.0 and ACP7.1 platforms Vijendar Mukunda
2024-12-19 17:23 ` Mario Limonciello [this message]
2024-12-25 6:00 ` Mukunda,Vijendar
2024-12-19 5:48 ` [PATCH 03/21] ASoC: amd: acp70: add acp init and de-init functions Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 04/21] ASoC: amd: acp70: add logic for scanning acp child devices Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 05/21] ASoC: amd: acp70: create platform devices for acp child nodes Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 06/21] ASoC: amd: acp70: enable driver build for ACP7.0 platform Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 07/21] ASoC: amd: acp70: add acp pdm platform driver Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 08/21] ASoC: amd: acp70: add acp pdm driver dma ops and dai ops Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 09/21] ASoC: amd: acp70: add acp soundwire dma driver Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 10/21] ASoC: amd: update ACP7.0 KConfig option description Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 11/21] ASoC: amd: acp70: add soundwire dma driver dma ops Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 12/21] ASoC: amd: acp70: add acp ip interrupt handler Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 13/21] ASoC: amd: acp70: add acp pdm driver pm ops Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 14/21] ASoC: amd: acp70: add pm ops support for soundwire dma driver Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 15/21] ASoC: amd: acp70: add acp driver pm ops support Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 16/21] ASoC: amd: acp70: enable wake capability for acp pci driver Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 17/21] ASoC: amd: acp70: add soundwire host wake interrupt handling Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 18/21] ASoC: amd: acp70: create a device node for soundwire machine driver Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 19/21] ASoC: amd: acp: add machine driver changes for ACP7.0 and ACP7.1 platforms Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 20/21] ASoC: amd: acp: add RT711, RT714 & RT1316 support for ACP7.0 platform Vijendar Mukunda
2024-12-19 5:48 ` [PATCH 21/21] ASoC: amd: acp: amd-acp70-acpi-match: Add rt722 support Vijendar Mukunda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e805eb22-9177-47c2-84d6-c32d93571a44@amd.com \
--to=mario.limonciello@amd.com \
--cc=Basavaraj.Hiregoudar@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=venkataprasad.potturu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox