1. 04 6月, 2020 1 次提交
    • T
      ALSA: usb-audio: Fix inconsistent card PM state after resume · 862b2509
      Takashi Iwai 提交于
      When a USB-audio interface gets runtime-suspended via auto-pm feature,
      the driver suspends all functionality and increment
      chip->num_suspended_intf.  Later on, when the system gets suspended to
      S3, the driver increments chip->num_suspended_intf again, skips the
      device changes, and sets the card power state to
      SNDRV_CTL_POWER_D3hot.  In return, when the system gets resumed from
      S3, the resume callback decrements chip->num_suspended_intf.  Since
      this refcount is still not zero (it's been runtime-suspended), the
      whole resume is skipped.  But there is a small pitfall here.
      
      The problem is that the driver doesn't restore the card power state
      after this resume call, leaving it as SNDRV_CTL_POWER_D3hot.  So,
      even after the system resume finishes, the card instance still appears
      as if it were system-suspended, and this confuses many ioctl accesses
      that are blocked unexpectedly.
      
      In details, we have two issues behind the scene: one is that the card
      power state is changed only when the refcount becomes zero, and
      another is that the prior auto-suspend check is kept in a boolean
      flag.  Although the latter problem is almost negligible since the
      auto-pm feature is imposed only on the primary interface, but this can
      be a potential problem on the devices with multiple interfaces.
      
      This patch addresses those issues by the following:
      
      - Replace chip->autosuspended boolean flag with chip->system_suspend
        counter
      
      - At the first system-suspend, chip->num_suspended_intf is recorded to
        chip->system_suspend
      
      - At system-resume, the card power state is restored when the
        chip->num_suspended_intf refcount reaches to chip->system_suspend,
        i.e. the state returns to the auto-suspended
      
      Also, the patch fixes yet another hidden problem by the code
      refactoring along with the fixes above: namely, when some resume
      procedure failed, the driver left chip->num_suspended_intf that was
      already decreased, and it might lead to the refcount unbalance.
      In the new code, the refcount decrement is done after the whole resume
      procedure, and the problem is avoided as well.
      
      Fixes: 0662292a ("ALSA: usb-audio: Handle normal and auto-suspend equally")
      Reported-and-tested-by: NMacpaul Lin <macpaul.lin@mediatek.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200603153709.6293-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      862b2509
  2. 02 6月, 2020 1 次提交
  3. 30 5月, 2020 1 次提交
  4. 28 5月, 2020 1 次提交
  5. 27 5月, 2020 1 次提交
    • T
      ALSA: usb-audio: Quirks for Gigabyte TRX40 Aorus Master onboard audio · 7f5ad9c9
      Takashi Iwai 提交于
      Gigabyte TRX40 Aorus Master is equipped with two USB-audio devices,
      a Realtek ALC1220-VB codec (USB ID 0414:a001) and an ESS SABRE9218 DAC
      (USB ID 0414:a000).  The latter serves solely for the headphone output
      on the front panel while the former serves for the rest I/Os (mostly
      for the I/Os in the rear panel but also including the front mic).
      
      Both chips do work more or less with the unmodified USB-audio driver,
      but there are a few glitches.  The ALC1220-VB returns an error for an
      inquiry to some jacks, as already seen on other TRX40-based mobos.
      However this machine has a slightly incompatible configuration, hence
      the existing mapping cannot be used as is.
      
      Meanwhile the ESS chip seems working without any quirk.  But since
      both audio devices don't provide any specific names, both cards appear
      as "USB-Audio", and it's quite confusing for users.
      
      This patch is an attempt to overcome those issues:
      
      - The specific mapping table for ALC1220-VB is provided, reducing the
        non-working nodes and renaming the badly chosen controls.
        The connector map isn't needed here unlike other TRX40 quirks.
      
      - For both USB IDs (0414:a000 and 0414:a001), provide specific card
        name strings, so that user-space can identify more easily; and more
        importantly, UCM profile can be applied to each.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200526082810.29506-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      7f5ad9c9
  6. 26 5月, 2020 1 次提交
  7. 16 5月, 2020 1 次提交
  8. 15 5月, 2020 1 次提交
  9. 08 5月, 2020 1 次提交
    • G
      ALSA: Replace zero-length array with flexible-array · 9ad06ebb
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      sizeof(flexible-array-member) triggers a warning because flexible array
      members have incomplete type[1]. There are some instances of code in
      which the sizeof operator is being incorrectly/erroneously applied to
      zero-length arrays and the result is zero. Such instances may be hiding
      some bugs. So, this work (flexible-array member conversions) will also
      help to get completely rid of those sorts of issues.
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Link: https://lore.kernel.org/r/20200507192223.GA16335@embeddedorSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      9ad06ebb
  10. 04 5月, 2020 1 次提交
  11. 03 5月, 2020 2 次提交
  12. 01 5月, 2020 1 次提交
  13. 30 4月, 2020 1 次提交
  14. 26 4月, 2020 1 次提交
  15. 24 4月, 2020 3 次提交
  16. 23 4月, 2020 1 次提交
  17. 22 4月, 2020 3 次提交
  18. 21 4月, 2020 2 次提交
  19. 20 4月, 2020 2 次提交
  20. 19 4月, 2020 1 次提交
  21. 15 4月, 2020 1 次提交
  22. 12 4月, 2020 4 次提交
  23. 08 4月, 2020 1 次提交
  24. 05 4月, 2020 1 次提交
  25. 03 4月, 2020 1 次提交
  26. 31 3月, 2020 1 次提交
  27. 26 3月, 2020 3 次提交
    • T
      ALSA: usb-audio: Inform devices that need delayed registration · a4aad563
      Takashi Iwai 提交于
      The USB-audio driver may call snd_card_register() multiple times as
      its probe function is per USB interface while some USB-audio devices
      may provide multiple interfaces to assign different streams although
      they belong to the same device.  This works in most cases but the
      registration is racy, hence it may miss the device recognition,
      e.g. PA doesn't see certain devices when hotplugged.
      
      The recent addition of the delayed registration quirk allows to sync
      the registration at the last known interface, and the previous commit
      added a new module option to allow the dynamic setup for that
      purpose.
      
      Now, this patch tries to find out and notifies for such devices that
      require the delayed registration.  It shows a message like:
      
        Found post-registration device assignment: 1234abcd:02
      
      If you hit this message, you can pass delayed_register module option
      like:
      
        snd_usb_audio.delayed_register=1234abcd:02
      
      by just copying the last shown entry.  If this works, it can be added
      statically in the quirk list, registration_quirks[] found at the end
      of sound/usb/quirks.c.
      
      Link: https://lore.kernel.org/r/20200325103322.2508-4-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      a4aad563
    • T
      ALSA: usb-audio: Add delayed_register option · b70038ef
      Takashi Iwai 提交于
      Add a new option for specifying the quirk for delayed registration of
      the certain device.  A list of devices can be passed in a form
      	ID:IFACE,ID:IFACE,ID:IFACE,....
      where ID is the 32bit hex number combo of vendor and device IDs and
      IFACE is the interface number to trigger the register.
      
      When a matching device is probed, the card registration is delayed
      until the given interface is probed.  It's needed for syncing the
      registration until the last interface when multiple interfaces are
      provided for the same card.
      
      Link: https://lore.kernel.org/r/20200325103322.2508-3-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      b70038ef
    • T
      ALSA: usb-audio: Rewrite registration quirk handling · d8695bc5
      Takashi Iwai 提交于
      A slight refactoring of the registration quirk code.  Now it uses the
      table lookup for easy additions in future.  Also the return type was
      changed to bool, and got a few more comments.
      
      Link: https://lore.kernel.org/r/20200325103322.2508-2-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      d8695bc5
  28. 15 3月, 2020 1 次提交