ASoC: amd: acp: add pcm constraints for buffer size and period size
authorVijendar Mukunda <Vijendar.Mukunda@amd.com>
Mon, 17 Jun 2024 07:28:41 +0000 (12:58 +0530)
committerMark Brown <broonie@kernel.org>
Fri, 21 Jun 2024 12:18:09 +0000 (13:18 +0100)
ACP common dma driver has a buffer size and period size restriction
which should be 64 byte aligned. Add pcm constraints for the same.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://patch.msgid.link/20240617072844.871468-8-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/acp/acp-platform.c

index aaac8aa744cb0655ede3437ab93b1505d1e97f38..4f409cd09c11cda12794fdb84d42a486937846c1 100644 (file)
@@ -197,6 +197,20 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subs
        else
                runtime->hw = acp_pcm_hardware_capture;
 
+       ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, DMA_SIZE);
+       if (ret) {
+               dev_err(component->dev, "set hw constraint HW_PARAM_PERIOD_BYTES failed\n");
+               kfree(stream);
+               return ret;
+       }
+
+       ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, DMA_SIZE);
+       if (ret) {
+               dev_err(component->dev, "set hw constraint HW_PARAM_BUFFER_BYTES failed\n");
+               kfree(stream);
+               return ret;
+       }
+
        ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
        if (ret < 0) {
                dev_err(component->dev, "set integer constraint failed\n");