forked from Minki/linux
ASoC: amd: add ACP3x TDM mode support
ACP3x I2S (CPU DAI) can act in normal I2S and TDM modes. Added support for TDM mode. Desired mode can be selected from ASoC machine driver. Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com> Link: https://lore.kernel.org/r/1577540460-21438-4-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
703a6e2288
commit
a43ea44ddd
@ -42,7 +42,7 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai,
|
|||||||
u32 tx_mask, u32 rx_mask, int slots, int slot_width)
|
u32 tx_mask, u32 rx_mask, int slots, int slot_width)
|
||||||
{
|
{
|
||||||
struct i2s_dev_data *adata;
|
struct i2s_dev_data *adata;
|
||||||
u32 val, reg_val, frmt_val, frm_len;
|
u32 val, reg_val, frmt_reg, frm_len;
|
||||||
u16 slot_len;
|
u16 slot_len;
|
||||||
|
|
||||||
adata = snd_soc_dai_get_drvdata(cpu_dai);
|
adata = snd_soc_dai_get_drvdata(cpu_dai);
|
||||||
@ -69,15 +69,31 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai,
|
|||||||
|
|
||||||
frm_len = FRM_LEN | (slots << 15) | (slot_len << 18);
|
frm_len = FRM_LEN | (slots << 15) | (slot_len << 18);
|
||||||
if (adata->substream_type == SNDRV_PCM_STREAM_PLAYBACK) {
|
if (adata->substream_type == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||||
reg_val = mmACP_BTTDM_ITER;
|
switch (adata->i2s_instance) {
|
||||||
frmt_val = mmACP_BTTDM_TXFRMT;
|
case I2S_BT_INSTANCE:
|
||||||
|
reg_val = mmACP_BTTDM_ITER;
|
||||||
|
frmt_reg = mmACP_BTTDM_TXFRMT;
|
||||||
|
break;
|
||||||
|
case I2S_SP_INSTANCE:
|
||||||
|
default:
|
||||||
|
reg_val = mmACP_I2STDM_ITER;
|
||||||
|
frmt_reg = mmACP_I2STDM_TXFRMT;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
reg_val = mmACP_BTTDM_IRER;
|
switch (adata->i2s_instance) {
|
||||||
frmt_val = mmACP_BTTDM_RXFRMT;
|
case I2S_BT_INSTANCE:
|
||||||
|
reg_val = mmACP_BTTDM_IRER;
|
||||||
|
frmt_reg = mmACP_BTTDM_RXFRMT;
|
||||||
|
break;
|
||||||
|
case I2S_SP_INSTANCE:
|
||||||
|
default:
|
||||||
|
reg_val = mmACP_I2STDM_IRER;
|
||||||
|
frmt_reg = mmACP_I2STDM_RXFRMT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val = rv_readl(adata->acp3x_base + reg_val);
|
val = rv_readl(adata->acp3x_base + reg_val);
|
||||||
rv_writel(val | 0x2, adata->acp3x_base + reg_val);
|
rv_writel(val | 0x2, adata->acp3x_base + reg_val);
|
||||||
rv_writel(frm_len, adata->acp3x_base + frmt_val);
|
rv_writel(frm_len, adata->acp3x_base + frmt_reg);
|
||||||
adata->tdm_fmt = frm_len;
|
adata->tdm_fmt = frm_len;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ struct acp3x_platform_info {
|
|||||||
struct i2s_dev_data {
|
struct i2s_dev_data {
|
||||||
bool tdm_mode;
|
bool tdm_mode;
|
||||||
unsigned int i2s_irq;
|
unsigned int i2s_irq;
|
||||||
|
u16 i2s_instance;
|
||||||
u32 tdm_fmt;
|
u32 tdm_fmt;
|
||||||
u32 substream_type;
|
u32 substream_type;
|
||||||
void __iomem *acp3x_base;
|
void __iomem *acp3x_base;
|
||||||
|
Loading…
Reference in New Issue
Block a user