[PATCH v6 5/9] ASoC: soc-core: enable "dai-format" on snd_soc_of_parse_daifmt()

Kuninori Morimoto
2017-04-18T02:42:54Z

Current snd_soc_of_parse_daifmt() detects [prefix]format, but
"format" was unclear in some case. This patch checks "dai-format"
first, and try to check "[prefix]format" if "dai-format" was not
exist.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
v5 -> v6

- "dai-format" on Subject
- don't allow [prefix] on dai-format

sound/soc/soc-core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9ee4d4a..4a20c30 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3950,11 +3950,15 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
prefix = "";

/*
- * check "[prefix]format = xxx"
+ * check "dai-format = xxx"
+ * or "[prefix]format = xxx"
* SND_SOC_DAIFMT_FORMAT_MASK area
*/
- snprintf(prop, sizeof(prop), "%sformat", prefix);
- ret = of_property_read_string(np, prop, &str);
+ ret = of_property_read_string(np, "dai-format", &str);
+ if (ret < 0) {
+ snprintf(prop, sizeof(prop), "%sformat", prefix);
+ ret = of_property_read_string(np, prop, &str);
+ }
if (ret == 0) {
for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) {
if (strcmp(str, of_fmt_table[i].name) == 0) {