mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: core: Always store of_node when getting DAI link component
@ 2023-06-23 21:04 Mark Brown
  2023-06-23 23:10 ` Mark Brown
  2023-06-25 23:54 ` Kuninori Morimoto
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Brown @ 2023-06-23 21:04 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Kuninori Morimoto; +Cc: alsa-devel, linux-kernel

The generic snd_soc_dai_get_dlc() contains a default translation function
for DAI names which has factored out common code in a number of card
drivers, resolving the dai_name and of_node either using a driver provided
translation function or with a generic implementation. Unfortunately the
of_node can't be set by the translation function since it currently doesn't
have an interface to do that but snd_soc_dai_get_dlc() only initialises the
of_node in the case where there is no translation function.

This breaks the Meson support after conversion to use the generic helpers
since the DPCM cards for it check which component of the SoC is connected
to each link by checking the compatible for the component and the Meson
components provide a custom operation so don't use the generic code.

Fix this and potentially other cards by unconditionally storing the node in
the dai_link_component, there shouldn't be a binding specific of_node
selected since that's how we determine the translation function.

Fixes: 2e1dbea1f8a3 ("ASoC: meson: use snd_soc_{of_}get_dlc()")
Fixes: 3c8b5861850c ("ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f06a20773a34..11bc5250ffd0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3262,6 +3262,8 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
 	struct snd_soc_component *pos;
 	int ret = -EPROBE_DEFER;
 
+	dlc->of_node = args->np;
+
 	mutex_lock(&client_mutex);
 	for_each_component(pos) {
 		struct device_node *component_of_node = soc_component_to_node(pos);
@@ -3300,7 +3302,6 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
 				id--;
 			}
 
-			dlc->of_node	= args->np;
 			dlc->dai_name	= dai->driver->name;
 			if (!dlc->dai_name)
 				dlc->dai_name = pos->name;

---
base-commit: 154756319cc6f8b8b86241da02da6a8fcc6abd1f
change-id: 20230623-asoc-fix-meson-probe-94ecd113bebb

Best regards,
-- 
Mark Brown,,, <broonie@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: core: Always store of_node when getting DAI link component
  2023-06-23 21:04 [PATCH] ASoC: core: Always store of_node when getting DAI link component Mark Brown
@ 2023-06-23 23:10 ` Mark Brown
  2023-06-25 23:54 ` Kuninori Morimoto
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2023-06-23 23:10 UTC (permalink / raw)
  To: Liam Girdwood, Kuninori Morimoto, Mark Brown; +Cc: alsa-devel, linux-kernel

On Fri, 23 Jun 2023 22:04:39 +0100, Mark Brown wrote:
> The generic snd_soc_dai_get_dlc() contains a default translation function
> for DAI names which has factored out common code in a number of card
> drivers, resolving the dai_name and of_node either using a driver provided
> translation function or with a generic implementation. Unfortunately the
> of_node can't be set by the translation function since it currently doesn't
> have an interface to do that but snd_soc_dai_get_dlc() only initialises the
> of_node in the case where there is no translation function.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: core: Always store of_node when getting DAI link component
      commit: 2d0cad0473bd1ffbc5842be0b9f2546265acb011

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: core: Always store of_node when getting DAI link component
  2023-06-23 21:04 [PATCH] ASoC: core: Always store of_node when getting DAI link component Mark Brown
  2023-06-23 23:10 ` Mark Brown
@ 2023-06-25 23:54 ` Kuninori Morimoto
  2023-06-26 11:49   ` Mark Brown
  1 sibling, 1 reply; 6+ messages in thread
From: Kuninori Morimoto @ 2023-06-25 23:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, linux-kernel


Hi Mark

Thank you for the patch !

> The generic snd_soc_dai_get_dlc() contains a default translation function
> for DAI names which has factored out common code in a number of card
> drivers, resolving the dai_name and of_node either using a driver provided
> translation function or with a generic implementation. Unfortunately the
> of_node can't be set by the translation function since it currently doesn't
> have an interface to do that but snd_soc_dai_get_dlc() only initialises the
> of_node in the case where there is no translation function.
> 
> This breaks the Meson support after conversion to use the generic helpers
> since the DPCM cards for it check which component of the SoC is connected
> to each link by checking the compatible for the component and the Meson
> components provide a custom operation so don't use the generic code.
> 
> Fix this and potentially other cards by unconditionally storing the node in
> the dai_link_component, there shouldn't be a binding specific of_node
> selected since that's how we determine the translation function.
> 
> Fixes: 2e1dbea1f8a3 ("ASoC: meson: use snd_soc_{of_}get_dlc()")
> Fixes: 3c8b5861850c ("ASoC: soc-core.c: add index on snd_soc_of_get_dai_name()")
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---

Yes, indeed.
But I think we want to set it under lock and if ret was no error case ?

----------
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ab1f302ee078..5cc3f4cc9d1b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3375,7 +3375,6 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
 				id--;
 			}
 
-			dlc->of_node	= args->np;
 			dlc->dai_name	= snd_soc_dai_name_get(dai);
 		} else if (ret) {
 			/*
@@ -3389,6 +3388,10 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
 
 		break;
 	}
+
+	if (ret == 0)
+		dlc->of_node = args->np;
+
 	mutex_unlock(&client_mutex);
 	return ret;
 }
-----------

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: core: Always store of_node when getting DAI link component
  2023-06-25 23:54 ` Kuninori Morimoto
@ 2023-06-26 11:49   ` Mark Brown
  2023-06-29 14:23     ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2023-06-26 11:49 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Liam Girdwood, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

On Sun, Jun 25, 2023 at 11:54:29PM +0000, Kuninori Morimoto wrote:

> > The generic snd_soc_dai_get_dlc() contains a default translation function
> > for DAI names which has factored out common code in a number of card
> > drivers, resolving the dai_name and of_node either using a driver provided

> Yes, indeed.
> But I think we want to set it under lock and if ret was no error case ?

It doesn't really matter - there's only one possible result, and nothing
should be looking at the dlc unless we return success, but yes that'd
probably be a little cleaner providing we don't ever return early.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: core: Always store of_node when getting DAI link component
  2023-06-26 11:49   ` Mark Brown
@ 2023-06-29 14:23     ` Mark Brown
  2023-06-29 23:23       ` Kuninori Morimoto
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2023-06-29 14:23 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Liam Girdwood, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

On Mon, Jun 26, 2023 at 12:49:16PM +0100, Mark Brown wrote:
> On Sun, Jun 25, 2023 at 11:54:29PM +0000, Kuninori Morimoto wrote:
> 
> > > The generic snd_soc_dai_get_dlc() contains a default translation function
> > > for DAI names which has factored out common code in a number of card
> > > drivers, resolving the dai_name and of_node either using a driver provided
> 
> > Yes, indeed.
> > But I think we want to set it under lock and if ret was no error case ?
> 
> It doesn't really matter - there's only one possible result, and nothing
> should be looking at the dlc unless we return success, but yes that'd
> probably be a little cleaner providing we don't ever return early.

BTW that's not to say don't submit this as a patch, just that it doesn't
need to get applied as a fix.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: core: Always store of_node when getting DAI link component
  2023-06-29 14:23     ` Mark Brown
@ 2023-06-29 23:23       ` Kuninori Morimoto
  0 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2023-06-29 23:23 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, linux-kernel


Hi Mark

Thank you for the mail

> > > But I think we want to set it under lock and if ret was no error case ?
> > 
> > It doesn't really matter - there's only one possible result, and nothing
> > should be looking at the dlc unless we return success, but yes that'd
> > probably be a little cleaner providing we don't ever return early.
> 
> BTW that's not to say don't submit this as a patch, just that it doesn't
> need to get applied as a fix.

Thanks. I thought it is not a big deal.
But yes, will post a patch.


Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-29 23:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23 21:04 [PATCH] ASoC: core: Always store of_node when getting DAI link component Mark Brown
2023-06-23 23:10 ` Mark Brown
2023-06-25 23:54 ` Kuninori Morimoto
2023-06-26 11:49   ` Mark Brown
2023-06-29 14:23     ` Mark Brown
2023-06-29 23:23       ` Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®