diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2012-03-29 14:51:20 -0500 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:00:03 +0200 |
commit | fbc54229287361d8ee6da4bbcd622452b671bd16 (patch) | |
tree | 14ab44192a9dbcbf4d3525f369193eec6e3fe148 /sound | |
parent | 46f54be05c42fb72b1eac9ba1ca3d0b50dce3463 (diff) | |
download | kernel_samsung_tuna-fbc54229287361d8ee6da4bbcd622452b671bd16.zip kernel_samsung_tuna-fbc54229287361d8ee6da4bbcd622452b671bd16.tar.gz kernel_samsung_tuna-fbc54229287361d8ee6da4bbcd622452b671bd16.tar.bz2 |
ASoC: ABE: Add hw_rule for 250us period constraint
Audio Backend requires period time in steps of 250us.
Change-Id: I9df1893ec557d883d435d77d24e019a054272c11
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound')
-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; |