|
37 | 37 | #define XLNX_AUD_XFER_COUNT 0x28
|
38 | 38 | #define XLNX_AUD_CH_STS_START 0x2C
|
39 | 39 | #define XLNX_BYTES_PER_CH 0x44
|
| 40 | +#define XLNX_AUD_ALIGN_BYTES 64 |
40 | 41 |
|
41 | 42 | #define AUD_STS_IOC_IRQ_MASK BIT(31)
|
42 | 43 | #define AUD_STS_CH_STS_MASK BIT(29)
|
@@ -368,12 +369,32 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component,
|
368 | 369 | snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware);
|
369 | 370 | runtime->private_data = stream_data;
|
370 | 371 |
|
371 |
| - /* Resize the period size divisible by 64 */ |
| 372 | + /* Resize the period bytes as divisible by 64 */ |
372 | 373 | err = snd_pcm_hw_constraint_step(runtime, 0,
|
373 |
| - SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64); |
| 374 | + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
| 375 | + XLNX_AUD_ALIGN_BYTES); |
374 | 376 | if (err) {
|
375 | 377 | dev_err(component->dev,
|
376 |
| - "unable to set constraint on period bytes\n"); |
| 378 | + "Unable to set constraint on period bytes\n"); |
| 379 | + return err; |
| 380 | + } |
| 381 | + |
| 382 | + /* Resize the buffer bytes as divisible by 64 */ |
| 383 | + err = snd_pcm_hw_constraint_step(runtime, 0, |
| 384 | + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, |
| 385 | + XLNX_AUD_ALIGN_BYTES); |
| 386 | + if (err) { |
| 387 | + dev_err(component->dev, |
| 388 | + "Unable to set constraint on buffer bytes\n"); |
| 389 | + return err; |
| 390 | + } |
| 391 | + |
| 392 | + /* Set periods as integer multiple */ |
| 393 | + err = snd_pcm_hw_constraint_integer(runtime, |
| 394 | + SNDRV_PCM_HW_PARAM_PERIODS); |
| 395 | + if (err < 0) { |
| 396 | + dev_err(component->dev, |
| 397 | + "Unable to set constraint on periods to be integer\n"); |
377 | 398 | return err;
|
378 | 399 | }
|
379 | 400 |
|
|
0 commit comments