diff mbox series

[v2,1/5] ASoC: audio-graph-port: add link-trigger-order

Message ID 87sexizojx.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Accepted
Commit fafc20ded3f4659873c83c2af6d389983d480994
Headers show
Series ASoC: simple-card / audio-graph: | expand

Commit Message

Kuninori Morimoto June 12, 2024, 6:02 a.m. UTC
Sound Card need to consider/adjust HW control ordering based on the
combination of CPU/Codec. The controlling feature is already supported
on ASoC, but Simple Audio Card / Audio Graph Card still not support it.
Let's support it.

Cc: Maxim Kochetkov <fido_max@inbox.ru>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/sound/audio-graph-port.yaml      |  9 +++++++
 include/dt-bindings/sound/audio-graph.h       | 26 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 include/dt-bindings/sound/audio-graph.h

Comments

Mark Brown June 26, 2024, 4:41 p.m. UTC | #1
On Wed, Jun 12, 2024 at 06:02:26AM +0000, Kuninori Morimoto wrote:

> Sound Card need to consider/adjust HW control ordering based on the
> combination of CPU/Codec. The controlling feature is already supported
> on ASoC, but Simple Audio Card / Audio Graph Card still not support it.
> Let's support it.

I'm really not thrilled about putting this in the DT bindings since it
feels like something which is likely to change depending on what the OS
is doing, at least sometimes.  OTOH I can't think of anything better
other than quirks and there are some cases where we just need a specific
order.
Kuninori Morimoto June 27, 2024, 12:35 a.m. UTC | #2
Hi Mark

> > Sound Card need to consider/adjust HW control ordering based on the
> > combination of CPU/Codec. The controlling feature is already supported
> > on ASoC, but Simple Audio Card / Audio Graph Card still not support it.
> > Let's support it.
> 
> I'm really not thrilled about putting this in the DT bindings since it
> feels like something which is likely to change depending on what the OS
> is doing, at least sometimes.  OTOH I can't think of anything better
> other than quirks and there are some cases where we just need a specific
> order.

Thank you for reviewing.

I'm not 100% sure when it is needed, but I think it is based on CPU/Codec
chip pair selection ? A device needs to start before B device, etc,
not a whimsical setting.

Other choise to setup it is to creat Simple-Card/Audio-Card custom
driver, I think. But creating custom driver only for such purpose is
a little bit too much.

If it is just a property naming issue, how about to use
"trigger-order-quirks" or something ?

Thank you for your help !!

Best regards
---
Kuninori Morimoto
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
index 28b27e7e45de..d1cbfc5edd3a 100644
--- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
+++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
@@ -25,6 +25,15 @@  definitions:
       capture-only:
         description: port connection used only for capture
         $ref: /schemas/types.yaml#/definitions/flag
+      link-trigger-order:
+        description: trigger order for both start/stop
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+      link-trigger-order-start:
+        description: trigger order for start
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+      link-trigger-order-stop:
+        description: trigger order for stop
+        $ref: /schemas/types.yaml#/definitions/uint32-array
 
   endpoint-base:
     allOf:
diff --git a/include/dt-bindings/sound/audio-graph.h b/include/dt-bindings/sound/audio-graph.h
new file mode 100644
index 000000000000..bdb70c6b7332
--- /dev/null
+++ b/include/dt-bindings/sound/audio-graph.h
@@ -0,0 +1,26 @@ 
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * audio-graph.h
+ *
+ * Copyright (c) 2024 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ */
+#ifndef __AUDIO_GRAPH_H
+#define __AUDIO_GRAPH_H
+
+/*
+ * used in
+ *	link-trigger-order
+ *	link-trigger-order-start
+ *	link-trigger-order-stop
+ *
+ * default is
+ *	link-trigger-order = <SND_SOC_TRIGGER_LINK
+ *			      SND_SOC_TRIGGER_COMPONENT
+ *			      SND_SOC_TRIGGER_DAI>;
+ */
+#define SND_SOC_TRIGGER_LINK		0
+#define SND_SOC_TRIGGER_COMPONENT	1
+#define SND_SOC_TRIGGER_DAI		2
+#define SND_SOC_TRIGGER_SIZE		3	/* shoud be last */
+
+#endif /* __AUDIO_GRAPH_H */