Re: [PATCH 03/10] ASoC: audio-graph: Support Codec with multiple endpoints

2020-08-03 Thread Sameer Pujar



On 7/20/2020 10:43 AM, Kuninori Morimoto wrote:

External email: Use caution opening links or attachments


Hi Sameer


diff --git a/sound/soc/generic/audio-graph-card.c 
b/sound/soc/generic/audio-graph-card.c
index 1e20562..b1903f9 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -201,8 +201,7 @@ static void graph_parse_mclk_fs(struct device_node *top,
   static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
  struct device_node *cpu_ep,
  struct device_node *codec_ep,
-   struct link_info *li,
-   int dup_codec)
+   struct link_info *li)

This patch breaks DPCM connection which is used for MIXer

Could you please elaborate a bit more as to what is broken with this?
The problem I am trying to solve here is to have multiple endpoints
for Codec port.

For example MIXer, it is like below.
If you removes "dup_codec", it breaks MIXer and/or TDM split mode.

 CPU0  ---+ DAI
  |
 CPU1  ---+

 cpu {
 ports {
 port@0 {
 cpu_0: endpoint {
 remote-endpoint = <_0>;
 };
 };
 port@1 {
 cpu_1: endpoint {
 remote-endpoint = <_1>;
 };
 };
 };
 };

 codec {
 port {
 codec_0: endpoint {
 remote-endpoint = <_0>;
 };
 codec_1: endpoint {
 remote-endpoint = <_1>;
 };
 }
 };


Thanks Kuninori for explaining above and for giving a background in an 
'off-list' thread. I will re-work on the patch by limiting the changes 
to specific flag so that it does not affect any other user.



Thank you for your help !!

Best regards
---
Kuninori Morimoto


Re: [PATCH 03/10] ASoC: audio-graph: Support Codec with multiple endpoints

2020-07-19 Thread Kuninori Morimoto


Hi Sameer

> >> diff --git a/sound/soc/generic/audio-graph-card.c 
> >> b/sound/soc/generic/audio-graph-card.c
> >> index 1e20562..b1903f9 100644
> >> --- a/sound/soc/generic/audio-graph-card.c
> >> +++ b/sound/soc/generic/audio-graph-card.c
> >> @@ -201,8 +201,7 @@ static void graph_parse_mclk_fs(struct device_node 
> >> *top,
> >>   static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
> >>  struct device_node *cpu_ep,
> >>  struct device_node *codec_ep,
> >> -   struct link_info *li,
> >> -   int dup_codec)
> >> +   struct link_info *li)
> > This patch breaks DPCM connection which is used for MIXer
> 
> Could you please elaborate a bit more as to what is broken with this?
> The problem I am trying to solve here is to have multiple endpoints
> for Codec port.

For example MIXer, it is like below.
If you removes "dup_codec", it breaks MIXer and/or TDM split mode.

CPU0  ---+ DAI
 |
CPU1  ---+

cpu {
ports {
port@0 {
cpu_0: endpoint {
remote-endpoint = <_0>;
};
};
port@1 {
cpu_1: endpoint {
remote-endpoint = <_1>;
};
};
};
};

codec {
port {
codec_0: endpoint {
remote-endpoint = <_0>;
};
codec_1: endpoint {
remote-endpoint = <_1>;
};
}
};

Thank you for your help !!

Best regards
---
Kuninori Morimoto


Re: [PATCH 03/10] ASoC: audio-graph: Support Codec with multiple endpoints

2020-07-19 Thread Sameer Pujar




On 7/20/2020 5:07 AM, Kuninori Morimoto wrote:

External email: Use caution opening links or attachments


Hi Sameer


If a Codec port has multiple endpoints, only first endpoint gets parsed
and remaining are ignored. This can be fixed by removing 'dup_codec' flag
passed to graph_dai_link_of_dpcm() and thus it loops over all endpoints
of Codec. Similarly graph_count_dpcm() is updated as well.

Signed-off-by: Sameer Pujar 
---
  sound/soc/generic/audio-graph-card.c | 28 +---
  1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/sound/soc/generic/audio-graph-card.c 
b/sound/soc/generic/audio-graph-card.c
index 1e20562..b1903f9 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -201,8 +201,7 @@ static void graph_parse_mclk_fs(struct device_node *top,
  static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 struct device_node *cpu_ep,
 struct device_node *codec_ep,
-   struct link_info *li,
-   int dup_codec)
+   struct link_info *li)

This patch breaks DPCM connection which is used for MIXer


Could you please elaborate a bit more as to what is broken with this? 
The problem I am trying to solve here is to have multiple endpoints for 
Codec port.




Thank you for your help !!

Best regards
---
Kuninori Morimoto




Re: [PATCH 03/10] ASoC: audio-graph: Support Codec with multiple endpoints

2020-07-19 Thread Kuninori Morimoto


Hi Sameer

