06 Jan, 2017

1 commit

  • commit 82ffb6fc637150b279f49e174166d2aa3853eaf4 upstream.

    The Logitech QuickCam Communicate Deluxe/S7500 microphone fails with the
    following warning.

    [ 6.778995] usb 2-1.2.2.2: Warning! Unlikely big volume range (=3072),
    cval->res is probably wrong.
    [ 6.778996] usb 2-1.2.2.2: [5] FU [Mic Capture Volume] ch = 1, val =
    4608/7680/1

    Adding it to the list of devices in volume_control_quirks makes it work
    properly, fixing related typo.

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

    Con Kolivas
     

09 Apr, 2016

2 commits

  • miniDSP USBStreamer UAC2 devices send clock validity changes with the
    control field set to zero. The current interrupt handler ignores all
    packets if the control field does not match the mixer element's, but
    it really should only do that in case that field is needed to
    distinguish multiple elements with the same ID.

    This patch implements a logic that lets notifications packets pass
    if the element ID is unique for a given device.

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

    Daniel Mack
     
  • UAC2 specifies clock sources that optionally have validity controls.
    This patch exposes them as mixer controls, so they can be read (and
    at least in theory even be written) by userspace applications in order
    to make clock selection policy decisions.

    This implementation does nothing if the device is not UAC2 compliant,
    or if the clock source does not define said validity control bits.

    Tested with a miniDSP USBStreamer (0x2752/0x0016).

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

    Daniel Mack
     

14 Dec, 2015

