Skip to content

Commit c5dcf8a

Browse files
jailuthrabroonie
authored andcommitted
ASoC: ti: davinci-mcasp: Set min period size using FIFO config
The minimum period size was enforced to 64 as older devices integrating McASP with EDMA used an internal FIFO of 64 samples. With UDMA based platforms this internal McASP FIFO is optional, as the DMA engine internally does some buffering which is already accounted for when registering the platform. So we should read the actual FIFO configuration (txnumevt/rxnumevt) instead of hardcoding frames.min to 64. Acked-by: Peter Ujfalusi <[email protected]> Signed-off-by: Jai Luthra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e834341 commit c5dcf8a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sound/soc/ti/davinci-mcasp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,10 +1472,11 @@ static int davinci_mcasp_hw_rule_min_periodsize(
14721472
{
14731473
struct snd_interval *period_size = hw_param_interval(params,
14741474
SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
1475+
u8 numevt = *((u8 *)rule->private);
14751476
struct snd_interval frames;
14761477

14771478
snd_interval_any(&frames);
1478-
frames.min = 64;
1479+
frames.min = numevt;
14791480
frames.integer = 1;
14801481

14811482
return snd_interval_refine(period_size, &frames);
@@ -1490,6 +1491,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
14901491
u32 max_channels = 0;
14911492
int i, dir, ret;
14921493
int tdm_slots = mcasp->tdm_slots;
1494+
u8 *numevt;
14931495

14941496
/* Do not allow more then one stream per direction */
14951497
if (mcasp->substreams[substream->stream])
@@ -1589,9 +1591,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
15891591
return ret;
15901592
}
15911593

1594+
numevt = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
1595+
&mcasp->txnumevt :
1596+
&mcasp->rxnumevt;
15921597
snd_pcm_hw_rule_add(substream->runtime, 0,
15931598
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1594-
davinci_mcasp_hw_rule_min_periodsize, NULL,
1599+
davinci_mcasp_hw_rule_min_periodsize, numevt,
15951600
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
15961601

15971602
return 0;

0 commit comments

Comments
 (0)