> If a Codec port has multiple endpoints, only first endpoint gets parsed
> and remaining are ignored. This can be fixed by removing 'dup_codec' flag
> passed to graph_dai_link_of_dpcm() and thus it loops over all endpoints
> of Codec. Similarly graph_count_dpcm() is updated as well.
> 
> Signed-off-by: Sameer Pujar 
> ---
>  sound/soc/generic/audio-graph-card.c | 28 +---
>  1 file changed, 9 insertions(+), 19 deletions(-)
> 
> diff --git a/sound/soc/generic/audio-graph-card.c 
> b/sound/soc/generic/audio-graph-card.c
> index 1e20562..b1903f9 100644
> --- a/sound/soc/generic/audio-graph-card.c
> +++ b/sound/soc/generic/audio-graph-card.c
> @@ -201,8 +201,7 @@ static void graph_parse_mclk_fs(struct device_node *top,
>  static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
> struct device_node *cpu_ep,
> struct device_node *codec_ep,
> -   struct link_info *li,
> -   int dup_codec)
> +   struct link_info *li)

This patch breaks DPCM connection which is used for MIXer

Thank you for your help !!

Best regards
---
Kuninori Morimoto


[PATCH 03/10] ASoC: audio-graph: Support Codec with multiple endpoints

2020-07-18 Thread Sameer Pujar
If a Codec port has multiple endpoints, only first endpoint gets parsed
and remaining are ignored. This can be fixed by removing 'dup_codec' flag
passed to graph_dai_link_of_dpcm() and thus it loops over all endpoints
of Codec. Similarly graph_count_dpcm() is updated as well.

Signed-off-by: Sameer Pujar 
---
 sound/soc/generic/audio-graph-card.c | 28 +---
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/sound/soc/generic/audio-graph-card.c 
b/sound/soc/generic/audio-graph-card.c
index 1e20562..b1903f9 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -201,8 +201,7 @@ static void graph_parse_mclk_fs(struct device_node *top,
 static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
  struct device_node *cpu_ep,
  struct device_node *codec_ep,
- struct link_info *li,
- int dup_codec)
+ struct link_info *li)
 {
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
@@ -217,10 +216,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv 
*priv,
struct snd_soc_dai_link_component *codecs = dai_link->codecs;
int ret;
 
-   /* Do it all CPU endpoint, and 1st Codec endpoint */
-   if (!li->cpu && dup_codec)
-   return 0;
-
port= of_get_parent(ep);
ports   = of_get_parent(port);
node= of_graph_get_port_parent(ep);
@@ -415,7 +410,7 @@ static int graph_for_each_link(struct asoc_simple_priv 
*priv,
int (*func_dpcm)(struct asoc_simple_priv *priv,
 struct device_node *cpu_ep,
 struct device_node *codec_ep,
-struct link_info *li, int dup_codec))
+struct link_info *li))
 {
struct of_phandle_iterator it;
struct device *dev = simple_priv_to_dev(priv);
@@ -424,7 +419,6 @@ static int graph_for_each_link(struct asoc_simple_priv 
*priv,
struct device_node *cpu_ep;
struct device_node *codec_ep;
struct device_node *codec_port;
-   struct device_node *codec_port_old = NULL;
struct asoc_simple_data adata;
uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
int rc, ret;
@@ -457,8 +451,7 @@ static int graph_for_each_link(struct asoc_simple_priv 
*priv,
if (dpcm_selectable &&
((of_get_child_count(codec_port) > 1) ||
 adata.convert_rate || adata.convert_channels))
-   ret = func_dpcm(priv, cpu_ep, codec_ep, li,
-   (codec_port_old == codec_port));
+   ret = func_dpcm(priv, cpu_ep, codec_ep, li);
/* else normal sound */
else
ret = func_noml(priv, cpu_ep, codec_ep, li);
@@ -468,8 +461,6 @@ static int graph_for_each_link(struct asoc_simple_priv 
*priv,
 
if (ret < 0)
return ret;
-
-   codec_port_old = codec_port;
}
}
 
@@ -532,19 +523,18 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
 static int graph_count_dpcm(struct asoc_simple_priv *priv,
struct device_node *cpu_ep,
struct device_node *codec_ep,
-   struct link_info *li,
-   int dup_codec)
+   struct link_info *li)
 {
struct device *dev = simple_priv_to_dev(priv);
 
+   /* CPU */
li->link++; /* 1xCPU-dummy */
li->dais++; /* 1xCPU */
 
-   if (!dup_codec) {
-   li->link++; /* 1xdummy-Codec */
-   li->conf++; /* 1xdummy-Codec */
-   li->dais++; /* 1xCodec */
-   }
+   /* Codec */
+   li->link++; /* 1xdummy-Codec */
+   li->conf++; /* 1xdummy-Codec */
+   li->dais++; /* 1xCodec */
 
dev_dbg(dev, "Count As DPCM\n");
 
-- 
2.7.4