Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40854c64 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: rsnd: fixup rsnd_dma_of_path method for mod base common method



Renesas sound needs many devices
(SSI/SSIU/SRC/CTU/MIX/DVC/CMD/AudioDMAC/AudioDMACpp).
SSI/SRC/CTU/MIX/DVC are implemented as module.
SSI parent, SSIU are implemented as part of SSI
CMD is implemented as part of CTU/MIX/DVC
AudioDMAC/AudioDMACpp are implemented as part of SSI/SRC
It is nice sense that these all devices are implemented as mod.

Current rsnd_dma_of_path is assuming that all mods are related to DMA.
But it will be wrong. This patch tidyup this wrong assumption

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 48d58281
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -533,7 +533,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
	struct rsnd_mod *mod_start, *mod_end;
	struct rsnd_mod *mod_start, *mod_end;
	struct rsnd_priv *priv = rsnd_mod_to_priv(this);
	struct rsnd_priv *priv = rsnd_mod_to_priv(this);
	struct device *dev = rsnd_priv_to_dev(priv);
	struct device *dev = rsnd_priv_to_dev(priv);
	int nr, i;
	int nr, i, idx;


	if (!ssi)
	if (!ssi)
		return;
		return;
@@ -562,23 +562,24 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
	mod_start	= (is_play) ? NULL : ssi;
	mod_start	= (is_play) ? NULL : ssi;
	mod_end		= (is_play) ? ssi  : NULL;
	mod_end		= (is_play) ? ssi  : NULL;


	mod[0] = mod_start;
	idx = 0;
	mod[idx++] = mod_start;
	for (i = 1; i < nr; i++) {
	for (i = 1; i < nr; i++) {
		if (src) {
		if (src) {
			mod[i] = src;
			mod[idx++] = src;
			src = NULL;
			src = NULL;
		} else if (ctu) {
		} else if (ctu) {
			mod[i] = ctu;
			mod[idx++] = ctu;
			ctu = NULL;
			ctu = NULL;
		} else if (mix) {
		} else if (mix) {
			mod[i] = mix;
			mod[idx++] = mix;
			mix = NULL;
			mix = NULL;
		} else if (dvc) {
		} else if (dvc) {
			mod[i] = dvc;
			mod[idx++] = dvc;
			dvc = NULL;
			dvc = NULL;
		}
		}
	}
	}
	mod[i] = mod_end;
	mod[idx] = mod_end;


	/*
	/*
	 *		| SSI | SRC |
	 *		| SSI | SRC |
@@ -587,8 +588,8 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
	 * !is_play	|  *  |  o  |
	 * !is_play	|  *  |  o  |
	 */
	 */
	if ((this == ssi) == (is_play)) {
	if ((this == ssi) == (is_play)) {
		*mod_from	= mod[nr - 1];
		*mod_from	= mod[idx - 1];
		*mod_to		= mod[nr];
		*mod_to		= mod[idx];
	} else {
	} else {
		*mod_from	= mod[0];
		*mod_from	= mod[0];
		*mod_to		= mod[1];
		*mod_to		= mod[1];
@@ -596,7 +597,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,


	dev_dbg(dev, "module connection (this is %s[%d])\n",
	dev_dbg(dev, "module connection (this is %s[%d])\n",
		rsnd_mod_name(this), rsnd_mod_id(this));
		rsnd_mod_name(this), rsnd_mod_id(this));
	for (i = 0; i <= nr; i++) {
	for (i = 0; i <= idx; i++) {
		dev_dbg(dev, "  %s[%d]%s\n",
		dev_dbg(dev, "  %s[%d]%s\n",
		       rsnd_mod_name(mod[i]), rsnd_mod_id(mod[i]),
		       rsnd_mod_name(mod[i]), rsnd_mod_id(mod[i]),
		       (mod[i] == *mod_from) ? " from" :
		       (mod[i] == *mod_from) ? " from" :