mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
ASoC: amd: acp: Refactor TDM slots selction based on acp revision id
Refactor TDM slots selection based on acp revision id. Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Link: https://patch.msgid.link/20240903113427.182997-2-venkataprasad.potturu@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
dc70fd0240
commit
cd60dec899
@ -95,9 +95,11 @@ 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 acp_dev_data *adata = snd_soc_dai_get_drvdata(dai);
|
||||
struct acp_chip_info *chip;
|
||||
struct acp_stream *stream;
|
||||
int slot_len, no_of_slots;
|
||||
|
||||
chip = dev_get_platdata(dev);
|
||||
switch (slot_width) {
|
||||
case SLOT_WIDTH_8:
|
||||
slot_len = 8;
|
||||
@ -116,6 +118,9 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (chip->acp_rev) {
|
||||
case ACP3X_DEV:
|
||||
case ACP6X_DEV:
|
||||
switch (slots) {
|
||||
case 1 ... 7:
|
||||
no_of_slots = slots;
|
||||
@ -127,17 +132,30 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas
|
||||
dev_err(dev, "Unsupported slots %d\n", slots);
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_err(dev, "Unknown chip revision %d\n", chip->acp_rev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
slots = no_of_slots;
|
||||
|
||||
spin_lock_irq(&adata->acp_lock);
|
||||
list_for_each_entry(stream, &adata->stream_list, list) {
|
||||
switch (chip->acp_rev) {
|
||||
case ACP3X_DEV:
|
||||
case ACP6X_DEV:
|
||||
if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
adata->tdm_tx_fmt[stream->dai_id - 1] =
|
||||
FRM_LEN | (slots << 15) | (slot_len << 18);
|
||||
else if (rx_mask && stream->dir == SNDRV_PCM_STREAM_CAPTURE)
|
||||
adata->tdm_rx_fmt[stream->dai_id - 1] =
|
||||
FRM_LEN | (slots << 15) | (slot_len << 18);
|
||||
break;
|
||||
default:
|
||||
dev_err(dev, "Unknown chip revision %d\n", chip->acp_rev);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
spin_unlock_irq(&adata->acp_lock);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user