From: Hui Wang <hui.wang@canonical.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org,
Vijendar.Mukunda@amd.com
Subject: [PATCH v2] ASoC: amd: put off registering mach platform_dev to avoid -517 err
Date: Fri, 22 May 2020 16:17:38 +0800 [thread overview]
Message-ID: <20200522081738.11636-1-hui.wang@canonical.com> (raw)
If the mach driver's probe is called ahead of codec driver's probe,
the kernel will print -517 error message although the audio still
works finally:
acp_pdm_mach acp_pdm_mach.0: snd_soc_register_card(acp) failed: -517
we could workaround this issue by moving the registration of mach
platform_dev to plat driver's probe.
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
sound/soc/amd/renoir/acp3x-pdm-dma.c | 13 +++++++++++++
sound/soc/amd/renoir/rn-pci-acp3x.c | 3 ---
sound/soc/amd/renoir/rn_acp3x.h | 3 ++-
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index 623dfd3ea705..46055c244998 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -402,6 +402,7 @@ static int acp_pdm_audio_probe(struct platform_device *pdev)
struct pdm_dev_data *adata;
unsigned int irqflags;
int status;
+ struct platform_device_info pdevinfo = {0};
if (!pdev->dev.platform_data) {
dev_err(&pdev->dev, "platform_data not retrieved\n");
@@ -448,6 +449,16 @@ static int acp_pdm_audio_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "ACP PDM IRQ request failed\n");
return -ENODEV;
}
+
+ pdevinfo.name = "acp_pdm_mach";
+ pdevinfo.id = 0;
+ pdevinfo.parent = &pdev->dev;
+ adata->m_pdev = platform_device_register_full(&pdevinfo);
+ if (IS_ERR(adata->m_pdev)) {
+ dev_err(&pdev->dev, "cannot register %s device\n",
+ pdevinfo.name);
+ return PTR_ERR(adata->m_pdev);
+ }
pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_enable(&pdev->dev);
@@ -457,7 +468,9 @@ static int acp_pdm_audio_probe(struct platform_device *pdev)
static int acp_pdm_audio_remove(struct platform_device *pdev)
{
+ struct pdm_dev_data *adata = dev_get_drvdata(&pdev->dev);
pm_runtime_disable(&pdev->dev);
+ platform_device_unregister(adata->m_pdev);
return 0;
}
diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c
index 859ed67b93cf..f5f450cbd249 100644
--- a/sound/soc/amd/renoir/rn-pci-acp3x.c
+++ b/sound/soc/amd/renoir/rn-pci-acp3x.c
@@ -230,9 +230,6 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
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]);
diff --git a/sound/soc/amd/renoir/rn_acp3x.h b/sound/soc/amd/renoir/rn_acp3x.h
index 75228e306e0b..232eda4db055 100644
--- a/sound/soc/amd/renoir/rn_acp3x.h
+++ b/sound/soc/amd/renoir/rn_acp3x.h
@@ -7,7 +7,7 @@
#include "rn_chip_offset_byte.h"
-#define ACP_DEVS 3
+#define ACP_DEVS 2
#define ACP_PHY_BASE_ADDRESS 0x1240000
#define ACP_REG_START 0x1240000
#define ACP_REG_END 0x1250200
@@ -59,6 +59,7 @@ struct pdm_dev_data {
u32 pdm_irq;
void __iomem *acp_base;
struct snd_pcm_substream *capture_stream;
+ struct platform_device *m_pdev;
};
struct pdm_stream_instance {
--
2.17.1
next reply other threads:[~2020-05-22 8:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 8:17 Hui Wang [this message]
2020-05-22 9:16 ` [PATCH v2] ASoC: amd: put off registering mach platform_dev to avoid -517 err Mukunda, Vijendar
2020-05-22 11:08 ` Mark Brown
2020-05-22 11:13 ` Mukunda, Vijendar
2020-05-22 11:22 ` Mark Brown
2020-05-22 11:28 ` Mukunda, Vijendar
2020-05-22 12:59 ` Hui Wang
2020-05-22 13:57 ` Hui Wang
2020-05-22 14:30 ` Mukunda, Vijendar
2020-05-22 15:14 ` Mukunda, Vijendar
2020-05-22 15:32 ` Mark Brown
2020-05-23 0:11 ` Mukunda, Vijendar
2020-05-25 3:32 ` Hui Wang
2020-05-22 19:10 ` kbuild test robot
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=20200522081738.11636-1-hui.wang@canonical.com \
--to=hui.wang@canonical.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
/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).