All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
To: <alsa-devel@alsa-project.org>, <broonie@kernel.org>, <tiwai@suse.de>
Cc: Alexander.Deucher@amd.com, Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Subject: [PATCH v3 12/14] ASoC: amd: create platform devices for Renoir
Date: Tue, 19 May 2020 01:17:02 +0800	[thread overview]
Message-ID: <20200518171704.24999-13-Vijendar.Mukunda@amd.com> (raw)
In-Reply-To: <20200518171704.24999-1-Vijendar.Mukunda@amd.com>

Create platform devices for generic dmic codec driver
and machine driver.
These platform devices required for creation of sound card.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
 sound/soc/amd/renoir/rn-pci-acp3x.c | 51 ++++++++++++++++++-----------
 sound/soc/amd/renoir/rn_acp3x.h     |  1 +
 2 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c
index 71bfae644372..502c3f794ba0 100644
--- a/sound/soc/amd/renoir/rn-pci-acp3x.c
+++ b/sound/soc/amd/renoir/rn-pci-acp3x.c
@@ -21,7 +21,7 @@ MODULE_PARM_DESC(acp_power_gating, "Enable acp power gating");
 struct acp_dev_data {
 	void __iomem *acp_base;
 	struct resource *res;
-	struct platform_device *pdev;
+	struct platform_device *pdev[ACP_DEVS];
 };
 
 static int rn_acp_power_on(void __iomem *acp_base)
