adsp: add buffer size constraint for pcm buffer

During pcm_open for ADSP pcm devices, the buffer allocated
is not constrained to be multiple of 4. This results in
the apm_process being called continuously for this APM since
data is available. However ADMA is not started because of
the size mismatch. Setting constraint of period and buffer size
(in frames) to be multiple of 4 fixes these issues

Bug 2599016

Change-Id: Idaabba29142d9577a4dc72d97aa6bb3cd4f791de
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2122112
(cherry picked from commit 82d702154bf2c1a903f32e50a9bc4afdf271d74f)
Reviewed-on: https://git-master.nvidia.com/r/2124176
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Hariharan Sivaraman
2019-05-20 16:37:42 +05:30
committed by Sameer Pujar
parent f10af03058
commit 6d267cc2f6

View File

@@ -1779,9 +1779,19 @@ static int tegra210_adsp_pcm_open(struct snd_pcm_substream *substream)
/* Ensure period size is multiple of 4 */
ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 0x4);
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 0x4);
if (ret) {
dev_err(adsp->dev, "failed to set constraint %d\n", ret);
dev_err(adsp->dev,
"failed to set period_size constraint %d\n", ret);
return ret;
}
/* Ensure buffer size is multiple of 4 */
ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0x4);
if (ret) {
dev_err(adsp->dev,
"failed to set buffer_size constraint %d\n", ret);
return ret;
}
substream->runtime->private_data = prtd;