diff options
author | Jyri Sarha <jsarha@ti.com> | 2014-03-24 06:15:24 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-23 08:14:27 -0400 |
commit | 389cb8348cf5ac4a702c71bf13673c4c8bf01e34 (patch) | |
tree | 7bf0e00cdc1290a186e99fec5130aea04e431d38 | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
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>
-rw-r--r-- | include/sound/soc.h | 4 | ||||
-rw-r--r-- | sound/soc/generic/simple-card.c | 5 | ||||
-rw-r--r-- | 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 0b83168d8ff4..58784105289a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -1241,7 +1241,9 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np, | |||
1241 | int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | 1241 | int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, |
1242 | const char *propname); | 1242 | const char *propname); |
1243 | unsigned int snd_soc_of_parse_daifmt(struct device_node *np, | 1243 | unsigned int snd_soc_of_parse_daifmt(struct device_node *np, |
1244 | const char *prefix); | 1244 | const char *prefix, |
1245 | struct device_node **bitclkmaster, | ||
1246 | struct device_node **framemaster); | ||
1245 | int snd_soc_of_get_dai_name(struct device_node *of_node, | 1247 | int snd_soc_of_get_dai_name(struct device_node *of_node, |
1246 | const char **dai_name); | 1248 | const char **dai_name); |
1247 | 1249 | ||
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, | |||
121 | * bitclock-master, frame-master | 121 | * bitclock-master, frame-master |
122 | * and specific "format" if it has | 122 | * and specific "format" if it has |
123 | */ | 123 | */ |
124 | dai->fmt = snd_soc_of_parse_daifmt(np, NULL); | 124 | dai->fmt = snd_soc_of_parse_daifmt(np, NULL, NULL, NULL); |
125 | dai->fmt |= daifmt; | 125 | dai->fmt |= daifmt; |
126 | 126 | ||
127 | /* | 127 | /* |
@@ -201,7 +201,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
201 | snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name"); | 201 | snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name"); |
202 | 202 | ||
203 | /* get CPU/CODEC common format via simple-audio-card,format */ | 203 | /* get CPU/CODEC common format via simple-audio-card,format */ |
204 | daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") & | 204 | daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,", NULL, |
205 | NULL) & | ||
205 | (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK); | 206 | (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK); |
206 | 207 | ||
207 | /* off-codec widgets */ | 208 | /* off-codec widgets */ |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 051c006281f5..3487a55c9a06 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -4554,7 +4554,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
4554 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing); | 4554 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing); |
4555 | 4555 | ||
4556 | unsigned int snd_soc_of_parse_daifmt(struct device_node *np, | 4556 | unsigned int snd_soc_of_parse_daifmt(struct device_node *np, |
4557 | const char *prefix) | 4557 | const char *prefix, |
4558 | struct device_node **bitclkmaster, | ||
4559 | struct device_node **framemaster) | ||
4558 | { | 4560 | { |
4559 | int ret, i; | 4561 | int ret, i; |
4560 | char prop[128]; | 4562 | char prop[128]; |
@@ -4637,9 +4639,13 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, | |||
4637 | */ | 4639 | */ |
4638 | snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); | 4640 | snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); |
4639 | bit = !!of_get_property(np, prop, NULL); | 4641 | bit = !!of_get_property(np, prop, NULL); |
4642 | if (bit && bitclkmaster) | ||
4643 | *bitclkmaster = of_parse_phandle(np, prop, 0); | ||
4640 | 4644 | ||
4641 | snprintf(prop, sizeof(prop), "%sframe-master", prefix); | 4645 | snprintf(prop, sizeof(prop), "%sframe-master", prefix); |
4642 | frame = !!of_get_property(np, prop, NULL); | 4646 | frame = !!of_get_property(np, prop, NULL); |
4647 | if (frame && framemaster) | ||
4648 | *framemaster = of_parse_phandle(np, prop, 0); | ||
4643 | 4649 | ||
4644 | switch ((bit << 4) + frame) { | 4650 | switch ((bit << 4) + frame) { |
4645 | case 0x11: | 4651 | case 0x11: |