ASoC: rsnd: handle DPCM converted rate/chan under core
converted rate/chan are handled each rated module, but it will be used other module too. For examle, converted channel is currently used for CTU, but, it will be used for TDM Split mode, too. This patch move/merge SRC/CTU hw_param under core.c and handles converted rate/chan under rsnd_dai_stream. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:

committed by
Mark Brown

szülő
beed78aeeb
commit
c2aaaa57d4
@@ -107,13 +107,6 @@ static void rsnd_ctu_halt(struct rsnd_mod *mod)
|
||||
rsnd_mod_write(mod, CTU_SWRSR, 0);
|
||||
}
|
||||
|
||||
int rsnd_ctu_converted_channel(struct rsnd_mod *mod)
|
||||
{
|
||||
struct rsnd_ctu *ctu = rsnd_mod_to_ctu(mod);
|
||||
|
||||
return ctu->channels;
|
||||
}
|
||||
|
||||
static int rsnd_ctu_probe_(struct rsnd_mod *mod,
|
||||
struct rsnd_dai_stream *io,
|
||||
struct rsnd_priv *priv)
|
||||
@@ -233,43 +226,6 @@ static int rsnd_ctu_quit(struct rsnd_mod *mod,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rsnd_ctu_hw_params(struct rsnd_mod *mod,
|
||||
struct rsnd_dai_stream *io,
|
||||
struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *fe_params)
|
||||
{
|
||||
struct rsnd_ctu *ctu = rsnd_mod_to_ctu(mod);
|
||||
struct snd_soc_pcm_runtime *fe = substream->private_data;
|
||||
|
||||
/*
|
||||
* CTU assumes that it is used under DPCM if user want to use
|
||||
* channel transfer. Then, CTU should be FE.
|
||||
* And then, this function will be called *after* BE settings.
|
||||
* this means, each BE already has fixuped hw_params.
|
||||
* see
|
||||
* dpcm_fe_dai_hw_params()
|
||||
* dpcm_be_dai_hw_params()
|
||||
*/
|
||||
ctu->channels = 0;
|
||||
if (fe->dai_link->dynamic) {
|
||||
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||
struct device *dev = rsnd_priv_to_dev(priv);
|
||||
struct snd_soc_dpcm *dpcm;
|
||||
struct snd_pcm_hw_params *be_params;
|
||||
int stream = substream->stream;
|
||||
|
||||
for_each_dpcm_be(fe, stream, dpcm) {
|
||||
be_params = &dpcm->hw_params;
|
||||
if (params_channels(fe_params) != params_channels(be_params))
|
||||
ctu->channels = params_channels(be_params);
|
||||
}
|
||||
|
||||
dev_dbg(dev, "CTU convert channels %d\n", ctu->channels);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rsnd_ctu_pcm_new(struct rsnd_mod *mod,
|
||||
struct rsnd_dai_stream *io,
|
||||
struct snd_soc_pcm_runtime *rtd)
|
||||
@@ -357,7 +313,6 @@ static struct rsnd_mod_ops rsnd_ctu_ops = {
|
||||
.probe = rsnd_ctu_probe_,
|
||||
.init = rsnd_ctu_init,
|
||||
.quit = rsnd_ctu_quit,
|
||||
.hw_params = rsnd_ctu_hw_params,
|
||||
.pcm_new = rsnd_ctu_pcm_new,
|
||||
.get_status = rsnd_mod_get_status,
|
||||
.id = rsnd_ctu_id,
|
||||
|
Reference in New Issue
Block a user