On Wed, 06 Dec 2023 16:10:46 +0100,
Ivan Orlov wrote:
Stop timer in the 'hw_free' callback instead of the 'close' callback
since we want the timer to be stopped before the DMA buffer is released.
Otherwise, it could trigger a kernel panic in some circumstances, for
instance when the DMA buffer is already released but the timer callback
is still running.
You can't call timer_shutdown_sync() at hw_free. The PCM stream is
still there and you can re-setup via hw_params without closing. But,
after timer_shutdown_sync(), the timer instance must not be used any
longer.
A more proper way would be to call timer_delete() (no sync) at trigger
STOP, then call timer_delete_sync() at sync_stop op in addition. This
assures the immediate stop and the sync before changing to another PCM
state.
timer_shutdown_sync() can be kept at the close op to be sure.
thanks,
Takashi