From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
alan@lxorguk.ukuu.org.uk, Daniel Mack <zonque@gmail.com>,
Takashi Iwai <tiwai@suse.de>
Subject: [ 072/122] ALSA: snd-usb: Add quirks for Playback Designs devices
Date: Thu, 11 Oct 2012 07:53:58 +0900 [thread overview]
Message-ID: <20121010225351.076653536@linuxfoundation.org> (raw)
In-Reply-To: <20121010225337.989799482@linuxfoundation.org>
3.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <zonque@gmail.com>
commit 2b58fd5b3193fd3af3d15114d95706087d25a7fe upstream.
Playback Designs' USB devices have some hardware limitations on their
USB interface. In particular:
- They need a 20ms delay after each class compliant request as the
hardware ACKs the USB packets before the device is actually ready
for the next command. Sending data immediately will result in buffer
overflows in the hardware.
- The devices send bogus feedback data at the start of each stream
which confuse the feedback format auto-detection.
This patch introduces a new quirks hook that is called after each
control packet and which adds a delay for all devices that match
Playback Designs' USB VID for now.
In addition, it adds a counter to snd_usb_endpoint to drop received
packets on the floor. Another new quirks function that is called once
an endpoint is started initializes that counter for these devices on
their sync endpoint.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-and-tested-by: Andreas Koch <andreas@akdesigninc.com>
Supported-by: Demian Martin <demianm_1@yahoo.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/usb/card.h | 2 ++
sound/usb/endpoint.c | 8 ++++++++
sound/usb/helper.c | 5 +++++
sound/usb/quirks.c | 24 ++++++++++++++++++++++++
sound/usb/quirks.h | 10 ++++++++++
5 files changed, 49 insertions(+)
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -92,6 +92,8 @@ struct snd_usb_endpoint {
unsigned char silence_value;
unsigned int stride;
int iface, alt_idx;
+ int skip_packets; /* quirks for devices to ignore the first n packets
+ in a stream */
spinlock_t lock;
struct list_head list;
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -31,6 +31,7 @@
#include "card.h"
#include "endpoint.h"
#include "pcm.h"
+#include "quirks.h"
#define EP_FLAG_ACTIVATED 0
#define EP_FLAG_RUNNING 1
@@ -170,6 +171,11 @@ static void retire_inbound_urb(struct sn
{
struct urb *urb = urb_ctx->urb;
+ if (unlikely(ep->skip_packets > 0)) {
+ ep->skip_packets--;
+ return;
+ }
+
if (ep->sync_slave)
snd_usb_handle_sync_urb(ep->sync_slave, ep, urb);
@@ -828,6 +834,8 @@ int snd_usb_endpoint_start(struct snd_us
ep->unlink_mask = 0;
ep->phase = 0;
+ snd_usb_endpoint_start_quirk(ep);
+
/*
* If this endpoint has a data endpoint as implicit feedback source,
* don't start the urbs here. Instead, mark them all as available,
--- a/sound/usb/helper.c
+++ b/sound/usb/helper.c
@@ -21,6 +21,7 @@
#include "usbaudio.h"
#include "helper.h"
+#include "quirks.h"
/*
* combine bytes and get an integer value
@@ -97,6 +98,10 @@ int snd_usb_ctl_msg(struct usb_device *d
memcpy(data, buf, size);
kfree(buf);
}
+
+ snd_usb_ctl_msg_quirk(dev, pipe, request, requesttype,
+ value, index, data, size);
+
return err;
}
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -761,3 +761,27 @@ void snd_usb_set_format_quirk(struct snd
}
}
+void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
+{
+ /*
+ * "Playback Design" products send bogus feedback data at the start
+ * of the stream. Ignore them.
+ */
+ if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&
+ ep->type == SND_USB_ENDPOINT_TYPE_SYNC)
+ ep->skip_packets = 4;
+}
+
+void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
+ __u8 request, __u8 requesttype, __u16 value,
+ __u16 index, void *data, __u16 size)
+{
+ /*
+ * "Playback Design" products need a 20ms delay after each
+ * class compliant request
+ */
+ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
+ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
+ mdelay(20);
+}
+
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -1,6 +1,10 @@
#ifndef __USBAUDIO_QUIRKS_H
#define __USBAUDIO_QUIRKS_H
+struct audioformat;
+struct snd_usb_endpoint;
+struct snd_usb_substream;
+
int snd_usb_create_quirk(struct snd_usb_audio *chip,
struct usb_interface *iface,
struct usb_driver *driver,
@@ -20,4 +24,10 @@ void snd_usb_set_format_quirk(struct snd
int snd_usb_is_big_endian_format(struct snd_usb_audio *chip,
struct audioformat *fp);
+void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep);
+
+void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
+ __u8 request, __u8 requesttype, __u16 value,
+ __u16 index, void *data, __u16 size);
+
#endif /* __USBAUDIO_QUIRKS_H */
next prev parent reply other threads:[~2012-10-10 23:03 UTC|newest]
Thread overview: 122+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 22:52 [ 000/122] 3.6.2-stable review Greg Kroah-Hartman
2012-10-10 22:52 ` [ 001/122] mn10300: only add -mmem-funcs to KBUILD_CFLAGS if gcc supports it Greg Kroah-Hartman
2012-10-10 22:52 ` [ 002/122] kbuild: make: fix if_changed when command contains backslashes Greg Kroah-Hartman
2012-10-10 22:52 ` [ 003/122] kbuild: Do not package /boot and /lib in make tar-pkg Greg Kroah-Hartman
2012-10-10 22:52 ` [ 004/122] kbuild: Fix gcc -x syntax Greg Kroah-Hartman
2012-10-10 22:52 ` [ 005/122] i2c-piix4: Fix build failure Greg Kroah-Hartman
2012-10-10 22:52 ` [ 006/122] slab: fix the DEADLOCK issue on l3 alien lock Greg Kroah-Hartman
2012-10-10 22:52 ` [ 007/122] powerpc/iommu: Fix multiple issues with IOMMU pools code Greg Kroah-Hartman
2012-10-10 22:52 ` [ 008/122] intel-iommu: Default to non-coherent for domains unattached to iommus Greg Kroah-Hartman
2012-10-10 22:52 ` [ 009/122] ARM: 7548/1: include linux/sched.h in syscall.h Greg Kroah-Hartman
2012-10-10 22:52 ` [ 010/122] em28xx: Make all em28xx extensions to be initialized asynchronously Greg Kroah-Hartman
2012-10-10 22:52 ` [ 011/122] media: rc: ite-cir: Initialise ite_dev::rdev earlier Greg Kroah-Hartman
2012-10-10 22:52 ` [ 012/122] media: gspca_pac7302: add support for device 1ae7:2001 Speedlink Snappy Microphone SL-6825-SBK Greg Kroah-Hartman
2012-10-10 22:52 ` [ 013/122] media: gspca_pac7302: make red balance and blue balance controls work again Greg Kroah-Hartman
2012-10-10 22:53 ` [ 014/122] ACPI: run _OSC after ACPI_FULL_INITIALIZATION Greg Kroah-Hartman
2012-10-10 22:53 ` [ 016/122] mfd: 88pm860x: Move _IO resources out of ioport_ioresource Greg Kroah-Hartman
2012-10-10 22:53 ` [ 017/122] lib/gcd.c: prevent possible div by 0 Greg Kroah-Hartman
2012-10-10 22:53 ` [ 018/122] kernel/sys.c: call disable_nonboot_cpus() in kernel_restart() Greg Kroah-Hartman
2012-10-10 22:53 ` [ 019/122] drivers/scsi/atp870u.c: fix bad use of udelay Greg Kroah-Hartman
2012-10-10 22:53 ` [ 020/122] drivers/dma/dmaengine.c: lower the priority of failed to get dma channel message Greg Kroah-Hartman
2012-10-10 22:53 ` [ 021/122] lguest: fix occasional crash in example launcher Greg Kroah-Hartman
2012-10-10 22:53 ` [ 022/122] powerpc: Fix VMX fix for memcpy case Greg Kroah-Hartman
2012-10-10 22:53 ` [ 023/122] powerpc/eeh: Fix crash on converting OF node to edev Greg Kroah-Hartman
2012-10-10 22:53 ` [ 024/122] ixgbe: fix PTP ethtool timestamping function Greg Kroah-Hartman
2012-10-10 22:53 ` [ 025/122] drxk: allow loading firmware synchrousnously Greg Kroah-Hartman
2012-10-10 22:53 ` [ 026/122] rapidio/rionet: fix multicast packet transmit logic Greg Kroah-Hartman
2012-10-10 22:53 ` [ 027/122] PM / Sleep: use resume event when call dpm_resume_early Greg Kroah-Hartman
2012-10-10 22:53 ` [ 028/122] workqueue: add missing smp_wmb() in process_one_work() Greg Kroah-Hartman
2012-10-10 22:53 ` [ 029/122] workqueue: fix possible stall on try_to_grab_pending() of a delayed work item Greg Kroah-Hartman
2012-10-10 22:53 ` [ 030/122] jbd2: dont write superblock when if its empty Greg Kroah-Hartman
2012-10-10 22:53 ` [ 031/122] localmodconfig: Fix localyesconfig to set to y not m Greg Kroah-Hartman
2012-10-10 22:53 ` [ 032/122] ipv4: add a fib_type to fib_info Greg Kroah-Hartman
2012-10-10 22:53 ` [ 033/122] 8021q: fix mac_len recomputation in vlan_untag() Greg Kroah-Hartman
2012-10-10 22:53 ` [ 034/122] ipv6: release reference of ip6_null_entrys dst entry in __ip6_del_rt Greg Kroah-Hartman
2012-10-10 22:53 ` [ 035/122] net: ethernet: davinci_cpdma: decrease the desc count when cleaning up the remaining packets Greg Kroah-Hartman
2012-10-10 22:53 ` [ 036/122] ipv6: del unreachable route when an addr is deleted on lo Greg Kroah-Hartman
2012-10-10 22:53 ` [ 037/122] drm/savage: re-add busmaster enable, regression fix Greg Kroah-Hartman
2012-10-10 22:53 ` [ 038/122] SCSI: zfcp: Adapt to new FC_PORTSPEED semantics Greg Kroah-Hartman
2012-10-10 22:53 ` [ 039/122] SCSI: zfcp: Make trace record tags unique Greg Kroah-Hartman
2012-10-10 22:53 ` [ 040/122] SCSI: zfcp: Bounds checking for deferred error trace Greg Kroah-Hartman
2012-10-10 22:53 ` [ 041/122] SCSI: zfcp: Do not wakeup while suspended Greg Kroah-Hartman
2012-10-10 22:53 ` [ 042/122] SCSI: zfcp: remove invalid reference to list iterator variable Greg Kroah-Hartman
2012-10-10 22:53 ` [ 043/122] SCSI: zfcp: restore refcount check on port_remove Greg Kroah-Hartman
2012-10-10 22:53 ` [ 044/122] SCSI: zfcp: only access zfcp_scsi_dev for valid scsi_device Greg Kroah-Hartman
2012-10-10 22:53 ` [ 045/122] PCI: Check P2P bridge for invalid secondary/subordinate range Greg Kroah-Hartman
2012-10-10 22:53 ` [ 046/122] ext4: ignore last group w/o enough space when resizing instead of BUGing Greg Kroah-Hartman
2012-10-10 22:53 ` [ 047/122] ext4: dont copy non-existent gdt blocks when resizing Greg Kroah-Hartman
2012-10-10 22:53 ` [ 048/122] ext4: avoid duplicate writes of the backup bg descriptor blocks Greg Kroah-Hartman
2012-10-10 22:53 ` [ 049/122] ext4: fix potential deadlock in ext4_nonda_switch() Greg Kroah-Hartman
2012-10-10 22:53 ` [ 050/122] ext4: fix crash when accessing /proc/mounts concurrently Greg Kroah-Hartman
2012-10-10 22:53 ` [ 051/122] ext4: move_extent code cleanup Greg Kroah-Hartman
2012-10-10 22:53 ` [ 052/122] ext4: online defrag is not supported for journaled files Greg Kroah-Hartman
2012-10-10 22:53 ` [ 053/122] ext4: always set i_op in ext4_mknod() Greg Kroah-Hartman
2012-10-10 22:53 ` [ 054/122] ext4: fix fdatasync() for files with only i_size changes Greg Kroah-Hartman
2012-10-10 22:53 ` [ 055/122] ext4: fix mtime update in nodelalloc mode Greg Kroah-Hartman
2012-10-10 22:53 ` [ 056/122] ASoC: wm_hubs: Ensure volume updates are handled during class W startup Greg Kroah-Hartman
2012-10-10 22:53 ` [ 057/122] ASoC: wm5110: Adding missing volume update bits Greg Kroah-Hartman
2012-10-10 22:53 ` [ 058/122] ASoC: wm9712: Fix name of Capture Switch Greg Kroah-Hartman
2012-10-10 22:53 ` [ 059/122] kpageflags: fix wrong KPF_THP on non-huge compound pages Greg Kroah-Hartman
2012-10-10 22:53 ` [ 060/122] hugetlb: do not use vma_hugecache_offset() for vma_prio_tree_foreach Greg Kroah-Hartman
2012-10-10 22:53 ` [ 061/122] mm: fix invalidate_complete_page2() lock ordering Greg Kroah-Hartman
2012-10-10 22:53 ` [ 062/122] mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP Greg Kroah-Hartman
2012-10-10 22:53 ` [ 063/122] MIPS: ath79: use correct fractional dividers for {CPU,DDR}_PLL on AR934x Greg Kroah-Hartman
2012-10-10 22:53 ` [ 064/122] drm/i915: prevent possible pin leak on error path Greg Kroah-Hartman
2012-10-10 22:53 ` [ 065/122] drm/i915: make sure we write all the DIP data bytes Greg Kroah-Hartman
2012-10-10 22:53 ` [ 066/122] ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310 Greg Kroah-Hartman
2012-10-10 22:53 ` [ 067/122] ALSA: aloop - add locking to timer access Greg Kroah-Hartman
2012-10-10 22:53 ` [ 068/122] ALSA: hda/via - dont report presence on HPs with no presence support Greg Kroah-Hartman
2012-10-10 22:53 ` [ 069/122] ALSA: hda/realtek - Fix detection of ALC271X codec Greg Kroah-Hartman
2012-10-10 22:53 ` [ 070/122] ALSA: hda - limit internal mic boost for Asus X202E Greg Kroah-Hartman
2012-10-10 22:53 ` [ 071/122] ALSA: usb - disable broken hw volume for Tenx TP6911 Greg Kroah-Hartman
2012-10-10 22:53 ` Greg Kroah-Hartman [this message]
2012-10-10 22:53 ` [ 073/122] ALSA: USB: Support for (original) Xbox Communicator Greg Kroah-Hartman
2012-10-10 22:54 ` [ 074/122] ALSA: hda - Add another pci id for Haswell board Greg Kroah-Hartman
2012-10-10 22:54 ` [ 075/122] ALSA: hda - use LPIB for delay estimation Greg Kroah-Hartman
2012-10-10 22:54 ` [ 076/122] drm/nvc0/fence: restore pre-suspend fence buffer context on resume Greg Kroah-Hartman
2012-10-10 22:54 ` [ 077/122] drm: Destroy the planes prior to destroying the associated CRTC Greg Kroah-Hartman
2012-10-10 22:54 ` [ 078/122] drm/radeon: only adjust default clocks on NI GPUs Greg Kroah-Hartman
2012-10-10 22:54 ` [ 079/122] drm/radeon/kms: allow STRMOUT_BASE_UPDATE on RS780 and RS880 Greg Kroah-Hartman
2012-10-10 22:54 ` [ 080/122] drm/radeon: allow MIP_ADDRESS=0 for MSAA textures on Evergreen Greg Kroah-Hartman
2012-10-10 22:54 ` [ 081/122] drm/radeon: Add MSI quirk for gateway RS690 Greg Kroah-Hartman
2012-10-10 22:54 ` [ 082/122] drm/radeon: force MSIs on RS690 asics Greg Kroah-Hartman
2012-10-10 22:54 ` [ 083/122] HID: hidraw: dont deallocate memory when it is in use Greg Kroah-Hartman
2012-10-10 22:54 ` [ 084/122] drm/i915: Flush the pending flips on the CRTC before modification Greg Kroah-Hartman
2012-10-10 22:54 ` [ 085/122] drm/i915: call drm_handle_vblank before finish_page_flip Greg Kroah-Hartman
2012-10-10 22:54 ` [ 086/122] drm/i915: Fix GT_MODE default value Greg Kroah-Hartman
2012-10-10 22:54 ` [ 087/122] ia64: Add missing RCU idle APIs on idle loop Greg Kroah-Hartman
2012-10-10 22:54 ` [ 088/122] h8300: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 089/122] parisc: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 090/122] xtensa: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 091/122] frv: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 092/122] mn10300: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 093/122] m68k: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 094/122] alpha: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 095/122] cris: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 096/122] m32r: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 097/122] score: " Greg Kroah-Hartman
2012-10-10 22:54 ` [ 098/122] rcu: Fix day-one dyntick-idle stall-warning bug Greg Kroah-Hartman
2012-10-10 22:54 ` [ 099/122] revert "mm: mempolicy: Let vma_merge and vma_split handle vma->vm_policy linkages" Greg Kroah-Hartman
2012-10-10 22:54 ` [ 100/122] mempolicy: remove mempolicy sharing Greg Kroah-Hartman
2012-10-10 22:54 ` [ 101/122] mempolicy: fix a race in shared_policy_replace() Greg Kroah-Hartman
2012-10-10 22:54 ` [ 102/122] mempolicy: fix refcount leak in mpol_set_shared_policy() Greg Kroah-Hartman
2012-10-10 22:54 ` [ 103/122] mempolicy: fix a memory corruption by refcount imbalance in alloc_pages_vma() Greg Kroah-Hartman
2012-10-10 22:54 ` [ 104/122] efi: Build EFI stub with EFI-appropriate options Greg Kroah-Hartman
2012-10-10 22:54 ` [ 105/122] efi: initialize efi.runtime_version to make query_variable_info/update_capsule workable Greg Kroah-Hartman
2012-10-10 22:54 ` [ 106/122] em28xx: regression fix: use DRX-K sync firmware requests on em28xx Greg Kroah-Hartman
2012-10-10 22:54 ` [ 107/122] sched: Fix load avg vs. cpu-hotplug Greg Kroah-Hartman
2012-10-10 22:54 ` [ 108/122] asix: Adds support for Lenovo 10/100 USB dongle Greg Kroah-Hartman
2012-10-10 22:54 ` [ 109/122] ALSA: hda - Fix hang caused by race during suspend Greg Kroah-Hartman
2012-10-10 22:54 ` [ 110/122] mtd: mtdpart: break it as soon as we parse out the partitions Greg Kroah-Hartman
2012-10-10 22:54 ` [ 111/122] mtd: autcpu12-nvram: Fix compile breakage Greg Kroah-Hartman
2012-10-10 22:54 ` [ 112/122] mtd: nandsim: bugfix: fail if overridesize is too big Greg Kroah-Hartman
2012-10-10 22:54 ` [ 113/122] mtd: nand: Use the mirror BBT descriptor when reading its version Greg Kroah-Hartman
2012-10-10 22:54 ` [ 114/122] mtd: omap2: fix omap_nand_remove segfault Greg Kroah-Hartman
2012-10-10 22:54 ` [ 115/122] mtd: omap2: fix module loading Greg Kroah-Hartman
2012-10-10 22:54 ` [ 116/122] mmc: omap_hsmmc: Pass on the suspend failure to the PM core Greg Kroah-Hartman
2012-10-10 22:54 ` [ 117/122] mmc: slot-gpio: Fix missing assignment to ctx->ro_gpio Greg Kroah-Hartman
2012-10-10 22:54 ` [ 118/122] mmc: sh-mmcif: avoid oops on spurious interrupts Greg Kroah-Hartman
2012-10-10 22:54 ` [ 119/122] JFFS2: fix unmount regression Greg Kroah-Hartman
2012-10-10 22:54 ` [ 120/122] JFFS2: dont fail on bitflips in OOB Greg Kroah-Hartman
2012-10-10 22:54 ` [ 121/122] cifs: reinstate the forcegid option Greg Kroah-Hartman
2012-10-10 22:54 ` [ 122/122] Convert properly UTF-8 to UTF-16 Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121010225351.076653536@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.de \
--cc=zonque@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox