05 Jan, 2017

2 commits

  • 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: Ioan-Adrian Ratiu
    Signed-off-by: Takashi Iwai

    Ioan-Adrian Ratiu
     
  • Commit 16200948d83 ("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 015618b90 ("ALSA: snd-usb: Fix URB cancellation at stream start")
    [2] commit e9ba389c5 ("ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM capture stream")
    [3] commit ccc1696d5 ("ALSA: usb-audio: simplify endpoint deactivation code")

    Fixes: f8114f8583bb ("Revert "ALSA: usb-audio: Fix race at stopping the stream"")

    Signed-off-by: Ioan-Adrian Ratiu
    Signed-off-by: Takashi Iwai

    Ioan-Adrian Ratiu
     

22 Dec, 2016

1 commit

  • This reverts commit 16200948d8353fe29a473a394d7d26790deae0e7.

    The commit was intended to cover the race condition, but it introduced
    yet another regression for devices with the implicit feedback, leading
    to a kernel panic due to NULL-dereference in an irq context.

    As the race condition that was addressed by the commit is very rare
    and the regression is much worse, let's revert the commit for rc1, and
    fix the issue properly in a later patch.

    Fixes: 16200948d835 ("ALSA: usb-audio: Fix race at stopping the stream")
    Reported-by: Ioan-Adrian Ratiu
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Linus Torvalds

    Takashi Iwai
     

13 Dec, 2016

1 commit

  • [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: Nobutaka Okabe
    Signed-off-by: Takashi Iwai

    Nobutaka Okabe
     

09 Dec, 2016

1 commit


06 Dec, 2016

1 commit

  • since commit 57e6dae1087b ("ALSA: usb-audio: do not trust too-big
    wMaxPacketSize values"), the expected packetsize is always limited
    to nominal + 25%. It was discovered, that some devices (Android audio
    accessory) have a much higher jitter in used packetsizes than 25%
    which would result in BABBLE condition and dropping of packets.
    A better solution is so assume the jitter to be the nominal packetsize:
    -one nearly empty packet followed by a almost 150% sized one.

    V2: changed to assume max frequency is +50 of nominal packetsize.

    Signed-off-by: Andreas Pape
    Signed-off-by: Jiada Wang
    Acked-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Andreas Pape
     

05 Dec, 2016

1 commit

  • 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 : [] lr : [] 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:
    [] (retire_capture_urb [snd_usb_audio]) from [] (snd_complete_urb+0x140/0x1f0 [snd_usb_audio])
    [] (snd_complete_urb [snd_usb_audio]) from [] (__usb_hcd_giveback_urb+0x78/0xf4)
    [] (__usb_hcd_giveback_urb) from [] (usb_giveback_urb_bh+0x8c/0xc0)
    [] (usb_giveback_urb_bh) from [] (tasklet_hi_action+0xc4/0x148)
    [] (tasklet_hi_action) from [] (__do_softirq+0x190/0x380)
    [] (__do_softirq) from [] (irq_exit+0x8c/0xfc)
    [] (irq_exit) from [] (handle_IRQ+0x8c/0xc8)
    [] (handle_IRQ) from [] (gic_handle_irq+0xbc/0xf8)
    [] (gic_handle_irq) from [] (__irq_svc+0x44/0x78)
    [] (_raw_spin_unlock_irq) from [] (finish_task_switch+0x5c/0x100)
    [] (finish_task_switch) from [] (__schedule+0x48c/0x6d8)
    [] (__schedule) from [] (schedule+0x98/0x9c)
    [] (schedule) from [] (do_work_pending+0x30/0xd0)
    [] (do_work_pending) from [] (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: b2eb950de2f0 ("ALSA: usb-audio: stop both data and sync...")
    Reported-by: Jiada Wang
    Reported-by: Mark Craske
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

22 Aug, 2016

3 commits

  • Users of devices affected by the Tenor feedback data error report
    buffer underruns, even with the +/- 0x1.0000 quirk applied.
    Compensating the error with 0xf000 instead seems to reliably fix
    that issue.

    See

    https://sourceforge.net/p/alsa/mailman/message/35230259/

    Reported-and-tested-by: Norman Nolte
    Reported-and-tested-by: Thomas Gresens
    Signed-off-by: Daniel Mack
    Signed-off-by: Takashi Iwai

    Daniel Mack
     
  • The quirk seems to be necessary not only for TEAC UD-H01 devices, but to
    more that are based on the Tenor 8802TL chipset. Devices built by T+A
    are affected too, and they apparently all use the same USB PID:PID.

    Extend the quirky handling for that device as well, and rename the
    quirks flag.

    Reported-and-tested-by: Thomas Gresens
    Signed-off-by: Daniel Mack
    Signed-off-by: Takashi Iwai

    Daniel Mack
     
  • That's a quirk, after all, so move it where to all the other quirks
    live.

    Signed-off-by: Daniel Mack
    Signed-off-by: Takashi Iwai

    Daniel Mack
     

16 Mar, 2016

1 commit

  • Add some sanity check codes before actually accessing the endpoint via
    get_endpoint() in order to avoid the invalid access through a
    malformed USB descriptor. Mostly just checking bNumEndpoints, but in
    one place (snd_microii_spdif_default_get()), the validity of iface and
    altsetting index is checked as well.

    Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

19 Oct, 2015

3 commits

  • For the Zoom R16/24 (tx_length_quirk set), when calculating the maximum
    sample frequency, consideration must be made for the fact that four bytes
    of the packet contain a length descriptor and consequently must not be
    counted as part of the audio data.

    This is corroborated by the wMaxPacketSize for this device, which is 108
    bytes according for the USB playback endpoint descriptor. The frame size
    is 8 bytes (2 channels of 4 bytes each), and the 108 bytes thus work out
    as 13 * 8 + 4, i.e. corresponding to 13 frames plus the additional 4 byte
    length descriptor.

    Signed-off-by: Ricard Wanderlof
    Signed-off-by: Takashi Iwai

    Ricard Wanderlof
     
  • The Zoom R16/24 have a nonstandard playback format where each isochronous
    packet contains a length descriptor in the first four bytes. (Curiously,
    capture data does not contain this and requires no quirk.)

    The quirk involves adding the extra length descriptor whenever outgoing
    isochronous packets are generated, both in pcm.c (outgoing audio) and
    endpoint.c (silent data).

    In order to make the quirk as unintrusive as possible, for
    pcm.c:prepare_playback_urb(), the isochronous packet descriptors are
    initially set up in the same way no matter if the quirk is enabled or not.
    Once it is time to actually copy the data into the outgoing packet buffer
    (together with the added length descriptors) the isochronous descriptors
    are adjusted in order take the increased payload length into account.

    For endpoint.c:prepare_silent_urb() it makes more sense to modify the
    actual function, partly because the function is less complex to start with
    and partly because it is not as time-critical as prepare_playback_urb()
    (whose bulk is run with interrupts disabled), so the (minute) additional
    time spent in the non-quirk case is motivated by the simplicity of having
    a single function for all cases.

    The quirk is controlled by the new tx_length_quirk member in struct
    snd_usb_substream and struct snd_usb_audio, which is conveyed to pcm.c
    and endpoint.c from quirks.c in a similar manner to the txfr_quirk member
    in the same structs.

    In contrast to txfr_quirk however, the quirk is enabled directly in
    quirks.c:create_standard_audio_quirk() by checking the USB ID in that
    function. Another option would be to introduce a new
    QUIRK_AUDIO_ZOOM_INTERFACE or somesuch, which would have made the quirk
    very plain to see in the quirk table, but it was felt that the additional
    code needed to implement it this way would just make the implementation
    more complex with no real gain.

    Tested with a Zoom R16, both by doing capture and playback separately
    using arecord and aplay (8 channel capture and 2 channel playback,
    respectively), as well as capture and playback together using Ardour, as
    well as Audacity and Qtractor together with jackd.

    The R24 is reportedly compatible with the R16 when used as an audio
    interface. Both devices share the same USB ID and have the same number of
    inputs (8) and outputs (2). Therefore "R16/24" is mentioned throughout the
    patch.

    Regression tested using an Edirol UA-5 in both class compliant (16-bit)
    and "advanced" (24 bit, forces the use of quirks) modes.

    Signed-off-by: Ricard Wanderlof
    Tested-by: Panu Matilainen
    Signed-off-by: Takashi Iwai

    Ricard Wanderlof
     
  • Refactoring in preparation for adding Zoom R16/24 quirk.
    No functional change.

    Signed-off-by: Ricard Wanderlof
    Signed-off-by: Takashi Iwai

    Ricard Wanderlof
     

13 Oct, 2015

1 commit

  • Rounding must take place before multiplication with the frame size, since
    each packet contains a whole number of frames.

    We must also properly consider the data interval, as a larger data
    interval will result in larger packets, which, depending on the sampling
    frequency, can result in packet sizes that are less than integral
    multiples of the packet size for a lower data interval.

    Detailed explanation and rationale:

    The code before this commit had the following expression on line 613 to
    calculate the maximum isochronous packet size:

    maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))
    >> (16 - ep->datainterval);

    Here, ep->freqmax is the maximum assumed sample frequency, calculated from the
    nominal sample frequency plus 25%. It is ultimately derived from ep->freqn,
    which is in the units of frames per packet, from get_usb_full_speed_rate()
    or usb_high_speed_rate(), as applicable, in Q16.16 format.

    The expression essentially adds the Q16.16 equivalent of 0.999... (i.e.
    the largest number less than one) to the sample rate, in order to get a
    rate whose integer part is rounded up from the fractional value. The
    multiplication with (frame_bits >> 3) yields the number of bytes in a
    packet, and the (16 >> ep->datainterval) then converts it from Q16.16 back
    to an integer, taking into consideration the bDataInterval field of the
    endpoint descriptor (which describes how often isochronous packets are
    transmitted relative to the (micro)frame rate (125us or 1ms, for USB high
    speed and full speed, respectively)). For this discussion we will initially
    assume a bDataInterval of 0, so the second line of the expression just
    converts the Q16.16 value to an integer.

    In order to illustrate the problem, we will set frame_bits 64, which
    corresponds to a frame size of 8 bytes.

    The problem here is twofold. First, the rounding operation consists
    of the addition of 0x0.ffff and subsequent conversion to integer, but as the
    expression stands, the conversion to integer is done after multiplication
    with the frame size, rather than before. This results in the resulting
    maxsize becoming too large.

    Let's take an example. We have a sample rate of 96 kHz, so our ep->freqn is
    0xc0000 (see usb_high_speed_rate()). Add 25% (line 612) and we get 0xf0000.
    The calculated maxsize is then ((0xf0000 + 0x0ffff) * 8) >> 16 = 127 .
    However, if we do the number of bytes calculation in a less obscure way it's
    more apparent what the true corresponding packet size is: we get
    ceil(96000 * 1.25 / 8000) * 8 = 120, where 1.25 is the 25% from line 612,
    and the 8000 is the number of isochronous packets per second on a high
    speed USB connection (125 us microframe interval).

    This is fixed by performing the complete rounding operation prior to
    multiplication with the frame rate.

    The second problem is that when considering the ep->datainterval, this
    must be done before rounding, in order to take the advantage of the fact
    that if the number of bytes per packet is not an integer, the resulting
    rounded-up integer is not necessarily a factor of two when the data
    interval is increased by the same factor.

    For instance, assuming a freqency of 41 kHz, the resulting
    bytes-per-packet value for USB high speed is 41 kHz / 8000 = 5.125, or
    0x52000 in Q16.16 format. With a data interval of 1 (ep->datainterval = 0),
    this means that 6 frames per packet are needed, whereas with a data
    interval of 2 we need 10.25, i.e. 11 frames needed.

    Rephrasing the maxsize expression to:

    maxsize = (((ep->freqmax << ep->datainterval) + 0xffff) >> 16) *
    (frame_bits >> 3);

    for the above 96 kHz example we instead get
    ((0xf0000 + 0xffff) >> 16) * 8 = 120 which is the correct value.

    We can also do the calculation with a non-integer sample rate which is when
    rounding comes into effect: say we have 44.1 kHz (resulting ep->freqn =
    0x58333, and resulting ep->freqmax 0x58333 * 1.25 = 0x6e3ff (rounded down)):

    Original maxsize = ((0x6e3ff + 0xffff) * 8) << 16 = 63 (63.124.. rounded down)
    True maxsize = ceil(44100 * 1.25 / 8000) * 8 = 7 * 8 = 56
    New maxsize = ((0x6e3ff + 0xffff) >> 16) * 8 = 7 * 8 = 56

    This is also corroborated by the wMaxPacketSize check on line 616. Assume
    that wMaxPacketSize = 104, with ep->maxpacksize then having the same value.
    As 104 < 127, we get maxsize = 104. ep->freqmax is then recalculated to
    (104 / 8) << 16 = 0xd0000 . Putting that rate into the original maxsize
    calculation yields a maxsize of ((0xd0000 + 0xffff) * 8) >> 16 = 111
    (with decimals 111.99988). Clearly, we should get back the 104 here,
    which we would with the new expression: ((0xd0000 + 0xffff) >> 16) * 8 = 104 .

    (The error has not been a problem because it only results in maxsize being
    a bit too big which just wastes a couple of bytes, either as a result of
    the first maxsize calculation, or because the resulting calculation will
    hit the wMaxPacketSize value before the packet is too big, resulting in
    fixing the size to wMaxPacketSize even though the packet is actually not
    too long.)

    Tested with an Edirol UA-5 both at 44.1 kHz and 96 kHz.

    Signed-off-by: Ricard Wanderlof
    Signed-off-by: Takashi Iwai

    Ricard Wanderlof
     

26 Aug, 2015

1 commit

  • After the recent fix of runtime PM for USB-audio driver, we got a
    lockdep warning like:

    =============================================
    [ INFO: possible recursive locking detected ]
    4.2.0-rc8+ #61 Not tainted
    ---------------------------------------------
    pulseaudio/980 is trying to acquire lock:
    (&chip->shutdown_rwsem){.+.+.+}, at: [] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]
    but task is already holding lock:
    (&chip->shutdown_rwsem){.+.+.+}, at: [] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]

    This comes from snd_usb_autoresume() invoking down_read() and it's
    used in a nested way. Although it's basically safe, per se (as these
    are read locks), it's better to reduce such spurious warnings.

    The read lock is needed to guarantee the execution of "shutdown"
    (cleanup at disconnection) task after all concurrent tasks are
    finished. This can be implemented in another better way.

    Also, the current check of chip->in_pm isn't good enough for
    protecting the racy execution of multiple auto-resumes.

    This patch rewrites the logic of snd_usb_autoresume() & co; namely,
    - The recursive call of autopm is avoided by the new refcount,
    chip->active. The chip->in_pm flag is removed accordingly.
    - Instead of rwsem, another refcount, chip->usage_count, is introduced
    for tracking the period to delay the shutdown procedure. At
    the last clear of this refcount, wake_up() to the shutdown waiter is
    called.
    - The shutdown flag is replaced with shutdown atomic count; this is
    for reducing the lock.
    - Two new helpers are introduced to simplify the management of these
    refcounts; snd_usb_lock_shutdown() increases the usage_count, checks
    the shutdown state, and does autoresume. snd_usb_unlock_shutdown()
    does the opposite. Most of mixer and other codes just need this,
    and simply returns an error if it receives an error from lock.

    Fixes: 9003ebb13f61 ('ALSA: usb-audio: Fix runtime PM unbalance')
    Reported-and-tested-by: Alexnader Kuleshov
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

