07 Aug, 2017

9 commits

  • [ Upstream commit 9f169b9f52a4afccdab7a7d2311b0c53a78a1e6b ]

    When multiple front-ends are using the same back-end, putting state of a
    front-end to STOP state upon receiving pause command will result in backend
    stream getting released by DPCM framework unintentionally. In order to
    avoid backend to be released when another active front-end stream is
    present, put the stream state to PAUSED state instead of STOP state.

    Signed-off-by: Patrick Lai
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Patrick Lai
     
  • [ Upstream commit bc65a326c579e93a5c2120a65ede72f11369ee5a ]

    Saved firmware ctx was not never released, so release Firmware
    ctx in cleanup routine.

    Signed-off-by: Jeeja KP
    Acked-by: Vinod Koul
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jeeja KP
     
  • [ Upstream commit 60448b077ed93d227e6c117a9e87db76ff0c1911 ]

    Frequency value of zero did not make sense, use same 24.576MHz
    setting and only change the clock source in idle mode

    Suggested-by: Bard Liao
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • [ Upstream commit 13a6c8328e6056932dc680e447d4c5e8ad9add17 ]

    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
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ioan-Adrian Ratiu
     
  • [ Upstream commit 4ee437fbf626b5ad756889d8bc0fcead3d66dde7 ]

    The fsl_ssi fifo watermark is by default set to 2 free spaces (i.e.
    activate DMA on FIFO when only 2 spaces are left.) This means the
    DMA must service the fifo within 2 audio samples, which is just not
    enough time for many use cases with high data rate. In many
    configurations the audio channel slips (causing l/r swap in stereo
    configurations, or channel slipping in multi-channel configurations).

    This patch gives more breathing room and allows the SSI to operate
    reliably by changing the fifio refill watermark to 8.

    There is no change in behavior for older chips (with an 8-deep fifo).
    Only the newer chips with a 15-deep fifo get the new behavior. I
    suspect a new fifo depth setting could be optimized on the older
    chips too, but I have not tested.

    Signed-off-by: Caleb Crome
    Reviewed-by: Fabio Estevam
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Caleb Crome
     
  • [ Upstream commit a1792cda51300e15b03549cccf0b09f3be82e697 ]

    The clk_ref_div is not configured in the correct position of the
    register. The patch fixes that clk_ref_div, Pre-Scalar, is assigned
    the wrong value.

    Signed-off-by: John Hsu
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    John Hsu
     
  • [ Upstream commit 63c3194b82530bd71fd49db84eb7ab656b8d404a ]

    The RESET register only have one self clearing bit and it should not be
    cached. If it is cached, when we sync the registers back to the chip we
    will initiate a software reset as well, which is not desirable.

    Signed-off-by: Peter Ujfalusi
    Reviewed-by: Jarkko Nikula
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peter Ujfalusi
     
  • commit 74ec118152ea494a25ebb677cbc83a75c982ac5f upstream.

    Add codec IDs for several recently released, pending, and historical
    NVIDIA GPU audio controllers to the patch table, to allow the correct
    patch functions to be selected for them.

    Signed-off-by: Daniel Dadap
    Reviewed-by: Andy Ritger
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Daniel Dadap
     
  • commit 610e1ae9b533be82b3aa118b907e0a703256913d upstream.

    The commit b56fa687e02b ("ALSA: fm801: detect FM-only card earlier")
    rearranged initialization calls, i.e. it makes snd_fm801_chip_init() to
    be called before we register interrupt handler and set PCI bus
    mastering.

    Somehow it prevents FM801-AU to work properly. Thus, partially revert
    initialization order changed by commit mentioned above.

    Fixes: b56fa687e02b ("ALSA: fm801: detect FM-only card earlier")
    Reported-by: Émeric MASCHINO
    Tested-by: Émeric MASCHINO
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     

28 Jul, 2017

1 commit

  • commit 01b8cedfd0422326caae308641dcadaa85e0ca72 upstream.

    Currently compress driver hardcodes direction as playback to get
    substream from the stream. This results in getting the incorrect
    substream for compressed capture usecase.
    To fix this, remove the hardcoding and derive substream based on
    the stream direction.

    Signed-off-by: Satish Babu Patakokila
    Signed-off-by: Banajit Goswami
    Acked-By: Vinod Koul
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Satish Babu Patakokila
     

12 Jul, 2017

1 commit

  • commit fe0dfd6358a17c79bd7d6996af7512ba452a7059 upstream.

    Thinkpad Helix 2 is a tablet PC, the audio is powered by Core M
    broadwell-audio and rt286 codec. For all versions of Linux kernel,
    the stereo output doesn't work properly when earphones are plugged
    in, the sound was coming out from both channels even if the audio
    contains only the left or right channel. Furthermore, if a music
    recorded in stereo is played, the two channels cancle out each other
    out, as a result, no voice but only distorted background music can be
    heard, like a sound card with builtin a Karaoke sount effect.

    Apparently this tablet uses a combo jack with polarity incorrectly
    set by rt286 driver. This patch adds DMI information of Thinkpad Helix 2
    to force_combo_jack_table[] and the issue is resolved. The microphone
    input doesn't work regardless to the presence of this patch and still
    needs help from other developers to investigate.

    This is my first patch to LKML directly, sorry for CC-ing too many
    people here.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=93841
    Signed-off-by: Yifeng Li
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Yifeng Li
     

05 Jul, 2017

2 commits

  • commit a8f20fd25bdce81a8e41767c39f456d346b63427 upstream.

    Recently we met a problem, the codec has valid adcs and input pins,
    and they can form valid input paths, but the driver does not build
    valid controls for them like "Mic boost", "Capture Volume" and
    "Capture Switch".

    Through debugging, I found the driver needs to shrink the invalid
    adcs and input paths for this machine, so it will move the whole
    column bitmap value to the previous column, after moving it, the
    driver forgets to set the original column bitmap value to zero, as a
    result, the driver will invalidate the path whose index value is the
    original colume bitmap value. After executing this function, all
    valid input paths are invalidated by a mistake, there are no any
    valid input paths, so the driver won't build controls for them.

    Fixes: 3a65bcdc577a ("ALSA: hda - Fix inconsistent input_paths after ADC reduction")
    Signed-off-by: Hui Wang
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Hui Wang
     
  • commit d94815f917da770d42c377786dc428f542e38f71 upstream.

    azx_codec_configure() loops over the codecs found on the given
    controller via a linked list. The code used to work in the past, but
    in the current version, this may lead to an endless loop when a codec
    binding returns an error.

    The culprit is that the snd_hda_codec_configure() unregisters the
    device upon error, and this eventually deletes the given codec object
    from the bus. Since the list is initialized via list_del_init(), the
    next object points to the same device itself. This behavior change
    was introduced at splitting the HD-audio code code, and forgotten to
    adapt it here.

    For fixing this bug, just use a *_safe() version of list iteration.

    Fixes: d068ebc25e6e ("ALSA: hda - Move some codes up to hdac_bus struct")
    Reported-by: Daniel Vetter
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

29 Jun, 2017

