[04/12] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform
Commit Message
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(+)
Comments
On Thu, Jun 22, 2023 at 08:53:44PM +0530, Syed Saba Kareem wrote:
> Add acp i2s master clock generation logic for rembrandt platform.
This doesn't apply against current code, please check and resend.
Hi Syed,
kernel test robot noticed the following build warnings:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.4-rc7 next-20230622]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Syed-Saba-Kareem/ASoC-amd-acp-remove-acp-poweroff-function/20230622-233145
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link: https://lore.kernel.org/r/20230622152406.3709231-7-Syed.SabaKareem%40amd.com
patch subject: [PATCH 04/12] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230623/202306230648.6X3y3ujR-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230623/202306230648.6X3y3ujR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306230648.6X3y3ujR-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> sound/soc/amd/acp/acp-rembrandt.c:169:5: warning: no previous prototype for 'acp6x_master_clock_generate' [-Wmissing-prototypes]
169 | int acp6x_master_clock_generate(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/acp6x_master_clock_generate +169 sound/soc/amd/acp/acp-rembrandt.c
168
> 169 int acp6x_master_clock_generate(struct device *dev)
170 {
171 int data = 0;
172 struct pci_dev *smn_dev;
173
174 smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, HOST_BRIDGE_ID, NULL);
175 if (!smn_dev) {
176 dev_err(dev, "Failed to get host bridge device\n");
177 return -ENODEV;
178 }
179
180 smn_write(smn_dev, MP1_C2PMSG_93, 0);
181 smn_write(smn_dev, MP1_C2PMSG_85, 0xC4);
182 smn_write(smn_dev, MP1_C2PMSG_69, 0x4);
183 read_poll_timeout(smn_read, data, data, DELAY_US,
184 ACP_TIMEOUT, false, smn_dev, MP1_C2PMSG_93);
185 return 0;
186 }
187
[AMD Official Use Only - General]
We found few warnings, will fix, and will resend the patch series.
Thanks,
Syed Saba Kareem
-----Original Message-----
From: Mark Brown <broonie@kernel.org>
Sent: Friday, June 23, 2023 4:01 AM
To: Saba Kareem, Syed <Syed.SabaKareem@amd.com>
Cc: alsa-devel@alsa-project.org; Mukunda, Vijendar <Vijendar.Mukunda@amd.com>; Hiregoudar, Basavaraj <Basavaraj.Hiregoudar@amd.com>; Dommati, Sunil-kumar <Sunil-kumar.Dommati@amd.com>; Reddy, V sujith kumar <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>; Prasad, Prasad <venkataprasad.potturu@amd.com>; Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>; open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 04/12] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform
On Thu, Jun 22, 2023 at 08:53:44PM +0530, Syed Saba Kareem wrote:
> Add acp i2s master clock generation logic for rembrandt platform.
This doesn't apply against current code, please check and resend.
@@ -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");
@@ -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);
@@ -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 */