Commit 78f13d0c authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: add struct rsnd_dai_platform_info

R-Car sound DAI consists from SSI/SCU/SSIU/SRU...
Current R-Car sound DAI is decided from these settings,
but it is intuitively unclear, and is not good design for DT support.
This patch adds new rsnd_dai_platform_info to solve this issue.

But now, many platform is using this driver without
rsnd_dai_platform_info.
So, this patch still supports DAI settings via SSI to keep compatible.
It will be removed in next Linux version.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent c82e1c88
...@@ -36,13 +36,15 @@ ...@@ -36,13 +36,15 @@
#define RSND_SSI_CLK_PIN_SHARE (1 << 31) #define RSND_SSI_CLK_PIN_SHARE (1 << 31)
#define RSND_SSI_PLAY (1 << 24) #define RSND_SSI_PLAY (1 << 24)
#define RSND_SSI(_dma_id, _pio_irq, _flags) \
{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \ #define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \
{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } { .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
#define RSND_SSI_UNUSED \ #define RSND_SSI_UNUSED \
{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 } { .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
struct rsnd_ssi_platform_info { struct rsnd_ssi_platform_info {
int dai_id; int dai_id; /* will be removed */
int dma_id; int dma_id;
int pio_irq; int pio_irq;
u32 flags; u32 flags;
...@@ -53,6 +55,8 @@ struct rsnd_ssi_platform_info { ...@@ -53,6 +55,8 @@ struct rsnd_ssi_platform_info {
*/ */
#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */ #define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
#define RSND_SCU(rate, _dma_id) \
{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
#define RSND_SCU_SET(rate, _dma_id) \ #define RSND_SCU_SET(rate, _dma_id) \
{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
#define RSND_SCU_UNUSED \ #define RSND_SCU_UNUSED \
...@@ -64,6 +68,15 @@ struct rsnd_scu_platform_info { ...@@ -64,6 +68,15 @@ struct rsnd_scu_platform_info {
int dma_id; /* for Gen2 SCU */ int dma_id; /* for Gen2 SCU */
}; };
struct rsnd_dai_path_info {
struct rsnd_ssi_platform_info *ssi;
};
struct rsnd_dai_platform_info {
struct rsnd_dai_path_info playback;
struct rsnd_dai_path_info capture;
};
/* /*
* flags * flags
* *
...@@ -81,6 +94,8 @@ struct rcar_snd_info { ...@@ -81,6 +94,8 @@ struct rcar_snd_info {
int ssi_info_nr; int ssi_info_nr;
struct rsnd_scu_platform_info *scu_info; struct rsnd_scu_platform_info *scu_info;
int scu_info_nr; int scu_info_nr;
struct rsnd_dai_platform_info *dai_info;
int dai_info_nr;
int (*start)(int id); int (*start)(int id);
int (*stop)(int id); int (*stop)(int id);
}; };
......
...@@ -639,19 +639,26 @@ static int rsnd_dai_probe(struct platform_device *pdev, ...@@ -639,19 +639,26 @@ static int rsnd_dai_probe(struct platform_device *pdev,
struct rsnd_priv *priv) struct rsnd_priv *priv)
{ {
struct snd_soc_dai_driver *drv; struct snd_soc_dai_driver *drv;
struct rcar_snd_info *info = rsnd_priv_to_info(priv);
struct rsnd_dai *rdai; struct rsnd_dai *rdai;
struct rsnd_mod *pmod, *cmod; struct rsnd_mod *pmod, *cmod;
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
int dai_nr; int dai_nr = info->dai_info_nr;
int i; int i;
/* get max dai nr */ /*
for (dai_nr = 0; dai_nr < 32; dai_nr++) { * dai_nr should be set via dai_info_nr,
pmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 1); * but allow it to keeping compatible
cmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 0); */
if (!dai_nr) {
/* get max dai nr */
for (dai_nr = 0; dai_nr < 32; dai_nr++) {
pmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 1);
cmod = rsnd_ssi_mod_get_frm_dai(priv, dai_nr, 0);
if (!pmod && !cmod) if (!pmod && !cmod)
break; break;
}
} }
if (!dai_nr) { if (!dai_nr) {
...@@ -671,6 +678,8 @@ static int rsnd_dai_probe(struct platform_device *pdev, ...@@ -671,6 +678,8 @@ static int rsnd_dai_probe(struct platform_device *pdev,
priv->rdai = rdai; priv->rdai = rdai;
for (i = 0; i < dai_nr; i++) { for (i = 0; i < dai_nr; i++) {
if (info->dai_info)
rdai[i].info = &info->dai_info[i];
pmod = rsnd_ssi_mod_get_frm_dai(priv, i, 1); pmod = rsnd_ssi_mod_get_frm_dai(priv, i, 1);
cmod = rsnd_ssi_mod_get_frm_dai(priv, i, 0); cmod = rsnd_ssi_mod_get_frm_dai(priv, i, 0);
......
...@@ -451,12 +451,26 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = { ...@@ -451,12 +451,26 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = {
struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv, struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv,
int dai_id, int is_play) int dai_id, int is_play)
{ {
struct rsnd_dai_platform_info *dai_info = NULL;
struct rsnd_dai_path_info *path_info = NULL;
struct rsnd_ssi_platform_info *target_info = NULL;
struct rsnd_ssi *ssi; struct rsnd_ssi *ssi;
int i, has_play; int i, has_play;
if (priv->rdai)
dai_info = priv->rdai[dai_id].info;
if (dai_info)
path_info = (is_play) ? &dai_info->playback : &dai_info->capture;
if (path_info)
target_info = path_info->ssi;
is_play = !!is_play; is_play = !!is_play;
for_each_rsnd_ssi(ssi, priv, i) { for_each_rsnd_ssi(ssi, priv, i) {
if (target_info == ssi->info)
return &ssi->mod;
/* for compatible */
if (rsnd_ssi_dai_id(ssi) != dai_id) if (rsnd_ssi_dai_id(ssi) != dai_id)
continue; continue;
......
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