* [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()
@ 2015-02-12 21:30 Nicolin Chen
2015-02-14 4:31 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2015-02-12 21:30 UTC (permalink / raw)
To: broonie; +Cc: alsa-devel, lgirdwood, linux-kernel
This patch adds snd_soc_of_parse_audio_routing() to get dapm routes
via Device Tree. Because snd_soc_of_parse_audio_routing() overrides
dpam_routes, we use snd_soc_dapm_add_routes() to append the original
build-in DPCM routes instead of linking them to dpam_routes directly.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
sound/soc/fsl/fsl-asoc-card.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 3f6959c..bdc9671 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -388,6 +388,8 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
struct device *dev = card->dev;
int ret;
+ snd_soc_dapm_add_routes(&card->dapm, audio_map, ARRAY_SIZE(audio_map));
+
ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id,
codec_priv->mclk_freq, SND_SOC_CLOCK_IN);
if (ret) {
@@ -503,15 +505,19 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->card.dev = &pdev->dev;
priv->card.name = priv->name;
priv->card.dai_link = priv->dai_link;
- priv->card.dapm_routes = audio_map;
priv->card.late_probe = fsl_asoc_card_late_probe;
- priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
priv->card.dapm_widgets = fsl_asoc_card_dapm_widgets;
priv->card.num_dapm_widgets = ARRAY_SIZE(fsl_asoc_card_dapm_widgets);
memcpy(priv->dai_link, fsl_asoc_card_dai,
sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link));
+ ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing");
+ if (ret) {
+ dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret);
+ goto asrc_fail;
+ }
+
/* Normal DAI Link */
priv->dai_link[0].cpu_of_node = cpu_np;
priv->dai_link[0].codec_of_node = codec_np;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()
2015-02-12 21:30 [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing() Nicolin Chen
@ 2015-02-14 4:31 ` Mark Brown
2015-02-14 5:02 ` Nicolin Chen
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-02-14 4:31 UTC (permalink / raw)
To: Nicolin Chen; +Cc: alsa-devel, lgirdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
On Thu, Feb 12, 2015 at 01:30:02PM -0800, Nicolin Chen wrote:
> This patch adds snd_soc_of_parse_audio_routing() to get dapm routes
> via Device Tree. Because snd_soc_of_parse_audio_routing() overrides
> dpam_routes, we use snd_soc_dapm_add_routes() to append the original
> build-in DPCM routes instead of linking them to dpam_routes directly.
It seems better to make the helper function play nicely with existing
DAPM routes in the card rather than have to rearrange things like this.
How about having it just record that it should parse the given property
when the table in the card is being handleed rather than overwrite that?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()
2015-02-14 4:31 ` Mark Brown
@ 2015-02-14 5:02 ` Nicolin Chen
2015-02-14 5:32 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2015-02-14 5:02 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, lgirdwood, linux-kernel
On Sat, Feb 14, 2015 at 01:31:53PM +0900, Mark Brown wrote:
> On Thu, Feb 12, 2015 at 01:30:02PM -0800, Nicolin Chen wrote:
>
> > This patch adds snd_soc_of_parse_audio_routing() to get dapm routes
> > via Device Tree. Because snd_soc_of_parse_audio_routing() overrides
> > dpam_routes, we use snd_soc_dapm_add_routes() to append the original
> > build-in DPCM routes instead of linking them to dpam_routes directly.
>
> It seems better to make the helper function play nicely with existing
> DAPM routes in the card rather than have to rearrange things like this.
Yes, that would be better.
> How about having it just record that it should parse the given property
> when the table in the card is being handleed rather than overwrite that?
You mean adding another pair of dapm_routes with num_dapm_routes for
Device Tree or something like that?
Thanks
Nicolin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()
2015-02-14 5:02 ` Nicolin Chen
@ 2015-02-14 5:32 ` Mark Brown
2015-02-14 5:49 ` Nicolin Chen
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-02-14 5:32 UTC (permalink / raw)
To: Nicolin Chen; +Cc: alsa-devel, lgirdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 510 bytes --]
On Fri, Feb 13, 2015 at 09:02:46PM -0800, Nicolin Chen wrote:
> On Sat, Feb 14, 2015 at 01:31:53PM +0900, Mark Brown wrote:
> > How about having it just record that it should parse the given property
> > when the table in the card is being handleed rather than overwrite that?
> You mean adding another pair of dapm_routes with num_dapm_routes for
> Device Tree or something like that?
That should work, I had been thinking of just recording where to parse
from and deferring the parse entirely.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()
2015-02-14 5:32 ` Mark Brown
@ 2015-02-14 5:49 ` Nicolin Chen
0 siblings, 0 replies; 5+ messages in thread
From: Nicolin Chen @ 2015-02-14 5:49 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, lgirdwood, linux-kernel
On Sat, Feb 14, 2015 at 02:32:12PM +0900, Mark Brown wrote:
> On Fri, Feb 13, 2015 at 09:02:46PM -0800, Nicolin Chen wrote:
> > On Sat, Feb 14, 2015 at 01:31:53PM +0900, Mark Brown wrote:
>
> > > How about having it just record that it should parse the given property
> > > when the table in the card is being handleed rather than overwrite that?
>
> > You mean adding another pair of dapm_routes with num_dapm_routes for
> > Device Tree or something like that?
>
> That should work, I had been thinking of just recording where to parse
> from and deferring the parse entirely.
Okay. I'll try both approaches and choose a comparatively neater one.
Thanks
Nicolin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-02-14 5:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 21:30 [PATCH] ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing() Nicolin Chen
2015-02-14 4:31 ` Mark Brown
2015-02-14 5:02 ` Nicolin Chen
2015-02-14 5:32 ` Mark Brown
2015-02-14 5:49 ` Nicolin Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox