17 Jul, 2014

1 commit

  • Pull sound fixes from Takashi Iwai:
    "Things seem to calm down so far, just a small few HD-audio fixes
    (regression fixes and a new codec ID addition) popping up"

    * tag 'sound-3.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: hda - Fix broken PM due to incomplete i915 initialization
    ALSA: hda - Revert stream assignment order for Intel controllers
    ALSA: hda - Add new GPU codec ID 0x10de0070 to snd-hda
    ALSA: hda: Fix build warning

    Linus Torvalds
     

15 Jul, 2014

1 commit

  • When the initialization of Intel HDMI controller fails due to missing
    i915 kernel symbols (e.g. HD-audio is built in while i915 is module),
    the driver discontinues the probe. However, since the probe was done
    asynchronously, the driver object still remains, thus the relevant PM
    ops are still called at suspend/resume. This results in the bad access
    to the incomplete audio card object, eventually leads to Oops or stall
    at PM.

    This patch adds the missing checks of chip->init_failed flag at each
    PM callback in order to fix the problem above.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=79561
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

14 Jul, 2014

1 commit

  • We got a regression report for 3.15.x kernels, and this turned out to
    be triggered by the fix for stream assignment order. On reporter's
    machine with Intel controller (8086:1e20) + VIA VT1802 codec, the
    first playback slot can't work with speaker outputs.

    But the original commit was actually a fix for AMD controllers where
    no proper GCAP value is returned, we shouldn't revert the whole
    commit. Instead, in this patch, a new flag is introduced to determine
    the stream assignment order, and follow the old behavior for Intel
    controllers.

    Fixes: dcb32ecd9a53 ('ALSA: hda - Do not assign streams in reverse order')
    Reported-and-tested-by: Steven Newbury
    Cc: [v3.15+]
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

13 Jul, 2014

1 commit


08 Jul, 2014

1 commit


07 Jul, 2014

1 commit

  • The hda_tegra_disable_clocks() function is only used by the suspend and
    resume code, so it needs to be included in the #ifdef CONFIG_PM_SLEEP
    block to prevent the following warning:

    CC sound/pci/hda/hda_tegra.o
    sound/pci/hda/hda_tegra.c:238:13: warning: 'hda_tegra_disable_clocks' defined but not used [-Wunused-function]
    static void hda_tegra_disable_clocks(struct hda_tegra *data)
    ^

    Signed-off-by: Thierry Reding
    Signed-off-by: Takashi Iwai

    Thierry Reding
     

04 Jul, 2014

1 commit

  • For HSW/BDW display HD-A controller, hda_set_bclk() is defined to set BCLK
    by programming the M/N values as per the core display clock (CDCLK) queried from
    i915 display driver.

    And the audio driver will also set BCLK in azx_first_init() since the display
    driver can turn off the shared power in boot phase if only eDP is connected
    and M/N values will be lost and must be reprogrammed.

    Signed-off-by: Mengdong Lin
    Cc:
    Signed-off-by: Takashi Iwai

    Mengdong Lin
     

01 Jul, 2014

1 commit

  • I received a report this morning from one of the Novena developers that
    the behaviour of the iMX6 ASoC codec driver (using imx-pcm-dma.c) was
    sub-optimal under high system load.

    While there are issues relating to system load remaining, upon reviewing
    the ASoC imx-pcm-dma.c driver, it was noticed that it not using the
    residue support, because SDMA doesn't support it. This has the effect
    that SDMA has to make multiple calls into the ASoC and ALSA code, one
    for each period.

    Since ALSA's snd_pcm_elapsed() does not need to be called multiple times
    and it is entirely sufficient to call it once to update ALSA with the
    current buffer position via the pointer method, we can do better here.
    We can also avoid stopping the DMA entirely, just like real cyclic DMA
    implementations behave. While this means that we replay some old samples,
    this is a nicer behaviour than having audio stop and restart.

    The changes to achieve this are relatively minor - imx-sdma.c can track
    where the DMA is to the nearest descriptor boundary - it does this
    already when deciding how many callbacks to issue. In doing this,
    buf_tail always points at the descriptor which will complete next.

    The residue is defined by the bytes remaining to the end of the buffer,
    when the buffer is viewed as a single block of memory [start...end].
    So, when we start out, there's a full buffer worth of residue, and this
    counts down as we approach the end of the buffer, eventually becoming
    zero at the end, before returning to the full buffer worth when we
    wrap back to the start.

    Moving the walking of the descriptors into the interrupt handler means
    that we can update the BD_DONE flag at interrupt time, thus avoiding
    a delayed tasklet stopping the cyclic DMA.

    This means that the residue can be calculated from (total descriptors -
    buf_tail) * descriptor size. This is what the change below does. We
    update imx-pcm-dma.c to remove the NO_RESIDUE flag since we now provide
    the residue.

    Signed-off-by: Russell King
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux
     

