1. 30 5月, 2017 1 次提交
    • B
      ALSA: declare snd_kcontrol_new structures as const · 905e46ac
      Bhumika Goyal 提交于
      Declare snd_kcontrol_new structures as const as they are only passed an
      argument to the function snd_ctl_new1. This argument is of type const,
      so snd_kcontrol_new structures having this property can be made const.
      Done using Coccinelle:
      
      @r disable optional_qualifier@
      identifier x;
      position p;
      @@
      static struct snd_kcontrol_new x@p={...};
      
      @ok@
      identifier r.x;
      position p;
      @@
      snd_ctl_new1(&x@p,...)
      
      @bad@
      position p != {r.p,ok.p};
      identifier r.x;
      @@
      x@p
      
      @depends on !bad disable optional_qualifier@
      identifier r.x;
      @@
      +const
      struct snd_kcontrol_new x;
      
      Cross compiled these files:
      sound/aoa/codecs/tas.c - powerpc
      sound/mips/{hal2.c/sgio2audio.c} - mips
      sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc
      sound/soc/sh/siu_dai.c - sh
      Could not find an architecture to compile sound/sh/aica.c.
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      905e46ac
  2. 20 2月, 2017 1 次提交
  3. 23 9月, 2016 1 次提交
    • A
      ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants · eb1a74b7
      Anssi Hannula 提交于
      The DragonFly quirk added in 42e3121d ("ALSA: usb-audio: Add a more
      accurate volume quirk for AudioQuest DragonFly") applies a custom dB map
      on the volume control when its range is reported as 0..50 (0 .. 0.2dB).
      
      However, there exists at least one other variant (hw v1.0c, as opposed
      to the tested v1.2) which reports a different non-sensical volume range
      (0..53) and the custom map is therefore not applied for that device.
      
      This results in all of the volume change appearing close to 100% on
      mixer UIs that utilize the dB TLV information.
      
      Add a fallback case where no dB TLV is reported at all if the control
      range is not 0..50 but still 0..N where N <= 1000 (3.9 dB). Also
      restrict the quirk to only apply to the volume control as there is also
      a mute control which would match the check otherwise.
      
      Fixes: 42e3121d ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly")
      Signed-off-by: NAnssi Hannula <anssi.hannula@iki.fi>
      Reported-by: NDavid W <regulars@d-dub.org.uk>
      Tested-by: NDavid W <regulars@d-dub.org.uk>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      eb1a74b7
  4. 16 3月, 2016 1 次提交
  5. 13 1月, 2016 1 次提交
  6. 14 12月, 2015 1 次提交
    • A
      ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly · 42e3121d
      Anssi Hannula 提交于
      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 2d1cb7f6 ("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: NAnssi Hannula <anssi.hannula@iki.fi>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      42e3121d
  7. 28 9月, 2015 1 次提交
  8. 26 8月, 2015 1 次提交
    • T
      ALSA: usb-audio: Avoid nested autoresume calls · 47ab1545
      Takashi Iwai 提交于
      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: [<ffffffffa0355dac>] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]
        but task is already holding lock:
         (&chip->shutdown_rwsem){.+.+.+}, at: [<ffffffffa0355dac>] 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: 9003ebb1 ('ALSA: usb-audio: Fix runtime PM unbalance')
      Reported-and-tested-by: NAlexnader Kuleshov <kuleshovmail@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      47ab1545
  9. 09 4月, 2015 1 次提交
  10. 21 11月, 2014 9 次提交
  11. 13 11月, 2014 2 次提交
    • C
      ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 · 76b188c4
      Chris J Arges 提交于
      This code contains the Scarlett mixer interface code that was originally
      written by Tobias Hoffman and Robin Gareus. Because the device doesn't
      properly implement UAC2 this code adds a mixer quirk for the device.
      
      Changes from the original code include removing the metering code along with
      dead code and comments. Compiler warnings were fixed. The code to initialize
      the sampling rate was causing a crash this was fixed as discussed on the
      mailing list. Error, and info messages were convered to dev_err and dev_info
      interfaces. The custom scarlett_mixer_elem_info struct was replaced with the
      more generic usb_mixer_elem_info to be able to recycle more code from mixer.c.
      
      This patch also makes additional modifications based on upstream comments.
      Individual control creation functions are removed and a generic
      function is no used. Macros for function calls are removed to improve
      readability. Hardcoded control initialization is removed. Save to HW
      functionality has been removed. Strings for enums are created dynamically for
      the mixer. Strings used for controls are now SNDRV_CTL_ELEM_ID_NAME_MAXLEN
      length.
      Signed-off-by: NChris J Arges <chris.j.arges@canonical.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      76b188c4
    • C
      ALSA: usb-audio: make set_*_mix_values functions public · eef90451
      Chris J Arges 提交于
      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: NChris J Arges <chris.j.arges@canonical.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      eef90451
  12. 12 11月, 2014 1 次提交
  13. 11 11月, 2014 1 次提交
  14. 21 10月, 2014 1 次提交
  15. 26 2月, 2014 1 次提交
    • T
      ALSA: usb-audio: Use standard printk helpers · 0ba41d91
      Takashi Iwai 提交于
      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: NTakashi Iwai <tiwai@suse.de>
      0ba41d91
  16. 06 12月, 2013 1 次提交
  17. 14 11月, 2013 1 次提交
  18. 28 6月, 2013 1 次提交
  19. 07 4月, 2013 1 次提交
    • E
      ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_* · 889d6684
      Eldad Zack 提交于
      The usb_control_msg() function expects __u16 types and performs
      the endianness conversions by itself.
      However, in three places, a conversion is performed before it is
      handed over to usb_control_msg(), which leads to a double conversion
      (= no conversion):
      * snd_usb_nativeinstruments_boot_quirk()
      * snd_nativeinstruments_control_get()
      * snd_nativeinstruments_control_put()
      
      Caught by sparse:
      
      sound/usb/mixer_quirks.c:512:38: warning: incorrect type in argument 6 (different base types)
      sound/usb/mixer_quirks.c:512:38:    expected unsigned short [unsigned] [usertype] index
      sound/usb/mixer_quirks.c:512:38:    got restricted __le16 [usertype] <noident>
      sound/usb/mixer_quirks.c:543:35: warning: incorrect type in argument 5 (different base types)
      sound/usb/mixer_quirks.c:543:35:    expected unsigned short [unsigned] [usertype] value
      sound/usb/mixer_quirks.c:543:35:    got restricted __le16 [usertype] <noident>
      sound/usb/mixer_quirks.c:543:56: warning: incorrect type in argument 6 (different base types)
      sound/usb/mixer_quirks.c:543:56:    expected unsigned short [unsigned] [usertype] index
      sound/usb/mixer_quirks.c:543:56:    got restricted __le16 [usertype] <noident>
      sound/usb/quirks.c:502:35: warning: incorrect type in argument 5 (different base types)
      sound/usb/quirks.c:502:35:    expected unsigned short [unsigned] [usertype] value
      sound/usb/quirks.c:502:35:    got restricted __le16 [usertype] <noident>
      Signed-off-by: NEldad Zack <eldad@fogrefinery.com>
      Acked-by: NDaniel Mack <zonque@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      889d6684
  20. 11 2月, 2013 1 次提交
  21. 10 1月, 2013 1 次提交
  22. 12 12月, 2012 1 次提交
  23. 29 11月, 2012 3 次提交
  24. 30 10月, 2012 1 次提交
  25. 11 6月, 2012 2 次提交
  26. 12 5月, 2012 1 次提交
  27. 24 4月, 2012 2 次提交