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

On Mon, 2026-11-16 at 17:41 +0100, Valerio Setti wrote:
> Hi Manuel
> 
> > I have read your patch and have a question.
> [...]

Ack.

> > > @@ -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.

I'm good with 'addr', thanks for the explanation. 
 Manuel

> 
> Best regards,

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

      reply	other threads:[~2026-11-18 14:56 UTC|newest]

Thread overview: 7+ 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
2026-11-18 14:56     ` Manuel Ebner [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=d825fa6717dc907247cbaec6c7555eccb5676b9b.camel@mailbox.org \
    --to=manuelebner@mailbox.org \
    --cc=broonie@kernel.org \
    --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=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=vsetti@baylibre.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®