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

ASoC: rsnd: don't use rsnd_mod_to_io() on snd_kcontrol

Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. In such case, mod <-> io is no longer 1:1
relationship. This patch removes rsnd_mod_to_io() from snd_kcontrol
and related function.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarKeita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 88c61cff
......@@ -880,16 +880,18 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
}
if (change)
cfg->update(mod);
cfg->update(cfg->io, mod);
return change;
}
static int __rsnd_kctrl_new(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
struct rsnd_kctrl_cfg *cfg,
void (*update)(struct rsnd_mod *mod))
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod))
{
struct snd_soc_card *soc_card = rtd->card;
struct snd_card *card = rtd->card->snd_card;
......@@ -918,6 +920,7 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
cfg->update = update;
cfg->card = card;
cfg->kctrl = kctrl;
cfg->io = io;
return 0;
}
......@@ -928,36 +931,42 @@ void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg)
}
int rsnd_kctrl_new_m(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_m *_cfg,
u32 max)
{
_cfg->cfg.max = max;
_cfg->cfg.size = RSND_DVC_CHANNELS;
_cfg->cfg.val = _cfg->val;
return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
}
int rsnd_kctrl_new_s(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_s *_cfg,
u32 max)
{
_cfg->cfg.max = max;
_cfg->cfg.size = 1;
_cfg->cfg.val = &_cfg->val;
return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
}
int rsnd_kctrl_new_e(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
struct rsnd_kctrl_cfg_s *_cfg,
void (*update)(struct rsnd_mod *mod),
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod),
const char * const *texts,
u32 max)
{
......@@ -965,7 +974,7 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
_cfg->cfg.size = 1;
_cfg->cfg.val = &_cfg->val;
_cfg->cfg.texts = texts;
return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
}
/*
......
......@@ -63,7 +63,8 @@ static const char * const dvc_ramp_rate[] = {
"0.125 dB/8192 steps", /* 10111 */
};
static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
u32 val[RSND_DVC_CHANNELS];
......@@ -172,7 +173,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
/* ch0/ch1 Volume */
rsnd_dvc_volume_update(dvc_mod);
rsnd_dvc_volume_update(io, dvc_mod);
rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
......@@ -217,7 +218,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
int ret;
/* Volume */
ret = rsnd_kctrl_new_m(mod, rtd,
ret = rsnd_kctrl_new_m(mod, io, rtd,
is_play ?
"DVC Out Playback Volume" : "DVC In Capture Volume",
rsnd_dvc_volume_update,
......@@ -226,7 +227,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret;
/* Mute */
ret = rsnd_kctrl_new_m(mod, rtd,
ret = rsnd_kctrl_new_m(mod, io, rtd,
is_play ?
"DVC Out Mute Switch" : "DVC In Mute Switch",
rsnd_dvc_volume_update,
......@@ -235,7 +236,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret;
/* Ramp */
ret = rsnd_kctrl_new_s(mod, rtd,
ret = rsnd_kctrl_new_s(mod, io, rtd,
is_play ?
"DVC Out Ramp Switch" : "DVC In Ramp Switch",
rsnd_dvc_volume_update,
......@@ -243,7 +244,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
if (ret < 0)
return ret;
ret = rsnd_kctrl_new_e(mod, rtd,
ret = rsnd_kctrl_new_e(mod, io, rtd,
is_play ?
"DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate",
&dvc->rup,
......@@ -252,7 +253,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
if (ret < 0)
return ret;
ret = rsnd_kctrl_new_e(mod, rtd,
ret = rsnd_kctrl_new_e(mod, io, rtd,
is_play ?
"DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate",
&dvc->rdown,
......
......@@ -487,7 +487,8 @@ struct rsnd_kctrl_cfg {
unsigned int size;
u32 *val;
const char * const *texts;
void (*update)(struct rsnd_mod *mod);
void (*update)(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
struct rsnd_dai_stream *io;
struct snd_card *card;
struct snd_kcontrol *kctrl;
};
......@@ -507,22 +508,28 @@ void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg);
#define rsnd_kctrl_remove(_cfg) _rsnd_kctrl_remove(&((_cfg).cfg))
int rsnd_kctrl_new_m(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_m *_cfg,
u32 max);
int rsnd_kctrl_new_s(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_s *_cfg,
u32 max);
int rsnd_kctrl_new_e(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
struct rsnd_kctrl_cfg_s *_cfg,
void (*update)(struct rsnd_mod *mod),
void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod),
const char * const *texts,
u32 max);
......
......@@ -876,9 +876,9 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
return ret;
}
static void rsnd_src_reconvert_update(struct rsnd_mod *mod)
static void rsnd_src_reconvert_update(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
struct rsnd_src *src = rsnd_mod_to_src(mod);
u32 convert_rate = rsnd_src_convert_rate(io, src);
......@@ -931,7 +931,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
/*
* enable sync convert
*/
ret = rsnd_kctrl_new_s(mod, rtd,
ret = rsnd_kctrl_new_s(mod, io, rtd,
rsnd_io_is_play(io) ?
"SRC Out Rate Switch" :
"SRC In Rate Switch",
......@@ -940,7 +940,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
if (ret < 0)
return ret;
ret = rsnd_kctrl_new_s(mod, rtd,
ret = rsnd_kctrl_new_s(mod, io, rtd,
rsnd_io_is_play(io) ?
"SRC Out Rate" :
"SRC In Rate",
......
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