diff options
Diffstat (limited to 'sound/soc/omap/omap-abe.c')
-rw-r--r-- | sound/soc/omap/omap-abe.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sound/soc/omap/omap-abe.c b/sound/soc/omap/omap-abe.c index 33054f3..2893f03 100644 --- a/sound/soc/omap/omap-abe.c +++ b/sound/soc/omap/omap-abe.c @@ -922,6 +922,20 @@ static void playback_trigger(struct snd_pcm_substream *substream, } } +static int omap_abe_hwrule_period_step(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval *period_size = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE); + unsigned int rate = params_rate(params); + + /* 44.1kHz has the same iteration number as 48kHz */ + rate = (rate == 44100) ? 48000 : rate; + + /* ABE requires chunks of 250us worth of data */ + return snd_interval_step(period_size, 0, rate / 4000); +} + static int omap_abe_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -950,6 +964,17 @@ static int omap_abe_dai_startup(struct snd_pcm_substream *substream, dev_err(abe_priv->modem_dai->dev, "failed to open DAI %d\n", ret); return ret; } + } else { + /* + * Period size must be aligned with the Audio Engine + * processing loop which is 250 us long + */ + snd_pcm_hw_rule_add(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + omap_abe_hwrule_period_step, + NULL, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + SNDRV_PCM_HW_PARAM_RATE, -1); } return ret; |