On Mon, 18 Nov 2019 17:38:49 +0100, Pierre-Louis Bossart wrote:
On 11/17/19 2:53 AM, Takashi Iwai wrote:
Many PCI and other drivers performs snd_pcm_period_elapsed() simply in its interrupt handler, so the sync_stop operation is just to call synchronize_irq(). Instead of putting this call multiple times, introduce the common card->sync_irq field. When this field is set, PCM core performs synchronize_irq() for sync-stop operation. Each driver just needs to copy its local IRQ number to card->sync_irq, and that's all we need.
Maybe a red-herring or complete non-sense, but I wonder if this is going to get in the way of Ranjani's multi-client work, where we could have multiple cards created but with a single IRQ handled by the parent PCI device?
Ranjani, you may want to double-check this and chime in, thanks!
The synchronize_irq() is fairly safe to call multiple times, and I don't think any problem by invoking it for multi-clients sharing the same IRQ. For example, Digigram miXart driver creates multiple card objects from a single PCI entry, and I already thought of that possibility; they set the same card->sync_irq value to all card objects, which eventually will call synchronize_irq() multiple times. From the performance POV, this shouldn't be a big problem, because the place calling this is only at hw_params, prepare and hw_free, neither are hot-path.
thanks,
Takashi