mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 09:36:52 +07:00
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
c82e1c8874
commit
78f13d0c5a
@ -36,13 +36,15 @@
|
||||
#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
|
||||
#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) \
|
||||
{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
|
||||
#define RSND_SSI_UNUSED \
|
||||
{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
|
||||
|
||||
struct rsnd_ssi_platform_info {
|
||||
int dai_id;
|
||||
int dai_id; /* will be removed */
|
||||
int dma_id;
|
||||
int pio_irq;
|
||||
u32 flags;
|
||||
@ -53,6 +55,8 @@ struct rsnd_ssi_platform_info {
|
||||
*/
|
||||
#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) \
|
||||
{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
|
||||
#define RSND_SCU_UNUSED \
|
||||
@ -64,6 +68,15 @@ struct rsnd_scu_platform_info {
|
||||
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
|
||||
*
|
||||
@ -81,6 +94,8 @@ struct rcar_snd_info {
|
||||
int ssi_info_nr;
|
||||
struct rsnd_scu_platform_info *scu_info;
|
||||
int scu_info_nr;
|
||||
struct rsnd_dai_platform_info *dai_info;
|
||||
int dai_info_nr;
|
||||
int (*start)(int id);
|
||||
int (*stop)(int id);
|
||||
};
|
||||
|
@ -639,19 +639,26 @@ static int rsnd_dai_probe(struct platform_device *pdev,
|
||||
struct rsnd_priv *priv)
|
||||
{
|
||||
struct snd_soc_dai_driver *drv;
|
||||
struct rcar_snd_info *info = rsnd_priv_to_info(priv);
|
||||
struct rsnd_dai *rdai;
|
||||
struct rsnd_mod *pmod, *cmod;
|
||||
struct device *dev = rsnd_priv_to_dev(priv);
|
||||
int dai_nr;
|
||||
int dai_nr = info->dai_info_nr;
|
||||
int i;
|
||||
|
||||
/* 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);
|
||||
/*
|
||||
* dai_nr should be set via dai_info_nr,
|
||||
* but allow it to keeping compatible
|
||||
*/
|
||||
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)
|
||||
break;
|
||||
if (!pmod && !cmod)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dai_nr) {
|
||||
@ -671,6 +678,8 @@ static int rsnd_dai_probe(struct platform_device *pdev,
|
||||
priv->rdai = rdai;
|
||||
|
||||
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);
|
||||
cmod = rsnd_ssi_mod_get_frm_dai(priv, i, 0);
|
||||
|
@ -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,
|
||||
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;
|
||||
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;
|
||||
|
||||
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)
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user