26 Jul, 2016

1 commit

  • ASoC: Updates for v4.8

    Not really any framework work this time around (though we have seen one
    of the Analog Devices drivers move more to the clock API which is good
    to see) but rather a lot of new drivers:

    - Lots of updates for the Intel drivers, mostly board support and bug
    fixing, and to the NAU8825 driver.
    - Work on generalizing bits of simple-card to allow more code sharing
    with the Renesas rsrc-card (which can't use simple-card due to DPCM).
    - Removal of the Odroid X2 driver due to replacement with simple-card.
    - Support for several new Mediatek platforms and associated boards.
    - New drivers for Allwinner A10, Analog Devices ADAU7002, Broadcom
    Cygnus, Cirrus Logic CS35L33 and CS53L30, Maxim MAX8960 and MAX98504,
    Realtek RT5514 and Wolfson WM8758

    Takashi Iwai
     

25 Jul, 2016

2 commits


08 Jul, 2016

2 commits

  • The chmap ctls assigned to PCM streams are freed in the PCM disconnect
    callback. However, since the disconnect callback isn't called when
    the card gets freed before registering, the chmap ctls may still be
    left assigned. They are eventually freed together with other ctls,
    but it may cause an Oops at pcm_chmap_ctl_private_free(), as the
    function refers to the assigned PCM stream, while the PCM objects have
    been already freed beforehand.

    The fix is to free the chmap ctls also at PCM free callback, not only
    at PCM disconnect.

    Reported-by: Laxminath Kasam
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • snd_ctl_remove() has a notification for the removal event. It's
    superfluous when done during the device got disconnected. Although
    the notification itself is mostly harmless, it may potentially be
    harmful, and should be suppressed. Actually some components PCM may
    free ctl elements during the disconnect or free callbacks, thus it's
    no theoretical issue.

    This patch adds the check of card->shutdown flag for avoiding
    unnecessary notifications after (or during) the disconnect.

    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

07 Jul, 2016

1 commit

  • The 'dimen' field in struct snd_ctl_elem_info is used to compose all of
    members in the element as multi-dimensional matrix. The field has four
    members. Each member represents the width in each dimension level by
    element member unit. For example, if the members consist of typical
    two dimensional matrix, the dimen[0] represents the number of rows
    and dimen[1] represents the number of columns (or vise-versa).

    The total members in the matrix should be exactly the same as the number
    of members in the element, while current implementation has no validator
    of this information. In a view of userspace applications, the information
    must be valid so that it cannot cause any bugs such as buffer-over-run.

    This commit adds a validator of dimension information for userspace
    applications which add new element sets. When they add the element sets
    with wrong dimension information, they receive -EINVAL.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

04 Jul, 2016

1 commit

  • The user timer tu->qused counter may go to a negative value when
    multiple concurrent reads are performed since both the check and the
    decrement of tu->qused are done in two individual locked contexts.
    This results in bogus read outs, and the endless loop in the
    user-space side.

    The fix is to move the decrement of the tu->qused counter into the
    same spinlock context as the zero-check of the counter.

    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

18 Jun, 2016

1 commit

  • The sequencer client manager reports timestamps in units of unsigned
    32-bit seconds/nanoseconds, but that does not suffer from the y2038
    overflow because it stores only the delta since the 'last_update'
    time was recorded.

    However, the use of the do_gettimeofday() function is problematic
    and we have to replace it to avoid the overflow on on 32-bit
    architectures.

    This uses 'struct timespec64' to record 'last_update', and changes
    the code to use monotonic timestamps that do not suffer from leap
    seconds and settimeofday updates.

    As a side-effect, the code can now use the timespec64_sub() helper
    and become more readable and also avoid a multiplication to convert
    from microseconds to nanoseconds.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Takashi Iwai

    Arnd Bergmann
     

15 Jun, 2016

1 commit

  • Replace the in order struct initialisation style with explicit field
    style.

    The Coccinelle semantic patch used to make this change is as follows:

    @decl@
    identifier i1,fld;
    type T;
    field list[n] fs;
    @@

    struct i1 {
    fs
    T fld;
    ...};

    @@
    identifier decl.i1,i2,decl.fld;
    expression e;
    position bad.p, bad.fix;
    @@

    struct i1 i2@p = { ...,
    + .fld = e
    - e@fix
    ,...};

    Also, removed some unnecessary comments.

    Signed-off-by: Amitoj Kaur Chawla
    Signed-off-by: Takashi Iwai

    Amitoj Kaur Chawla
     

13 Jun, 2016

1 commit

  • Currently, the avail IOCTL doesn't pass any error status, which
    means typically on error it simply shows no data available. This
    can lead to situations where user-space is waiting indefinitely
    for data that will never come as the DSP has suffered an
    unrecoverable error.

    Add snd_compr_stop_error which end drivers can call to indicate
    the stream has suffered an unrecoverable error and stop it. The
    avail and poll IOCTLs are then updated to report if the stream is
    in an error state to user-space. Allowing the error to propagate
    out. Processing of the actual snd_compr_stop needs to be deferred
    to a worker thread as the end driver may detect the errors during
    an existing operation callback.

    Signed-off-by: Charles Keepax
    Acked-by: Vinod Koul
    Signed-off-by: Mark Brown

    Charles Keepax
     

16 May, 2016

1 commit


13 May, 2016

2 commits


10 May, 2016

1 commit

  • When snd_pcm_add_chmap_ctls() is called to the PCM stream to which a
    chmap has been already assigned, it returns as an error due to the
    conflicting snd_ctl_add() result. However, this also clears the
    already assigned chmap_kctl field via pcm_chmap_ctl_private_free(),
    and becomes inconsistent in the later operation.

    This patch adds the check of the conflicting chmap kctl before
    actually trying to allocate / assign. The check failure is treated as
    a kernel warning, as the double call of snd_pcm_add_chmap_ctls() is
    basically a driver bug and having the stack trace would help
    developers to figure out the bad code path.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

09 May, 2016

5 commits


08 May, 2016

3 commits


28 Apr, 2016

1 commit

  • dmaengine_pcm currently only supports setups where FIFO reads/writes
    correspond to exactly one sample, eg 16-bit sample data is transferred
    via 16-bit FIFO accesses, 32-bit data via 32-bit accesses.

    This patch adds support for setups with fixed width FIFOs where
    multiple samples are packed into a larger word.

    For example setups with a 32-bit wide FIFO register that expect
    16-bit sample transfers to be done with the left+right sample data
    packed into a 32-bit word.

    Support for packed transfers is controlled via the
    SND_DMAENGINE_PCM_DAI_FLAG_PACK flag in snd_dmaengine_dai_dma_data.flags

    If this flag is set dmaengine_pcm doesn't put any restriction on the
    supported formats and sets the DMA transfer width to undefined.

    This means control over the constraints is now transferred to the DAI
    driver and it's responsible to provide proper configuration and
    check for possible corner cases that aren't handled by the ALSA core.

    Signed-off-by: Matthias Reichl
    Acked-by: Lars-Peter Clausen
    Tested-by: Martin Sperl
    Signed-off-by: Mark Brown

    Matthias Reichl
     

26 Apr, 2016

1 commit

  • This patch tries to address the still remaining issues in ALSA hrtimer
    driver:
    - Spurious use-after-free was detected in hrtimer callback
    - Incorrect rescheduling due to delayed start
    - WARN_ON() is triggered in hrtimer_forward() invoked in hrtimer
    callback

    The first issue happens only when the new timer is scheduled even
    while hrtimer is being closed. It's related with the second and third
    items; since ALSA timer core invokes hw.start callback during hrtimer
    interrupt, this may result in the explicit call of hrtimer_start().

    Also, the similar problem is seen for the stop; ALSA timer core
    invokes hw.stop callback even in the hrtimer handler, too. Since we
    must not call the synced hrtimer_cancel() in such a context, it's just
    a hrtimer_try_to_cancel() call that doesn't properly work.

    Another culprit of the second and third items is the call of
    hrtimer_forward_now() before snd_timer_interrupt(). The timer->stick
    value may change during snd_timer_interrupt() call, but this
    possibility is ignored completely.

    For covering these subtle and messy issues, the following changes have
    been done in this patch:
    - A new flag, in_callback, is introduced in the private data to
    indicate that the hrtimer handler is being processed.
    - Both start and stop callbacks skip when called from (during)
    in_callback flag.
    - The hrtimer handler returns properly HRTIMER_RESTART and NORESTART
    depending on the running state now.
    - The hrtimer handler reprograms the expiry properly after
    snd_timer_interrupt() call, instead of before.
    - The close callback clears running flag and sets in_callback flag
    to block any further start/stop calls.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

25 Apr, 2016

1 commit


15 Apr, 2016

1 commit

  • Currently kill_fasync() is called outside the stream lock in
    snd_pcm_period_elapsed(). This is potentially racy, since the stream
    may get released even during the irq handler is running. Although
    snd_pcm_release_substream() calls snd_pcm_drop(), this doesn't
    guarantee that the irq handler finishes, thus the kill_fasync() call
    outside the stream spin lock may be invoked after the substream is
    detached, as recently reported by KASAN.

    As a quick workaround, move kill_fasync() call inside the stream
    lock. The fasync is rarely used interface, so this shouldn't have a
    big impact from the performance POV.

    Ideally, we should implement some sync mechanism for the proper finish
    of stream and irq handler. But this oneliner should suffice for most
    cases, so far.

    Reported-by: Baozeng Ding
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

07 Apr, 2016

2 commits


01 Apr, 2016

1 commit

  • ALSA system timer backend stops the timer via del_timer() without sync
    and leaves del_timer_sync() at the close instead. This is because of
    the restriction by the design of ALSA timer: namely, the stop callback
    may be called from the timer handler, and calling the sync shall lead
    to a hangup. However, this also triggers a kernel BUG() when the
    timer is rearmed immediately after stopping without sync:
    kernel BUG at kernel/time/timer.c:966!
    Call Trace:

    [] snd_timer_s_start+0x13e/0x1a0
    [] snd_timer_interrupt+0x504/0xec0
    [] ? debug_check_no_locks_freed+0x290/0x290
    [] snd_timer_s_function+0xb4/0x120
    [] call_timer_fn+0x162/0x520
    [] ? call_timer_fn+0xcd/0x520
    [] ? snd_timer_interrupt+0xec0/0xec0
    ....

    It's the place where add_timer() checks the pending timer. It's clear
    that this may happen after the immediate restart without sync in our
    cases.

    So, the workaround here is just to use mod_timer() instead of
    add_timer(). This looks like a band-aid fix, but it's a right move,
    as snd_timer_interrupt() takes care of the continuous rearm of timer.

    Reported-by: Jiri Slaby
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

23 Mar, 2016

1 commit

  • 'struct snd_timer_gparams' includes some members with 'unsigned long',
    therefore its size differs depending on data models of architecture. As
    a result, x86/x32 applications fail to execute ioctl(2) with
    SNDRV_TIMER_GPARAMS command on x86_64 machine.

    This commit fixes this bug by adding a pair of structure and ioctl
    command for the compatibility.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

17 Mar, 2016

1 commit

  • …e in core implementation

    In control compatibility layer, when no elements are found by
    ELEM_READ/ELEM_WRITE ioctl commands, ENXIO is returned. On the other hand,
    in core implementation, ENOENT is returned. This is not good for
    ALSA ctl applications.

    This commit changes the return value from the compatibility layer so
    that the same value is returned.

    Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>

    Takashi Sakamoto
     

14 Mar, 2016

1 commit

  • ASoC: Updates for v4.6

    The main thing in terms of the core this time around has been some
    additional framework work for dynamic topologies (though we *still*
    don't appear to have a stable ABI for the topology code, it's probably
    worth considering if this will ever happen...). Otherwise the work has
    almost all been in the drivers:

    - HDMI support for Sky Lake, along with other fixes and enhancements
    for the Intel drivers.
    - Lots of improvements to the Renesas drivers.
    - Capture support for Qualcomm drivers.
    - Support for TI DaVinci DRA7xxx devices.
    - New machine drivers for Freescale systems with Cirrus CODECs,
    Mediatek systems with RT5650 CODECs.
    - New CPU drivers for Allwinner S/PDIF controllers
    - New CODEC drivers for Maxim MAX9867 and MAX98926 and Realtek RT5514.

    Takashi Iwai
     

13 Mar, 2016

1 commit


11 Mar, 2016

1 commit

  • The commit [d507941beb1e: ALSA: pcm: Correct PCM BUG error message]
    made the warning prefix back to "BUG:" due to its previous wrong
    prefix. But a kernel message containing "BUG:" seems taken as an Oops
    message wrongly by some brain-dead daemons, and it annoys users in the
    end. Instead of teaching daemons, change the string again to a more
    reasonable one.

    Fixes: 507941beb1e ('ALSA: pcm: Correct PCM BUG error message')
    Cc: # v3.19+
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

08 Mar, 2016

1 commit

  • rawmidi devices expose the card number via IOCTLs, which allows to
    find the corresponding device in sysfs.

    The sequencer provides no identifing data. Chromium works around this
    issue by scanning rawmidi as well as sequencer devices and matching
    them by using assumtions, how the kernel register sequencer devices.

    This changes adds support for exposing the card number for kernel clients
    as well as the PID for user client.

    The minor of the API version is changed to distinguish between the zero
    initialised reserved field and card number 0.

    [minor coding style fixes by tiwai]

    Signed-off-by: Martin Koegler
    Acked-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Martin Koegler
     

05 Mar, 2016

3 commits


04 Mar, 2016

2 commits