Commit af8a4788 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: add rsnd_scu_transfer_start()

Renesas sound has SRC (= Sampling Rate Converter),
but, the HW implementation depends on its generation.
It was part of SRU on Gen1, and SCU on Gen2.
This SCU needs DMA transfer to use it.
Current rsnd driver is using it as DMA transfer buffer
(= no rate convert), and Gen1 is only supported at this point.

This patch cleanup it with focusing about SRC and Gen2 part.

SRC_CTRL/BUSIF_MODE are used for transfer start.
This patch adds rsnd_scu_transfer_start() and merge these
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 2582718c
...@@ -106,22 +106,6 @@ static int rsnd_src_set_route_if_gen1(struct rsnd_priv *priv, ...@@ -106,22 +106,6 @@ static int rsnd_src_set_route_if_gen1(struct rsnd_priv *priv,
return 0; return 0;
} }
static int rsnd_scu_set_mode(struct rsnd_priv *priv,
struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
int id = rsnd_mod_id(mod);
u32 val;
if (rsnd_is_gen1(priv)) {
val = (1 << id);
rsnd_mod_bset(mod, SRC_ROUTE_CTRL, val, val);
}
return 0;
}
static int rsnd_scu_set_hpbif(struct rsnd_priv *priv, static int rsnd_scu_set_hpbif(struct rsnd_priv *priv,
struct rsnd_mod *mod, struct rsnd_mod *mod,
struct rsnd_dai *rdai, struct rsnd_dai *rdai,
...@@ -141,12 +125,29 @@ static int rsnd_scu_set_hpbif(struct rsnd_priv *priv, ...@@ -141,12 +125,29 @@ static int rsnd_scu_set_hpbif(struct rsnd_priv *priv,
return -EIO; return -EIO;
} }
rsnd_mod_write(mod, BUSIF_MODE, 1);
rsnd_mod_write(mod, SRC_ADINR, adinr); rsnd_mod_write(mod, SRC_ADINR, adinr);
return 0; return 0;
} }
static int rsnd_scu_transfer_start(struct rsnd_priv *priv,
struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
int id = rsnd_mod_id(mod);
u32 val;
if (rsnd_is_gen1(priv)) {
val = (1 << id);
rsnd_mod_bset(mod, SRC_ROUTE_CTRL, val, val);
}
rsnd_mod_write(mod, BUSIF_MODE, 1);
return 0;
}
bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod) bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod)
{ {
struct rsnd_scu *scu = rsnd_mod_to_scu(mod); struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
...@@ -180,11 +181,11 @@ static int rsnd_scu_start(struct rsnd_mod *mod, ...@@ -180,11 +181,11 @@ static int rsnd_scu_start(struct rsnd_mod *mod,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = rsnd_scu_set_mode(priv, mod, rdai, io); ret = rsnd_scu_set_hpbif(priv, mod, rdai, io);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = rsnd_scu_set_hpbif(priv, mod, rdai, io); ret = rsnd_scu_transfer_start(priv, mod, rdai, io);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment