From: Syed Saba kareem <Syed.SabaKareem@amd.com>
To: <broonie@kernel.org>, <alsa-devel@alsa-project.org>
Cc: Sunil-kumar.Dommati@amd.com,
open list <linux-kernel@vger.kernel.org>,
Basavaraj.Hiregoudar@amd.com, Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
mario.limonciello@amd.com, Vijendar.Mukunda@amd.com,
Syed Saba kareem <Syed.SabaKareem@amd.com>
Subject: [PATCH 02/13] ASoC: amd: add Pink Sardine ACP PCI driver
Date: Fri, 12 Aug 2022 17:37:20 +0530 [thread overview]
Message-ID: <20220812120731.788052-3-Syed.SabaKareem@amd.com> (raw)
In-Reply-To: <20220812120731.788052-1-Syed.SabaKareem@amd.com>
ACP is a PCI audio device.
This patch adds PCI driver to bind to this device and get
PCI resources for Pink Sardine Platform.
Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
sound/soc/amd/ps/acp62.h | 21 +++++++++
sound/soc/amd/ps/pci-ps.c | 94 +++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
create mode 100644 sound/soc/amd/ps/acp62.h
create mode 100644 sound/soc/amd/ps/pci-ps.c
diff --git a/sound/soc/amd/ps/acp62.h b/sound/soc/amd/ps/acp62.h
new file mode 100644
index 000000000000..e91762240c93
--- /dev/null
+++ b/sound/soc/amd/ps/acp62.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * AMD ALSA SoC PDM Driver
+ *
+ * Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
+ */
+
+#include <sound/acp62_chip_offset_byte.h>
+
+#define ACP_DEVICE_ID 0x15E2
+#define ACP62_PHY_BASE_ADDRESS 0x1240000
+
+static inline u32 acp62_readl(void __iomem *base_addr)
+{
+ return readl(base_addr - ACP62_PHY_BASE_ADDRESS);
+}
+
+static inline void acp62_writel(u32 val, void __iomem *base_addr)
+{
+ writel(val, base_addr - ACP62_PHY_BASE_ADDRESS);
+}
diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
new file mode 100644
index 000000000000..25169797275c
--- /dev/null
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * AMD Pink Sardine ACP PCI Driver
+ *
+ * Copyright 2022 Advanced Micro Devices, Inc.
+ */
+
+#include <linux/pci.h>
+#include <linux/module.h>
+#include <linux/io.h>
+
+#include "acp62.h"
+
+struct acp62_dev_data {
+ void __iomem *acp62_base;
+};
+
+static int snd_acp62_probe(struct pci_dev *pci,
+ const struct pci_device_id *pci_id)
+{
+ struct acp62_dev_data *adata;
+ u32 addr;
+ int ret;
+
+ /* Pink Sardine device check */
+ switch (pci->revision) {
+ case 0x63:
+ break;
+ default:
+ dev_dbg(&pci->dev, "acp62 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");
+ if (ret < 0) {
+ dev_err(&pci->dev, "pci_request_regions failed\n");
+ goto disable_pci;
+ }
+ adata = devm_kzalloc(&pci->dev, sizeof(struct acp62_dev_data),
+ GFP_KERNEL);
+ if (!adata) {
+ ret = -ENOMEM;
+ goto release_regions;
+ }
+
+ addr = pci_resource_start(pci, 0);
+ adata->acp62_base = devm_ioremap(&pci->dev, addr,
+ pci_resource_len(pci, 0));
+ if (!adata->acp62_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_acp62_remove(struct pci_dev *pci)
+{
+ pci_release_regions(pci);
+ pci_disable_device(pci);
+}
+
+static const struct pci_device_id snd_acp62_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_acp62_ids);
+
+static struct pci_driver ps_acp62_driver = {
+ .name = KBUILD_MODNAME,
+ .id_table = snd_acp62_ids,
+ .probe = snd_acp62_probe,
+ .remove = snd_acp62_remove,
+};
+
+module_pci_driver(ps_acp62_driver);
+
+MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
+MODULE_AUTHOR("Syed.SabaKareem@amd.com");
+MODULE_DESCRIPTION("AMD ACP Pink Sardine PCI driver");
+MODULE_LICENSE("GPL v2");
--
2.25.1
next prev parent reply other threads:[~2022-08-12 12:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 12:07 [PATCH 00/13] Add Pink Sardine platform ASoC driver Syed Saba kareem
2022-08-12 12:07 ` [PATCH 01/13] ASoC: amd: add Pink Sardine platform ACP IP register header Syed Saba kareem
2022-08-12 12:07 ` Syed Saba kareem [this message]
2022-08-12 14:19 ` [PATCH 02/13] ASoC: amd: add Pink Sardine ACP PCI driver Amadeusz Sławiński
2022-08-16 6:00 ` Syed Saba Kareem
2022-08-12 12:07 ` [PATCH 03/13] ASoC: amd: add acp6.2 init/de-init functions Syed Saba kareem
2022-08-12 12:33 ` Mark Brown
2022-08-16 5:47 ` Syed Saba Kareem
2022-08-12 14:19 ` Amadeusz Sławiński
2022-08-16 6:48 ` Syed Saba Kareem
2022-08-12 12:07 ` [PATCH 04/13] ASoC: amd: add platform devices for acp6.2 pdm driver and dmic driver Syed Saba kareem
2022-08-12 14:20 ` Amadeusz Sławiński
2022-08-16 6:49 ` Syed Saba Kareem
2022-08-12 12:07 ` [PATCH 05/13] ASoC: amd: add acp6.2 pdm platform driver Syed Saba kareem
2022-08-12 14:20 ` Amadeusz Sławiński
2022-08-12 12:07 ` [PATCH 06/13] ASoC: amd: add acp6.2 irq handler Syed Saba kareem
2022-08-12 12:07 ` [PATCH 07/13] ASoC: amd: add acp6.2 pdm driver dma ops Syed Saba kareem
[not found] ` <2dca1704-c04b-9c42-ce1a-51a16530af38@linux.intel.com>
2022-08-16 7:02 ` Syed Saba Kareem
2022-08-12 12:07 ` [PATCH 08/13] ASoC: amd: add acp6.2 pci driver pm ops Syed Saba kareem
2022-08-12 12:07 ` [PATCH 09/13] ASoC: amd: add acp6.2 pdm " Syed Saba kareem
2022-08-12 12:07 ` [PATCH 10/13] ASoC: amd: enable Pink Sardine acp6.2 drivers build Syed Saba kareem
[not found] ` <YvZeNDg++YwEsgdI@sirena.org.uk>
2022-08-27 16:50 ` Syed Saba Kareem
2022-08-12 12:07 ` [PATCH 11/13] ASoC: amd: create platform device for acp6.2 machine driver Syed Saba kareem
2022-08-12 12:07 ` [PATCH 12/13] ASoC: amd: add Pink Sardine machine driver using dmic Syed Saba kareem
2022-08-12 12:07 ` [PATCH 13/13] ASoC: amd: enable Pink sardine platform machine driver build Syed Saba kareem
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=20220812120731.788052-3-Syed.SabaKareem@amd.com \
--to=syed.sabakareem@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=mario.limonciello@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).