1. 07 6月, 2022 2 次提交
  2. 24 5月, 2022 1 次提交
  3. 13 4月, 2022 1 次提交
    • T
      ALSA: usb-audio: Limit max buffer and period sizes per time · 24d0c9f0
      Takashi Iwai 提交于
      In the previous fix, we increased the max buffer bytes from 1MB to 4MB
      so that we can use bigger buffers for the modern HiFi devices with
      higher rates, more channels and wider formats.  OTOH, extending this
      has a concern that too big buffer is allowed for the lower rates, less
      channels and narrower formats; when an application tries to allocate
      as big buffer as possible, it'll lead to unexpectedly too huge size.
      
      Also, we had a problem about the inconsistent max buffer and period
      bytes for the implicit feedback mode when both streams have different
      channels.  This was fixed by the (relatively complex) patch to reduce
      the max buffer and period bytes accordingly.
      
      This is an alternative fix for those, a patch to kill two birds with
      one stone (*): instead of increasing the max buffer bytes blindly and
      applying the reduction per channels, we simply use the hw constraints
      for the buffer and period "time".  Meanwhile the max buffer and period
      bytes are set unlimited instead.
      
      Since the inconsistency of buffer (and period) bytes comes from the
      difference of the channels in the tied streams, as long as we care
      only about the buffer (and period) time, it doesn't matter; the buffer
      time is same for different channels, although we still allow higher
      buffer size.  Similarly, this will allow more buffer bytes for HiFi
      devices while it also keeps the reasonable size for the legacy
      devices, too.
      
      As of this patch, the max period and buffer time are set to 1 and 2
      seconds, which should be large enough for all possible use cases.
      
      (*) No animals were harmed in the making of this patch.
      
      Fixes: 98c27add ("ALSA: usb-audio: Cap upper limits of buffer/period bytes for implicit fb")
      Fixes: fee2ec8c ("ALSA: usb-audio: Increase max buffer size")
      Link: https://lore.kernel.org/r/20220412130740.18933-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      24d0c9f0
  4. 08 4月, 2022 2 次提交
  5. 19 11月, 2021 2 次提交
  6. 12 10月, 2021 1 次提交
  7. 07 10月, 2021 1 次提交
  8. 30 9月, 2021 7 次提交
    • T
      ALSA: usb-audio: Avoid killing in-flight URBs during draining · 813a17ca
      Takashi Iwai 提交于
      While draining a stream, ALSA PCM core stops the stream by issuing
      snd_pcm_stop() after all data has been sent out.  And, at PCM trigger
      stop, currently USB-audio driver kills the in-flight URBs explicitly,
      then at sync-stop ops, sync with the finish of all remaining URBs.
      This might result in a drop of the drained samples as most of
      USB-audio devices / hosts allow relatively long in-flight samples (as
      a sort of FIFO).
      
      For avoiding the trimming, this patch changes the stream-stop behavior
      during PCM draining state.  Under that condition, the pending URBs
      won't be killed.  The leftover in-flight URBs are caught by the
      sync-stop operation that shall be performed after the trigger-stop
      operation.
      
      Link: https://lore.kernel.org/r/20210929080844.11583-10-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      813a17ca
    • T
      ALSA: usb-audio: Improved lowlatency playback support · d5f871f8
      Takashi Iwai 提交于
      This is another attempt to improve further the handling of playback
      stream in the low latency mode.  The latest workaround in commit
      4267c5a8 ("ALSA: usb-audio: Work around for XRUN with low latency
      playback") revealed that submitting URBs forcibly in advance may
      trigger XRUN easily.  In the classical mode, this problem was avoided
      by practically delaying the submission of the actual data with the
      pre-submissions of silent data before triggering the stream start.
      But that is exactly what we want to avoid.
      
      Now, in this patch, instead of the previous workaround, we take a
      similar approach as used in the implicit feedback mode.  The URBs are
      queued at the PCM trigger start like before, but we check whether the
      buffer has been already filled enough before each submission, and
      stop queuing if the data overcomes the threshold.  The remaining URBs
      are kept in the ready list, and they will be retrieved in the URB
      complete callback of other (already queued) URBs.  In the complete
      callback, we try to fill the data and submit as much as possible
      again.  When there is no more available in-flight URBs that may handle
      the pending data, we'll check in PCM ack callback and submit and
      process URBs there in addition.  In this way, the amount of in-flight
      URBs may vary dynamically and flexibly depending on the available data
      without hitting XRUN.
      
      The following things are changed to achieve the behavior above:
      
      * The endpoint prepare callback is changed to return an error code;
        when there is no enough data available, it may return -EAGAIN.
        Currently only prepare_playback_urb() returns the error.
      
        The evaluation of the available data is a bit messy here; we can't
        check with snd_pcm_avail() at the point of prepare callback (as
        runtime->status->hwptr hasn't been updated yet), hence we manually
        estimate the appl_ptr and compare with the internal hwptr_done to
        calculate the available frames.
      
      * snd_usb_endpoint_start() doesn't submit full URBs if the prepare
        callback returns -EAGAIN, and puts the remaining URBs to the ready
        list for the later submission.
      
      * snd_complete_urb() treats the URBs in the low-latency mode similarly
        like the implicit feedback mode, and submissions are done in
        (now exported) snd_usb_queue_pending_output_urbs().
      
      * snd_usb_queue_pending_output_urbs() again checks the error value
        from the prepare callback.  If it's -EAGAIN for the normal stream
        (i.e. not implicit feedback mode), we push it back to the ready list
        again.
      
      * PCM ack callback is introduced for the playback stream, and it calls
        snd_usb_queue_pending_output_urbs() if there is no in-flight URB
        while the stream is running.  This corresponds to the case where the
        system needs the appl_ptr update for re-submitting a new URB.
      
      * snd_usb_queue_pending_output_urbs() and the prepare EP callback
        receive in_stream_lock argument, which is a bool flag indicating the
        call path from PCM ack.  It's needed for avoiding the deadlock of
        snd_pcm_period_elapsed() calls.
      
      * Set the new SNDRV_PCM_INFO_EXPLICIT_SYNC flag when the new
        low-latency mode is deployed.  This assures catching each applptr
        update even in the mmap mode.
      
      Fixes: 4267c5a8 ("ALSA: usb-audio: Work around for XRUN with low latency playback")
      Link: https://lore.kernel.org/r/20210929080844.11583-9-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      d5f871f8
    • T
      ALSA: usb-audio: Check available frames for the next packet size · d215f63d
      Takashi Iwai 提交于
      This is yet more preparation for the upcoming changes.
      
      Extend snd_usb_endpoint_next_packet_size() to check the available
      frames and return -EAGAIN if the next packet size is equal or exceeds
      the given size.  This will be needed for avoiding XRUN during the low
      latency operation.
      
      As of this patch, avail=0 is passed, i.e. the check is skipped and no
      behavior change.
      
      Link: https://lore.kernel.org/r/20210929080844.11583-7-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      d215f63d
    • T
      ALSA: usb-audio: Disable low-latency mode for implicit feedback sync · bceee753
      Takashi Iwai 提交于
      When a playback stream runs in the implicit feedback mode, its
      operation is passive and won't start unless the capture packet is
      received.  This behavior contradicts with the low-latency playback
      mode, and we should turn off lowlatency_playback flag accordingly.
      
      In theory, we may take the low-latency mode when the playback-first
      quirk is set, but it still conflicts with the later operation with the
      fixed packet numbers, so it's disabled all together for now.
      
      Link: https://lore.kernel.org/r/20210929080844.11583-6-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      bceee753
    • T
      ALSA: usb-audio: Disable low-latency playback for free-wheel mode · e581f1ce
      Takashi Iwai 提交于
      The free-wheel stream operation like dmix may not update the appl_ptr
      appropriately, and it doesn't fit with the low-latency playback mode.
      Disable the low-latency playback operation when the stream is set up
      in such a mode.
      
      Link: https://lore.kernel.org/r/20210929080844.11583-5-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      e581f1ce
    • T
      ALSA: usb-audio: Rename early_playback_start flag with lowlatency_playback · 9c9a3b9d
      Takashi Iwai 提交于
      This is a preparation patch for the upcoming low-latency improvement
      changes.
      
      Rename early_playback_start flag with lowlatency_playback as it's more
      intuitive.  The new flag is basically a reverse meaning.
      
      Along with the rename, factor out the code to set the flag to a
      function.  This makes the complex condition checks simpler.
      
      Also, the same flag is introduced to snd_usb_endpoint, too, that is
      carried from the snd_usb_substream flag.  Currently the endpoint flag
      isn't still referred, but will be used in later patches.
      
      Link: https://lore.kernel.org/r/20210929080844.11583-4-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      9c9a3b9d
    • T
      ALSA: usb-audio: Restrict rates for the shared clocks · 4e7cf1fb
      Takashi Iwai 提交于
      When a single clock source is shared among several endpoints, we have
      to keep the same rate on all active endpoints as long as the clock is
      being used.  For dealing with such a case, this patch adds one more
      check in the hw params constraint for the rate to take the shared
      clocks into account.  The current rate is evaluated from the endpoint
      list that applies the same clock source.
      
      BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1190418
      Link: https://lore.kernel.org/r/20210929080844.11583-2-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      4e7cf1fb
  9. 29 8月, 2021 1 次提交
  10. 28 8月, 2021 1 次提交
    • T
      ALSA: usb-audio: Work around for XRUN with low latency playback · 4267c5a8
      Takashi Iwai 提交于
      The recent change for low latency playback works in most of test cases
      but it turned out still to hit errors on some use cases, most notably
      with JACK with small buffer sizes.  This is because USB-audio driver
      fills up and submits full URBs at the beginning, while the URBs would
      return immediately and try to fill more -- that can easily trigger
      XRUN.  It was more or less expected, but in the small buffer size, the
      problem became pretty obvious.
      
      Fixing this behavior properly would require the change of the
      fundamental driver design, so it's no trivial task, unfortunately.
      Instead, here we work around the problem just by switching back to the
      old method when the given configuration is too fragile with the low
      latency stream handling.  As a threshold, we calculate the total
      buffer bytes in all plus one URBs, and check whether it's beyond the
      PCM buffer bytes.  The one extra URB is needed because XRUN happens at
      the next submission after the first round.
      
      Fixes: 307cc9ba ("ALSA: usb-audio: Reduce latency at playback start, take#2")
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210827203311.5987-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      4267c5a8
  11. 07 7月, 2021 1 次提交
    • T
      ALSA: usb-audio: Reduce latency at playback start, take#2 · 307cc9ba
      Takashi Iwai 提交于
      This is another attempt for the reduction of the latency at the start
      of a USB audio playback stream.  The first attempt in the commit
      9ce650a7 caused an unexpected regression (a deadlock with pipewire
      usage) and was later reverted by the commit 4b820e16.  The devils
      are always living in details, of course; the cause of the deadlock was
      the call of snd_pcm_period_elapsed() inside prepare_playback_urb()
      callback.  In the original code, this callback is never called from
      the stream lock context as it's driven solely from the URB complete
      callback.  Along with the movement of the URB submission into the
      trigger START, this prepare call may be also executed in the stream
      lock context, hence it deadlocked with the another lock in
      snd_pcm_period_elapsed().  (Note that this happens only conditionally
      with a small period size that matches with the URB buffer length,
      which was a reason I overlooked during my tests.  Also, the problem
      wasn't seen in the capture stream because the capture stream handles
      the period-elapsed only at retire callback that isn't executed at the
      trigger.)
      
      If it were only about avoiding the deadlock, it'd be possible to use
      snd_pcm_period_elapsed_under_stream_lock() as a solution.  However, in
      general, the period elapsed notification must be sent after the actual
      stream start, and replacing the call wouldn't satisfy the pattern.
      A better option is to delay the notification after the stream start
      procedure finished, instead.  In the case of USB framework, one of the
      fitting place would be the complete callback of the first URB.
      
      So, as a workaround of the deadlock and the order fixes above, in
      addition to the re-applying the changes in the commit 9ce650a7,
      this patch introduces a new flag indicating the delayed period-elapsed
      handling and sets it under the possible deadlock condition
      (i.e. prepare callback being called before subs->running is set).
      Once when the flag is set, the period-elapsed call is handled at a
      later URB complete call instead.
      
      As a reference for the original motivation for the low-latency change,
      I cite here again:
      
      | USB-audio driver behaves a bit strangely for the playback stream --
      | namely, it starts sending silent packets at PCM prepare state while
      | the actual data is submitted at first when the trigger START is
      | kicked off.  This is a workaround for the behavior where URBs are
      | processed too quickly at the beginning.  That is, if we start
      | submitting URBs at trigger START, the first few URBs will be
      | immediately completed, and this would result in the immediate
      | period-elapsed calls right after the start, which may confuse
      | applications.
      |
      | OTOH, submitting the data after silent URBs would, of course, result
      | in a certain delay of the actual data processing, and this is rather
      | more serious problem on modern systems, in practice.
      |
      | This patch tries to revert the workaround and lets the URB
      | submission starting at PCM trigger for the playback again.  As far
      | as I've tested with various backends (native ALSA, PA, JACK, PW), I
      | haven't seen any problems (famous last words :)
      |
      | Note that the capture stream handling needs no such workaround,
      | since the capture is driven per received URB.
      
      Link: https://lore.kernel.org/r/4e71531f-4535-fd46-040e-506a3c256bbd@marcan.st
      Link: https://lore.kernel.org/r/s5hbl7li0fe.wl-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20210707112447.27485-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      307cc9ba
  12. 03 7月, 2021 1 次提交
    • L
      Revert "ALSA: usb-audio: Reduce latency at playback start" · 4b820e16
      Linus Torvalds 提交于
      This reverts commit 9ce650a7.
      
      This commit causes watchdog lockups on my machine, and while I have no
      idea what the cause is, it bisected right to this commit, and reverting
      the change promptly fixes it.
      
      At least occasionally one of the watchdog call traces was
      
        Call Trace:
          _raw_spin_lock_irqsave+0x35/0x40
          snd_pcm_period_elapsed+0x1b/0xa0 [snd_pcm]
          snd_usb_endpoint_start+0x1a0/0x3c0 [snd_usb_audio]
          start_endpoints+0x23/0x90 [snd_usb_audio]
          snd_usb_substream_playback_trigger+0x7b/0x1a0 [snd_usb_audio]
          snd_pcm_common_ioctl+0x1c44/0x2360 [snd_pcm]
          snd_pcm_ioctl+0x2e/0x40 [snd_pcm]
          __se_sys_ioctl+0x72/0xc0
          do_syscall_64+0x4c/0xa0
          entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      so presumably it's a locking error on that substream spinlock that
      snd_pcm_period_elapsed() takes.  But at this point I just want to have a
      working system so that I can continue the merge window work tomorrow.
      
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4b820e16
  13. 02 6月, 2021 5 次提交
    • T
      ALSA: usb-audio: Reduce latency at playback start · 9ce650a7
      Takashi Iwai 提交于
      USB-audio driver behaves a bit strangely for the playback stream --
      namely, it starts sending silent packets at PCM prepare state while
      the actual data is submitted at first when the trigger START is kicked
      off.  This is a workaround for the behavior where URBs are processed
      too quickly at the beginning.  That is, if we start submitting URBs at
      trigger START, the first few URBs will be immediately completed, and
      this would result in the immediate period-elapsed calls right after
      the start, which may confuse applications.
      
      OTOH, submitting the data after silent URBs would, of course, result
      in a certain delay of the actual data processing, and this is rather
      more serious problem on modern systems, in practice.
      
      This patch tries to revert the workaround and lets the URB submission
      starting at PCM trigger for the playback again.  As far as I've tested
      with various backends (native ALSA, PA, JACK, PW), I haven't seen any
      problems (famous last words :)
      
      Note that the capture stream handling needs no such workaround, since
      the capture is driven per received URB.
      
      Link: https://lore.kernel.org/r/20210601162457.4877-6-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      9ce650a7
    • T
      ALSA: usb-audio: Factor out DSD bitrev copy function · 4f083917
      Takashi Iwai 提交于
      Just minor code refactoring.  Like DOP DSD code, it can be better in a
      separate function for code readability.
      
      Link: https://lore.kernel.org/r/20210601162457.4877-5-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      4f083917
    • T
      ALSA: usb-audio: Refactoring delay account code · e8a8f09c
      Takashi Iwai 提交于
      The PCM delay accounting in USB-audio driver is a bit complex to
      follow, and this is an attempt to improve the readability and provide
      some potential fix.
      
      Basically, the PCM position delay is calculated from two factors: the
      in-flight data on URBs and the USB frame counter.  For the playback
      stream, we advance the hwptr already at submitting URBs.  Those
      "in-flight" data amount is now tracked, and this is used as the base
      value for the PCM delay correction.  The in-flight data is decreased
      again at URB completion in return.  For the capture stream, OTOH,
      there is no in-flight data, hence the delay base is zero.
      
      The USB frame counter is used in addition for correcting the current
      position.  The reference frame counter is updated at each submission
      and receiving time, and the difference from the current counter value
      is taken into account.
      
      In this patch, each in-flight data bytes is recorded in the new
      snd_usb_ctx.queued field, and the total in-flight amount is tracked in
      snd_usb_substream.inflight_bytes field, as the replacement of
      last_delay field.
      
      Note that updating the hwptr after URB completion doesn't work for
      PulseAudio who tries to scratch the buffer on the fly; USB-audio is
      basically a double-buffer implementation, hence the scratching the
      buffer can't work for the already submitted data.  So we always update
      hwptr beforehand.  It's not ideal, but the delay account should give
      enough correctness.
      
      Link: https://lore.kernel.org/r/20210601162457.4877-4-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      e8a8f09c
    • T
      ALSA: usb-audio: Pre-calculate buffer byte size · d303c5d3
      Takashi Iwai 提交于
      There are a bunch of lines calculating the buffer size in bytes at
      each time.  Keep the value in subs->buffer_bytes and use it
      consistently for the code simplicity.
      
      Link: https://lore.kernel.org/r/20210601162457.4877-3-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      d303c5d3
    • T
      ALSA: usb-audio: Make snd_usb_pcm_delay() static · cdebd553
      Takashi Iwai 提交于
      It's a local function, let's make it static.
      
      Link: https://lore.kernel.org/r/20210601162457.4877-2-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      cdebd553
  14. 28 2月, 2021 1 次提交
    • T
      ALSA: usb-audio: Allow modifying parameters with succeeding hw_params calls · 5f5e6a3e
      Takashi Iwai 提交于
      The recent fix for the hw constraints for implicit feedback streams
      via commit e4ea77f8 ("ALSA: usb-audio: Always apply the hw
      constraints for implicit fb sync") added the check of the matching
      endpoints and whether those EPs are already opened.  This is needed
      and correct, per se, even for the normal streams without the implicit
      feedback, as the endpoint setup is exclusive.
      
      However, it's reported that there seem applications that behave in
      unexpected ways to update the hw_params without clearing the previous
      setup via hw_free, and those hit a problem now: then hw_params is
      called with still the previous EP setup kept, hence it's restricted
      with the previous own setup.  Although the obvious fix is to call
      snd_pcm_hw_free() API in the application side, it's a kind of
      unwelcome change.
      
      This patch tries to ease the situation: in the endpoint check, we add
      a couple of more conditions and now skip the endpoint that is being
      used only by the stream in question itself.  That is, in addition to
      the presence check of ep (ep->cur_audiofmt is non-NULL), when the
      following conditions are met, we skip such an ep:
      - ep->opened == 1, and
      - ep->cur_audiofmt == subs->cur_audiofmt.
      
      subs->cur_audiofmt is non-NULL only if it's a re-setup of hw_params,
      and ep->cur_audiofmt points to the currently set up parameters.  So if
      those match, it must be this stream itself.
      
      Fixes: e4ea77f8 ("ALSA: usb-audio: Always apply the hw constraints for implicit fb sync")
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=211941
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210228080138.9936-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      5f5e6a3e
  15. 08 2月, 2021 1 次提交
  16. 06 2月, 2021 1 次提交
    • T
      ALSA: usb-audio: Fix PCM buffer allocation in non-vmalloc mode · fb3c293b
      Takashi Iwai 提交于
      The commit f274baa4 ("ALSA: usb-audio: Allow non-vmalloc buffer
      for PCM buffers") introduced the mode to allocate coherent pages for
      PCM buffers, and it used bus->controller device as its DMA device.
      It turned out, however, that bus->sysdev is a more appropriate device
      to be used for DMA mapping in HCD code.
      
      This patch corrects the device reference accordingly.
      
      Note that, on most platforms, both point to the very same device,
      hence this patch doesn't change anything practically.  But on
      platforms like xhcd-plat hcd, the change becomes effective.
      
      Fixes: f274baa4 ("ALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers")
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210205144559.29555-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      fb3c293b
  17. 21 1月, 2021 1 次提交
    • T
      ALSA: usb-audio: Fix hw constraints dependencies · 506c203c
      Takashi Iwai 提交于
      Since the recent refactoring, it's been reported that some USB-audio
      devices (typically webcams) are no longer detected properly by
      PulseAudio.  The debug session revealed that it's failing at probing
      by PA to try the sample rate 44.1kHz while the device has discrete
      sample rates other than 44.1kHz.  But the puzzle was that arecord
      works as is, and some other devices with the discrete rates work,
      either.
      
      After all, this turned out to be the lack of the dependencies in a few
      hw constraint rules: snd_pcm_hw_rule_add() has the (variable)
      arguments specifying the dependent parameters, and some functions
      didn't set the target parameter itself as the dependencies.  This
      resulted in an invalid parameter that could be generated only in a
      certain call pattern.  This bug itself has been present in the code,
      but it didn't trigger errors just because the rules were casually
      avoiding such a corner case.  After the recent refactoring and
      cleanup, however, the hw constraints work "as expected", and the
      problem surfaced now.
      
      For fixing the problem above, this patch adds the missing dependent
      parameters to each snd_pcm_hw_rule() call.
      
      Fixes: bc4e94aa ("ALSA: usb-audio: Handle discrete rates properly in hw constraints")
      BugLink: http://bugzilla.opensuse.org/show_bug.cgi?id=1181014
      Link: https://lore.kernel.org/r/20210120204554.30177-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      506c203c
  18. 14 1月, 2021 1 次提交
    • T
      ALSA: usb-audio: Always apply the hw constraints for implicit fb sync · e4ea77f8
      Takashi Iwai 提交于
      Since the commit 5a6c3e11 ("ALSA: usb-audio: Add hw constraint for
      implicit fb sync"), we apply the hw constraints for the implicit
      feedback sync to make the secondary open aligned with the already
      opened stream setup.  This change assumed that the secondary open is
      performed after the first stream has been already set up, and adds the
      hw constraints to sync with the first stream's parameters only when
      the EP setup for the first stream was confirmed at the open time.
      However, most of applications handling the full-duplex operations do
      open both playback and capture streams at first, then set up both
      streams.  This results in skipping the additional hw constraints since
      the counter-part stream hasn't been set up yet at the open of the
      second stream, and it eventually leads to "incompatible EP" error in
      the end.
      
      This patch corrects the behavior by always applying the hw constraints
      for the implicit fb sync.  The hw constraint rules are defined so that
      they check the sync EP dynamically at each invocation, instead.  This
      covers the concurrent stream setups better and lets the hw refine
      calls resolving to the right configuration.
      
      Also this patch corrects a minor error that has existed in the debug
      print that isn't built as default.
      
      Fixes: 5a6c3e11 ("ALSA: usb-audio: Add hw constraint for implicit fb sync")
      Link: https://lore.kernel.org/r/20210111081611.12790-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      e4ea77f8
  19. 23 11月, 2020 9 次提交