From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
To: unlisted-recipients:; (no To-header on input)
Cc: <vijendar.mukunda@amd.com>, <Alexander.Deucher@amd.com>,
<Vishnuvardhanrao.Ravulapati@amd.com>,
Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@amd.com>,
Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>,
Sanju R Mehta <sanju.mehta@amd.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
"Jaroslav Kysela" <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Vijendar Mukunda <Vijendar.Mukunda@amd.com>,
open list <linux-kernel@vger.kernel.org>,
"moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
MANAGEM..." <alsa-devel@alsa-project.org>
Subject: [PATCH 02/11] ASoC: AMD: add ACP3.0 PCI driver
Date: Mon, 12 Nov 2018 11:04:53 +0530 [thread overview]
Message-ID: <1542000903-19020-3-git-send-email-Vijendar.Mukunda@amd.com> (raw)
In-Reply-To: <1542000903-19020-1-git-send-email-Vijendar.Mukunda@amd.com>
From: Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@amd.com>
ACP 3.0 is a PCI audio device. This patch adds PCI driver to bind
to this device and get PCI resources.
Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Signed-off-by: Sanju R Mehta <sanju.mehta@amd.com>
Tested-by: Ravulapati Vishnu vardhan Rao <Vishnuvardhanrao.Ravulapati@amd.com>
Signed-off-by: Vijendar Mukunda <vijendar.mukunda@amd.com>
---
sound/soc/amd/raven/acp3x.h | 13 ++++++
sound/soc/amd/raven/pci-acp3x.c | 97 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+)
create mode 100644 sound/soc/amd/raven/acp3x.h
create mode 100644 sound/soc/amd/raven/pci-acp3x.c
diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h
new file mode 100644
index 0000000..e9b4df0
--- /dev/null
+++ b/sound/soc/amd/raven/acp3x.h
@@ -0,0 +1,13 @@
+#include "chip_offset_byte.h"
+
+#define ACP3x_PHY_BASE_ADDRESS 0x1240000
+
+static inline u32 rv_readl(void __iomem *base_addr)
+{
+ return readl(base_addr - ACP3x_PHY_BASE_ADDRESS);
+}
+
+static inline void rv_writel(u32 val, void __iomem *base_addr)
+{
+ writel(val, base_addr - ACP3x_PHY_BASE_ADDRESS);
+}
diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c
new file mode 100644
index 0000000..27588ed
--- /dev/null
+++ b/sound/soc/amd/raven/pci-acp3x.c
@@ -0,0 +1,97 @@
+/*
+ * AMD ALSA SoC PCM Driver
+ *
+ * Copyright 2016 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/pci.h>
+#include <linux/module.h>
+#include <linux/io.h>
+
+#include "acp3x.h"
+
+struct acp3x_dev_data {
+ void __iomem *acp3x_base;
+};
+
+static int snd_acp3x_probe(struct pci_dev *pci,
+ const struct pci_device_id *pci_id)
+{
+ int ret;
+ u32 addr;
+ struct acp3x_dev_data *adata;
+
+ 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 acp3x_dev_data),
+ GFP_KERNEL);
+ if (!adata) {
+ ret = -ENOMEM;
+ goto release_regions;
+ }
+
+ addr = pci_resource_start(pci, 0);
+ adata->acp3x_base = ioremap(addr, pci_resource_len(pci, 0));
+ if (!adata->acp3x_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_acp3x_remove(struct pci_dev *pci)
+{
+ struct acp3x_dev_data *adata = pci_get_drvdata(pci);
+
+ iounmap(adata->acp3x_base);
+ pci_release_regions(pci);
+ pci_disable_device(pci);
+}
+
+static const struct pci_device_id snd_acp3x_ids[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x15e2),
+ .class = PCI_CLASS_MULTIMEDIA_OTHER << 8,
+ .class_mask = 0xffffff },
+ { 0, },
+};
+MODULE_DEVICE_TABLE(pci, snd_acp3x_ids);
+
+static struct pci_driver acp3x_driver = {
+ .name = KBUILD_MODNAME,
+ .id_table = snd_acp3x_ids,
+ .probe = snd_acp3x_probe,
+ .remove = snd_acp3x_remove,
+};
+
+module_pci_driver(acp3x_driver);
+
+MODULE_AUTHOR("Maruthi.Bayyavarapu@amd.com");
+MODULE_DESCRIPTION("AMD ACP3x PCI driver");
+MODULE_LICENSE("GPL v2");
--
2.7.4
next prev parent reply other threads:[~2018-11-12 5:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1542000903-19020-1-git-send-email-Vijendar.Mukunda@amd.com>
2018-11-12 5:34 ` [PATCH 01/11] ASoC: AMD: add ACP 3.x IP register header Vijendar Mukunda
2018-11-13 19:36 ` Mark Brown
2018-11-14 15:35 ` Mukunda, Vijendar
2018-11-13 19:46 ` Applied "ASoC: AMD: add ACP 3.x IP register header" to the asoc tree Mark Brown
2018-11-12 5:34 ` Vijendar Mukunda [this message]
2018-11-13 19:46 ` Applied "ASoC: AMD: add ACP3.0 PCI driver" " Mark Brown
2018-11-12 5:34 ` [PATCH 03/11] ASoC: amd: create ACP3x PCM platform device Vijendar Mukunda
2018-11-13 19:46 ` Applied "ASoC: amd: create ACP3x PCM platform device" to the asoc tree Mark Brown
2018-11-12 5:34 ` [PATCH 04/11] ASoC: amd: add ACP3x PCM platform driver Vijendar Mukunda
2018-11-13 19:41 ` Mark Brown
2018-11-13 19:46 ` Applied "ASoC: amd: add ACP3x PCM platform driver" to the asoc tree Mark Brown
2018-11-12 5:34 ` [PATCH 05/11] ASoC: amd: Interrupt handler changes for ACP3x DMA driver Vijendar Mukunda
2018-11-13 19:46 ` Applied "ASoC: amd: Interrupt handler changes for ACP3x DMA driver" to the asoc tree Mark Brown
2018-11-12 5:34 ` [PATCH 06/11] ASoC: amd: add acp3x pcm driver dma ops Vijendar Mukunda
2018-11-13 19:46 ` Applied "ASoC: amd: add acp3x pcm driver dma ops" to the asoc tree Mark Brown
2018-11-12 5:34 ` [PATCH 07/11] ASoC: amd: add acp3x i2s ops Vijendar Mukunda
2018-11-13 19:45 ` Applied "ASoC: amd: add acp3x i2s ops" to the asoc tree Mark Brown
2018-11-12 5:34 ` [PATCH 08/11] ASoC: amd: add acp3x tdm mode support Vijendar Mukunda
2018-11-13 19:45 ` Applied "ASoC: amd: add acp3x tdm mode support" to the asoc tree Mark Brown
2018-11-12 5:35 ` [PATCH 09/11] ASoC: amd: add acp3x runtime pm ops Vijendar Mukunda
2018-11-13 19:45 ` Applied "ASoC: amd: add acp3x runtime pm ops" to the asoc tree Mark Brown
2018-11-12 5:35 ` [PATCH 10/11] ASoC: amd: add acp3x system resume pm op Vijendar Mukunda
2018-11-13 19:45 ` Applied "ASoC: amd: add acp3x system resume pm op" to the asoc tree Mark Brown
2018-11-12 5:35 ` [PATCH 11/11] ASoC: amd: enable acp3x drivers build Vijendar Mukunda
2018-11-13 19:45 ` Mark Brown
2018-11-13 19:45 ` Applied "ASoC: amd: enable acp3x drivers build" to the asoc tree Mark Brown
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=1542000903-19020-3-git-send-email-Vijendar.Mukunda@amd.com \
--to=vijendar.mukunda@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Maruthi.Bayyavarapu@amd.com \
--cc=Vishnuvardhanrao.Ravulapati@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=sanju.mehta@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).