1. 10 Jun, 2021 2 commits
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: operate for period elapse event in process context · 7ba5ca32
      Takashi Sakamoto authored
      All of drivers in ALSA firewire stack processes two chances to process
      isochronous packets in any isochronous context; in software IRQ context
      for 1394 OHCI, and in process context of ALSA PCM application.
      
      In the process context, callbacks of .pointer and .ack are utilized. The
      callbacks are done by ALSA PCM core under acquiring lock of PCM substream,
      
      In design of ALSA PCM core, call of snd_pcm_period_elapsed() is used for
      drivers to awaken user processes from waiting for available frames. The
      function voluntarily acquires lock of PCM substream, therefore it is not
      called in the process context since it causes dead lock.
      
      As a workaround to avoid the dead lock, all of drivers in ALSA firewire
      stack uses workqueue to delegate the call. A variant of
      snd_pcm_period_elapsed() without lock acquisition can obsolete the
      workqueue.
      
      An extra care is needed for the callback of .pointer since it's called
      from snd_pcm_period_elapsed(). The isochronous context in Linux FireWire
      subsystem is safe mostly for nested call except in software IRQ context.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20210610031733.56297-3-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7ba5ca32
    • Takashi Sakamoto's avatar
      ALSA: pcm: add snd_pcm_period_elapsed() variant without acquiring lock of PCM substream · 47271b1b
      Takashi Sakamoto authored
      Current implementation of ALSA PCM core has a kernel API,
      snd_pcm_period_elapsed(), for drivers to queue event to awaken processes
      from waiting for available frames. The function voluntarily acquires lock
      of PCM substream, therefore it is not called in process context for any
      PCM operation since the lock is already acquired.
      
      It is convenient for packet-oriented driver, at least for drivers to audio
      and music unit in IEEE 1394 bus. The drivers are allowed by Linux
      FireWire subsystem to process isochronous packets queued till recent
      isochronous cycle in process context in any time.
      
      This commit adds snd_pcm_period_elapsed() variant,
      snd_pcm_period_elapsed_without_lock(), for drivers to queue the event in
      the process context.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20210610031733.56297-2-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      47271b1b
  2. 09 Jun, 2021 38 commits