Re: [PATCH] ASoC: meson: aiu-fifo: prevent sleeping when spinlock is held

From: Valerio Setti

Date: Mon Nov 16 2026 - 11:42:01 EST


Hi Manuel

I have read your patch and have a question.
[...]
@@ -48,14 +49,22 @@ static int aiu_fifo_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
  struct snd_soc_dai *dai)
 {
  struct snd_soc_component *component = dai->component;
+ unsigned int val;

Here is val.

+ int ret;
  switch (cmd) {
  case SNDRV_PCM_TRIGGER_START:
  case SNDRV_PCM_TRIGGER_RESUME:
  case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- snd_soc_component_write(component, AIU_RST_SOFT,
- AIU_RST_SOFT_I2S_FAST);
- snd_soc_component_read(component, AIU_I2S_SYNC);
+ ret = regmap_write(component->regmap, AIU_RST_SOFT, AIU_RST_SOFT_I2S_FAST);
+ if (ret < 0)
+ return snd_soc_ret(component->dev, ret,
+    "Failed to write register on trigger");
+
+ ret = regmap_read(component->regmap, AIU_I2S_SYNC, &val);

So as I understand val/&val is just there to listen and forget what gets returned.
That's kinda weird, but not an issue.

Well, I understand that it might be weird from a software point of view, but it makes sense from the hardware one. According to the manual:

A read from this register indicates that the next sample to be
sent out of the interface should go into the left channel of
the dac.
@@ -37,8 +38,11 @@ snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component,
  struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
  struct snd_pcm_runtime *runtime = substream->runtime;
  unsigned int addr;

Here it's addr. It's not yours, you just kept it.

+ int ret;
- addr = snd_soc_component_read(component, fifo->mem_offset + AIU_MEM_RD);
+ ret = regmap_read(component->regmap, fifo->mem_offset + AIU_MEM_RD, &addr);

Similar as above. But why is addr here and val above? I think it's the same role in regmap_read().
Would it make sense to name both the same? If it does, I'm in favor of val, because that's in the
kernel-doc of regmap_read().

+ if (ret < 0)
+ return snd_soc_ret(component->dev, ret, "Failed to read FIFO pointer");
  return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr);
Here addr is used, so it's not same as above.

Looking forward to your POV.

Here I left 'addr' to minimize the number of changes in the patch.
Looking at it again now, I'm more in favor of keeping it as 'addr'. I understand that the regmap documentation uses 'val', but in this case we know that the returned value is really an address of memory, not just a generic value.
Also keeping the name as it is makes the last line of that function reading smoothly.

However if you deem this unacceptable I can change as you requested. Just let me know.

Best regards,

--
Valerio