alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Mukunda, Vijendar" <Vijendar.Mukunda@amd.com>
To: Hui Wang <hui.wang@canonical.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"broonie@kernel.org" <broonie@kernel.org>
Subject: RE: [PATCH v2] ASoC: amd: put off registering mach platform_dev to avoid -517 err
Date: Fri, 22 May 2020 09:16:43 +0000	[thread overview]
Message-ID: <DM6PR12MB26330E411A264053F18C3B3E97B40@DM6PR12MB2633.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20200522081738.11636-1-hui.wang@canonical.com>



> -----Original Message-----
> From: Hui Wang <hui.wang@canonical.com>
> Sent: Friday, May 22, 2020 1:48 PM
> To: alsa-devel@alsa-project.org; broonie@kernel.org; Mukunda, Vijendar
> <Vijendar.Mukunda@amd.com>
> Subject: [PATCH v2] ASoC: amd: put off registering mach platform_dev to avoid
> -517 err
> 
> 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.

ACP PCI driver creates the platform devices for DMA driver,
Machine driver & DMIC generic driver.

During machine driver probe, Sound card registration  fails if
it is unable to find Codec component and platform component 
throwing an error as EPROBE_DEFER.(-517)

It will try few more iterations to bind the DAI links.
I guess this is an expected behavior only.

Sound card registration is successful after several attempts.
This is the reason audio is working without any issues.
Below is the sample log.
acp_pdm_mach acp_pdm_mach.0: dmic-hifi <-> acp_rn_pdm_dma.0 mapping ok

Not really sure do we still need to fix the sound card registration fail issue?
We have seen similar issue in Raven I2S driver also.

Ideally ACP PCI device should be parent device for platform devices needed by
DMA driver,  generic dmic driver and machine driver.

In one way, we are forcing machine driver gets probed only after 
DMA driver and codec driver to avoid sound card registration failure

Correct me , If my understanding is wrong.

> 
> 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


  reply	other threads:[~2020-05-22  9:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  8:17 [PATCH v2] ASoC: amd: put off registering mach platform_dev to avoid -517 err Hui Wang
2020-05-22  9:16 ` Mukunda, Vijendar [this message]
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=DM6PR12MB26330E411A264053F18C3B3E97B40@DM6PR12MB2633.namprd12.prod.outlook.com \
    --to=vijendar.mukunda@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hui.wang@canonical.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).