27 Jun, 2014

2 commits


26 Jun, 2014

2 commits

  • For Intel Haswell/Broadwell display HD-A controller, the 24MHz HD-A link BCLK
    is converted from Core Display Clock (CDCLK): BCLK = CDCLK * M / N
    And there are two registers EM4 and EM5 to program M, N value respectively.
    The EM4/EM5 values will be lost and when the display power well is disabled.

    BIOS programs CDCLK selected by OEM and EM4/EM5, but BIOS has no idea about
    display power well on/off at runtime. So the M/N can be wrong if non-default
    CDCLK is used when the audio controller resumes, which results in an invalid
    BCLK and abnormal audio playback rate. So this patch saves and restores valid
    M/N values on controller suspend/resume.

    And 'struct hda_intel' is defined to contain standard HD-A 'struct azx' and
    Intel specific fields, as Takashi suggested.

    Signed-off-by: Mengdong Lin
    Cc:
    Signed-off-by: Takashi Iwai

    Mengdong Lin
     
  • 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
     

25 Jun, 2014

1 commit

  • HP Spectre 13 has the IDT 92HD95 codec, and BIOS seems to set the
    default high-pass filter in some "safer" range, which results in the
    very soft tone from the built-in speakers in contrast to Windows.
    Also, the mute LED control is missing, since 92HD95 codec still has no
    HP-specific fixups for GPIO setups.

    This patch adds these missing features: the HPF is adjusted by the
    vendor-specific verb, and the LED is set up from a DMI string (but
    with the default polarity = 0 assumption due to the incomplete BIOS on
    the given machine).

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=74841
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

24 Jun, 2014

3 commits


23 Jun, 2014

2 commits

  • We need to call the proper init function in case it has been
    overridden, as it might restore things that the generic routing
    doesn't know anything about. E.g. AMD cards have special verbs
    that need resetting.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=77901
    Fixes: 5a61358433b1 ('ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support')
    Signed-off-by: Pierre Ossman
    Cc: [v3.13+]
    Signed-off-by: Takashi Iwai

    Pierre Ossman
     
  • A recent refactoring broke the possibility to manually specify
    model name as a module parameter. This patch restores the desired
    functionality.

    Fixes: c21c8cf77f47 ('ALSA: hda - Add fixup_forced flag')
    Reported-by: Kent Baxley
    Signed-off-by: David Henningsson
    Signed-off-by: Takashi Iwai

    David Henningsson
     

18 Jun, 2014

