Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: meson: axg-fifo: add NO_PERIOD_WAKEUP support

On the AXG family, the fifo irq is not necessary for the HW to operate.
It is just used to notify that a period has elapsed. If userpace does not
care for these wakeups (such as pipewire), we are just wasting CPU cycles.

Add support for NO_PERIOD_WAKEUP and disable irq when they are no needed.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210407145914.311479-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jerome Brunet and committed by
Mark Brown
9be701ec fa74c223

+6 -5
+6 -5
sound/soc/meson/axg-fifo.c
··· 27 27 SNDRV_PCM_INFO_MMAP | 28 28 SNDRV_PCM_INFO_MMAP_VALID | 29 29 SNDRV_PCM_INFO_BLOCK_TRANSFER | 30 - SNDRV_PCM_INFO_PAUSE), 31 - 30 + SNDRV_PCM_INFO_PAUSE | 31 + SNDRV_PCM_INFO_NO_PERIOD_WAKEUP), 32 32 .formats = AXG_FIFO_FORMATS, 33 33 .rate_min = 5512, 34 34 .rate_max = 192000, ··· 113 113 { 114 114 struct snd_pcm_runtime *runtime = ss->runtime; 115 115 struct axg_fifo *fifo = axg_fifo_data(ss); 116 - unsigned int burst_num, period, threshold; 116 + unsigned int burst_num, period, threshold, irq_en; 117 117 dma_addr_t end_ptr; 118 118 119 119 period = params_period_bytes(params); ··· 142 142 regmap_field_write(fifo->field_threshold, 143 143 threshold ? threshold - 1 : 0); 144 144 145 - /* Enable block count irq */ 145 + /* Enable irq if necessary */ 146 + irq_en = runtime->no_period_wakeup ? 0 : FIFO_INT_COUNT_REPEAT; 146 147 regmap_update_bits(fifo->map, FIFO_CTRL0, 147 148 CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT), 148 - CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT)); 149 + CTRL0_INT_EN(irq_en)); 149 150 150 151 return 0; 151 152 }