[alsa-devel] [PATCH 7/8] ALSA: pcm: Add card sync_irq field

Takashi Iwai tiwai at suse.de
Mon Nov 18 20:49:29 CET 2019


On Mon, 18 Nov 2019 20:20:41 +0100,
Sridharan, Ranjani wrote:
> 
> On Mon, Nov 18, 2019 at 10:54 AM Takashi Iwai <tiwai at suse.de> wrote:
> 
>     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 for the clarification, Takashi. But just wondering how would one pass
> on the sync_irq when the snd_card is created? Typically in the case of the
> Intel platforms, the card->dev points to the platform device for the machine
> driver that registers the card and the PCI device is the parent of the machine
> drv platform device. 

It's completely up to the driver implementation :)
You can implement the own sync_stop ops if that's easier, too.

In general, the driver can set up card->sync_irq when the
request_irq() or its variant is called.


Takashi


More information about the Alsa-devel mailing list