10 Nov, 2014

1 commit

  • Add a new helper function snd_pcm_stop_xrun() to the standard sequnce
    lock/snd_pcm_stop(XRUN)/unlock by a single call, and replace the
    existing open codes with this helper.

    The function checks the PCM running state to prevent setting the wrong
    state, too, for more safety.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

06 Nov, 2014

1 commit

  • The usb-audio driver detects XRUN at its complete callback, but the
    actual code to trigger PCM XRUN is commented out because it caused
    deadlock in the past. This patch revives the PCM trigger properly.
    It resulted in more than just enabling snd_pcm_stop(), but it had to
    deduce the PCM substream with proper NULL checks and holds the stream
    lock around the call.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

04 Nov, 2014

1 commit

  • Some functions in mixer.c and endpoint.c receive list_head instead of
    the object itself. This is not obvious and rather error-prone. Let's
    pass the proper object directly instead.

    The functions in midi.c still receive list_head and this can't be
    changed since the object definition isn't exposed to the outside of
    midi.c, so left as is.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

26 Jun, 2014

1 commit

  • When a USB-audio device is disconnected while PCM is still running, we
    still see some race: the disconnect callback calls
    snd_usb_endpoint_free() that calls release_urbs() and then kfree()
    while a PCM stream would be closed at the same time and calls
    stop_endpoints() that leads to wait_clear_urbs(). That is, the EP
    object might be deallocated while a PCM stream is syncing with
    wait_clear_urbs() with the same EP.

    Basically calling multiple wait_clear_urbs() would work fine, also
    calling wait_clear_urbs() and release_urbs() would work, too, as
    wait_clear_urbs() just reads some fields in ep. The problem is the
    succeeding kfree() in snd_pcm_endpoint_free().

    This patch moves out the EP deallocation into the later point, the
    destructor callback. At this stage, all PCMs must have been already
    closed, so it's safe to free the objects.

    Reported-by: Alan Stern
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

03 May, 2014

1 commit

  • The TEAC UD-H01 firmware sends wrong feedback frequency values, thus
    causing the PC to send the samples at a wrong rate, which results in
    clicks and crackles in the output.

    Add a workaround to detect and fix the corruption.

    Signed-off-by: Clemens Ladisch
    [mick37@gmx.de: use sender->udh01_fb_quirk rather than
    ep->udh01_fb_quirk in snd_usb_handle_sync_urb()]
    Reported-and-tested-by: Mick
    Reported-and-tested-by: Andrea Messa
    Cc:
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

26 Feb, 2014

1 commit

  • Convert with dev_err() and co from snd_printk(), etc.
    As there are too deep indirections (e.g. ep->chip->dev->dev),
    a few new local macros, usb_audio_err() & co, are introduced.

    Also, the device numbers in some messages are dropped, as they are
    shown in the prefix automatically.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

27 Nov, 2013

1 commit


07 Oct, 2013

5 commits


26 Sep, 2013

1 commit

  • This patch changes the way URBs are allocated and their sizes are
    determined for PCM playback in the snd-usb-audio driver. Currently
    the driver allocates too few URBs for endpoints that don't use
    implicit sync, making underruns more likely to occur. This may be a
    holdover from before I/O delays could be measured accurately; in any
    case, it is no longer necessary.

    The patch allocates as many URBs as possible, subject to four
    limitations:

    The total number of URBs for the endpoint is not allowed to
    exceed MAX_URBS (which the patch increases from 8 to 12).

    The total number of packets per URB is not allowed to exceed
    MAX_PACKS (or MAX_PACKS_HS for high-speed devices), which is
    decreased from 20 to 6.

    The total duration of queued data is not allowed to exceed
    MAX_QUEUE, which is decreased from 24 ms to 18 ms.

    The total number of ALSA frames in the output queue is not
    allowed to exceed the ALSA buffer size.

    The last requirement is the hardest to implement. Currently the
    number of URBs needed to fill a buffer cannot be determined in
    advance, because a buffer contains a fixed number of frames whereas
    the number of frames in an URB varies to match shifts in the device's
    clock rate. To solve this problem, the patch changes the logic for
    deciding how many packets an URB should contain. Rather than using as
    many as possible without exceeding an ALSA period boundary, now the
    driver uses only as many packets as needed to transfer a predetermined
    number of frames. As a result, unless the device's clock has an
    exceedingly variable rate, the number of URBs making up each period
    (and hence each buffer) will remain constant.

    The overall effect of the patch is that playback works better in
    low-latency settings. The user can still specify values for
    frames/period and periods/buffer that exceed the capabilities of the
    hardware, of course. But for values that are within those
    capabilities, the performance will be improved. For example, testing
    shows that a high-speed device can handle 32 frames/period and 3
    periods/buffer at 48 KHz, whereas the current driver starts to get
    glitchy at 64 frames/period and 2 periods/buffer.

    A side effect of these changes is that the "nrpacks" module parameter
    is no longer used. The patch removes it.

    Signed-off-by: Alan Stern
    CC: Clemens Ladisch
    Tested-by: Daniel Mack
    Tested-by: Eldad Zack
    Signed-off-by: Takashi Iwai

    Alan Stern
     

23 Aug, 2013

1 commit

  • ASoC: Updates for v3.12

    - DAPM is now mandatory for CODEC drivers in order to avoid the repeated
    regressions in the special cases for non-DAPM CODECs and make it
    easier to integrate with other components on boards. All existing
    drivers have had some level of DAPM support added.
    - A lot of cleanups in DAPM plus support for maintaining controls in a
    specific state while a DAPM widget all contributed by Lars-Peter Clausen.
    - Core helpers for bitbanged AC'97 reset from Markus Pargmann.
    - New drivers and support for Analog Devices ADAU1702 and ADAU1401(a),
    Asahi Kasei Microdevices AK4554, Atmel AT91ASM9x5 and WM8904 based
    machines, Freescale S/PDIF and SSI AC'97, Renesas R-Car SoCs, Samsung
    Exynos5420 SoCs, Texas Instruments PCM1681 and PCM1792A and Wolfson
    Microelectronics WM8997.
    - Support for building drivers that can support it cross-platform for
    compile test.

    Takashi Iwai
     

08 Aug, 2013

1 commit

  • The driver used to assume that the streaming endpoint's wMaxPacketSize
    value would be an indication of how much data the endpoint expects or
    sends, and compute the number of packets per URB using this value.

    However, the Focusrite Scarlett 2i4 declares a value of 1024 bytes,
    while only about 88 or 44 bytes are be actually used. This discrepancy
    would result in URBs with far too few packets, which would not work
    correctly on the EHCI driver.

    To get correct URBs, use wMaxPacketSize only as an upper limit on the
    packet size.

    Reported-by: James Stone
    Tested-by: James Stone
    Cc: # 2.6.35+
    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

06 Aug, 2013

1 commit


29 Apr, 2013

1 commit

  • The recent changes in the USB API ("implement new semantics for
    URB_ISO_ASAP") made the former meaning of the URB_ISO_ASAP flag the
    default, and changed this flag to mean that URBs can be delayed.
    This is not the behaviour wanted by any of the audio drivers because
    it leads to discontinuous playback with very small period sizes.
    Therefore, our URBs need to be submitted without this flag.

    Reported-by: Joe Rayhawk
    Cc: # 3.8 only
    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

18 Apr, 2013

1 commit

  • In order to provide a compatibility way for pushing DSD
    samples through ordinary PCM channels, the "DoP open Standard" was
    invented. See http://www.dsd-guide.com for the official document.

    The host is required to stuff DSD marker bytes (0x05, 0xfa,
    alternating) in the MSB of 24 bit wide samples on the bus, in addition
    to the 16 bits of actual DSD sample payload.

    To support this, the hardware and software stride logic in the driver
    has to be tweaked a bit, as we make the userspace believe we're
    operating on 16 bit samples, while we in fact push one more byte per
    channel down to the hardware.

    The DOP runtime information is stored in struct snd_usb_substream, so
    we can keep track of our state across multiple calls to
    prepare_playback_urb_dsd_dop().

    Signed-off-by: Daniel Mack
    Signed-off-by: Takashi Iwai

    Daniel Mack
     

04 Apr, 2013

2 commits


29 Nov, 2012

1 commit

  • For implicit feedback endpoints, the number of bytes for each packet
    is matched by the corresponding synchronizing endpoint.
    The size is calculated by taking the actual size and dividing it by
    the stride - currently by the endpoint's stride, but we should use the
    synchronization source's stride.
    This is evident when the number of channels differ between the
    synchronization source and the implicitly fed-back endpoint, as with
    M-Audio Fast Track C400 - the synchronization source (capture)
    has 4 channels, while the implicit feedback mode endpoint has 6.

    Signed-off-by: Eldad Zack
    Signed-off-by: Takashi Iwai

    Eldad Zack
     

21 Nov, 2012

3 commits