(!(priv->info->func) ? 0 : \
priv->info->func(param))
+#define rsnd_is_enable_path(io, name) \
+ ((io)->info ? (io)->info->name : NULL)
+#define rsnd_info_id(priv, io, name) \
+ ((io)->info->name - priv->info->name##_info)
+
/*
* rsnd_mod functions
*/
struct rsnd_dai_stream *io)
{
struct rsnd_mod *mod;
+ struct rsnd_dai_platform_info *dai_info = rdai->info;
int ret;
- int id;
+ int ssi_id = -1;
+ int scu_id = -1;
/*
* Gen1 is created by SRU/SSI, and this SRU is base module of
*
* Gen2 SCU path is very flexible, but, Gen1 SRU (SCU parts) is
* using fixed path.
- *
- * Then, SSI id = SCU id here
*/
- /* get SSI's ID */
- mod = rsnd_ssi_mod_get_frm_dai(priv,
- rsnd_dai_id(priv, rdai),
- rsnd_dai_is_play(rdai, io));
- if (!mod)
- return 0;
- id = rsnd_mod_id(mod);
+ if (dai_info) {
+ if (rsnd_is_enable_path(io, ssi))
+ ssi_id = rsnd_info_id(priv, io, ssi);
+ if (rsnd_is_enable_path(io, scu))
+ scu_id = rsnd_info_id(priv, io, scu);
+ } else {
+ /* get SSI's ID */
+ mod = rsnd_ssi_mod_get_frm_dai(priv,
+ rsnd_dai_id(priv, rdai),
+ rsnd_dai_is_play(rdai, io));
+ if (!mod)
+ return 0;
+ ssi_id = scu_id = rsnd_mod_id(mod);
+ }
+
ret = 0;
/* SCU */
- mod = rsnd_scu_mod_get(priv, id);
- if (mod) {
+ if (scu_id >= 0) {
+ mod = rsnd_scu_mod_get(priv, scu_id);
ret = rsnd_dai_connect(mod, io);
if (ret < 0)
return ret;
}
/* SSI */
- mod = rsnd_ssi_mod_get(priv, id);
- if (mod) {
+ if (ssi_id >= 0) {
+ mod = rsnd_ssi_mod_get(priv, ssi_id);
ret = rsnd_dai_connect(mod, io);
if (ret < 0)
return ret;
drv[i].playback.formats = RSND_FMTS;
drv[i].playback.channels_min = 2;
drv[i].playback.channels_max = 2;
+
+ if (info->dai_info)
+ rdai[i].playback.info = &info->dai_info[i].playback;
rsnd_path_init(priv, &rdai[i], &rdai[i].playback);
}
if (cmod) {
drv[i].capture.formats = RSND_FMTS;
drv[i].capture.channels_min = 2;
drv[i].capture.channels_max = 2;
+
+ if (info->dai_info)
+ rdai[i].capture.info = &info->dai_info[i].capture;
rsnd_path_init(priv, &rdai[i], &rdai[i].capture);
}
struct rsnd_dai_stream {
struct snd_pcm_substream *substream;
struct rsnd_mod *mod[RSND_MOD_MAX];
+ struct rsnd_dai_path_info *info; /* rcar_snd.h */
int byte_pos;
int period_pos;
int byte_per_period;
#define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags)
#define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags)
+#define rsnd_info_is_playback(priv, type) \
+({ \
+ struct rcar_snd_info *info = rsnd_priv_to_info(priv); \
+ int i, is_play = 0; \
+ for (i = 0; i < info->dai_info_nr; i++) { \
+ if (info->dai_info[i].playback.type == (type)->info) { \
+ is_play = 1; \
+ break; \
+ } \
+ } \
+ is_play; \
+})
+
/*
* R-Car SCU
*/
* init SCU
*/
nr = info->scu_info_nr;
+ if (!nr)
+ return 0;
+
scu = devm_kzalloc(dev, sizeof(*scu) * nr, GFP_KERNEL);
if (!scu) {
dev_err(dev, "SCU allocate failed\n");
if (rsnd_is_gen1(priv))
ops = &rsnd_scu_gen1_ops;
if (rsnd_is_gen2(priv)) {
- struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, i);
- int ret = rsnd_dma_init(priv,
- rsnd_mod_to_dma(&scu->mod),
- rsnd_ssi_is_play(ssi),
- scu->info->dma_id);
+ int ret;
+ int is_play;
+
+ if (info->dai_info) {
+ is_play = rsnd_info_is_playback(priv, scu);
+ } else {
+ struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, i);
+ is_play = rsnd_ssi_is_play(ssi);
+ }
+ ret = rsnd_dma_init(priv,
+ rsnd_mod_to_dma(&scu->mod),
+ is_play,
+ scu->info->dma_id);
if (ret < 0)
return ret;