@@ -57,8 +57,7 @@ static u32 rsnd_adg_ssi_ws_timing_gen2(struct rsnd_dai_stream *io)
return (0x6 + ws) << 8;
}
-int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_dai *rdai,
- struct rsnd_mod *mod,
+int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io)
{
int id = rsnd_mod_id(mod);
@@ -75,8 +74,7 @@ int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_dai *rdai,
return 0;
}
-static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai,
- struct rsnd_mod *mod,
+static int rsnd_adg_set_src_timsel_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
u32 timsel)
{
@@ -122,7 +120,6 @@ static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai,
}
int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct rsnd_dai_stream *io,
unsigned int src_rate,
unsigned int dst_rate)
@@ -178,7 +175,7 @@ int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod,
return -EIO;
}
- ret = rsnd_adg_set_src_timsel_gen2(rdai, mod, io, val);
+ ret = rsnd_adg_set_src_timsel_gen2(mod, io, val);
if (ret < 0) {
dev_err(dev, "timsel error\n");
return ret;
@@ -190,12 +187,11 @@ int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod,
}
int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
u32 val = rsnd_adg_ssi_ws_timing_gen2(io);
- return rsnd_adg_set_src_timsel_gen2(rdai, mod, io, val);
+ return rsnd_adg_set_src_timsel_gen2(mod, io, val);
}
int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv,
@@ -1025,7 +1025,6 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
}
static int __rsnd_kctrl_new(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
struct rsnd_kctrl_cfg *cfg,
@@ -1057,7 +1056,6 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
}
int rsnd_kctrl_new_m(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
@@ -1067,11 +1065,10 @@ int rsnd_kctrl_new_m(struct rsnd_mod *mod,
_cfg->cfg.max = max;
_cfg->cfg.size = RSND_DVC_CHANNELS;
_cfg->cfg.val = _cfg->val;
- return __rsnd_kctrl_new(mod, rdai, rtd, name, &_cfg->cfg, update);
+ return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
}
int rsnd_kctrl_new_s(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
@@ -1081,11 +1078,10 @@ int rsnd_kctrl_new_s(struct rsnd_mod *mod,
_cfg->cfg.max = max;
_cfg->cfg.size = 1;
_cfg->cfg.val = &_cfg->val;
- return __rsnd_kctrl_new(mod, rdai, rtd, name, &_cfg->cfg, update);
+ return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
}
int rsnd_kctrl_new_e(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
struct rsnd_kctrl_cfg_s *_cfg,
@@ -1097,7 +1093,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, rdai, rtd, name, &_cfg->cfg, update);
+ return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
}
/*
@@ -1138,10 +1134,9 @@ static const struct snd_soc_component_driver rsnd_soc_component = {
};
static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
- struct rsnd_dai *rdai,
- int is_play)
+ struct rsnd_dai_stream *io)
{
- struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture;
+ struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
int ret;
ret = rsnd_dai_call(probe, io, rdai);
@@ -1241,11 +1236,11 @@ static int rsnd_probe(struct platform_device *pdev)
}
for_each_rsnd_dai(rdai, priv, i) {
- ret = rsnd_rdai_continuance_probe(priv, rdai, 1);
+ ret = rsnd_rdai_continuance_probe(priv, &rdai->playback);
if (ret)
goto exit_snd_probe;
- ret = rsnd_rdai_continuance_probe(priv, rdai, 0);
+ ret = rsnd_rdai_continuance_probe(priv, &rdai->capture);
if (ret)
goto exit_snd_probe;
}
@@ -171,7 +171,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
- rsnd_adg_set_cmd_timsel_gen2(rdai, dvc_mod, io);
+ rsnd_adg_set_cmd_timsel_gen2(dvc_mod, io);
return 0;
}
@@ -210,7 +210,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
int ret;
/* Volume */
- ret = rsnd_kctrl_new_m(mod, rdai, rtd,
+ ret = rsnd_kctrl_new_m(mod, rtd,
is_play ?
"DVC Out Playback Volume" : "DVC In Capture Volume",
rsnd_dvc_volume_update,
@@ -219,7 +219,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret;
/* Mute */
- ret = rsnd_kctrl_new_m(mod, rdai, rtd,
+ ret = rsnd_kctrl_new_m(mod, rtd,
is_play ?
"DVC Out Mute Switch" : "DVC In Mute Switch",
rsnd_dvc_volume_update,
@@ -228,7 +228,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret;
/* Ramp */
- ret = rsnd_kctrl_new_s(mod, rdai, rtd,
+ ret = rsnd_kctrl_new_s(mod, rtd,
is_play ?
"DVC Out Ramp Switch" : "DVC In Ramp Switch",
rsnd_dvc_volume_update,
@@ -236,7 +236,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
if (ret < 0)
return ret;
- ret = rsnd_kctrl_new_e(mod, rdai, rtd,
+ ret = rsnd_kctrl_new_e(mod, rtd,
is_play ?
"DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate",
&dvc->rup,
@@ -245,7 +245,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
if (ret < 0)
return ret;
- ret = rsnd_kctrl_new_e(mod, rdai, rtd,
+ ret = rsnd_kctrl_new_e(mod, rtd,
is_play ?
"DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate",
&dvc->rdown,
@@ -351,15 +351,12 @@ int rsnd_adg_set_convert_clk_gen1(struct rsnd_priv *priv,
unsigned int src_rate,
unsigned int dst_rate);
int rsnd_adg_set_convert_clk_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct rsnd_dai_stream *io,
unsigned int src_rate,
unsigned int dst_rate);
int rsnd_adg_set_convert_timing_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct rsnd_dai_stream *io);
-int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_dai *rdai,
- struct rsnd_mod *mod,
+int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io);
/*
@@ -453,21 +450,18 @@ struct rsnd_kctrl_cfg_s {
};
int rsnd_kctrl_new_m(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_m *_cfg,
u32 max);
int rsnd_kctrl_new_s(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
void (*update)(struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_s *_cfg,
u32 max);
int rsnd_kctrl_new_e(struct rsnd_mod *mod,
- struct rsnd_dai *rdai,
struct snd_soc_pcm_runtime *rtd,
const unsigned char *name,
struct rsnd_kctrl_cfg_s *_cfg,
@@ -486,14 +480,10 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
struct rsnd_dai_stream *io,
struct snd_pcm_runtime *runtime);
int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai,
int use_busif);
-int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai);
-int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai);
-int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai);
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod);
+int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
+int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
#define rsnd_src_nr(priv) ((priv)->src_nr)
@@ -114,10 +114,10 @@ struct rsnd_src {
* Gen1/Gen2 common functions
*/
int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai,
int use_busif)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
+ struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
int ssi_id = rsnd_mod_id(ssi_mod);
@@ -181,8 +181,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
return 0;
}
-int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai)
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod)
{
/*
* DMA settings for SSIU
@@ -192,8 +191,7 @@ int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
return 0;
}
-int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai)
+int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
@@ -209,8 +207,7 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod,
return 0;
}
-int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod,
- struct rsnd_dai *rdai)
+int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
@@ -247,8 +244,7 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
return rate;
}
-static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_set_convert_rate(struct rsnd_mod *mod)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
@@ -280,8 +276,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
return 0;
}
-static int rsnd_src_init(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_init(struct rsnd_mod *mod)
{
struct rsnd_src *src = rsnd_mod_to_src(mod);
@@ -333,8 +328,7 @@ static int rsnd_src_stop(struct rsnd_mod *mod)
/*
* Gen1 functions
*/
-static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_set_route_gen1(struct rsnd_mod *mod)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
struct src_route_config {
@@ -371,8 +365,7 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
return 0;
}
-static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
@@ -430,13 +423,12 @@ static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod,
return 0;
}
-static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod)
{
struct rsnd_src *src = rsnd_mod_to_src(mod);
int ret;
- ret = rsnd_src_set_convert_rate(mod, rdai);
+ ret = rsnd_src_set_convert_rate(mod);
if (ret < 0)
return ret;
@@ -473,19 +465,19 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
{
int ret;
- ret = rsnd_src_init(mod, rdai);
+ ret = rsnd_src_init(mod);
if (ret < 0)
return ret;
- ret = rsnd_src_set_route_gen1(mod, rdai);
+ ret = rsnd_src_set_route_gen1(mod);
if (ret < 0)
return ret;
- ret = rsnd_src_set_convert_rate_gen1(mod, rdai);
+ ret = rsnd_src_set_convert_rate_gen1(mod);
if (ret < 0)
return ret;
- ret = rsnd_src_set_convert_timing_gen1(mod, rdai);
+ ret = rsnd_src_set_convert_timing_gen1(mod);
if (ret < 0)
return ret;
@@ -628,8 +620,7 @@ static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data)
return IRQ_HANDLED;
}
-static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
@@ -653,7 +644,7 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
return -EINVAL;
}
- ret = rsnd_src_set_convert_rate(mod, rdai);
+ ret = rsnd_src_set_convert_rate(mod);
if (ret < 0)
return ret;
@@ -681,8 +672,7 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
return 0;
}
-static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod,
- struct rsnd_dai *rdai)
+static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod)
{
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
@@ -691,11 +681,11 @@ static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod,
int ret;
if (convert_rate)
- ret = rsnd_adg_set_convert_clk_gen2(mod, rdai, io,
+ ret = rsnd_adg_set_convert_clk_gen2(mod, io,
runtime->rate,
convert_rate);
else
- ret = rsnd_adg_set_convert_timing_gen2(mod, rdai, io);
+ ret = rsnd_adg_set_convert_timing_gen2(mod, io);
return ret;
}
@@ -755,15 +745,15 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod,
{
int ret;
- ret = rsnd_src_init(mod, rdai);
+ ret = rsnd_src_init(mod);
if (ret < 0)
return ret;
- ret = rsnd_src_set_convert_rate_gen2(mod, rdai);
+ ret = rsnd_src_set_convert_rate_gen2(mod);
if (ret < 0)
return ret;
- ret = rsnd_src_set_convert_timing_gen2(mod, rdai);
+ ret = rsnd_src_set_convert_timing_gen2(mod);
if (ret < 0)
return ret;
@@ -64,7 +64,6 @@ struct rsnd_ssi {
struct rsnd_ssi *parent;
struct rsnd_mod mod;
- struct rsnd_dai *rdai;
u32 cr_own;
u32 cr_clk;
int err;
@@ -178,10 +177,10 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_ssi *ssi)
}
static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
- struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
+ struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct device *dev = rsnd_priv_to_dev(priv);
u32 cr_mode;
u32 cr;
@@ -191,7 +190,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
if (rsnd_rdai_is_clk_master(rdai)) {
if (rsnd_ssi_clk_from_parent(ssi))
- rsnd_ssi_hw_start(ssi->parent, rdai, io);
+ rsnd_ssi_hw_start(ssi->parent, io);
else
rsnd_ssi_master_clk_start(ssi, io);
}
@@ -222,10 +221,11 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
rsnd_mod_name(&ssi->mod), rsnd_mod_id(&ssi->mod));
}
-static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi,
- struct rsnd_dai *rdai)
+static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
+ struct rsnd_dai_stream *io = rsnd_mod_to_io(&ssi->mod);
+ struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct device *dev = rsnd_priv_to_dev(priv);
u32 cr;
@@ -254,7 +254,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi,
if (rsnd_rdai_is_clk_master(rdai)) {
if (rsnd_ssi_clk_from_parent(ssi))
- rsnd_ssi_hw_stop(ssi->parent, rdai);
+ rsnd_ssi_hw_stop(ssi->parent);
else
rsnd_ssi_master_clk_stop(ssi);
}
@@ -313,7 +313,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
/*
* set ssi parameter
*/
- ssi->rdai = rdai;
ssi->cr_own = cr;
ssi->err = -1; /* ignore 1st error */
@@ -330,7 +329,6 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,
if (ssi->err > 0)
dev_warn(dev, "ssi under/over flow err = %d\n", ssi->err);
- ssi->rdai = NULL;
ssi->cr_own = 0;
ssi->err = 0;
@@ -354,11 +352,11 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
+ rsnd_src_ssiu_start(mod, rsnd_ssi_use_busif(mod));
- rsnd_ssi_hw_start(ssi, rdai, io);
+ rsnd_ssi_hw_start(ssi, io);
- rsnd_src_ssi_irq_enable(mod, rdai);
+ rsnd_src_ssi_irq_enable(mod);
return 0;
}
@@ -368,13 +366,13 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
{
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
- rsnd_src_ssi_irq_disable(mod, rdai);
+ rsnd_src_ssi_irq_disable(mod);
rsnd_ssi_record_error(ssi, rsnd_mod_read(mod, SSISR));
- rsnd_ssi_hw_stop(ssi, rdai);
+ rsnd_ssi_hw_stop(ssi);
- rsnd_src_ssiu_stop(mod, rdai);
+ rsnd_src_ssiu_stop(mod);
return 0;
}
@@ -382,9 +380,9 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
{
struct rsnd_ssi *ssi = data;
- struct rsnd_dai *rdai = ssi->rdai;
struct rsnd_mod *mod = &ssi->mod;
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+ struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
u32 status = rsnd_mod_read(mod, SSISR);
if (!io)