7 commits

  • Takashi Iwai
     
  • …nie/sound into for-linus

    ASoC: Fixes for v3.16

    Quite a few build coverage fixes in here among the usual small driver
    fixes includling the sigmadsp change from Lars - moving the driver to
    separate modules per bus (which is basically just code motion) avoids
    issues with some combinations of buses being enabled.

    Takashi Iwai
     
  • The ALSA control code expects that the range of assigned indices to a control is
    continuous and does not overflow. Currently there are no checks to enforce this.
    If a control with a overflowing index range is created that control becomes
    effectively inaccessible and unremovable since snd_ctl_find_id() will not be
    able to find it. This patch adds a check that makes sure that controls with a
    overflowing index range can not be created.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Jaroslav Kysela
    Cc:
    Signed-off-by: Takashi Iwai

    Lars-Peter Clausen
     
  • Each control gets automatically assigned its numids when the control is created.
    The allocation is done by incrementing the numid by the amount of allocated
    numids per allocation. This means that excessive creation and destruction of
    controls (e.g. via SNDRV_CTL_IOCTL_ELEM_ADD/REMOVE) can cause the id to
    eventually overflow. Currently when this happens for the control that caused the
    overflow kctl->id.numid + kctl->count will also over flow causing it to be
    smaller than kctl->id.numid. Most of the code assumes that this is something
    that can not happen, so we need to make sure that it won't happen

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Jaroslav Kysela
    Cc:
    Signed-off-by: Takashi Iwai

    Lars-Peter Clausen
     
  • A control that is visible on the card->controls list can be freed at any time.
    This means we must not access any of its memory while not holding the
    controls_rw_lock. Otherwise we risk a use after free access.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Jaroslav Kysela
    Cc:
    Signed-off-by: Takashi Iwai

    Lars-Peter Clausen
     
  • There are two issues with the current implementation for replacing user
    controls. The first is that the code does not check if the control is actually a
    user control and neither does it check if the control is owned by the process
    that tries to remove it. That allows userspace applications to remove arbitrary
    controls, which can cause a user after free if a for example a driver does not
    expect a control to be removed from under its feed.

    The second issue is that on one hand when a control is replaced the
    user_ctl_count limit is not checked and on the other hand the user_ctl_count is
    increased (even though the number of user controls does not change). This allows
    userspace, once the user_ctl_count limit as been reached, to repeatedly replace
    a control until user_ctl_count overflows. Once that happens new controls can be
    added effectively bypassing the user_ctl_count limit.

    Both issues can be fixed by instead of open-coding the removal of the control
    that is to be replaced to use snd_ctl_remove_user_ctl(). This function does
    proper permission checks as well as decrements user_ctl_count after the control
    has been removed.

    Note that by using snd_ctl_remove_user_ctl() the check which returns -EBUSY at
    beginning of the function if the control already exists is removed. This is not
    a problem though since the check is quite useless, because the lock that is
    protecting the control list is released between the check and before adding the
    new control to the list, which means that it is possible that a different
    control with the same settings is added to the list after the check. Luckily
    there is another check that is done while holding the lock in snd_ctl_add(), so
    we'll rely on that to make sure that the same control is not added twice.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Jaroslav Kysela
    Cc:
    Signed-off-by: Takashi Iwai

    Lars-Peter Clausen
     
  • The user-control put and get handlers as well as the tlv do not protect against
    concurrent access from multiple threads. Since the state of the control is not
    updated atomically it is possible that either two write operations or a write
    and a read operation race against each other. Both can lead to arbitrary memory
    disclosure. This patch introduces a new lock that protects user-controls from
    concurrent access. Since applications typically access controls sequentially
    than in parallel a single lock per card should be fine.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Jaroslav Kysela
    Cc:
    Signed-off-by: Takashi Iwai

    Lars-Peter Clausen
     

16 Jun, 2014

3 commits


13 Jun, 2014

4 commits

  • Pull sound fixes from Takashi Iwai:
    "Most of changes are small and easy cleanup or fixes:

    - a few HD-audio Realtek codec fixes and quirks
    - Intel HDMI audio fixes for Broadwell and Haswell / ValleyView
    - FireWire sound stack cleanups
    - a couple of sequencer core fixes
    - compress ABI fix for 64bit
    - conversion to modern ktime*() API"

    * tag 'sound-fix-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (23 commits)
    ALSA: hda/realtek - Add more entry for enable HP mute led
    ALSA: hda - Add quirk for external mic on Lifebook U904
    ALSA: hda - fix a fixup value for codec alc293 in the pin_quirk table
    ALSA: intel8x0: Use ktime and ktime_get()
    ALSA: core: Use ktime_get_ts()
    ALSA: hda - verify pin:converter connection on unsol event for HSW and VLV
    ALSA: compress: Cancel the optimization of compiler and fix the size of struct for all platform.
    ALSA: hda - Add quirk for ABit AA8XE
    Revert "ALSA: hda - mask buggy stream DMA0 for Broadwell display controller"
    ALSA: hda - using POS_FIX_LPIB on Broadwell HDMI Audio
    ALSA: hda/realtek - Add support of ALC667 codec
    ALSA: hda/realtek - Add more codec rename
    ALSA: hda/realtek - New vendor ID for ALC233
    ALSA: hda - add two new pin tables
    ALSA: hda/realtek - Add support of ALC891 codec
    ALSA: seq: Continue broadcasting events to ports if one of them fails
    ALSA: bebob: Remove unused function prototype
    ALSA: fireworks: Remove meaningless mutex_destroy()
    ALSA: fireworks: Remove a constant over width to which it's applied
    ALSA: fireworks: Improve comments about Fireworks transaction
    ...

    Linus Torvalds
     
  • More HP machine need mute led support.

    Signed-off-by: Kailang Yang
    Cc:
    Signed-off-by: Takashi Iwai

    Kailang Yang
     
  • According to the bug reporter (Данило Шеган), the external mic
    starts to work and has proper jack detection if only pin 0x19
    is marked properly as an external headset mic.

    AlsaInfo at https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1328587/+attachment/4128991/+files/AlsaInfo.txt

    Cc: stable@vger.kernel.org
    BugLink: https://bugs.launchpad.net/bugs/1328587
    Signed-off-by: David Henningsson
    Signed-off-by: Takashi Iwai

    David Henningsson
     
  • The fixup value for codec alc293 was set to
    ALC269_FIXUP_DELL1_MIC_NO_PRESENCE by a mistake, if we don't fix it,
    the Dock mic will be overwriten by the headset mic, this will make
    the Dock mic can't work.

    Cc: David Henningsson
    Signed-off-by: Hui Wang
    Signed-off-by: Takashi Iwai

    Hui Wang
     

