[PATCH] ASoC: simple-card: add trigger-stop entry parser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It may be useful to specify trigger-stop for some DMA-based simple
audio card. So add this "trigger-stop" device tree entry parser.

Signed-off-by: Maxim Kochetkov <fido_max@xxxxxxxx>
---
 sound/soc/generic/simple-card.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index a78babf44f38..86df7d326068 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -145,8 +145,27 @@ static int simple_parse_node(struct asoc_simple_priv *priv,
 	struct snd_soc_dai_link_component *dlc;
 	struct asoc_simple_dai *dai;
 	int ret;
+	const char *str;
+	struct {
+		char *name;
+		unsigned int val;
+	} of_trigger_table[] = {
+		{ "default",	SND_SOC_TRIGGER_ORDER_DEFAULT },
+		{ "ldc",	SND_SOC_TRIGGER_ORDER_LDC },
+	};
+
 
 	if (cpu) {
+		ret = of_property_read_string(np, "trigger-stop", &str);
+		if (ret == 0) {
+			for (int i = 0; i < ARRAY_SIZE(of_trigger_table); i++) {
+				if (strcmp(str, of_trigger_table[i].name) == 0) {
+					dai_link->trigger_stop = of_trigger_table[i].val;
+					break;
+				}
+			}
+		}
+
 		dlc = asoc_link_to_cpu(dai_link, 0);
 		dai = simple_props_to_dai_cpu(dai_props, 0);
 	} else {
-- 
2.40.1




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux