This project is mirrored from https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git. Pull mirroring updated .
  1. 14 Apr, 2021 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Apply implicit feedback mode for BOSS devices · ebe8dc5a
      Takashi Iwai authored
      During the recent rewrite of the implicit feedback support, we've
      tested to apply the implicit fb on BOSS devices, but it failed, as the
      capture stream didn't start without the playback.  As the end result,
      it got another type of quirk for tying both streams but starts
      playback always (commit 6234fdc1
      
       "ALSA: usb-audio: Quirk for BOSS
      GT-001").
      
      Meanwhile, Mike Oliphant has tested the real implicit feedback mode
      for the playback again with the latest code, and found out that it
      actually works if the initial feedback sync is skipped; that is, on
      those BOSS devices, the playback stream has to be started at first
      without waiting for the capture URB completions.  Otherwise it gets
      stuck.  In the rest operations after the capture stream processed, we
      can take them as the implicit feedback source.
      
      This patch is an attempt to improve the support for BOSS devices with
      the implicit feedback mode in the way described above.  It adds a new
      flag to snd_usb_audio, playback_first, indicating that the playback
      stream starts without sync with the initial capture completion.  This
      flag is set in the quirk table with the new IMPLICIT_FB_BOTH type.
      
      Reported-and-tested-by: default avatarMike Oliphant <oliphant@nostatic.org>
      Link: https://lore.kernel.org/r/20210414083255.9527-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ebe8dc5a
  2. 08 Feb, 2021 3 commits
  3. 05 Feb, 2021 1 commit
  4. 18 Jan, 2021 1 commit
  5. 08 Jan, 2021 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Annotate the endpoint index in audioformat · eae4d054
      Takashi Iwai authored
      There are devices that have multiple endpoints sharing the same
      iface/altset not only for sync but also for the actual streams, and
      the audioformat for such an endpoint needs to be handled with the
      proper endpoint index; otherwise it confuses the endpoint management.
      
      This patch extends the audioformat to annotate the endpoint index, and
      put the proper ep_idx=1 to Pioneer device quirk entries accordingly.
      
      Fixes: bf6313a0 ("ALSA: usb-audio: Refactor endpoint management")
      Link: https://lore.kernel.org/r/20210108075219.21463-5-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      eae4d054
    • Takashi Iwai's avatar
      ALSA: usb-audio: Avoid unnecessary interface re-setup · 00272c61
      Takashi Iwai authored
      The current endpoint handling assumed (more or less) a unique 1:1
      relation between the endpoint and the iface/altset.  The exception was
      the sync EP without the implicit feedback which has usually the
      secondary EP of the same altset.  This works fine for most devices,
      but it turned out that some unusual devices like Pinoeer's ones have
      both playback and capture endpoints in the same iface/altsetting and
      use both for the implicit feedback mode.  For handling such a case, we
      need to extend the endpoint management to take the shared interface
      into account.
      
      This patch does that: it adds a new object snd_usb_iface_ref for
      managing the reference counts of the each USB interface that is used
      by each endpoint.  The interface setup is performed only once for the
      (sharing) endpoints, and the doubly initialization is avoided.
      
      Along with this, the resource release of endpoints and interface
      refcounts are put into a single function, snd_usb_endpoint_free_all()
      instead of looping in the caller side.
      
      Fixes: bf6313a0 ("ALSA: usb-audio: Refactor endpoint management")
      Link: https://lore.kernel.org/r/20210108075219.21463-4-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      00272c61
  6. 23 Nov, 2020 14 commits
  7. 06 Oct, 2020 1 commit
  8. 27 Jul, 2020 1 commit
  9. 16 Jul, 2020 1 commit
  10. 30 Jun, 2020 2 commits
  11. 15 May, 2020 1 commit
  12. 24 Apr, 2020 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix racy list management in output queue · 5b6cc38f
      Takashi Iwai authored
      The linked list entry from FIFO is peeked at
      queue_pending_output_urbs() but the actual element pop-out is
      performed outside the spinlock, and it's potentially racy.
      
      Do delete the link at the right place inside the spinlock.
      
      Fixes: 8fdff6a3 ("ALSA: snd-usb: implement new endpoint streaming model")
      Link: https://lore.kernel.org/r/20200424074016.14301-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5b6cc38f
    • Alexander Tsoy's avatar
      ALSA: usb-audio: Improve frames size computation · f0bd62b6
      Alexander Tsoy authored
      
      
      For computation of the the next frame size current value of fs/fps and
      accumulated fractional parts of fs/fps are used, where values are stored
      in Q16.16 format. This is quite natural for computing frame size for
      asynchronous endpoints driven by explicit feedback, since in this case
      fs/fps is a value provided by the feedback endpoint and it's already in
      the Q format. If an error is accumulated over time, the device can
      adjust fs/fps value to prevent buffer overruns/underruns.
      
      But for synchronous endpoints the accuracy provided by these computations
      is not enough. Due to accumulated error the driver periodically produces
      frames with incorrect size (+/- 1 audio sample).
      
      This patch fixes this issue by implementing a different algorithm for
      frame size computation. It is based on accumulating of the remainders
      from division fs/fps and it doesn't accumulate errors over time. This
      new method is enabled for synchronous and adaptive playback endpoints.
      
      Signed-off-by: default avatarAlexander Tsoy <alexander@tsoy.me>
      Link: https://lore.kernel.org/r/20200424022449.14972-1-alexander@tsoy.me
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f0bd62b6
  13. 13 Nov, 2019 1 commit
    • Henry Lin's avatar
      ALSA: usb-audio: not submit urb for stopped endpoint · 52869931
      Henry Lin authored
      
      
      While output urb's snd_complete_urb() is executing, calling
      prepare_outbound_urb() may cause endpoint stopped before
      prepare_outbound_urb() returns and result in next urb submitted
      to stopped endpoint. usb-audio driver cannot re-use it afterwards as
      the urb is still hold by usb stack.
      
      This change checks EP_FLAG_RUNNING flag after prepare_outbound_urb() again
      to let snd_complete_urb() know the endpoint already stopped and does not
      submit next urb. Below kind of error will be fixed:
      
      [  213.153103] usb 1-2: timeout: still 1 active urbs on EP #1
      [  213.164121] usb 1-2: cannot submit urb 0, error -16: unknown error
      
      Signed-off-by: default avatarHenry Lin <henryl@nvidia.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191113021420.13377-1-henryl@nvidia.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      52869931
  14. 30 May, 2019 1 commit
  15. 01 Aug, 2018 1 commit
  16. 05 Jan, 2017 2 commits
    • Ioan-Adrian Ratiu's avatar
      ALSA: usb-audio: test EP_FLAG_RUNNING at urb completion · 13a6c832
      Ioan-Adrian Ratiu authored
      
      
      Testing EP_FLAG_RUNNING in snd_complete_urb() before running the completion
      logic allows us to save a few cpu cycles by returning early, skipping the
      pending urb in case the stream was stopped; the stop logic handles the urb
      and sets the completion callbacks to NULL.
      
      Signed-off-by: default avatarIoan-Adrian Ratiu <adi@adirat.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      13a6c832
    • Ioan-Adrian Ratiu's avatar
      ALSA: usb-audio: Fix irq/process data synchronization · 1d0f9530
      Ioan-Adrian Ratiu authored
      Commit 16200948 ("ALSA: usb-audio: Fix race at stopping the stream") was
      incomplete causing another more severe kernel panic, so it got reverted.
      This fixes both the original problem and its fallout kernel race/crash.
      
      The original fix is to move the endpoint member NULL clearing logic inside
      wait_clear_urbs() so the irq triggering the urb completion doesn't call
      retire_capture/playback_urb() after the NULL clearing and generate a panic.
      
      However this creates a new race between snd_usb_endpoint_start()'s call
      to wait_clear_urbs() and the irq urb completion handler which again calls
      retire_capture/playback_urb() leading to a new NULL dereference.
      
      We keep the EP deactivation code in snd_usb_endpoint_start() because
      removing it will break the EP reference counting (see [1] [2] for info),
      however we don't need the "can_sleep" mechanism anymore because a new
      function was introduced (snd_usb_endpoint_sync_pending_stop()) which
      synchronizes pending stops and gets called inside the pcm prepare callback.
      
      It also makes sense to remove can_sleep because it was also removed from
      deactivate_urbs() signature in [3] so we benefit from more simplification.
      
      [1] commit 015618b9 ("ALSA: snd-usb: Fix URB cancellation at stream start")
      [2] commit e9ba389c ("ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM capture stream")
      [3] commit ccc1696d ("ALSA: usb-audio: simplify endpoint deactivation code")
      
      Fixes: f8114f85
      
       ("Revert "ALSA: usb-audio: Fix race at stopping the stream"")
      
      Signed-off-by: default avatarIoan-Adrian Ratiu <adi@adirat.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1d0f9530
  17. 21 Dec, 2016 1 commit
  18. 12 Dec, 2016 1 commit
    • Nobutaka Okabe's avatar
      ALSA: usb-audio: Eliminate noise at the start of DSD playback. · 01200730
      Nobutaka Okabe authored
      
      
      [Problem]
      In some USB DACs, a terrible pop noise comes to be heard
      at the start of DSD playback (in the following situations).
      
      - play first DSD track
      - change from PCM track to DSD track
      - change from DSD64 track to DSD128 track (and etc...)
      - seek DSD track
      - Fast-Forward/Rewind DSD track
      
      [Cause]
      At the start of playback, there is a little silence.
      The silence bit pattern "0x69" is required on DSD mode,
      but it is not like that.
      
      [Solution]
      This patch adds DSD silence pattern to the endpoint settings.
      
      Signed-off-by: default avatarNobutaka Okabe <nob77413@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      01200730
  19. 06 Dec, 2016 1 commit
  20. 05 Dec, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix race at stopping the stream · 16200948
      Takashi Iwai authored
      We've got a kernel crash report showing like:
      
        Unable to handle kernel NULL pointer dereference at virtual address 00000008 pgd = a1d7c000
        [00000008] *pgd=31c93831, *pte=00000000, *ppte=00000000
        Internal error: Oops: 17 [#1] PREEMPT SMP ARM
        CPU: 0 PID: 250 Comm: dbus-daemon Not tainted 3.14.51-03479-gf50bdf4 #1
        task: a3ae61c0 ti: a08c8000 task.ti: a08c8000
        PC is at retire_capture_urb+0x10/0x1f4 [snd_usb_audio]
        LR is at snd_complete_urb+0x140/0x1f0 [snd_usb_audio]
        pc : [<7f0eb22c>]    lr : [<7f0e57fc>]    psr: 200e0193
        sp : a08c9c98  ip : a08c9ce8  fp : a08c9ce4
        r10: 0000000a  r9 : 00000102  r8 : 94cb3000
        r7 : 94cb3000  r6 : 94d0f000  r5 : 94d0e8e8  r4 : 94d0e000
        r3 : 7f0eb21c  r2 : 00000000  r1 : 94cb3000  r0 : 00000000
        Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
        Control: 10c5387d  Table: 31d7c04a  DAC: 00000015
        Process dbus-daemon (pid: 250, stack limit = 0xa08c8238)
        Stack: (0xa08c9c98 to 0xa08ca000)
        ...
        Backtrace:
        [<7f0eb21c>] (retire_capture_urb [snd_usb_audio]) from [<7f0e57fc>] (snd_complete_urb+0x140/0x1f0 [snd_usb_audio])
        [<7f0e56bc>] (snd_complete_urb [snd_usb_audio]) from [<80371118>] (__usb_hcd_giveback_urb+0x78/0xf4)
        [<803710a0>] (__usb_hcd_giveback_urb) from [<80371514>] (usb_giveback_urb_bh+0x8c/0xc0)
        [<80371488>] (usb_giveback_urb_bh) from [<80028e3c>] (tasklet_hi_action+0xc4/0x148)
        [<80028d78>] (tasklet_hi_action) from [<80028358>] (__do_softirq+0x190/0x380)
        [<800281c8>] (__do_softirq) from [<80028858>] (irq_exit+0x8c/0xfc)
        [<800287cc>] (irq_exit) from [<8000ea88>] (handle_IRQ+0x8c/0xc8)
        [<8000e9fc>] (handle_IRQ) from [<800085e8>] (gic_handle_irq+0xbc/0xf8)
        [<8000852c>] (gic_handle_irq) from [<80509044>] (__irq_svc+0x44/0x78)
        [<80508820>] (_raw_spin_unlock_irq) from [<8004b880>] (finish_task_switch+0x5c/0x100)
        [<8004b824>] (finish_task_switch) from [<805052f0>] (__schedule+0x48c/0x6d8)
        [<80504e64>] (__schedule) from [<805055d4>] (schedule+0x98/0x9c)
        [<8050553c>] (schedule) from [<800116c8>] (do_work_pending+0x30/0xd0)
        [<80011698>] (do_work_pending) from [<8000e160>] (work_pending+0xc/0x20)
        Code: e1a0c00d e92ddff0 e24cb004 e24dd024 (e5902008)
        Kernel panic - not syncing: Fatal exception in interrupt
      
      There is a race between retire_capture_urb() and stop_endpoints().
      The latter is called at stopping the stream and it sets some endpoint
      fields to NULL.  But its call is asynchronous, thus the pending
      complete callback might get called after these NULL clears, and it
      leads the NULL dereference like the above.
      
      The fix is to move the NULL clearance after the synchronization,
      i.e. wait_clear_urbs().  This is called at prepare and hw_free
      callbacks, so it's assured to be called before the restart of the
      stream or the release of the stream.
      
      Also, while we're at it, put the EP_FLAG_RUNNING flag check at the
      beginning of snd_complete_urb() to skip the pending complete after the
      stream is stopped.
      
      Fixes: b2eb950d
      
       ("ALSA: usb-audio: stop both data and sync...")
      Reported-by: default avatarJiada Wang <jiada_wang@mentor.com>
      Reported-by: default avatarMark Craske <Mark_Craske@mentor.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      16200948
  21. 22 Aug, 2016 1 commit