Re: [PATCH v2 09/21] ASoC: apple: Add macaudio machine driver
From: Cezary Rojewski
Date: Mon Oct 12 2026 - 06:04:55 EST
On 10/10/2026 6:40 AM, James Calligeros wrote:
>> macaudio_vlimit_enable_timeout()
>> macaudio_vlimit_disable_timeout()
>> macaudio_vlimit_update()
>> called in context of delayed part of the trigger() callback.
>> I'd need more information on the trigger() implementation of
>> yours to present a solution. See the comments below.
>
> are slightly more difficult to deal with. These are called from workqueues
> which only have reference to the driver data struct. Other than keeping a
> pointer to the card around, I'm not sure how else to deal with this other
> than keeping a pointer to card around in the driver data struct.
>
>> Please correct me if I'm wrong but it seems the scheduled work does
>> speaker-volume operations only. Moreover, it seems that
>> ->lock_update_work may schedule a follow up work in form of
>> ->lock_timeout_work. Are you sure trigger() is the right place to do
>> volume-control in delayed manner?
>
> The intention here is to activate the timeout when the stream starts
> so that if speakersafetyd dies at any point during playback, the speaker
> volume(s) are limited to prevent damage. We only want this running when
> speaker playback starts and we need to disable it when that playback stops,
> so trigger() seems like the natural place for this.
How does one know the speaker died? Is there some kind of signal, event
or an interrupt we could depend on? As delayed-work is a mechanism of
choice here for handling the case, I believe there is still a gap and a
chance for bad things to happen.
Czarek