12 Jun, 2014

5 commits

  • do_posix_clock_monotonic_gettime() is a leftover from the initial
    posix timer implementation which maps to ktime_get_ts() and returns
    the monotonic time in a timespec.

    Use ktime based ktime_get() and use the ktime_delta_us() function to
    calculate the delta instead of open coding the timespec math.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Takashi Iwai

    Thomas Gleixner
     
  • do_posix_clock_monotonic_gettime() is a leftover from the initial
    posix timer implementation which maps to ktime_get_ts().

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Takashi Iwai

    Thomas Gleixner
     
  • This patch will verify the pin's coverter selection for an active stream
    when an unsol event reports this pin becomes available again after a display
    mode change or hot-plug event.

    For Haswell+ and Valleyview: display mode change or hot-plug can change the
    transcoder:port connection and make all the involved audio pins share the 1st
    converter. So the stream using 1st convertor will flow to multiple pins
    but active streams using other converters will fail. This workaround
    is to assure the pin selects the right conveter and an assigned converter is
    not shared by other unused pins.

    Signed-off-by: Mengdong Lin
    Cc:
    Signed-off-by: Takashi Iwai

    Mengdong Lin
     
  • Commit 432481220 (ASoC: fsl-ssi: Use regmap) removed struct ccsr_ssi.
    Unfortunately, the structure is still used. This causes
    mpc85xx_smp_defconfig and mpc85xx_defconfig builds to fail with

    sound/soc/fsl/fsl_dma.c:926:50:
    error: invalid use of undefined type 'struct ccsr_ssi'
    dma->ssi_stx_phys = res.start + offsetof(struct ccsr_ssi, stx0);
    ound/soc/fsl/fsl_dma.c:927:50:
    error: invalid use of undefined type 'struct ccsr_ssi'
    dma->ssi_srx_phys = res.start + offsetof(struct ccsr_ssi, srx0);

    Fix by using constants, similar to original commit.

    Cc: Markus Pargmann
    Signed-off-by: Guenter Roeck
    Signed-off-by: Mark Brown

    Guenter Roeck
     
  • Index of dma name should use -1, not +1 when capture case.
    Thank you Dan.

    Reported-by: Dan Carpenter
    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

10 Jun, 2014

3 commits

  • Bios does not set up the pin config default correctly (everything
    is set to zero). Reporter claims that 6stack-dig and 6stack-automute
    solve the problem.

    Alsa-info at http://www.alsa-project.org/db/?f=376c0804cbdde90bcd2cb94799407cb1cacf5d05
    BugLink: https://bugs.launchpad.net/bugs/1319291
    Reported-by: Stefano Statuti
    Signed-off-by: David Henningsson
    Signed-off-by: Takashi Iwai

    David Henningsson
     
  • The calculation code does
    u64 = (u32 - u32) * 100000;

    The 64 bits are of no help here as the type is casted only after the
    multiplication, and therefore the result may overflow, possibly causing
    inoptimal or wrong clock setup in an unfortunate case (the maximum
    result value of the first substraction is currently 47999).

    Fix the code to cast before multiplication.

    Signed-off-by: Anssi Hannula
    Acked-by: Nicolin Chen
    Signed-off-by: Mark Brown

    Anssi Hannula
     
  • We should not copy the return value into this val since it's supposed to
    get the value of the register not the success result of regmap_read().
    Thus fix it.

    Signed-off-by: Nicolin Chen
    Signed-off-by: Mark Brown

    Nicolin Chen