From: Andrei Simion <andrei.simion@microchip.com>
To: <broonie@kernel.org>
Cc: <alexandre.belloni@bootlin.com>, <alsa-devel@alsa-project.org>,
<andrei.simion@microchip.com>, <claudiu.beznea@tuxon.dev>,
<lgirdwood@gmail.com>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-sound@vger.kernel.org>,
<nicolas.ferre@microchip.com>, <perex@perex.cz>, <tiwai@suse.com>
Subject: Re: [PATCH] ASoC: atmel: mchp-pdmc: Skip ALSA restoration if substream runtime is uninitialized
Date: Tue, 24 Sep 2024 14:25:44 +0300 [thread overview]
Message-ID: <20240924112542.78321-1-andrei.simion@microchip.com> (raw)
In-Reply-To: <ZvJ_ZFpIiRpD_uzO@finisterre.sirena.org.uk>
On 24.09.2024 11:59, Mark Brown wrote:
>
>
> On Tue, Sep 24, 2024 at 11:12:38AM +0300, Andrei Simion wrote:
>
>> Update the driver to prevent alsa-restore.service from failing when
>> reading data from /var/lib/alsa/asound.state at boot. Ensure that the
>> restoration of ALSA mixer configurations is skipped if substream->runtime
>> is NULL.
>> +++ b/sound/soc/atmel/mchp-pdmc.c
>> @@ -302,6 +302,9 @@ static int mchp_pdmc_chmap_ctl_put(struct snd_kcontrol *kcontrol,
>> if (!substream)
>> return -ENODEV;
>>
>> + if (!substream->runtime)
>> + return 0; /* just for avoiding error from alsactl restore */
>> +
> This then means that control writes are just discarded which presumably
> is going to upset things if they actually saved a value here. Why is
> that a good choice, rather than either fixing the race so the card
> doesn't come up too early or removing the need for the runtime?
Ok. I understand. My first intention was to follow the
https://github.com/torvalds/linux/blob/master/sound/hda/hdmi_chmap.c#L794
but after your point of view, I intend to return -EAGAIN in V2
to specify the substream->runtime is not ready.
I retested: configured pdmc, then reboot the board and the configuration:
as a result the configuration kept.
alsa-restore.service status success.
Do you think this solution is enough?
Thank you and best regards,
Andrei Simion
WARNING: multiple messages have this Message-ID (diff)
From: Andrei Simion <andrei.simion@microchip.com>
To: <broonie@kernel.org>
Cc: alexandre.belloni@bootlin.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, lgirdwood@gmail.com,
linux-sound@vger.kernel.org, claudiu.beznea@tuxon.dev,
andrei.simion@microchip.com, tiwai@suse.com, perex@perex.cz,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ASoC: atmel: mchp-pdmc: Skip ALSA restoration if substream runtime is uninitialized
Date: Tue, 24 Sep 2024 14:25:44 +0300 [thread overview]
Message-ID: <20240924112542.78321-1-andrei.simion@microchip.com> (raw)
In-Reply-To: <ZvJ_ZFpIiRpD_uzO@finisterre.sirena.org.uk>
On 24.09.2024 11:59, Mark Brown wrote:
>
>
> On Tue, Sep 24, 2024 at 11:12:38AM +0300, Andrei Simion wrote:
>
>> Update the driver to prevent alsa-restore.service from failing when
>> reading data from /var/lib/alsa/asound.state at boot. Ensure that the
>> restoration of ALSA mixer configurations is skipped if substream->runtime
>> is NULL.
>> +++ b/sound/soc/atmel/mchp-pdmc.c
>> @@ -302,6 +302,9 @@ static int mchp_pdmc_chmap_ctl_put(struct snd_kcontrol *kcontrol,
>> if (!substream)
>> return -ENODEV;
>>
>> + if (!substream->runtime)
>> + return 0; /* just for avoiding error from alsactl restore */
>> +
> This then means that control writes are just discarded which presumably
> is going to upset things if they actually saved a value here. Why is
> that a good choice, rather than either fixing the race so the card
> doesn't come up too early or removing the need for the runtime?
Ok. I understand. My first intention was to follow the
https://github.com/torvalds/linux/blob/master/sound/hda/hdmi_chmap.c#L794
but after your point of view, I intend to return -EAGAIN in V2
to specify the substream->runtime is not ready.
I retested: configured pdmc, then reboot the board and the configuration:
as a result the configuration kept.
alsa-restore.service status success.
Do you think this solution is enough?
Thank you and best regards,
Andrei Simion
next prev parent reply other threads:[~2024-10-01 12:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 8:12 [PATCH] ASoC: atmel: mchp-pdmc: Skip ALSA restoration if substream runtime is uninitialized Andrei Simion
2024-09-24 8:59 ` Mark Brown
2024-09-24 8:59 ` Mark Brown
2024-09-24 11:25 ` Andrei Simion [this message]
2024-09-24 11:25 ` Andrei Simion
2024-09-24 11:34 ` Mark Brown
2024-09-24 11:34 ` Mark Brown
2024-09-24 15:28 ` Mark Brown
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=20240924112542.78321-1-andrei.simion@microchip.com \
--to=andrei.simion@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=claudiu.beznea@tuxon.dev \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.