void rsnd_mod_init(struct rsnd_priv *priv,
struct rsnd_mod *mod,
struct rsnd_mod_ops *ops,
+ struct clk *clk,
enum rsnd_mod_type type,
int id)
{
mod->id = id;
mod->ops = ops;
mod->type = type;
+ mod->clk = clk;
}
/*
struct rsnd_dvc {
struct rsnd_dvc_platform_info *info; /* rcar_snd.h */
struct rsnd_mod mod;
- struct clk *clk;
struct rsnd_kctrl_cfg_m volume;
struct rsnd_kctrl_cfg_m mute;
struct rsnd_kctrl_cfg_s ren; /* Ramp Enable */
static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
struct rsnd_dai *rdai)
{
- struct rsnd_dvc *dvc = rsnd_mod_to_dvc(dvc_mod);
struct rsnd_dai_stream *io = rsnd_mod_to_io(dvc_mod);
struct rsnd_priv *priv = rsnd_mod_to_priv(dvc_mod);
struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
return -EINVAL;
}
- clk_prepare_enable(dvc->clk);
+ rsnd_mod_hw_start(dvc_mod);
/*
* fixme
static int rsnd_dvc_quit(struct rsnd_mod *mod,
struct rsnd_dai *rdai)
{
- struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
-
- clk_disable_unprepare(dvc->clk);
+ rsnd_mod_hw_stop(mod);
return 0;
}
return PTR_ERR(clk);
dvc->info = &info->dvc_info[i];
- dvc->clk = clk;
- rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops, RSND_MOD_DVC, i);
+ rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops,
+ clk, RSND_MOD_DVC, i);
dev_dbg(dev, "CMD%d probed\n", i);
}
struct rsnd_mod_ops *ops;
struct rsnd_dma dma;
struct rsnd_dai_stream *io;
+ struct clk *clk;
u32 status;
};
/*
#define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma)
#define rsnd_mod_to_io(mod) ((mod)->io)
#define rsnd_mod_id(mod) ((mod)->id)
+#define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk)
+#define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk)
void rsnd_mod_init(struct rsnd_priv *priv,
struct rsnd_mod *mod,
struct rsnd_mod_ops *ops,
+ struct clk *clk,
enum rsnd_mod_type type,
int id);
char *rsnd_mod_name(struct rsnd_mod *mod);
struct rsnd_src {
struct rsnd_src_platform_info *info; /* rcar_snd.h */
struct rsnd_mod mod;
- struct clk *clk;
int err;
};
{
struct rsnd_src *src = rsnd_mod_to_src(mod);
- clk_prepare_enable(src->clk);
+ rsnd_mod_hw_start(mod);
src->err = 0;
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
- clk_disable_unprepare(src->clk);
+ rsnd_mod_hw_stop(mod);
if (src->err)
dev_warn(dev, "src under/over flow err = %d\n", src->err);
return PTR_ERR(clk);
src->info = &info->src_info[i];
- src->clk = clk;
- rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i);
+ rsnd_mod_init(priv, &src->mod, ops, clk, RSND_MOD_SRC, i);
dev_dbg(dev, "SRC%d probed\n", i);
}
#define SSI_NAME "ssi"
struct rsnd_ssi {
- struct clk *clk;
struct rsnd_ssi_platform_info *info; /* rcar_snd.h */
struct rsnd_ssi *parent;
struct rsnd_mod mod;
u32 cr;
if (0 == ssi->usrcnt) {
- clk_prepare_enable(ssi->clk);
+ rsnd_mod_hw_start(&ssi->mod);
if (rsnd_dai_is_clk_master(rdai)) {
if (rsnd_ssi_clk_from_parent(ssi))
rsnd_ssi_master_clk_stop(ssi);
}
- clk_disable_unprepare(ssi->clk);
+ rsnd_mod_hw_stop(&ssi->mod);
}
dev_dbg(dev, "%s[%d] hw stopped\n",
return PTR_ERR(clk);
ssi->info = pinfo;
- ssi->clk = clk;
ops = &rsnd_ssi_non_ops;
if (pinfo->dma_id > 0)
else if (rsnd_ssi_pio_available(ssi))
ops = &rsnd_ssi_pio_ops;
- rsnd_mod_init(priv, &ssi->mod, ops, RSND_MOD_SSI, i);
+ rsnd_mod_init(priv, &ssi->mod, ops, clk, RSND_MOD_SSI, i);
rsnd_ssi_parent_clk_setup(priv, ssi);
}