1 commit

  • AudioQuest DragonFly DAC reports a volume control range of 0..50
    (0x0000..0x0032) which in USB Audio means a range of 0 .. 0.2dB, which
    is obviously incorrect and would cause software using the dB information
    in e.g. volume sliders to have a massive volume difference in 100..102%
    range.

    Commit 2d1cb7f658fb ("ALSA: usb-audio: add dB range mapping for some
    devices") added a dB range mapping for it with range 0..50 dB.

    However, the actual volume mapping seems to be neither linear volume nor
    linear dB scale, but instead quite close to the cubic mapping e.g.
    alsamixer uses, with a range of approx. -53...0 dB.

    Replace the previous quirk with a custom dB mapping based on some basic
    output measurements, using a 10-item range TLV (which will still fit in
    alsa-lib MAX_TLV_RANGE_SIZE).

    Tested on AudioQuest DragonFly HW v1.2. The quirk is only applied if the
    range is 0..50, so if this gets fixed/changed in later HW revisions it
    will no longer be applied.

    v2: incorporated Takashi Iwai's suggestion for the quirk application
    method

    Signed-off-by: Anssi Hannula
    Cc:
    Signed-off-by: Takashi Iwai

    Anssi Hannula
     

28 Aug, 2015

1 commit


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
     

20 Aug, 2015

1 commit

  • The input terminal parser recurses into the referenced clock entity to verify
    it is existant and thus the terminal descriptor is valid. The actual property
    values of the term instance which is initially parsed must not be overriden by
    the recursion. For this to work the term properties have to be assigned after
    recursing into the referenced clock entity descriptors.

    Signed-off-by: Julian Scheel
    Acked-by: Daniel Mack
    Signed-off-by: Takashi Iwai

    Julian Scheel
     

14 Aug, 2015

1 commit

  • USB Audio Class version 2.0 supports three different parameter block sizes for
    CUR requests, which are 1 byte (5.2.3.1 Layout 1 Parameter Block), 2 bytes
    (5.2.3.2 Layout 2 Parameter Block) and 4 bytes (5.2.3.3 Layout 3 Parameter
    Block). Use the correct size according to the specific control as it was
    already done for UACv1. The allocated block size for control requests is
    increased to support the 4 byte worst case.

    Signed-off-by: Julian Scheel
    Signed-off-by: Takashi Iwai

    Julian Scheel
     

11 Jun, 2015

1 commit


03 Jun, 2015

1 commit

  • The driver worked around an error in the MAYA44 USB(+)'s mixer unit
    descriptor by aborting before parsing the missing field. However,
    aborting parsing too early prevented parsing of the other units
    connected to this unit, so the capture mixer controls would be missing.

    Fix this by moving the check for this descriptor error after the parsing
    of the unit's input pins.

    Reported-by: nightmixes
    Tested-by: nightmixes
    Signed-off-by: Clemens Ladisch
    Cc:
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

29 May, 2015

1 commit


18 Jan, 2015

1 commit


21 Nov, 2014

3 commits

  • So far, we blindly assumed that the all usb-audio mixer elements
    follow the standard and apply the standard resume method for the
    registered elements in the id_elems[] list. However, some quirks
    really need the own resume and it's incomplete for now.

    This patch enhances the resume handling in two folds:
    - split some fields in struct usb_mixer_elem_info into a smaller
    header struct (usb_mixer_elem_list) for keeping the minimal
    information in the linked-list; the usb_mixer_elem_info embeds this
    header struct instead
    - add resume and dump callbacks to usb_mixer_elem_list struct to allow
    quirks providing the own methods

    For the standard mixer elements, these new callbacks are set to the
    standard ones as default, thus there is no functional change by this
    patch yet.

    The dump and resume callbacks are typedef'ed for ease of later patches
    using arrays of such function pointers.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • Introduce an internal helper macro for avoiding many open codes.

    The only slight behavior change is in a couple of get ballcks where
    the value is reset at error no matter whether ignore_ctl_error is set
    or not. Actually this is even safer than before.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • Takashi Iwai
     

17 Nov, 2014

1 commit


13 Nov, 2014

1 commit

  • Make the functions set_cur_mix_value and get_cur_mix_value accessible by files
    that include mixer.h. In addition make usb_mixer_elem_free accessible.
    This allows reuse of these functions by mixers that may require quirks.

    The following summarizes the renamed functions:
    - set_cur_mix_value -> snd_usb_set_cur_mix_value
    - get_cur_mix_value -> snd_usb_get_cur_mix_value
    - usb_mixer_elem_free -> snd_usb_mixer_elem_free

    Signed-off-by: Chris J Arges
    Signed-off-by: Takashi Iwai

    Chris J Arges
     

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
     

19 Oct, 2014

1 commit


04 Aug, 2014

1 commit


25 May, 2014

2 commits


28 Apr, 2014

1 commit


13 Mar, 2014

1 commit

  • ASoC: Updates for v3.15

    Quite a busy release for ASoC this time, more on janitorial work than
    exciting new features but welcome nontheless:

    - Lots of cleanups from Takashi for enumerations; the original API for
    these was error prone so he's refactored lots of code to use more
    modern APIs which avoid issues.
    - Elimination of the ASoC level wrappers for I2C and SPI moving us
    closer to converting to regmap completely and avoiding some
    randconfig hassle.
    - Provide both manually and transparently locked DAPM APIs rather than
    a mix of the two fixing some concurrency issues.
    - Start converting CODEC drivers to use separate bus interface drivers
    rather than having them all in one file helping avoid dependency
    issues.
    - DPCM support for Intel Haswell and Bay Trail platforms.
    - Lots of work on improvements for simple-card, DaVinci and the Renesas
    rcar drivers.
    - New drivers for Analog Devices ADAU1977, TI PCM512x and parts of the
    CSR SiRF SoC.

    Takashi Iwai
     

05 Mar, 2014

1 commit


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
     

14 Feb, 2014

1 commit


03 Feb, 2014

1 commit


26 Sep, 2013

1 commit

  • Convert 0 to false and 1 to true when assigning values to bool
    variables. Inspired by commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2.

    The simplified semantic patch that find this problem is as
    follows (http://coccinelle.lip6.fr/):

    @@
    bool b;
    @@
    (
    -b = 0
    +b = false
    |
    -b = 1
    +b = true
    )

    Signed-off-by: Peter Senna Tschudin
    Signed-off-by: Takashi Iwai

    Peter Senna Tschudin
     

12 Aug, 2013

1 commit


17 Jun, 2013

1 commit


05 Jun, 2013

1 commit

  • USB audio driver spews an error message when probing Logitech HD
    webcam c270:
    ALSA mixer.c:1300 usb_audio: Warning! Unlikely big volume range (=6144), cval->res is probably wrong.
    ALSA mixer.c:1304 usb_audio: [5] FU [Mic Capture Volume] ch = 1, val = 1536/7680/1

    Obviously the device needs a fixed volume resolution (cval->res = 384)
    like other Logitech devices.

    Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=821735

    Reported-and-tested-by: Cristian Rodríguez
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

20 Mar, 2013

3 commits

  • Creation of individual mixer controls may fail, but that shouldn't cause
    the entire mixer creation to fail. Even worse, if the mixer creation
    fails, that will error out the entire device probing.

    All the functions called by parse_audio_unit() should return -EINVAL if
    they find descriptors that are unsupported or believed to be malformed,
    so we can safely handle this error code as a non-fatal condition in
    snd_usb_mixer_controls().

    That fixes a long standing bug which is commonly worked around by
    adding quirks which make the driver ignore entire interfaces. Some of
    them might now be unnecessary.

    Signed-off-by: Daniel Mack
    Reported-and-tested-by: Rodolfo Thomazelli
    Cc:
    Signed-off-by: Takashi Iwai

    Daniel Mack
     
  • In check_input_term() and parse_audio_feature_unit(), propagate the
    error value that has been returned by a failing function instead of
    -EINVAL. That helps cleaning up the error pathes in the mixer.

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

    Daniel Mack
     
  • UAC2_EXTENSION_UNIT_V2 differs from UAC1_EXTENSION_UNIT, but can be handled in
    the same way when parsing the unit. Otherwise parse_audio_unit() fails when it
    sees an extension unit on a UAC2 device.

    UAC2_EXTENSION_UNIT_V2 is outside the range allocated by UAC1.

    Signed-off-by: Torstein Hegge
    Acked-by: Daniel Mack
    Cc:
    Signed-off-by: Takashi Iwai

    Torstein Hegge
     

11 Feb, 2013

1 commit

  • Adds quirks and mixer support for the M-Audio Fast Track C600 USB
    audio interface. This device is very similar to the C400 - the C600
    simply has some more inputs and outputs, so the existing C400 support
    is extended to support this device as well.

    Signed-off-by: Matt Gruskin
    Signed-off-by: Takashi Iwai

    Matt Gruskin
     

27 Jan, 2013

1 commit

  • Commit 23caaf19b11e (ALSA: usb-mixer: Add support for Audio Class v2.0)
    forgot to adjust the length check for UAC 2.0 feature unit descriptors.
    This would make the code abort on encountering a feature unit without
    per-channel controls, and thus prevented the driver to work with any
    device having such a unit, such as the RME Babyface or Fireface UCX.

    Reported-by: Florian Hanisch
    Tested-by: Matthew Robbetts
    Tested-by: Michael Beer
    Cc: Daniel Mack
    Cc: 2.6.35+
    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

29 Nov, 2012

3 commits

  • A lot of headsets/headphones have a "Speaker" mixer control. This confuses
    PulseAudio to think it is a speaker instead of a headphone/headset.
    Therfore, we rename it to "Headphone".

    We determine if something is a headphone similar to how udev determines
    form factor (see 78-sound-card.rules).

    BugLink: https://bugs.launchpad.net/bugs/1082357
    Signed-off-by: David Henningsson
    Signed-off-by: Takashi Iwai

    David Henningsson
     
  • Add ranges for various Fast Track C400 controls, as observed
    while using the vendor's mixer control software (res values
    are an estimation).

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

    Eldad Zack
     
  • Current code mishandles the case where the device is a UAC2
    and the bDescriptorSubtype is a UAC2 Effect Unit (0x07).
    It tries to parse it as a Processing Unit (which is similar to two
    other UAC1 units with overlapping subtypes), but since the structure
    is different (See: 4.7.2.10, 4.7.2.11 in UAC2 standard), the parsing
    is done incorrectly and prevents the device from initializing.
    For now, just ignore the unit.

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

    Eldad Zack