mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valerio Setti <vsetti@baylibre.com>
To: Manuel Ebner <manuelebner@mailbox.org>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Christian Hewitt <christianshewitt@gmail.com>,
	linux-sound@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: meson: aiu-fifo: prevent sleeping when spinlock is held
Date: Mon, 16 Nov 2026 17:41:09 +0100	[thread overview]
Message-ID: <34e02f23-1ace-4a13-9353-b73a1464a592@baylibre.com> (raw)
In-Reply-To: <0140bc0b3d1078bf8851340e0cb893b2907e146a.camel@mailbox.org>

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


      parent reply	other threads:[~2026-11-16 16:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 10:09 Valerio Setti
2026-11-12 23:05 ` Martin Blumenstingl
2026-11-13 12:47   ` Valerio Setti
2026-11-13 14:54 ` Manuel Ebner
2026-11-13 15:09   ` Mark Brown
2026-11-16 16:41   ` Valerio Setti [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34e02f23-1ace-4a13-9353-b73a1464a592@baylibre.com \
    --to=vsetti@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=christianshewitt@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=manuelebner@mailbox.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®