ASoC: makes CPU/Codec channel connection map more generic
Subsystems (5)
Kuninori Morimoto
maintainerv3 cover ASoC: makes CPU/Codec channel connection map more generic
Hi Mark
Cc Bard, Pierre-Louis, DT-ML
This is v3 patch-set.
Current ASoC is supporting CPU/Codec = N:M (N < M) connection by using ch_map idea. This patch-set expands it that all connection uses this idea, and no longer N < M limit [1].
This patch is tested on Audio-Graph-Card2 with sample dtsi, but needs Tested-by, at least from Intel.
v2 -> v3
- tidyup comment
- use more clear connection image on DT
- "ch_maps" -> "ch-maps" on DT
- Add DT maintainer on "To:" for all patches
v1 -> v2
- makes CPU/Codec connection relation clear on comment/sample
- fixup type "connction" -> "connection"
- makes error message clear
Kuninori Morimoto (4):
ASoC: makes CPU/Codec channel connection map more generic
ASoC: audio-graph-card2: add CPU:Codec = N:M support
ASoC: audio-graph-card2-custom-sample: add CPU/Codec = N:M sample
dt-bindings: audio-graph-port: add ch-maps property
.../bindings/sound/audio-graph-port.yaml | 2 + include/sound/soc.h | 66 ++++++++- .../audio-graph-card2-custom-sample.dtsi | 138 +++++++++++++++--- sound/soc/generic/audio-graph-card2.c | 29 ++++ sound/soc/intel/boards/sof_sdw.c | 14 +- sound/soc/soc-core.c | 85 +++++++++++ sound/soc/soc-dapm.c | 47 +++--- sound/soc/soc-pcm.c | 73 ++++----- 8 files changed, 363 insertions(+), 91 deletions(-)
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 1/4 ASoC: makes CPU/Codec channel connection map more generic
Current ASoC CPU:Codec = N:M connection is using connection mapping idea, but it is used for CPU < Codec case only. We want to use it for any case.
By this patch, not only N:M connection, but all existing connection (1:1, 1:N, N:N) will use same connection mapping. Because it will use default mapping, no conversion patch is needed to exising CPU/Codec drivers.
More over, CPU:Codec = M:N (M > N) also supported in the same time.
--- include/sound/soc.h | 66 +++++++++++++++++++++++-- sound/soc/intel/boards/sof_sdw.c | 14 +++--- sound/soc/soc-core.c | 85 ++++++++++++++++++++++++++++++++ sound/soc/soc-dapm.c | 47 +++++++----------- sound/soc/soc-pcm.c | 73 ++++++++++++++------------- 5 files changed, 211 insertions(+), 74 deletions(-)
include/sound/soc.h +63 -3
@@ -655,8 +655,68 @@ struct snd_soc_dai_link_component {struct of_phandle_args *dai_args; }; -struct snd_soc_dai_link_codec_ch_map { -unsigned int connected_cpu_id; +/* +* [dai_link->ch_maps Image sample] +* +* if (num_cpus >= num_codecs) +* .ch_maps is [CPU] base +* else +* .ch_maps is [Codec] base +* +*------------------------- +* CPU0 <---> CodecX +* +* Because [num_cpus >= num_codecs] +* .ch_maps is [CPU] base +* +* .num_cpus = 1; +* .num_codecs = 1; +* .ch_maps[] = {{.connected_node = X; }}; CPU0 <-> CodecX +* +*------------------------- +* CPU0 <---> CodecX +* CPU1 <---> CodecY +* CPU2 <---> CodecZ +* +* Because [num_cpus >= num_codecs] +* .ch_maps is [CPU] base +* +* .num_cpus = 3; +* .num_codecs = 3; +* .ch_maps[] = {{.connected_node = X; }, CPU0 <-> CodecX +* {.connected_node = Y; }, CPU1 <-> CodecY +* {.connected_node = Z; }}; CPU2 <-> CodecZ +* +*------------------------- +* CPU0 <---> CodecX +* CPU1 <-+-> CodecY +* CPU2 <-/ +* +* Because [num_cpus >= num_codecs] +* .ch_maps is [CPU] base +* +* .num_cpus = 3; +* .num_codecs = 2; +* .ch_maps[] = {{.connected_node = X; }, CPU0 <-> CodecX +* {.connected_node = Y; }, CPU1 <-> CodecY +* {.connected_node = Y; }}; CPU2 <-> CodecY +* +*------------------------- +* CPU_X <---> Codec0 +* CPU_Y <-+-> Codec1 +* \-> Codec2 +* +* Because [num_cpus < num_codecs] +* .ch_maps is [Codec] base +* +* .num_cpus = 2; +* .num_codecs = 3; +* .ch_maps[] = {{.connected_node = X; }, Codec0 <-> CPU_X +* {.connected_node = Y; }, Codec1 <-> CPU_Y +* {.connected_node = Y; }}; Codec2 <-> CPU_Y +*/ +struct snd_soc_dai_link_ch_map { +unsigned int connected_node;unsigned int ch_mask; };
@@ -688,7 +748,7 @@ struct snd_soc_dai_link {struct snd_soc_dai_link_component *codecs;unsigned int num_codecs; -struct snd_soc_dai_link_codec_ch_map *codec_ch_maps; +struct snd_soc_dai_link_ch_map *ch_maps;/* * You MAY specify the link's platform/PCM/DMA driver, either by * device name, or by DT/OF node, but not both. Some forms of link
sound/soc/intel/boards/sof_sdw.c +7 -7
@@ -579,7 +579,7 @@ int sdw_hw_params(struct snd_pcm_substream *substream,int i;int j; -if (!rtd->dai_link->codec_ch_maps) +if (!rtd->dai_link->ch_maps)return 0 ;/* Identical data will be sent to all codecs in playback */
@@ -607,9 +607,9 @@ int sdw_hw_params(struct snd_pcm_substream *substream,*/ for_each_rtd_cpu_dais (rtd, i, cpu_dai) {for_each_rtd_codec_dais (rtd, j, codec_dai) { -if (rtd->dai_link->codec_ch_maps[j].connected_cpu_id != i) +if (rtd->dai_link->ch_maps[j].connected_node != i)continue ; - rtd->dai_link->codec_ch_maps[j].ch_mask = ch_mask << (j * step); + rtd->dai_link->ch_maps[j].ch_mask = ch_mask << (j * step); } }return 0 ;
@@ -1350,7 +1350,7 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link,return 0 ; } -static void set_dailink_map (struct snd_soc_dai_link_codec_ch_map *sdw_codec_ch_maps, +static void set_dailink_map (struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps,int codec_num,int cpu_num) {int step;
@@ -1358,7 +1358,7 @@ static void set_dailink_map(struct snd_soc_dai_link_codec_ch_map *sdw_codec_ch_m step = codec_num / cpu_num;for (i =0 ; i < codec_num; i++) - sdw_codec_ch_maps[i].connected_cpu_id = i / step; + sdw_codec_ch_maps[i].connected_node = i / step; }static const char *const type_strings[] = {"SimpleJack" ,"SmartAmp" ,"SmartMic" };
@@ -1453,7 +1453,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, *ignore_pch_dmic = true;for_each_pcm_streams (stream) { -struct snd_soc_dai_link_codec_ch_map *sdw_codec_ch_maps; +struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps;char *name, *cpu_name;int playback, capture;static const char *const sdw_stream_name[] = {
@@ -1530,7 +1530,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, dai_links[*link_index].nonatomic = true;set_dailink_map (sdw_codec_ch_maps, codec_num, cpu_dai_num); - dai_links[*link_index].codec_ch_maps = sdw_codec_ch_maps; + dai_links[*link_index].ch_maps = sdw_codec_ch_maps; ret =set_codec_init_func (card, adr_link, dai_links + (*link_index)++, playback, group_id, adr_index, dai_index);if (ret <0 ) {
sound/soc/soc-core.c +85 -0
97 lines not on this page · raw message
sound/soc/soc-dapm.c +17 -30
62 lines not on this page · raw message
sound/soc/soc-pcm.c +39 -34
104 lines not on this page · raw message
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 2/4 ASoC: audio-graph-card2: add CPU:Codec = N:M support
In reply to Kuninori MorimotoNow ASoC is supporting CPU:Codec = N:M support.
This patch enables it on Audio Graph Card2.
--- sound/soc/generic/audio-graph-card2.c | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
sound/soc/generic/audio-graph-card2.c +29 -0
@@ -515,7 +515,10 @@ static int graph_parse_node(struct simple_util_priv *priv,int ret =0 ;if (graph_lnk_is_multi (port)) { +struct device_node *ports =of_get_parent (port);int idx; +int num; +char *props ="ch-maps" ;of_node_get (port);
@@ -530,6 +533,32 @@ static int graph_parse_node(struct simple_util_priv *priv,if (ret <0 )break ; } + +/* read "ch-maps" property if exist */ + num =of_property_count_elems_of_size (ports, props,sizeof (u32)); +if (num >0 ) { +struct snd_soc_dai_link *dai_link =simple_priv_to_link (priv, li->link); +struct device *dev =simple_priv_to_dev (priv); +struct snd_soc_dai_link_ch_map *ch_maps =devm_kcalloc (dev, num,sizeof (*ch_maps),GFP_KERNEL ); +int *temp =devm_kcalloc (dev, num,sizeof (int ),GFP_KERNEL ); +int i; + +if (!ch_maps || !temp) { + ret = -ENOMEM ; + goto multi_end; + } + + ret =of_property_read_u32_array (ports, props, temp, num); +if (ret <0 ) + goto multi_end; + + dai_link->ch_maps = ch_maps; +for (i =0 ; i < num; i++) + dai_link->ch_maps[i].connected_node = temp[i]; +multi_end: +devm_kfree (dev, temp); + } +of_node_put (ports); }else {/* Single CPU / Codec */ ep =port_to_endpoint (port);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 3/4 ASoC: audio-graph-card2-custom-sample: add CPU/Codec = N:M sample
In reply to Kuninori MorimotoNow ASoC is supporting CPU/Codec = N:M connection. This patch adds its sample settings.
But One note here is that it has many type of samples, it reached to maximum of sound minor number. Therefore, new sample is disabled so far. If you want to try it, you need to disable some other one instead.
--- .../audio-graph-card2-custom-sample.dtsi | 138 +++++++++++++++--- 1 file changed, 121 insertions(+), 17 deletions(-)
sound/soc/generic/audio-graph-card2-custom-sample.dtsi +121 -17
@@ -58,12 +58,32 @@ / { * | |-> codec13 * +-+ * - * [Multi-CPU/Codec] + * [Multi-CPU/Codec-0] * +-+ +-+ * cpu1 <--| |<-@--------->| |-> codec1 * cpu2 <--| | | |-> codec2 * +-+ +-+ * + * [Multi-CPU/Codec-1] + * About ch-map (*), see + * soc-core.c :: [dai_link->ch_maps Image sample] + * + * +-+ +-+ + * cpu8 <--| |<-@--------->| |-> codec14 [0]codec14 <---> [0]cpu8 + * cpu9 <--| | | |-> codec15 [1]codec15 <-+-> [1]cpu9 + * +-+ | |-> codec16 [2]codec16 <-/ + * +-+ (*) ch-map = [0, 1, 1] + * + * [Multi-CPU/Codec-2] + * About ch-map (*), see + * soc-core.c :: [dai_link->ch_maps Image sample] + * + * +-+ +-+ + * cpu10 <-| |<-@--------->| |-> codec17 [1]cpu11 <---> [0]codec17 + * cpu11 <-| | | |-> codec18 [0]cpu10 <-+-> [1]codec18 + * cpu12 <-| | +-+ [2]cpu12 <-/ + * +-+ (*) ch-map = [1, 0, 1] + * * [DPCM] * * CPU3/CPU4 are converting rate to 44100
@@ -144,15 +164,38 @@ audio-graph-card2-custom-sample { */ &cpu0 - /* [Semi-Multi] */ + /* + * [Semi-Multi] + * cpu7/codec12/codec13 + */ &sm0 /* - * [Multi-CPU/Codec]: cpu side only + * [Multi-CPU/Codec-0]: cpu side only * cpu1/cpu2/codec1/codec2 */ &mcpu0 + /* + * [Multi-CPU/Codec-1]: cpu side only + * cpu8/cpu9/codec14/codec15/codec16 + * + * Because it will reach to the maximum of sound minor number, + * disable it so far. + * If you want to try it, please disable some other one instead. + */ + //&mcpu1 + + /* + * [Multi-CPU/Codec-2]: cpu side only + * cpu10/cpu11/cpu12/codec17/codec18 + * + * Because it will reach to the maximum of sound minor number, + * disable it so far. + * If you want to try it, please disable some other one instead. + */ + //&mcpu2 + /* * [DPCM]: both FE / BE * cpu3/cpu4/codec3
@@ -182,24 +225,24 @@ multi { #address-cells = <1>; #size-cells = <0>; + /* [Multi-CPU-0] */ ports@0 { reg = <0>; #address-cells = <1>; #size-cells = <0>; - /* [Multi-CPU] */ - mcpu0: port@0 { reg = <0>; mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; - port@1 { reg = <1>; mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; - port@2 { reg = <2>; mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; + mcpu0: port@0 { reg = <0>; mcpu00_ep: endpoint { remote-endpoint = <&mcodec00_ep>; }; }; + port@1 { reg = <1>; mcpu01_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; + port@2 { reg = <2>; mcpu02_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; }; - /* [Multi-Codec] */ + /* [Multi-Codec-0] */ ports@1 { reg = <1>; #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; - port@1 { reg = <1>; mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; - port@2 { reg = <2>; mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; + port@0 { reg = <0>; mcodec00_ep: endpoint { remote-endpoint = <&mcpu00_ep>; }; }; + port@1 { reg = <1>; mcodec01_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; + port@2 { reg = <2>; mcodec02_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; }; /* [DPCM-Multi]::BE */
@@ -241,6 +284,50 @@ ports@5 { port@1 { reg = <1>; smcodec1_ep: endpoint { remote-endpoint = <&codec12_ep>; }; }; port@2 { reg = <2>; smcodec2_ep: endpoint { remote-endpoint = <&codec13_ep>; }; }; }; + + /* [Multi-CPU-1] */ + ports@6 { + reg = <6>; + #address-cells = <1>; + #size-cells = <0>; + mcpu1: port@0 { reg = <0>; mcpu10_ep: endpoint { remote-endpoint = <&mcodec10_ep>; }; }; + port@1 { reg = <1>; mcpu11_ep: endpoint { remote-endpoint = <&cpu8_ep>; }; }; + port@2 { reg = <2>; mcpu12_ep: endpoint { remote-endpoint = <&cpu9_ep>; }; }; + }; + + /* [Multi-Codec-1] */ + ports@7 { + reg = <7>; + ch-maps = <0 1 1>; /* see [Multi-CPU/Codec-1] */ + #address-cells = <1>; + #size-cells = <0>; + port@0 { reg = <0>; mcodec10_ep: endpoint { remote-endpoint = <&mcpu10_ep>; }; }; + port@1 { reg = <1>; mcodec11_ep: endpoint { remote-endpoint = <&codec14_ep>; }; }; + port@2 { reg = <2>; mcodec12_ep: endpoint { remote-endpoint = <&codec15_ep>; }; }; + port@3 { reg = <3>; mcodec13_ep: endpoint { remote-endpoint = <&codec16_ep>; }; }; + }; + + /* [Multi-CPU-2] */ + ports@8 { + reg = <8>; + ch-maps = <1 0 1>; /* see [Multi-CPU/Codec-2] */ + #address-cells = <1>; + #size-cells = <0>; + mcpu2: port@0 { reg = <0>; mcpu20_ep: endpoint { remote-endpoint = <&mcodec20_ep>; }; }; + port@1 { reg = <1>; mcpu21_ep: endpoint { remote-endpoint = <&cpu10_ep>; }; }; + port@2 { reg = <2>; mcpu22_ep: endpoint { remote-endpoint = <&cpu11_ep>; }; }; + port@3 { reg = <3>; mcpu23_ep: endpoint { remote-endpoint = <&cpu12_ep>; }; }; + }; + + /* [Multi-Codec-2] */ + ports@9 { + reg = <9>; + #address-cells = <1>; + #size-cells = <0>; + port@0 { reg = <0>; mcodec20_ep: endpoint { remote-endpoint = <&mcpu20_ep>; }; }; + port@1 { reg = <1>; mcodec21_ep: endpoint { remote-endpoint = <&codec17_ep>; }; }; + port@2 { reg = <2>; mcodec22_ep: endpoint { remote-endpoint = <&codec18_ep>; }; }; + }; }; dpcm {
@@ -323,9 +410,9 @@ ports { /* [Normal] */ cpu0: port@0 { reg = <0>; cpu0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; }; - /* [Multi-CPU] */ - port@1 { reg = <1>; cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; }; - port@2 { reg = <2>; cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; }; + /* [Multi-CPU-0] */ + port@1 { reg = <1>; cpu1_ep: endpoint { remote-endpoint = <&mcpu01_ep>; }; }; + port@2 { reg = <2>; cpu2_ep: endpoint { remote-endpoint = <&mcpu02_ep>; }; }; /* [DPCM]::FE */ port@3 { reg = <3>; cpu3_ep: endpoint { remote-endpoint = <&fe00_ep>; }; };
@@ -337,6 +424,15 @@ ports { /* [Semi-Multi] */ sm0: port@7 { reg = <7>; cpu7_ep: endpoint { remote-endpoint = <&smcodec0_ep>; }; }; + + /* [Multi-CPU-1] */ + port@8 { reg = <8>; cpu8_ep: endpoint { remote-endpoint = <&mcpu11_ep>; }; }; + port@9 { reg = <9>; cpu9_ep: endpoint { remote-endpoint = <&mcpu12_ep>; }; }; + + /* [Multi-CPU-2] */ + port@a { reg = <10>; cpu10_ep: endpoint { remote-endpoint = <&mcpu21_ep>; }; }; + port@b { reg = <11>; cpu11_ep: endpoint { remote-endpoint = <&mcpu22_ep>; }; }; + port@c { reg = <12>; cpu12_ep: endpoint { remote-endpoint = <&mcpu23_ep>; }; }; }; };
@@ -363,9 +459,9 @@ ports { /* [Normal] */ port@0 { reg = <0>; codec0_ep: endpoint { remote-endpoint = <&cpu0_ep>; }; }; - /* [Multi-Codec] */ - port@1 { reg = <1>; codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; }; - port@2 { reg = <2>; codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; }; + /* [Multi-Codec-0] */ + port@1 { reg = <1>; codec1_ep: endpoint { remote-endpoint = <&mcodec01_ep>; }; }; + port@2 { reg = <2>; codec2_ep: endpoint { remote-endpoint = <&mcodec02_ep>; }; }; /* [DPCM]::BE */ port@3 {
@@ -395,6 +491,14 @@ port@3 { port@c { reg = <12>; codec12_ep: endpoint { remote-endpoint = <&smcodec1_ep>; }; }; port@d { reg = <13>; codec13_ep: endpoint { remote-endpoint = <&smcodec2_ep>; }; }; + /* [Multi-Codec-1] */ + port@e { reg = <14>; codec14_ep: endpoint { remote-endpoint = <&mcodec11_ep>; }; }; + port@f { reg = <15>; codec15_ep: endpoint { remote-endpoint = <&mcodec12_ep>; }; }; + port@10 { reg = <16>; codec16_ep: endpoint { remote-endpoint = <&mcodec13_ep>; }; }; + + /* [Multi-Codec-2] */ + port@11 { reg = <17>; codec17_ep: endpoint { remote-endpoint = <&mcodec21_ep>; }; }; + port@12 { reg = <18>; codec18_ep: endpoint { remote-endpoint = <&mcodec22_ep>; }; }; }; }; };
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 4/4 dt-bindings: audio-graph-port: add ch-maps property
In reply to Kuninori MorimotoThis patch adds ch-maps property to enable handling CPU:Codec = N:M connection.
--- Documentation/devicetree/bindings/sound/audio-graph-port.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +2 -0
@@ -19,6 +19,8 @@ definitions: properties: mclk-fs: $ref: simple-card.yaml#/definitions/mclk-fs + ch-maps: + $ref: /schemas/types.yaml#/definitions/uint32-array endpoint-base: allOf:
Signature · 1 line
2.25.1
Re: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Hey,
Quoted 13 lines · Kuninori Morimoto
This patch adds ch-maps property to enable handling CPU:Codec = N:M connection.
Signed-off-by Kuninori Morimoto <[email protected]>--- Documentation/devicetree/bindings/sound/audio-graph-port.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/sound/audio-graph-port.yaml +0
-0
Documentation/devicetree/bindings/sound/audio-graph-port.yaml definitions: · line 23
Quoted 5 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +2
-0@@ -19,6 +19,8 @@ definitions: properties: mclk-fs: $ref: simple-card.yaml#/definitions/mclk-fs + ch-maps: + $ref: /schemas/types.yaml#/definitions/uint32-array
Most of what I said on the last version applies here too. Only the s/_/-/ was done. Is there a reason you ignored those comments?
Thanks,
Conor.
Quoted 6 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +0
-0endpoint-base: allOf:Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Hi Conor
Thank you for your feedback
Quoted 5 lines
Quoted 5 lines
This patch adds ch-maps property to enable handling CPU:Codec = N:M connection.
Signed-off-by Kuninori Morimoto <[email protected]>---
(snip)
Quoted 5 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml definitions: · line 23
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +2
-0+ ch-maps: + $ref: /schemas/types.yaml#/definitions/uint32-arrayMost of what I said on the last version applies here too. Only the s/_/-/ was done. Is there a reason you ignored those comments?
Ah sorry. I thought you wanted was add your address on To/Cc for all patch-set.
Quoted 2 lines
I only got this one patch, so I have no context at all for this change. Given that, and since I know almost nothing about sound stuff...
(snip)
Quoted 3 lines
...I have absolutely no idea how I would populate "
ch_maps" correctly. Please describe (in the binding) what this property actually does & how to use it. Also, properties use -s not _s.
Some Sound want to use multiple connections between CPUs (N) and Codecs (M). Current audio-graph-card2 driver is already supporting 1:N / N:1 / N:N connections, this patch expand it.
These are implemented by using Of-Graph.
For example N:N connection case, it is expressed like below. One note here is that cpu0/cpu1 and codec0/codec1 are *not* independent. We need to consider cpu0/cpu1 pair and codec0/codec1 pair.
ep (endpoint)
(A) (B) <- port -> <- port -> <- port -> <- port -> ax(ep) <--> (ep)bx cpu0(ep) <--> (ep)a0 b0(ep) <--> (ep)codec0 cpu1(ep) <--> (ep)a1 b1(ep) <--> (ep)codec1
In N:N case, it is assuming cpu0/codec0, and cpu1/codec1 has related. This patch expand (A)/(B) part to N:M (N != M). Then, ch-maps indicates how these are related.
(A) (B) <- port -> <- port -> <- port -> <- port -> ax(ep) <--> (ep)bx cpu0(ep) <--> (ep)a0 b0(ep) <--> (ep)codec0 cpu1(ep) <--> (ep)a1 b1(ep) <--> (ep)codec1
=> cpu2(ep) <--> (ep)a2
ch-maps = <0 0 1>
ch-maps = <0 0 1> means,
cpu0 <-> codec0 cpu1 <-> codec0 cpu2 <-> codec1
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Mark Brown
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Quoted 5 lines · Kuninori Morimoto
Quoted 5 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml definitions: · line 23
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +2
-0+ ch-maps: + $ref: /schemas/types.yaml#/definitions/uint32-arrayI only got this one patch, so I have no context at all for this change. Given that, and since I know almost nothing about sound stuff...
Quoted 8 lines
(snip)
Quoted 3 lines
...I have absolutely no idea how I would populate "
ch_maps" correctly. Please describe (in the binding) what this property actually does & how to use it. Also, properties use -s not _s.Some Sound want to use multiple connections between CPUs (N) and Codecs (M). Current audio-graph-card2 driver is already supporting 1:N / N:1 / N:N connections, this patch expand it.
Some of this explanation needs to go into the binding - someone reading the binding should really be able to figure out what numbers to put in there without looking at the code.
Quoted 6 lines
ch-maps = <0 0 1> means,
cpu0 <-> codec0 cpu1 <-> codec0 cpu2 <-> codec1Thank you for your help !!
So probably somthing along the lines of saying "there should be one element in the array for each CPU DAI, this should be the CODEC number to route to" (that's probably still a bit unclear but roughly that).
Re: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Quoted 12 lines · Mark Brown
Quoted 9 lines · Kuninori Morimoto
Quoted 5 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml definitions: · line 23
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph-port.yaml +2
-0+ ch-maps: + $ref: /schemas/types.yaml#/definitions/uint32-arrayI only got this one patch, so I have no context at all for this change. Given that, and since I know almost nothing about sound stuff...
(snip)
Quoted 3 lines
...I have absolutely no idea how I would populate "
ch_maps" correctly. Please describe (in the binding) what this property actually does & how to use it. Also, properties use -s not _s.
Quoted 7 lines
Quoted 3 lines
Some Sound want to use multiple connections between CPUs (N) and Codecs (M). Current audio-graph-card2 driver is already supporting 1:N / N:1 / N:N connections, this patch expand it.
Some of this explanation needs to go into the binding - someone reading the binding should really be able to figure out what numbers to put in there without looking at the code.
Absolutely :)
Quoted 4 lines
Quoted 4 lines
ch-maps = <0 0 1> means,
cpu0 <-> codec0 cpu1 <-> codec0 cpu2 <-> codec1
What happens when you want to convey that codec0 & codec1 are both connected to cpu0 & codec2 is connected to cpu1?
How would that be described in a DT?
Or is that not something anyone would even want to do?
Quoted 5 lines
Quoted 1 line
Thank you for your help !!
So probably somthing along the lines of saying "there should be one element in the array for each CPU DAI, this should be the CODEC number to route to" (that's probably still a bit unclear but roughly that).
Kuninori Morimoto
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Hi Conor
Quoted 5 lines
Quoted 3 lines
Some of this explanation needs to go into the binding - someone reading the binding should really be able to figure out what numbers to put in there without looking at the code.
Absolutely :)
Indeed :) will do in v4
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
ch-maps = <0 0 1> means,
cpu0 <-> codec0 cpu1 <-> codec0 cpu2 <-> codec1What happens when you want to convey that codec0 & codec1 are both connected to cpu0 & codec2 is connected to cpu1?
How would that be described in a DT?
Or is that not something anyone would even want to do?
In such case, ch-maps is from codec. it will be like below. It is judged by number of cpu vs codec. [PATCH 3/4] has both case sample.
cpu >= codec : CPU base cpu < codec : Codec base ch-maps = <0 0 1> codec0 <-> cpu0 codec1 <-> cpu0 codec2 <-> cpu1
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Re: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Quoted 24 lines · Kuninori Morimoto
Hi Conor
Quoted 5 lines
Quoted 3 lines
Some of this explanation needs to go into the binding - someone reading the binding should really be able to figure out what numbers to put in there without looking at the code.
Absolutely :)
Indeed :) will do in v4
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
ch-maps = <0 0 1> means,
cpu0 <-> codec0 cpu1 <-> codec0 cpu2 <-> codec1What happens when you want to convey that codec0 & codec1 are both connected to cpu0 & codec2 is connected to cpu1?
How would that be described in a DT?
Or is that not something anyone would even want to do?In such case, ch-maps is from codec. it will be like below. It is judged by number of cpu vs codec. [PATCH 3/4] has both case sample.
Quoted 7 lines
cpu >= codec : CPU base cpu < codec : Codec base ch-maps = <0 0 1> codec0 <-> cpu0 codec1 <-> cpu0 codec2 <-> cpu1
That seems like a very unintuitive interface. If there were 32 CPUs and 30 codecs, then it'd be very inconvenient for a human reader to grok the configuration. CPUs were to be disabled in the DT, could the meaning of the property invert?
I am not really the best when it comes to audio (or media) bindings, but I am wondering if a phandle based approach would be better, where the codecs have phandles for their associated CPUs. Maybe Mark, Rob etc could comment if doing that sort of thing is not feasible.
Cheers,
Conor.
Kuninori Morimoto
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Hi Conor
Quoted 3 lines
That seems like a very unintuitive interface. If there were 32 CPUs and 30 codecs, then it'd be very inconvenient for a human reader to grok the configuration.
I don't think such huge number connection will be used...
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Re: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Quoted 8 lines · Kuninori Morimoto
Hi Conor
Quoted 3 lines
That seems like a very unintuitive interface. If there were 32 CPUs and 30 codecs, then it'd be very inconvenient for a human reader to grok the configuration.
I don't think such huge number connection will be used...
Your binding allows for that though!
I really don't like the number of elements inverting the meaning of the property.
Also, this was not the only item in my mail. Why did you not respond to the other comments?
Cheers,
Conor.
Quoted 5 lines
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Mark Brown
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Quoted 7 lines · Conor Dooley
Quoted 5 lines · Kuninori Morimoto
Quoted 3 lines
That seems like a very unintuitive interface. If there were 32 CPUs and 30 codecs, then it'd be very inconvenient for a human reader to grok the configuration.
I don't think such huge number connection will be used...
I suspect that if we run into systems with very large numbers of devices on a single bus they'll either want to do something more dynamic and use it as a switch or be very regular which makes writing things a lot more manageable.
Quoted 3 lines
Your binding allows for that though!
I really don't like the number of elements inverting the meaning of the property.
I have to say I'm not a big fan of that either. It might be easier to map each channel to a slot number on the link, each DAI could then have an independent map and the kernel could compare DAI slots to join things up.
Kuninori Morimoto
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Hi Mark
Quoted 7 lines
Quoted 2 lines
I really don't like the number of elements inverting the meaning of the property.
I have to say I'm not a big fan of that either. It might be easier to map each channel to a slot number on the link, each DAI could then have an independent map and the kernel could compare DAI slots to join things up.
Do you mean something like this ?
almost pseudo code...
Image
CPU0 <---> Codec0 CPU1 <-+-> Codec1 CPU2 <-/
code
ch_maps = {
.cpu;
.codec;
...
};
.ch_maps[0].cpu = CPU0
.ch_maps[1].cpu = CPU1
.ch_maps[2].cpu = CPU2
.ch_maps[0].codec = Codec0
.ch_maps[1].codec = Codec1
.ch_maps[2].codec = Codec1DT
(A) (B) <- port -> <- port -> <- port -> <- port -> ax(ep) <--> (ep)bx map=<0> cpu0(ep) <--> (ep)a0 b0(ep) <--> (ep)codec0 map=<0> map=<1> cpu1(ep) <--> (ep)a1 b1(ep) <--> (ep)codec1 map=<1 2> map=<2> cpu2(ep) <--> (ep)a2 ~~~~~~~~~ ~~~~~~~
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Mark Brown
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Quoted 7 lines · Kuninori Morimoto
DT
(A) (B) <- port -> <- port -> <- port -> <- port -> ax(ep) <--> (ep)bx map=<0> cpu0(ep) <--> (ep)a0 b0(ep) <--> (ep)codec0 map=<0> map=<1> cpu1(ep) <--> (ep)a1 b1(ep) <--> (ep)codec1 map=<1 2> map=<2> cpu2(ep) <--> (ep)a2 ~~~~~~~~~
I think that looks like what I was thinking of, yes. Might be misreading it though!
Kuninori Morimoto
maintainerRe: [PATCH v3 4/4] dt-bindings: audio-graph-port: add ch-maps property
Hi Mark
Quoted 10 lines
Quoted 7 lines
DT
(A) (B) <- port -> <- port -> <- port -> <- port -> ax(ep) <--> (ep)bx map=<0> cpu0(ep) <--> (ep)a0 b0(ep) <--> (ep)codec0 map=<0> map=<1> cpu1(ep) <--> (ep)a1 b1(ep) <--> (ep)codec1 map=<1 2> map=<2> cpu2(ep) <--> (ep)a2 ~~~~~~~~~I think that looks like what I was thinking of, yes. Might be misreading it though!
OK, I see.
Indeed this is better idea than mine. It is easy to understand and code can be more simple. Will use it on v5.
Thank you for your help !!
Best regards
---
Kuninori Morimoto