All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gong, Richard" <richard.gong@amd.com>
To: Vijendar Mukunda <Vijendar.Mukunda@amd.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: "Dommati, Sunil-kumar" <Sunil-kumar.Dommati@amd.com>,
	open list <linux-kernel@vger.kernel.org>,
	"Hiregoudar, Basavaraj" <Basavaraj.Hiregoudar@amd.com>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"Limonciello, Mario" <Mario.Limonciello@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: Re: [PATCH 02/13] ASoC: amd: add Yellow Carp ACP PCI driver
Date: Mon, 11 Oct 2021 06:01:11 -0500	[thread overview]
Message-ID: <e61fa81d-bf63-8b41-03d8-12bd3e61af59@amd.com> (raw)
In-Reply-To: <20211011055621.13240-3-Vijendar.Mukunda@amd.com>


On 10/11/2021 12:56 AM, Vijendar Mukunda wrote:
> ACP is a PCI audio device.
> This patch adds PCI driver to bind to this device and get
> PCI resources.
>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> ---
>   sound/soc/amd/yc/acp6x.h     | 21 +++++++++
>   sound/soc/amd/yc/pci-acp6x.c | 89 ++++++++++++++++++++++++++++++++++++
>   2 files changed, 110 insertions(+)
>   create mode 100644 sound/soc/amd/yc/acp6x.h
>   create mode 100644 sound/soc/amd/yc/pci-acp6x.c
>
> diff --git a/sound/soc/amd/yc/acp6x.h b/sound/soc/amd/yc/acp6x.h
> new file mode 100644
> index 000000000000..62a05db5e34c
> --- /dev/null
> +++ b/sound/soc/amd/yc/acp6x.h
> @@ -0,0 +1,21 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
Use // here
> +/*
> + * AMD ALSA SoC PDM Driver
> + *
> + * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved.
> + */
> +
> +#include "acp6x_chip_offset_byte.h"
> +
> +#define ACP_DEVICE_ID 0x15E2
> +#define ACP6x_PHY_BASE_ADDRESS 0x1240000
> +
> +static inline u32 acp6x_readl(void __iomem *base_addr)
> +{
> +	return readl(base_addr - ACP6x_PHY_BASE_ADDRESS);
> +}
> +
> +static inline void acp6x_writel(u32 val, void __iomem *base_addr)
> +{
> +	writel(val, base_addr - ACP6x_PHY_BASE_ADDRESS);
> +}
> diff --git a/sound/soc/amd/yc/pci-acp6x.c b/sound/soc/amd/yc/pci-acp6x.c
> new file mode 100644
> index 000000000000..2965e8b00314
> --- /dev/null
> +++ b/sound/soc/amd/yc/pci-acp6x.c
> @@ -0,0 +1,89 @@
> +// SPDX-License-Identifier: GPL-2.0+
It's correct to use // here.
> +//
> +// AMD Renoir ACP PCI Driver
> +//
> +//Copyright 2021 Advanced Micro Devices, Inc.
> +
Use /*  */ rather than //
> +#include <linux/pci.h>
> +#include <linux/module.h>
> +#include <linux/io.h>
> +
> +#include "acp6x.h"
> +
> +struct acp6x_dev_data {
> +	void __iomem *acp6x_base;
> +};
> +
> +static int snd_acp6x_probe(struct pci_dev *pci,
> +			   const struct pci_device_id *pci_id)
> +{
> +	struct acp6x_dev_data *adata;
> +	int ret;
> +	u32 addr;
> +
> +	/* Yellow Carp device check */
> +	if (pci->revision != 0x60)
> +		return -ENODEV;
> +
> +	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");
> +		goto disable_pci;
> +	}
> +
> +	adata = devm_kzalloc(&pci->dev, sizeof(struct acp6x_dev_data),
> +			     GFP_KERNEL);
> +	if (!adata) {
> +		ret = -ENOMEM;
> +		goto release_regions;
> +	}
> +
> +	addr = pci_resource_start(pci, 0);
> +	adata->acp6x_base = devm_ioremap(&pci->dev, addr,
> +					 pci_resource_len(pci, 0));
> +	if (!adata->acp6x_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_acp6x_remove(struct pci_dev *pci)
> +{
> +	pci_release_regions(pci);
> +	pci_disable_device(pci);
> +}
> +
> +static const struct pci_device_id snd_acp6x_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_acp6x_ids);
> +
> +static struct pci_driver yc_acp6x_driver  = {
> +	.name = KBUILD_MODNAME,
> +	.id_table = snd_acp6x_ids,
> +	.probe = snd_acp6x_probe,
> +	.remove = snd_acp6x_remove,
> +};
> +
> +module_pci_driver(yc_acp6x_driver);
> +
> +MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
> +MODULE_DESCRIPTION("AMD ACP Yellow Carp PCI driver");
> +MODULE_LICENSE("GPL v2");

  reply	other threads:[~2021-10-12 12:14 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11  5:56 [PATCH 00/13] Add Yellow Carp platform ASoC driver Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 01/13] ASoC: amd: add Yellow Carp ACP6x IP register header Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 02/13] ASoC: amd: add Yellow Carp ACP PCI driver Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11 11:01   ` Gong, Richard [this message]
2021-10-11 11:43     ` Mukunda,Vijendar
2021-10-11 11:43       ` Mukunda,Vijendar
2021-10-11  5:56 ` [PATCH 03/13] ASoC: amd: add acp6x init/de-init functions Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11 11:04   ` Gong, Richard
2021-10-11 11:04     ` Gong, Richard
2021-10-11 11:06   ` Gong, Richard
2021-10-11 11:06     ` Gong, Richard
2021-10-11 11:40     ` Mukunda,Vijendar
2021-10-11 11:40       ` Mukunda,Vijendar
2021-10-11  5:56 ` [PATCH 04/13] ASoC: amd: add platform devices for acp6x pdm driver and dmic driver Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 05/13] ASoC: amd: add acp6x pdm platform driver Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 06/13] ASoC: amd: add acp6x irq handler Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  8:58   ` Joe Perches
2021-10-11  8:58     ` Joe Perches
2021-10-11  9:28     ` Mukunda,Vijendar
2021-10-11  9:28       ` Mukunda,Vijendar
2021-10-11  5:56 ` [PATCH 07/13] ASoC: amd: add acp6x pdm driver dma ops Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 08/13] ASoC: amd: add acp6x pci driver pm ops Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 09/13] ASoC: amd: add acp6x pdm " Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 10/13] ASoC: amd: enable Yellow carp acp6x drivers build Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 11/13] ASoC: amd: create platform device for acp6x machine driver Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 12/13] ASoC: amd: add YC machine driver using dmic Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  5:56 ` [PATCH 13/13] ASoC: amd: enable yc machine driver build Vijendar Mukunda
2021-10-11  5:56   ` Vijendar Mukunda
2021-10-11  7:55   ` Randy Dunlap
2021-10-11  7:55     ` Randy Dunlap
2021-10-11  8:25     ` Mukunda,Vijendar
2021-10-11  8:25       ` Mukunda,Vijendar

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=e61fa81d-bf63-8b41-03d8-12bd3e61af59@amd.com \
    --to=richard.gong@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Basavaraj.Hiregoudar@amd.com \
    --cc=Mario.Limonciello@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=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.