On Mon, 03 Mar 2025 18:27:43 +0100, noman pouigt wrote: > > Hello Maintainers, > > I have a question regarding XRUN handling. > After an XRUN is triggered, userspace generally > calls TRIGGER_STOP followed by PREPARE > and TRIGGER_START. In the PREPARE stage, > we are currently not sending the ALSA ring > buffer (physical address, rate, format, etc.) IPC to the > DSP but instead doing that in HW_PARAMS > which is causing bad audio after XRUN is triggered. > > I was able to resolve the issue by moving the > IPC to PREPARE, which fixes the XRUN problem > and results in good audio even after an XRUN. > I have also observed a similar approach in > Qualcomm drivers, which I assume is for the same reason. > > Is moving the IPC to PREPARE the correct > approach for handling this issue? I would appreciate any > insights or guidance on whether this is the recommended > way to handle XRUN recovery. IMO, It's not necessarily about XRUN, but rather a question how the driver reacts to user's action: stop, and the immediate prepare & restart. It's a common pattern, and the driver should handle it properly in general. Note that, if the hardware needs some time or procedure to clean up before the prepare, it should be handled by the driver's sync_stop PCM callback. Takashi