mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-03 19:24:02 +08:00
ASoC: rsnd: attach Audio-DMAC-periperi correctly
SSI/SRC will try to attach DMAC as Audio-DMAC or Audio-DMAC-periperi. It is fixed IP, but will be attached to each streams as different module in case of MUX (= multi sound path will be merged). This patch solves this issue. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5ba17b42e1
commit
355cb84fbe
@ -622,15 +622,13 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
|
int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod,
|
||||||
struct rsnd_mod *mod, int id)
|
struct rsnd_mod **dma_mod, int id)
|
||||||
{
|
{
|
||||||
struct rsnd_mod *dma_mod;
|
|
||||||
struct rsnd_mod *mod_from = NULL;
|
struct rsnd_mod *mod_from = NULL;
|
||||||
struct rsnd_mod *mod_to = NULL;
|
struct rsnd_mod *mod_to = NULL;
|
||||||
struct rsnd_priv *priv = rsnd_io_to_priv(io);
|
struct rsnd_priv *priv = rsnd_io_to_priv(io);
|
||||||
struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
|
struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
|
||||||
struct rsnd_dma *dma;
|
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
struct rsnd_mod_ops *ops;
|
struct rsnd_mod_ops *ops;
|
||||||
enum rsnd_mod_type type;
|
enum rsnd_mod_type type;
|
||||||
@ -646,17 +644,10 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
|
|||||||
* rsnd_rdai_continuance_probe()
|
* rsnd_rdai_continuance_probe()
|
||||||
*/
|
*/
|
||||||
if (!dmac)
|
if (!dmac)
|
||||||
return ERR_PTR(-EAGAIN);
|
return -EAGAIN;
|
||||||
|
|
||||||
dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL);
|
|
||||||
if (!dma)
|
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
|
|
||||||
rsnd_dma_of_path(mod, io, is_play, &mod_from, &mod_to);
|
rsnd_dma_of_path(mod, io, is_play, &mod_from, &mod_to);
|
||||||
|
|
||||||
dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
|
|
||||||
dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0);
|
|
||||||
|
|
||||||
/* for Gen2 */
|
/* for Gen2 */
|
||||||
if (mod_from && mod_to) {
|
if (mod_from && mod_to) {
|
||||||
ops = &rsnd_dmapp_ops;
|
ops = &rsnd_dmapp_ops;
|
||||||
@ -678,27 +669,38 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
|
|||||||
type = RSND_MOD_AUDMA;
|
type = RSND_MOD_AUDMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
dma_mod = rsnd_mod_get(dma);
|
if (!(*dma_mod)) {
|
||||||
|
struct rsnd_dma *dma;
|
||||||
|
|
||||||
ret = rsnd_mod_init(priv, dma_mod,
|
dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL);
|
||||||
ops, NULL, rsnd_mod_get_status, type, dma_id);
|
if (!dma)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
*dma_mod = rsnd_mod_get(dma);
|
||||||
|
|
||||||
|
dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
|
||||||
|
dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0);
|
||||||
|
|
||||||
|
ret = rsnd_mod_init(priv, *dma_mod, ops, NULL,
|
||||||
|
rsnd_mod_get_status, type, dma_id);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n",
|
||||||
|
rsnd_mod_name(*dma_mod), rsnd_mod_id(*dma_mod),
|
||||||
|
rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
|
||||||
|
rsnd_mod_name(mod_to), rsnd_mod_id(mod_to));
|
||||||
|
|
||||||
|
ret = attach(io, dma, id, mod_from, mod_to);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = rsnd_dai_connect(*dma_mod, io, type);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ERR_PTR(ret);
|
return ret;
|
||||||
|
|
||||||
dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n",
|
return 0;
|
||||||
rsnd_mod_name(dma_mod), rsnd_mod_id(dma_mod),
|
|
||||||
rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
|
|
||||||
rsnd_mod_name(mod_to), rsnd_mod_id(mod_to));
|
|
||||||
|
|
||||||
ret = attach(io, dma, id, mod_from, mod_to);
|
|
||||||
if (ret < 0)
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
|
|
||||||
ret = rsnd_dai_connect(dma_mod, io, type);
|
|
||||||
if (ret < 0)
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
|
|
||||||
return rsnd_mod_get(dma);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rsnd_dma_probe(struct rsnd_priv *priv)
|
int rsnd_dma_probe(struct rsnd_priv *priv)
|
||||||
|
@ -166,8 +166,8 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
|
|||||||
/*
|
/*
|
||||||
* R-Car DMA
|
* R-Car DMA
|
||||||
*/
|
*/
|
||||||
struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
|
int rsnd_dma_attach(struct rsnd_dai_stream *io,
|
||||||
struct rsnd_mod *mod, int id);
|
struct rsnd_mod *mod, struct rsnd_mod **dma_mod, int id);
|
||||||
int rsnd_dma_probe(struct rsnd_priv *priv);
|
int rsnd_dma_probe(struct rsnd_priv *priv);
|
||||||
struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
|
struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
|
||||||
struct rsnd_mod *mod, char *name);
|
struct rsnd_mod *mod, char *name);
|
||||||
|
@ -495,9 +495,7 @@ static int rsnd_src_probe_(struct rsnd_mod *mod,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
src->dma = rsnd_dma_attach(io, mod, 0);
|
ret = rsnd_dma_attach(io, mod, &src->dma, 0);
|
||||||
if (IS_ERR(src->dma))
|
|
||||||
return PTR_ERR(src->dma);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -704,9 +704,8 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ssi->dma = rsnd_dma_attach(io, mod, dma_id);
|
/* SSI probe might be called many times in MUX multi path */
|
||||||
if (IS_ERR(ssi->dma))
|
ret = rsnd_dma_attach(io, mod, &ssi->dma, dma_id);
|
||||||
return PTR_ERR(ssi->dma);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user