| From 016b67e717ef312dd430a3b7c742b850a292a063 Mon Sep 17 00:00:00 2001 |
| From: Jyri Sarha <jsarha@ti.com> |
| Date: Mon, 24 Mar 2014 12:15:24 +0200 |
| Subject: ASoC: core: Update snd_soc_of_parse_daifmt() interface |
| |
| Adds struct device_node **bitclkmaster and struct device_node **framemaster |
| function parameters. With the new syntax bitclock-master and frame-master |
| properties can explicitly indicate the dai-link bit-clock and frame masters |
| with a phandle. This patch also makes the minimal changes to simple-card |
| for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears |
| to be the only user of snd_soc_of_parse_daifmt() for now. |
| |
| Signed-off-by: Jyri Sarha <jsarha@ti.com> |
| Acked-by: Jean-Francois Moine <moinejf@free.fr> |
| Signed-off-by: Mark Brown <broonie@linaro.org> |
| (cherry picked from commit 389cb8348cf5ac4a702c71bf13673c4c8bf01e34) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| include/sound/soc.h | 4 +++- |
| sound/soc/generic/simple-card.c | 5 +++-- |
| sound/soc/soc-core.c | 8 +++++++- |
| 3 files changed, 13 insertions(+), 4 deletions(-) |
| |
| diff --git a/include/sound/soc.h b/include/sound/soc.h |
| index 2a878d03c147..27bb5abf62b0 100644 |
| --- a/include/sound/soc.h |
| +++ b/include/sound/soc.h |
| @@ -1181,7 +1181,9 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np, |
| int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, |
| const char *propname); |
| unsigned int snd_soc_of_parse_daifmt(struct device_node *np, |
| - const char *prefix); |
| + const char *prefix, |
| + struct device_node **bitclkmaster, |
| + struct device_node **framemaster); |
| int snd_soc_of_get_dai_name(struct device_node *of_node, |
| const char **dai_name); |
| |
| diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c |
| index 21f1ccbdf582..835fd0258243 100644 |
| --- a/sound/soc/generic/simple-card.c |
| +++ b/sound/soc/generic/simple-card.c |
| @@ -121,7 +121,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np, |
| * bitclock-master, frame-master |
| * and specific "format" if it has |
| */ |
| - dai->fmt = snd_soc_of_parse_daifmt(np, NULL); |
| + dai->fmt = snd_soc_of_parse_daifmt(np, NULL, NULL, NULL); |
| dai->fmt |= daifmt; |
| |
| /* |
| @@ -201,7 +201,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, |
| snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name"); |
| |
| /* get CPU/CODEC common format via simple-audio-card,format */ |
| - daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") & |
| + daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,", NULL, |
| + NULL) & |
| (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK); |
| |
| /* off-codec widgets */ |
| diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
| index 5b7d3ba87c7a..c75d008393d9 100644 |
| --- a/sound/soc/soc-core.c |
| +++ b/sound/soc/soc-core.c |
| @@ -4620,7 +4620,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, |
| EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing); |
| |
| unsigned int snd_soc_of_parse_daifmt(struct device_node *np, |
| - const char *prefix) |
| + const char *prefix, |
| + struct device_node **bitclkmaster, |
| + struct device_node **framemaster) |
| { |
| int ret, i; |
| char prop[128]; |
| @@ -4703,9 +4705,13 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, |
| */ |
| snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); |
| bit = !!of_get_property(np, prop, NULL); |
| + if (bit && bitclkmaster) |
| + *bitclkmaster = of_parse_phandle(np, prop, 0); |
| |
| snprintf(prop, sizeof(prop), "%sframe-master", prefix); |
| frame = !!of_get_property(np, prop, NULL); |
| + if (frame && framemaster) |
| + *framemaster = of_parse_phandle(np, prop, 0); |
| |
| switch ((bit << 4) + frame) { |
| case 0x11: |
| -- |
| 2.1.2 |
| |