Re: [PATCH v5 4/7] ASoC: meson: add AUDIN driver

From: Martin Blumenstingl

Date: Sun Nov 15 2026 - 16:27:12 EST


On Sun, Oct 18, 2026 at 12:18 PM Valerio Setti <vsetti@xxxxxxxxxxxx> wrote:
[...]
> +static int audin_fifo_dai_prepare(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct audin_fifo_dai_data *data = snd_soc_dai_dma_data_get_capture(dai);
> + struct snd_soc_component *component = dai->component;
> + struct snd_pcm_runtime *runtime = substream->runtime;
> + dma_addr_t dma_end = runtime->dma_addr + runtime->dma_bytes - AUDIN_FIFO_LANE_SIZE;
> + unsigned int val;
> +
> + data->last_pos = 0;
> +
> + /*
> + * Setup memory boundaries.
> + * Note: DMA has a 32-bit mask, so it's OK to take lower 32 bits.
> + */
> + snd_soc_component_write(component, dai->driver->base + AUDIN_FIFO_START,
> + lower_32_bits(runtime->dma_addr));
> + snd_soc_component_write(component, dai->driver->base + AUDIN_FIFO_PTR,
> + lower_32_bits(runtime->dma_addr));
> + snd_soc_component_write(component, dai->driver->base + AUDIN_FIFO_END,
> + lower_32_bits(dma_end));
> +
> + /* Load new addresses (both LOAD and UG are self-clearing). */
> + val = AUDIN_FIFO_CTRL_LOAD | AUDIN_FIFO_CTRL_UG;
> + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_CTRL, val, val);
> +
> + /* Reset (RST is self-clearing). */
> + snd_soc_component_update_bits(component, dai->driver->base + AUDIN_FIFO_CTRL,
> + AUDIN_FIFO_CTRL_RST,
> + AUDIN_FIFO_CTRL_RST);
not a problem but a hint in case you experienced some weirdness during testing:
older vendor kernels have a different register write order and also do
a retry-reset dance when _PTR and _START don't match: [0]


[0] https://github.com/endlessm/linux-meson/blob/d6e13c220931110fe676ede6da69fc61a7cb04b6/sound/soc/aml/m8/aml_audio_hw.c#L348-L357