2 commits

  • commit 2deaeaf102d692cb6f764123b1df7aa118a8e97c upstream.

    The standard PCM chmap helper callbacks treat the NULL info->chmap as
    a fatal error and spews the kernel warning with stack trace when
    CONFIG_SND_DEBUG is on. This was OK, originally it was supposed to be
    always static and non-NULL. But, as the recent addition of Intel LPE
    audio driver shows, the chmap content may vary dynamically, and it can
    be even NULL when disconnected. The user still sees the kernel
    warning unnecessarily.

    For clearing such a confusion, this patch simply removes the
    snd_BUG_ON() in each place, just returns an error without warning.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 4a9bfafc64f44ef83de4e00ca1b57352af6cd8c2 upstream.

    At Linux v3.5, packet processing can be done in process context of ALSA
    PCM application as well as software IRQ context for OHCI 1394. Below is
    an example of the callgraph (some calls are omitted).

    ioctl(2) with e.g. HWSYNC
    (sound/core/pcm_native.c)
    ->snd_pcm_common_ioctl1()
    ->snd_pcm_hwsync()
    ->snd_pcm_stream_lock_irq
    (sound/core/pcm_lib.c)
    ->snd_pcm_update_hw_ptr()
    ->snd_pcm_udpate_hw_ptr0()
    ->struct snd_pcm_ops.pointer()
    (sound/firewire/*)
    = Each handler on drivers in ALSA firewire stack
    (sound/firewire/amdtp-stream.c)
    ->amdtp_stream_pcm_pointer()
    (drivers/firewire/core-iso.c)
    ->fw_iso_context_flush_completions()
    ->struct fw_card_driver.flush_iso_completion()
    (drivers/firewire/ohci.c)
    = flush_iso_completions()
    ->struct fw_iso_context.callback.sc
    (sound/firewire/amdtp-stream.c)
    = in_stream_callback() or out_stream_callback()
    ->...
    ->snd_pcm_stream_unlock_irq

    When packet queueing error occurs or detecting invalid packets in
    'in_stream_callback()' or 'out_stream_callback()', 'snd_pcm_stop_xrun()'
    is called on local CPU with disabled IRQ.

    (sound/firewire/amdtp-stream.c)
    in_stream_callback() or out_stream_callback()
    ->amdtp_stream_pcm_abort()
    ->snd_pcm_stop_xrun()
    ->snd_pcm_stream_lock_irqsave()
    ->snd_pcm_stop()
    ->snd_pcm_stream_unlock_irqrestore()

    The process is stalled on the CPU due to attempt to acquire recursive lock.

    [ 562.630853] INFO: rcu_sched detected stalls on CPUs/tasks:
    [ 562.630861] 2-...: (1 GPs behind) idle=37d/140000000000000/0 softirq=38323/38323 fqs=7140
    [ 562.630862] (detected by 3, t=15002 jiffies, g=21036, c=21035, q=5933)
    [ 562.630866] Task dump for CPU 2:
    [ 562.630867] alsa-source-OXF R running task 0 6619 1 0x00000008
    [ 562.630870] Call Trace:
    [ 562.630876] ? vt_console_print+0x79/0x3e0
    [ 562.630880] ? msg_print_text+0x9d/0x100
    [ 562.630883] ? up+0x32/0x50
    [ 562.630885] ? irq_work_queue+0x8d/0xa0
    [ 562.630886] ? console_unlock+0x2b6/0x4b0
    [ 562.630888] ? vprintk_emit+0x312/0x4a0
    [ 562.630892] ? dev_vprintk_emit+0xbf/0x230
    [ 562.630895] ? do_sys_poll+0x37a/0x550
    [ 562.630897] ? dev_printk_emit+0x4e/0x70
    [ 562.630900] ? __dev_printk+0x3c/0x80
    [ 562.630903] ? _raw_spin_lock+0x20/0x30
    [ 562.630909] ? snd_pcm_stream_lock+0x31/0x50 [snd_pcm]
    [ 562.630914] ? _snd_pcm_stream_lock_irqsave+0x2e/0x40 [snd_pcm]
    [ 562.630918] ? snd_pcm_stop_xrun+0x16/0x70 [snd_pcm]
    [ 562.630922] ? in_stream_callback+0x3e6/0x450 [snd_firewire_lib]
    [ 562.630925] ? handle_ir_packet_per_buffer+0x8e/0x1a0 [firewire_ohci]
    [ 562.630928] ? ohci_flush_iso_completions+0xa3/0x130 [firewire_ohci]
    [ 562.630932] ? fw_iso_context_flush_completions+0x15/0x20 [firewire_core]
    [ 562.630935] ? amdtp_stream_pcm_pointer+0x2d/0x40 [snd_firewire_lib]
    [ 562.630938] ? pcm_capture_pointer+0x19/0x20 [snd_oxfw]
    [ 562.630943] ? snd_pcm_update_hw_ptr0+0x47/0x3d0 [snd_pcm]
    [ 562.630945] ? poll_select_copy_remaining+0x150/0x150
    [ 562.630947] ? poll_select_copy_remaining+0x150/0x150
    [ 562.630952] ? snd_pcm_update_hw_ptr+0x10/0x20 [snd_pcm]
    [ 562.630956] ? snd_pcm_hwsync+0x45/0xb0 [snd_pcm]
    [ 562.630960] ? snd_pcm_common_ioctl1+0x1ff/0xc90 [snd_pcm]
    [ 562.630962] ? futex_wake+0x90/0x170
    [ 562.630966] ? snd_pcm_capture_ioctl1+0x136/0x260 [snd_pcm]
    [ 562.630970] ? snd_pcm_capture_ioctl+0x27/0x40 [snd_pcm]
    [ 562.630972] ? do_vfs_ioctl+0xa3/0x610
    [ 562.630974] ? vfs_read+0x11b/0x130
    [ 562.630976] ? SyS_ioctl+0x79/0x90
    [ 562.630978] ? entry_SYSCALL_64_fastpath+0x1e/0xad

    This commit fixes the above bug. This assumes two cases:
    1. Any error is detected in software IRQ context of OHCI 1394 context.
    In this case, PCM substream should be aborted in packet handler. On the
    other hand, it should not be done in any process context. TO distinguish
    these two context, use 'in_interrupt()' macro.
    2. Any error is detect in process context of ALSA PCM application.
    In this case, PCM substream should not be aborted in packet handler
    because PCM substream lock is acquired. The task to abort PCM substream
    should be done in ALSA PCM core. For this purpose, SNDRV_PCM_POS_XRUN is
    returned at 'struct snd_pcm_ops.pointer()'.

    Suggested-by: Clemens Ladisch
    Fixes: e9148dddc3c7("ALSA: firewire-lib: flush completed packets when reading PCM position")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     

14 Jun, 2017

3 commits

  • commit 4efda5f2130da033aeedc5b3205569893b910de2 upstream.

    soc_cleanup_card_resources() call snd_card_free() at the last of its
    procedure. This turned out to lead to a use-after-free.
    PCM runtimes have been already removed via soc_remove_pcm_runtimes(),
    while it's dereferenced later in soc_pcm_free() called via
    snd_card_free().

    The fix is simple: just move the snd_card_free() call to the beginning
    of the whole procedure. This also gives another benefit: it
    guarantees that all operations have been shut down before actually
    releasing the resources, which was racy until now.

    Reported-and-tested-by: Robert Jarzmik
    Signed-off-by: Takashi Iwai
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit ba3021b2c79b2fa9114f92790a99deb27a65b728 upstream.

    snd_timer_user_tselect() reallocates the queue buffer dynamically, but
    it forgot to reset its indices. Since the read may happen
    concurrently with ioctl and snd_timer_user_tselect() allocates the
    buffer via kmalloc(), this may lead to the leak of uninitialized
    kernel-space data, as spotted via KMSAN:

    BUG: KMSAN: use of unitialized memory in snd_timer_user_read+0x6c4/0xa10
    CPU: 0 PID: 1037 Comm: probe Not tainted 4.11.0-rc5+ #2739
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:16
    dump_stack+0x143/0x1b0 lib/dump_stack.c:52
    kmsan_report+0x12a/0x180 mm/kmsan/kmsan.c:1007
    kmsan_check_memory+0xc2/0x140 mm/kmsan/kmsan.c:1086
    copy_to_user ./arch/x86/include/asm/uaccess.h:725
    snd_timer_user_read+0x6c4/0xa10 sound/core/timer.c:2004
    do_loop_readv_writev fs/read_write.c:716
    __do_readv_writev+0x94c/0x1380 fs/read_write.c:864
    do_readv_writev fs/read_write.c:894
    vfs_readv fs/read_write.c:908
    do_readv+0x52a/0x5d0 fs/read_write.c:934
    SYSC_readv+0xb6/0xd0 fs/read_write.c:1021
    SyS_readv+0x87/0xb0 fs/read_write.c:1018

    This patch adds the missing reset of queue indices. Together with the
    previous fix for the ioctl/read race, we cover the whole problem.

    Reported-by: Alexander Potapenko
    Tested-by: Alexander Potapenko
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit d11662f4f798b50d8c8743f433842c3e40fe3378 upstream.

    The read from ALSA timer device, the function snd_timer_user_tread(),
    may access to an uninitialized struct snd_timer_user fields when the
    read is concurrently performed while the ioctl like
    snd_timer_user_tselect() is invoked. We have already fixed the races
    among ioctls via a mutex, but we seem to have forgotten the race
    between read vs ioctl.

    This patch simply applies (more exactly extends the already applied
    range of) tu->ioctl_lock in snd_timer_user_tread() for closing the
    race window.

    Reported-by: Alexander Potapenko
    Tested-by: Alexander Potapenko
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

07 Jun, 2017

1 commit

  • commit 1fc2e41f7af4572b07190f9dec28396b418e9a36 upstream.

    This model is actually called 92XXM2-8 in Windows driver. But since pin
    configs for M22 and M28 are identical, just reuse M22 quirk.

    Fixes external microphone (tested) and probably docking station ports
    (not tested).

    Signed-off-by: Alexander Tsoy
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Alexander Tsoy
     

25 May, 2017

2 commits

  • commit 49b2e27ab9f66b0a22c21980ad8118a4038324ae upstream.

    During reset "refactoring" the output configuration was lost.
    This commit repairs sound on EDB93XX boards.

    Fixes: 9a397f4 ("ASoC: cs4271: add regulator consumer support")
    Signed-off-by: Alexander Sverdlin
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Alexander Sverdlin
     
  • commit 960013762df0a214b57f2fce655422fb52bdfd2c upstream.

    Using jiffies in hdac_wait_for_cmd_dmas() to determine when to time out
    when interrupts are off (snd_hdac_bus_stop_cmd_io()/spin_lock_irq())
    causes hard lockup so unlock while waiting using jiffies.

    ------
    [ 1211.603046] NMI watchdog: Watchdog detected hard LOCKUP on cpu 3
    [ 1211.603047] Modules linked in: snd_hda_intel i915 vgem
    [ 1211.603053] irq event stamp: 13366
    [ 1211.603053] hardirqs last enabled at (13365):
    ...
    [ 1211.603059] Call Trace:
    [ 1211.603059] ? delay_tsc+0x3d/0xc0
    [ 1211.603059] __delay+0xa/0x10
    [ 1211.603060] __const_udelay+0x31/0x40
    [ 1211.603060] snd_hdac_bus_stop_cmd_io+0x96/0xe0 [snd_hda_core]
    [ 1211.603060] ? azx_dev_disconnect+0x20/0x20 [snd_hda_intel]
    [ 1211.603061] snd_hdac_bus_stop_chip+0xb1/0x100 [snd_hda_core]
    [ 1211.603061] azx_stop_chip+0x9/0x10 [snd_hda_codec]
    [ 1211.603061] azx_suspend+0x72/0x220 [snd_hda_intel]
    [ 1211.603061] pci_pm_suspend+0x71/0x140
    [ 1211.603062] dpm_run_callback+0x6f/0x330
    [ 1211.603062] ? pci_pm_freeze+0xe0/0xe0
    [ 1211.603062] __device_suspend+0xf9/0x370
    [ 1211.603062] ? dpm_watchdog_set+0x60/0x60
    [ 1211.603063] async_suspend+0x1a/0x90
    [ 1211.603063] async_run_entry_fn+0x34/0x160
    [ 1211.603063] process_one_work+0x1f4/0x6d0
    [ 1211.603063] ? process_one_work+0x16e/0x6d0
    [ 1211.603064] worker_thread+0x49/0x4a0
    [ 1211.603064] kthread+0x107/0x140
    [ 1211.603064] ? process_one_work+0x6d0/0x6d0
    [ 1211.603065] ? kthread_create_on_node+0x40/0x40
    [ 1211.603065] ret_from_fork+0x2e/0x40

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100419
    Fixes: 38b19ed7f81ec ("ALSA: hda: fix to wait for RIRB & CORB DMA to set")
    Reported-by: Marta Lofstedt
    Suggested-by: Takashi Iwai
    Signed-off-by: Jeeja KP
    Acked-by: Vinod Koul
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Jeeja KP
     

14 May, 2017

1 commit

  • commit ab949d519601880fd46e8bc1445d6a453bf2dc09 upstream.

    Imre Deak reported a deadlock of HD-audio driver at unbinding while
    it's still in probing. Since we probe the codecs asynchronously in a
    work, the codec driver probe may still be kicked off while the
    controller itself is being unbound. And, azx_remove() tries to
    process all pending tasks via cancel_work_sync() for fixing the other
    races (see commit [0b8c82190c12: ALSA: hda - Cancel probe work instead
    of flush at remove]), now we may meet a bizarre deadlock:

    Unbind snd_hda_intel via sysfs:
    device_release_driver() ->
    device_lock(snd_hda_intel) ->
    azx_remove() ->
    cancel_work_sync(azx_probe_work)

    azx_probe_work():
    codec driver probe() ->
    __driver_attach() ->
    device_lock(snd_hda_intel)

    This deadlock is caused by the fact that both device_release_driver()
    and driver_probe_device() take both the device and its parent locks at
    the same time. The codec device sets the controller device as its
    parent, and this lock is taken before the probe() callback is called,
    while the controller remove() callback gets called also with the same
    lock.

    In this patch, as an ugly workaround, we unlock the controller device
    temporarily during cancel_work_sync() call. The race against another
    bind call should be still suppressed by the parent's device lock.

    Reported-by: Imre Deak
    Fixes: 0b8c82190c12 ("ALSA: hda - Cancel probe work instead of flush at remove")
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

03 May, 2017

4 commits

  • commit 6e4cac23c5a648d50b107d1b53e9c4e1120c7943 upstream.

    The FE setups of Intel SST bytcr_rt5640 and bytcr_rt5651 drivers carry
    the ignore_suspend flag, and this prevents the suspend/resume working
    properly while the stream is running, since SST core code has the
    check of the running streams and returns -EBUSY. Drop these
    superfluous flags for fixing the behavior.

    Also, the bytcr_rt5640 driver lacks of nonatomic flag in some FE
    definitions, which leads to the kernel Oops at suspend/resume like:

    BUG: scheduling while atomic: systemd-sleep/3144/0x00000003
    Call Trace:
    dump_stack+0x5c/0x7a
    __schedule_bug+0x55/0x70
    __schedule+0x63c/0x8c0
    schedule+0x3d/0x90
    schedule_timeout+0x16b/0x320
    ? del_timer_sync+0x50/0x50
    ? sst_wait_timeout+0xa9/0x170 [snd_intel_sst_core]
    ? sst_wait_timeout+0xa9/0x170 [snd_intel_sst_core]
    ? remove_wait_queue+0x60/0x60
    ? sst_prepare_and_post_msg+0x275/0x960 [snd_intel_sst_core]
    ? sst_pause_stream+0x9b/0x110 [snd_intel_sst_core]
    ....

    This patch addresses these appropriately, too.

    Signed-off-by: Takashi Iwai
    Acked-by: Vinod Koul
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 4e7655fd4f47c23e5249ea260dc802f909a64611 upstream.

    The snd_use_lock_sync() (thus its implementation
    snd_use_lock_sync_helper()) has the 5 seconds timeout to break out of
    the sync loop. It was introduced from the beginning, just to be
    "safer", in terms of avoiding the stupid bugs.

    However, as Ben Hutchings suggested, this timeout rather introduces a
    potential leak or use-after-free that was apparently fixed by the
    commit 2d7d54002e39 ("ALSA: seq: Fix race during FIFO resize"):
    for example, snd_seq_fifo_event_in() -> snd_seq_event_dup() ->
    copy_from_user() could block for a long time, and snd_use_lock_sync()
    goes timeout and still leaves the cell at releasing the pool.

    For fixing such a problem, we remove the break by the timeout while
    still keeping the warning.

    Suggested-by: Ben Hutchings
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit dfb00a56935186171abb5280b3407c3f910011f1 upstream.

    An abstraction of asynchronous transaction for transmission of MIDI
    messages was introduced in Linux v4.4. Each driver can utilize this
    abstraction to transfer MIDI messages via fixed-length payload of
    transaction to a certain unit address. Filling payload of the transaction
    is done by callback. In this callback, each driver can return negative
    error code, however current implementation assigns the return value to
    unsigned variable.

    This commit changes type of the variable to fix the bug.

    Reported-by: Julia Lawall
    Fixes: 585d7cba5e1f ("ALSA: firewire-lib: add helper functions for asynchronous transactions to transfer MIDI messages")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     
  • commit 3d016d57fdc5e6caa4cd67896f4b081bccad6e2c upstream.

    At a commit 6c29230e2a5f ("ALSA: oxfw: delayed registration of sound
    card"), ALSA oxfw driver fails to handle SCS.1m/1d, due to -EBUSY at a call
    of snd_card_register(). The cause is that the driver manages to register
    two rawmidi instances with the same device number 0. This is a regression
    introduced since kernel 4.7.

    This commit fixes the regression, by fixing up device property after
    discovering stream formats.

    Fixes: 6c29230e2a5f ("ALSA: oxfw: delayed registration of sound card")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     

21 Apr, 2017

1 commit

  • commit ebf79091bf85d9b2270ab29191de9cd3aaf888c5 upstream.

    Select DW_DMAC_CORE like the rest of glue drivers do, e.g.
    drivers/dma/dw/Kconfig.

    While here group selectors under SND_SOC_INTEL_HASWELL and
    SND_SOC_INTEL_BAYTRAIL.

    Make platforms, which are using a common SST firmware driver, to be
    dependent on DMADEVICES.

    Signed-off-by: Andy Shevchenko
    Acked-by: Liam Girdwood
    Signed-off-by: Mark Brown
    Cc: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     

12 Apr, 2017

10 commits

  • [ Upstream commit 2ad6f30de7087515a0bc2a718fca6681a57739a0 ]

    Some SoCs have a reset line that must be asserted/deasserted.
    This patch adds a quirk to handle the new compatible
    "allwinner,sun6i-a31-i2s" which will deassert the reset
    line on probe function and assert it on remove's one.

    This new compatible is useful in case of A33 codec driver, for example.

    Signed-off-by: Mylène Josserand
    Acked-by: Maxime Ripard
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mylène Josserand
     
  • [ Upstream commit a50477e55fff69e1028f25624ee9fc9182d59b1f ]

    The existing code assumes a 19.2 MHz MCLK as the default
    hardware configuration. This is valid for CherryTrail but
    not for Baytrail.

    Add explicit MCLK configuration to set the 19.2 clock on/off
    depending on DAPM events.

    This is a prerequisite step to enable devices with Baytrail
    and RT5645 such as Asus X205TA

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • [ Upstream commit 42648c2270ca0c96935dfc5d0f5c4f8d2406cf75 ]

    Fix classic issue of having multiple codecs listed in DSDT
    but a single one actually enabled. The previous code did
    not handle such errors and could also lead to uninitalized
    configurations

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • [ Upstream commit fd0138dc5d17c636477b371d99265c406437c583 ]

    the BIOS reports this codec as RT5640 but it's a rt5670. Use the
    quirk mechanism to use the cht_bsw_rt5672 machine driver

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • [ Upstream commit 93ffeaa8ee3f10a0628ad135b552a2497e0bef2c ]

    the BIOS incorrectly reports this codec as 5640 but it is
    really a rt5670

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     
  • [ Upstream commit d25280060835e1b2b84c242905da8334ab15c5b4 ]

    rt5670 driver supports also RT5672 codec, but its ACPI ID is missing.
    This was found on Dell Wyse 3040 box.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • [ Upstream commit 571800487837263e914ef68681e4ad6a57d49c7f ]

    There are literally dozens of Insyde devices with a different
    name but with the same audio routing. Use a generic quirk to
    match on vendor name only to avoid recurring edits of the
    same thing.

    Signed-off-by: youling257
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    youling257
     
  • [ Upstream commit 7f38ca047b0cb54df7f6d9e4110e292e45dba6ad ]

    This patch adds native DSD support for the following devices.

    - TEAC NT-503
    - TEAC UD-503
    - TEAC UD-501

    (1) Add quirks for native DSD support for TEAC devices.
    (2) A specific vendor command is needed to switch between PCM/DOP and
    DSD mode, same as Denon/Marantz devices.

    Signed-off-by: Nobutaka Okabe
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Nobutaka Okabe
     
  • [ Upstream commit 17f08b0d9aafccdb10038ab6dbd9ddb6433c13e2 ]

    The Axe-Fx II implicit feedback end point and the data sync endpoint
    are in different interface descriptors. Add quirk to ensure a sync
    endpoint is properly configured.

    Signed-off-by: Alberto Aguirre
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Alberto Aguirre
     
  • [ Upstream commit bf46241bee7bc3ec28703796f4fbd56085055fca ]

    Most Baytrail-CR devices use analog differential microphones,
    modify capture default to avoid DMI quirks. Keep digital mics
    for all other configurations.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Pierre-Louis Bossart
     

08 Apr, 2017

3 commits

  • commit d1a6fe41d3c4ff0d26f0b186d774493555ca5282 upstream.

    In 'skl_tplg_set_module_init_data()', a pointer to 'params' member of
    'struct skl_algo_data' is calculated, then casted to (u32 *) and assigned
    to a member of configuration data. The configuration data is passed to the
    other functions and used to process intel IPC. In this processing, the
    value of member is used to get message data, however this can bring invalid
    memory access in 'skl_set_module_params()' as a result of calculation of
    a pointer for actual message data.

    (sound/soc/intel/skylake/skl-topology.c)
    skl_tplg_init_pipe_modules()
    ->skl_tplg_set_module_init_data() (has this bug)
    ->skl_tplg_set_module_params()
    (sound/soc/intel/skylake/skl-messages.c)
    ->skl_set_module_params()
    ((char *)param) + data_offset

    This commit fixes the bug.

    Fixes: abb740033b56 ("ASoC: Intel: Skylake: Add support to configure module params")
    Signed-off-by: Takashi Sakamoto
    Acked-by: Vinod Koul
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     
  • commit cd3ac9affc43b44f49d7af70d275f0bd426ba643 upstream.

    Fix the audio clock rate according to the datasheet.

    Reported-by: Dushara Jayasinghe
    Signed-off-by: Songjun Wu
    Acked-by: Nicolas Ferre
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Songjun Wu
     
  • commit 2f726aec19a9d2c63bec9a8a53a3910ffdcd09f8 upstream.

    On this Dell AIO machine, the lineout jack does not work.

    We found the pin 0x1a is assigned to lineout on this machine, and in
    the past, we applied ALC298_FIXUP_DELL1_MIC_NO_PRESENCE to fix the
    heaset-set mic problem for this machine, this fixup will redefine
    the pin 0x1a to headphone-mic, as a result the lineout doesn't
    work anymore.

    After consulting with Dell, they told us this machine doesn't support
    microphone via headset jack, so we add a new fixup which only defines
    the pin 0x18 as the headset-mic.

    [rearranged the fixup insertion position by tiwai in order to make the
    merge with other branches easier -- tiwai]

    Fixes: 59ec4b57bcae ("ALSA: hda - Fix headset mic detection problem for two dell machines")
    Signed-off-by: Hui Wang
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Hui Wang