Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
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, Sunil-kumar.Dommati@amd.com,
	venkataprasad.potturu@amd.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] ASoC: amd: acp7x: add ACP PCI driver probe/remove sequence
Date: Thu, 7 May 2026 14:36:13 -0500	[thread overview]
Message-ID: <36454da7-840d-41ba-9e9d-84c45ff9af7f@kernel.org> (raw)
In-Reply-To: <20260507181251.20594-3-Vijendar.Mukunda@amd.com>



On 5/7/26 13:11, Vijendar Mukunda wrote:
> Add ACP7.x PCI driver probe and remove sequence for ACP7.D/7.E/7.F
> variants.
> 
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
>   sound/soc/amd/acp7x/acp7x.h     |  31 ++++++++++
>   sound/soc/amd/acp7x/pci-acp7x.c | 100 ++++++++++++++++++++++++++++++++
>   2 files changed, 131 insertions(+)
>   create mode 100644 sound/soc/amd/acp7x/acp7x.h
>   create mode 100644 sound/soc/amd/acp7x/pci-acp7x.c
> 
> diff --git a/sound/soc/amd/acp7x/acp7x.h b/sound/soc/amd/acp7x/acp7x.h
> new file mode 100644
> index 000000000000..b4586a2afae4
> --- /dev/null
> +++ b/sound/soc/amd/acp7x/acp7x.h
> @@ -0,0 +1,31 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * AMD Common ACP header file for ACP7.X variants(ACP7.D/7.E/7.F)
> + *
> + * Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.
> + */
> +
> +#ifndef __SOUND_SOC_AMD_ACP7X_H
> +#define __SOUND_SOC_AMD_ACP7X_H
> +
> +#include <linux/io.h>
> +#include <linux/pci.h>
> +#include <linux/types.h>
> +
> +#include <sound/acp7x_chip_offset_byte.h>
> +
> +#define ACP_DEVICE_ID		0x15E2
> +#define ACP7X_REG_START		0x1240000
> +#define ACP7X_REG_END		0x125C000
> +
> +#define ACP7D_PCI_REV		0x7D
> +#define ACP7E_PCI_REV		0x7E
> +#define ACP7F_PCI_REV		0x7F
> +
> +int snd_amd_acp_find_config(struct pci_dev *pci);
> +
> +struct acp7x_dev_data {
> +	void __iomem *acp7x_base;
> +};
> +
> +#endif /* __SOUND_SOC_AMD_ACP7X_H */
> diff --git a/sound/soc/amd/acp7x/pci-acp7x.c b/sound/soc/amd/acp7x/pci-acp7x.c
> new file mode 100644
> index 000000000000..476b3ae52634
> --- /dev/null
> +++ b/sound/soc/amd/acp7x/pci-acp7x.c
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * AMD common ACP PCI driver for ACP7.x variants
> + * which includes ACP7.D/7.E/7.F and future variants
> + * with same register layout.
> + *
> + * Copyright 2026 Advanced Micro Devices, Inc.
> + */
> +
> +#include <linux/errno.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/slab.h>
> +#include <linux/types.h>
> +
> +#include "acp7x.h"
> +
> +static int snd_acp7x_probe(struct pci_dev *pci,
> +			   const struct pci_device_id *pci_id)
> +{
> +	struct acp7x_dev_data *adata;
> +	u32 addr;
> +	u32 flag;
> +	int ret;
> +
> +	flag = snd_amd_acp_find_config(pci);
> +	if (flag)
> +		return -ENODEV;
> +
> +	/* ACP PCI revision id check for ACP7.x platforms */
> +	switch (pci->revision) {
> +	case ACP7D_PCI_REV:
> +	case ACP7E_PCI_REV:
> +	case ACP7F_PCI_REV:
> +		break;
> +	default:
> +		return -ENODEV;
> +	}
> +	if (pci_enable_device(pci)) {
> +		dev_err(&pci->dev, "pci_enable_device failed\n");
> +		return -ENODEV;
> +	}
> +
> +	ret = pci_request_regions(pci, "AMD 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 acp7x_dev_data),
> +			     GFP_KERNEL);
> +	if (!adata) {
> +		ret = -ENOMEM;
> +		goto release_regions;
> +	}
> +	addr = pci_resource_start(pci, 0);
> +	adata->acp7x_base = devm_ioremap(&pci->dev, addr,
> +					 pci_resource_len(pci, 0));
> +	if (!adata->acp7x_base) {
> +		ret = -ENOMEM;
> +		goto release_regions;
> +	}
> +	pci_set_master(pci);
> +	pci_set_drvdata(pci, adata);
> +	return 0;
> +
> +release_regions:
> +	pci_release_regions(pci);
> +disable_pci:
> +	pci_disable_device(pci);
> +
> +	return ret;
> +}
> +
> +static void snd_acp7x_remove(struct pci_dev *pci)
> +{
> +	pci_release_regions(pci);
> +	pci_disable_device(pci);
> +}
> +
> +static const struct pci_device_id snd_acp7x_ids[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, ACP_DEVICE_ID),
> +	.class = PCI_CLASS_MULTIMEDIA_OTHER << 8,
> +	.class_mask = 0xffffff },
> +	{ 0, },
> +};
> +MODULE_DEVICE_TABLE(pci, snd_acp7x_ids);
> +
> +static struct pci_driver acp7x_pci_driver  = {
> +	.name = KBUILD_MODNAME,
> +	.id_table = snd_acp7x_ids,
> +	.probe = snd_acp7x_probe,
> +	.remove = snd_acp7x_remove,
> +};
> +
> +module_pci_driver(acp7x_pci_driver);
> +
> +MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
> +MODULE_DESCRIPTION("AMD ACP PCI driver for ACP7.X");
> +MODULE_LICENSE("GPL");


  reply	other threads:[~2026-05-07 19:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 18:11 [PATCH 0/5] ASoC: AMD: ACP7.x initial PCI driver bring-up Vijendar Mukunda
2026-05-07 18:11 ` [PATCH 1/5] include: sound: add register header file for acp7.x series Vijendar Mukunda
2026-05-07 19:34   ` Mario Limonciello
2026-05-07 18:11 ` [PATCH 2/5] ASoC: amd: acp7x: add ACP PCI driver probe/remove sequence Vijendar Mukunda
2026-05-07 19:36   ` Mario Limonciello [this message]
2026-05-07 18:11 ` [PATCH 3/5] ASoC: amd: acp7x: add helper functions and hw ops Vijendar Mukunda
2026-05-07 19:34   ` Mario Limonciello
2026-05-07 18:11 ` [PATCH 4/5] ASoC: amd: enable acp7.x drivers build Vijendar Mukunda
2026-05-07 19:36   ` Mario Limonciello
2026-05-07 18:11 ` [PATCH 5/5] ASoC: amd: acp7x: add system and runtime PM ops Vijendar Mukunda
2026-05-07 19:33   ` Mario Limonciello

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=36454da7-840d-41ba-9e9d-84c45ff9af7f@kernel.org \
    --to=superm1@kernel.org \
    --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