From 5c065eaf445d14e70cbdb1da75e12567c7ae9b91 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 1 Nov 2022 04:21:54 +0000 Subject: ASoC: simple-card-utils: remove asoc_simple_convert_fixup() No one is using asoc_simple_convert_fixup(), we don't need to export its symbol. This patch removes it. Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/874jvj8ftp.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/simple-card-utils.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'sound/soc/generic') diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index be69bbc47f81..e35becce9635 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -41,27 +41,6 @@ static void asoc_simple_fixup_sample_fmt(struct asoc_simple_data *data, } } -void asoc_simple_convert_fixup(struct asoc_simple_data *data, - struct snd_pcm_hw_params *params) -{ - struct snd_interval *rate = hw_param_interval(params, - SNDRV_PCM_HW_PARAM_RATE); - struct snd_interval *channels = hw_param_interval(params, - SNDRV_PCM_HW_PARAM_CHANNELS); - - if (data->convert_rate) - rate->min = - rate->max = data->convert_rate; - - if (data->convert_channels) - channels->min = - channels->max = data->convert_channels; - - if (data->convert_sample_format) - asoc_simple_fixup_sample_fmt(data, params); -} -EXPORT_SYMBOL_GPL(asoc_simple_convert_fixup); - void asoc_simple_parse_convert(struct device_node *np, char *prefix, struct asoc_simple_data *data) @@ -522,8 +501,20 @@ int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, { struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); + struct asoc_simple_data *data = &dai_props->adata; + struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); + + if (data->convert_rate) + rate->min = + rate->max = data->convert_rate; - asoc_simple_convert_fixup(&dai_props->adata, params); + if (data->convert_channels) + channels->min = + channels->max = data->convert_channels; + + if (data->convert_sample_format) + asoc_simple_fixup_sample_fmt(data, params); return 0; } -- cgit v1.2.3 From 2dc025aba7fbebd6c6f3a05bc3530af31776a6fa Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 1 Nov 2022 04:22:09 +0000 Subject: ASoC: audio-graph-card2-custom-sample.dtsi: add convert-rate for DPCM (MIXer) audio-graph-card2-custom-sample.dtsi is assuming that DPCM sample is MIXer connection. FE BE **** CPU3 -- * * -- Codec3 CPU4 -- * * **** CPU3/CPU4 need to convert rate in this case. This patch adds missing "convert-rate" setting sample for it. Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/8735b38fta.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/audio-graph-card2-custom-sample.dtsi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sound/soc/generic') diff --git a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi index fe547c18771f..994db61a26b3 100644 --- a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi +++ b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi @@ -49,10 +49,13 @@ * +-+ +-+ * * [DPCM] + * + * CPU3/CPU4 are converting rate to 44100 + * * FE BE * **** * cpu3 <-@--* *--@-> codec3 - * cpu4 <-@--* * + * cpu4 <-@--* * (44.1kHz) * **** * * [DPCM-Multi] @@ -286,7 +289,10 @@ port@2 { codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; }; /* [DPCM]::BE */ - port@3 { codec3_ep: endpoint { remote-endpoint = <&be00_ep>; }; }; + port@3 { + convert-rate = <44100>; + codec3_ep: endpoint { remote-endpoint = <&be00_ep>; }; + }; /* [DPCM-Multi]::BE */ port@4 { codec4_ep: endpoint { remote-endpoint = <&mbe1_ep>; }; }; -- cgit v1.2.3 From 8f5979833b45b318d0971f384de3fb17924042f0 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 1 Nov 2022 04:22:27 +0000 Subject: ASoC: audio-graph-card2: check also dpcm node for convert-xxx DPCM connection on Card2, its DT looks like below. Current Card2 is checking (a)/(b) part only for convert-xxx settings. But it is not useful. This patch enables its settings at (A)/(B) part too. (A)/(B) settings will be overwritten (a)/(b) settings if it has. (A) (a) Card2 <--+--> FE <---> CPU | +--> BE <---> Codec (B) (b)
card2-sound { ... links = ; /* (A) (B) */ }; dpcm { /* FE */ ports@0 { /* (A) */ fe: port { fe_ep: endpoint { remote-endpoint = <&cpu_ep>; } }; }; /* BE */ ports@1 { /* (B) */ be: port { convert-rate = <44100>; /* This patch enables this */ be_ep: endpoint { remote-endpoint = <&codec_ep>; } }; }; }; cpu { /* CPU (a) */ port { cpu_ep: endpoint { remote-endpoint = <&fe_ep>; } }; }; codec { /* Codec (b) */ port { convert-rate = <48000>; /* (B) settings will be over written here */ codec_ep: endpoint { remote-endpoint = <&be_ep>; } }; }; Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/871qqn8fst.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/audio-graph-card2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound/soc/generic') diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 8ac6df645ee6..e34c3433d354 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -849,7 +849,8 @@ int audio_graph2_link_dpcm(struct asoc_simple_priv *priv, goto err; } - graph_parse_convert(rep, dai_props); + graph_parse_convert(ep, dai_props); /* at node of */ + graph_parse_convert(rep, dai_props); /* at node of */ snd_soc_dai_link_set_capabilities(dai_link); -- cgit v1.2.3 From 1985fa962a6dd8fc002cbf7b2c894ebcc44b2eb2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 11 Nov 2022 04:34:51 +0000 Subject: ASoC: audio-graph-card2: remove Experimental announce Audio Graph Card2 has been announcing "Audio Graph Card2 is still under Experimental stage", but it is time to remove it. This patch removes it. Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87k042nm6s.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/audio-graph-card2.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'sound/soc/generic') diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index e34c3433d354..06609a526b78 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -1272,9 +1272,6 @@ err: if (ret < 0) dev_err_probe(dev, ret, "parse error\n"); - if (ret == 0) - dev_warn(dev, "Audio Graph Card2 is still under Experimental stage\n"); - return ret; } EXPORT_SYMBOL_GPL(audio_graph2_parse_of); -- cgit v1.2.3 From 8ab2d12c726f0fde0692fa5d81d8019b3dcd62d0 Mon Sep 17 00:00:00 2001 From: Wang Yufen Date: Mon, 5 Dec 2022 16:15:27 +0800 Subject: ASoC: audio-graph-card: fix refcount leak of cpu_ep in __graph_for_each_link() The of_get_next_child() returns a node with refcount incremented, and decrements the refcount of prev. So in the error path of the while loop, of_node_put() needs be called for cpu_ep. Fixes: fce9b90c1ab7 ("ASoC: audio-graph-card: cleanup DAI link loop method - step2") Signed-off-by: Wang Yufen Acked-by: Kuninori Morimoto Link: https://lore.kernel.org/r/1670228127-13835-1-git-send-email-wangyufen@huawei.com Signed-off-by: Mark Brown --- sound/soc/generic/audio-graph-card.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound/soc/generic') diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index fe7cf972d44c..5daa824a4ffc 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -485,8 +485,10 @@ static int __graph_for_each_link(struct asoc_simple_priv *priv, of_node_put(codec_ep); of_node_put(codec_port); - if (ret < 0) + if (ret < 0) { + of_node_put(cpu_ep); return ret; + } codec_port_old = codec_port; } -- cgit v1.2.3