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 <[email protected]>
---
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
Hi Maxim
Thank you for your patch
> 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 <[email protected]>
> ---
(snip)
> + const char *str;
> + struct {
> + char *name;
> + unsigned int val;
> + } of_trigger_table[] = {
> + { "default", SND_SOC_TRIGGER_ORDER_DEFAULT },
> + { "ldc", SND_SOC_TRIGGER_ORDER_LDC },
> + };
(snip)
> + ret = of_property_read_string(np, "trigger-stop", &str);
The name of "LDC" is from initials of "Link -> DAI -> Component".
Thus, people want to know what does it mean.
You need to update DT doc/yaml too :)
Or maybe like this ?
// 0 : Link
// 1 : DAI
// 2 : Component
trigger-stop = <0, 1, 2>; // default
trigger-stop = <0, 2, 1>; // LDC
And please add paired "trigger-start" or add comment like
/* ADD .trigger-start here */ or something.
Unbalanced implementation is very confusable.
Thank you for your help !!
Best regards
---
Kuninori Morimoto