@@ -156,9 +156,9 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
 			    const struct pci_device_id *pci_id)
 {
 	struct acp_dev_data *adata;
-	struct platform_device_info pdevinfo;
+	struct platform_device_info pdevinfo[ACP_DEVS];
 	unsigned int irqflags;
-	int ret;
+	int ret, index;
 	u32 addr;
 
 	if (pci_enable_device(pci)) {
@@ -219,20 +219,29 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
 	adata->res[1].end = pci->irq;
 
 	memset(&pdevinfo, 0, sizeof(pdevinfo));
-	pdevinfo.name = "acp_rn_pdm_dma";
-	pdevinfo.id = 0;
-	pdevinfo.parent = &pci->dev;
-	pdevinfo.num_res = 2;
-	pdevinfo.res = adata->res;
-	pdevinfo.data = &irqflags;
-	pdevinfo.size_data = sizeof(irqflags);
-
-	adata->pdev = platform_device_register_full(&pdevinfo);
-	if (IS_ERR(adata->pdev)) {
-		dev_err(&pci->dev, "cannot register %s device\n",
-			pdevinfo.name);
-		ret = PTR_ERR(adata->pdev);
-		goto unregister_devs;
+	pdevinfo[0].name = "acp_rn_pdm_dma";
+	pdevinfo[0].id = 0;
+	pdevinfo[0].parent = &pci->dev;
+	pdevinfo[0].num_res = 2;
+	pdevinfo[0].res = adata->res;
+	pdevinfo[0].data = &irqflags;
+	pdevinfo[0].size_data = sizeof(irqflags);
+
+	pdevinfo[1].name = "dmic-codec";
+	pdevinfo[1].id = 0;
+	pdevinfo[1].parent = &pci->dev;
+	pdevinfo[2].name = "acp_pdm_mach";
+	pdevinfo[2].id = 0;
+	pdevinfo[2].parent = &pci->dev;
+	for (index = 0; index < ACP_DEVS; index++) {
+		adata->pdev[index] =
+				platform_device_register_full(&pdevinfo[index]);
+		if (IS_ERR(adata->pdev[index])) {
+			dev_err(&pci->dev, "cannot register %s device\n",
+				pdevinfo[index].name);
+			ret = PTR_ERR(adata->pdev[index]);
+			goto unregister_devs;
+		}
 	}
 	pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS);
 	pm_runtime_use_autosuspend(&pci->dev);
@@ -241,7 +250,8 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
 	return 0;
 
 unregister_devs:
-	platform_device_unregister(adata->pdev);
+	for (index = 0; index < ACP_DEVS; index++)
+		platform_device_unregister(adata->pdev[index]);
 de_init:
 	if (rn_acp_deinit(adata->acp_base))
 		dev_err(&pci->dev, "ACP de-init failed\n");
@@ -294,10 +304,11 @@ static const struct dev_pm_ops rn_acp_pm = {
 static void snd_rn_acp_remove(struct pci_dev *pci)
 {
 	struct acp_dev_data *adata;
-	int ret;
+	int ret, index;
 
 	adata = pci_get_drvdata(pci);
-	platform_device_unregister(adata->pdev);
+	for (index = 0; index < ACP_DEVS; index++)
+		platform_device_unregister(adata->pdev[index]);
 	ret = rn_acp_deinit(adata->acp_base);
 	if (ret)
 		dev_err(&pci->dev, "ACP de-init failed\n");
diff --git a/sound/soc/amd/renoir/rn_acp3x.h b/sound/soc/amd/renoir/rn_acp3x.h
index 6e1888167fb3..75228e306e0b 100644
--- a/sound/soc/amd/renoir/rn_acp3x.h
+++ b/sound/soc/amd/renoir/rn_acp3x.h
@@ -7,6 +7,7 @@
 
 #include "rn_chip_offset_byte.h"
 
+#define ACP_DEVS		3
 #define ACP_PHY_BASE_ADDRESS 0x1240000
 #define	ACP_REG_START	0x1240000
 #define	ACP_REG_END	0x1250200
-- 
2.26.2


  parent reply	other threads:[~2020-05-18 17:26 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 17:16 [PATCH v3 00/14] Add Renoir ACP driver Vijendar Mukunda
2020-05-18 17:16 ` [PATCH v3 01/14] ASoC: amd: add Renoir ACP3x IP register header Vijendar Mukunda
2020-05-18 17:16 ` [PATCH v3 02/14] ASoC: amd: add Renoir ACP PCI driver Vijendar Mukunda
2020-05-18 17:16 ` [PATCH v3 03/14] ASoC: amd: add acp init/de-init functions Vijendar Mukunda
2020-05-18 17:16 ` [PATCH v3 04/14] ASoC: amd: create acp3x pdm platform device Vijendar Mukunda
2020-05-19 10:53   ` Mark Brown
2020-05-19 11:03     ` Mukunda, Vijendar
2020-05-19 14:40       ` Deucher, Alexander
2020-05-19 15:45         ` Mark Brown
2020-05-18 17:16 ` [PATCH v3 05/14] ASoC: amd: add ACP3x PDM platform driver Vijendar Mukunda
2020-05-19 10:54   ` Mark Brown
2020-05-19 11:10     ` Mukunda, Vijendar
2020-05-19 11:32       ` Mark Brown
2020-05-18 17:16 ` [PATCH v3 06/14] ASoC: amd: irq handler changes for ACP3x PDM dma driver Vijendar Mukunda
2020-05-18 17:16 ` [PATCH v3 07/14] ASoC: amd: add acp3x pdm driver dma ops Vijendar Mukunda
2020-05-18 17:16 ` [PATCH v3 08/14] ASoC: amd: add ACP PDM DMA driver dai ops Vijendar Mukunda
2020-05-19 11:19   ` Mark Brown
2020-05-19 11:37     ` Mukunda, Vijendar
2020-05-19 11:40       ` Mark Brown
2020-05-19 11:42         ` Mukunda, Vijendar
2020-05-18 17:16 ` [PATCH v3 09/14] ASoC: amd: add Renoir ACP PCI driver PM ops Vijendar Mukunda
2020-05-19 11:33   ` Mark Brown
2020-05-19 11:39     ` Mukunda, Vijendar
2020-05-18 17:17 ` [PATCH v3 10/14] ASoC: amd: add ACP PDM DMA driver pm ops Vijendar Mukunda
2020-05-18 17:17 ` [PATCH v3 11/14] ASoC: amd: enable Renoir acp3x drivers build Vijendar Mukunda
2020-05-19 11:59   ` kbuild test robot
2020-05-19 14:46     ` Mukunda, Vijendar
2020-05-18 17:17 ` Vijendar Mukunda [this message]
2020-05-18 17:17 ` [PATCH v3 13/14] ASoC: amd: RN machine driver using dmic Vijendar Mukunda
2020-05-18 17:17 ` [PATCH v3 14/14] ASoC: amd: enable build for RN machine driver Vijendar Mukunda
2020-05-18 17:31 ` [PATCH v3 00/14] Add Renoir ACP driver Pierre-Louis Bossart
2020-05-19 11:38 ` Mark Brown
2020-05-19 11:43   ` Mukunda, Vijendar
2020-05-19 12:45     ` Mukunda, Vijendar
2020-05-19 13:19 ` 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=20200518171704.24999-13-Vijendar.Mukunda@amd.com \
    --to=vijendar.mukunda@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=tiwai@suse.de \
    /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.