From: Syed Saba Kareem <Syed.SabaKareem@amd.com>
To: <broonie@kernel.org>, <alsa-devel@alsa-project.org>
Cc: Vijendar.Mukunda@amd.com, Basavaraj.Hiregoudar@amd.com,
Sunil-kumar.Dommati@amd.com,
"Syed Saba Kareem" <Syed.SabaKareem@amd.com>,
"V Sujith Kumar Reddy" <vsujithkumar.reddy@amd.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Venkata Prasad Potturu" <venkataprasad.potturu@amd.com>,
"Ajit Kumar Pandey" <AjitKumar.Pandey@amd.com>,
"open list" <linux-kernel@vger.kernel.org>
Subject: [PATCH 04/12] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform
Date: Thu, 22 Jun 2023 20:53:44 +0530 [thread overview]
Message-ID: <20230622152406.3709231-7-Syed.SabaKareem@amd.com> (raw)
In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com>
Add acp i2s master clock generation logic for rembrandt platform.
Signed-off-by: V Sujith Kumar Reddy <vsujithkumar.reddy@amd.com>
Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
---
sound/soc/amd/acp/acp-legacy-common.c | 19 +++++++++++++++++++
sound/soc/amd/acp/acp-rembrandt.c | 26 ++++++++++++++++++++++++++
sound/soc/amd/acp/amd.h | 3 +++
3 files changed, 48 insertions(+)
diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c
index 5b7000eae693..4302d8db88a4 100644
--- a/sound/soc/amd/acp/acp-legacy-common.c
+++ b/sound/soc/amd/acp/acp-legacy-common.c
@@ -13,6 +13,7 @@
*/
#include "amd.h"
+#include <linux/pci.h>
#include <linux/export.h>
static int acp_power_on(struct acp_chip_info *chip)
@@ -96,4 +97,22 @@ int acp_deinit(void __iomem *base)
}
EXPORT_SYMBOL_NS_GPL(acp_deinit, SND_SOC_ACP_COMMON);
+int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data)
+{
+ pci_write_config_dword(dev, 0x60, smn_addr);
+ pci_write_config_dword(dev, 0x64, data);
+ return 0;
+}
+EXPORT_SYMBOL_NS_GPL(smn_write, SND_SOC_ACP_COMMON);
+
+int smn_read(struct pci_dev *dev, u32 smn_addr)
+{
+ u32 data;
+
+ pci_write_config_dword(dev, 0x60, smn_addr);
+ pci_read_config_dword(dev, 0x64, &data);
+ return data;
+}
+EXPORT_SYMBOL_NS_GPL(smn_read, SND_SOC_ACP_COMMON);
+
MODULE_LICENSE("Dual BSD/GPL");
diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c
index 59b1653b8479..83515ee753f3 100644
--- a/sound/soc/amd/acp/acp-rembrandt.c
+++ b/sound/soc/amd/acp/acp-rembrandt.c
@@ -19,11 +19,17 @@
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include <linux/dma-mapping.h>
+#include <linux/pci.h>
#include "amd.h"
#define DRV_NAME "acp_asoc_rembrandt"
+#define MP1_C2PMSG_69 0x3B10A14
+#define MP1_C2PMSG_85 0x3B10A54
+#define MP1_C2PMSG_93 0x3B10A74
+#define HOST_BRIDGE_ID 0x14B5
+
static struct acp_resource rsrc = {
.offset = 0,
.no_of_ctrls = 2,
@@ -160,6 +166,25 @@ static struct snd_soc_dai_driver acp_rmb_dai[] = {
},
};
+int acp6x_master_clock_generate(struct device *dev)
+{
+ int data = 0;
+ struct pci_dev *smn_dev;
+
+ smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, HOST_BRIDGE_ID, NULL);
+ if (!smn_dev) {
+ dev_err(dev, "Failed to get host bridge device\n");
+ return -ENODEV;
+ }
+
+ smn_write(smn_dev, MP1_C2PMSG_93, 0);
+ smn_write(smn_dev, MP1_C2PMSG_85, 0xC4);
+ smn_write(smn_dev, MP1_C2PMSG_69, 0x4);
+ read_poll_timeout(smn_read, data, data, DELAY_US,
+ ACP_TIMEOUT, false, smn_dev, MP1_C2PMSG_93);
+ return 0;
+}
+
static void acp6x_enable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
@@ -228,6 +253,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev)
acp_machine_select(adata);
dev_set_drvdata(dev, adata);
+ acp6x_master_clock_generate(dev);
acp6x_enable_interrupts(adata);
acp_platform_register(dev);
diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h
index 83c9a3ba8584..96bd87290eee 100644
--- a/sound/soc/amd/acp/amd.h
+++ b/sound/soc/amd/acp/amd.h
@@ -187,6 +187,9 @@ int acp_platform_unregister(struct device *dev);
int acp_machine_select(struct acp_dev_data *adata);
+int smn_read(struct pci_dev *dev, u32 smn_addr);
+int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data);
+
int acp_init(struct acp_chip_info *chip);
int acp_deinit(void __iomem *base);
/* Machine configuration */
--
2.25.1
next prev parent reply other threads:[~2023-06-22 15:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-22 15:23 [PATCH 01/12] ASoC: amd: acp: clear pdm dma interrupt mask Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 01/11] ASoC: amd: acp: remove acp poweroff function Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 02/11] ASoC: amd: acp: refactor the acp init and de-init sequence Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 02/12] ASoC: amd: acp: remove acp poweroff function Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 03/11] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 03/12] ASoC: amd: acp: refactor the acp init and de-init sequence Syed Saba Kareem
2023-06-22 15:23 ` Syed Saba Kareem [this message]
2023-06-22 22:30 ` [PATCH 04/12] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform Mark Brown
2023-06-23 14:07 ` Saba Kareem, Syed
2023-06-22 22:30 ` kernel test robot
2023-06-22 15:23 ` [PATCH 04/11] ASoC: amd: acp: remove the redundant acp enable/disable interrupts functions Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 05/12] " Syed Saba Kareem
2023-06-23 4:13 ` kernel test robot
2023-06-22 15:23 ` [PATCH 05/11] ASoC: amd: acp: store platform device reference created in pci probe call Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 06/11] ASoC: amd: acp: add pm ops support for acp pci driver Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 06/12] ASoC: amd: acp: store platform device reference created in pci probe call Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 07/12] ASoC: amd: acp: add pm ops support for acp pci driver Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 07/11] ASoC: amd: acp: store xfer_resolution of the stream Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 08/11] ASoC: amd: acp: export config_acp_dma() and config_pte_for_stream() symbols Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 08/12] ASoC: amd: acp: store xfer_resolution of the stream Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 09/12] ASoC: amd: acp: export config_acp_dma() and config_pte_for_stream() symbols Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 09/11] ASoC: amd: acp: store the pdm stream channel mask Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 10/11] ASoC: amd: acp: move pdm macros to common header file Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 10/12] ASoC: amd: acp: store the pdm stream channel mask Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 11/11] ASoC: amd: acp: add pm ops support for rembrandt platform Syed Saba Kareem
2023-06-22 15:23 ` [PATCH 11/12] ASoC: amd: acp: move pdm macros to common header file Syed Saba Kareem
2023-06-22 15:24 ` [PATCH 12/12] ASoC: amd: acp: add pm ops support for rembrandt platform Syed Saba Kareem
2023-06-23 0:49 ` [PATCH 01/12] ASoC: amd: acp: clear pdm dma interrupt mask 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=20230622152406.3709231-7-Syed.SabaKareem@amd.com \
--to=syed.sabakareem@amd.com \
--cc=AjitKumar.Pandey@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=nicolas.ferre@microchip.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=venkataprasad.potturu@amd.com \
--cc=vsujithkumar.reddy@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