Commit bdde278a authored by Venkata Prasad Potturu's avatar Venkata Prasad Potturu Committed by Mark Brown

ASoC: amd: acp: Add TDM slots setting support for ACP I2S controller

Modify set tdm slot function to set ACP I2S controller slots
in tdm mode based on number of slots.
Signed-off-by: default avatarVenkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20221018122711.2559452-1-venkataprasad.potturu@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 73e4981f
...@@ -51,7 +51,7 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas ...@@ -51,7 +51,7 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas
struct device *dev = dai->component->dev; struct device *dev = dai->component->dev;
struct acp_dev_data *adata = snd_soc_dai_get_drvdata(dai); struct acp_dev_data *adata = snd_soc_dai_get_drvdata(dai);
struct acp_stream *stream; struct acp_stream *stream;
int slot_len; int slot_len, no_of_slots;
switch (slot_width) { switch (slot_width) {
case SLOT_WIDTH_8: case SLOT_WIDTH_8:
...@@ -71,6 +71,20 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas ...@@ -71,6 +71,20 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas
return -EINVAL; return -EINVAL;
} }
switch (slots) {
case 1 ... 7:
no_of_slots = slots;
break;
case 8:
no_of_slots = 0;
break;
default:
dev_err(dev, "Unsupported slots %d\n", slots);
return -EINVAL;
}
slots = no_of_slots;
spin_lock_irq(&adata->acp_lock); spin_lock_irq(&adata->acp_lock);
list_for_each_entry(stream, &adata->stream_list, list) { list_for_each_entry(stream, &adata->stream_list, list) {
if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK) if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
......
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