public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Clemens Ladisch <clemens@ladisch.de>,
	Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 3.10 042/103] ALSA: usb-audio: work around corrupted TEAC UD-H01 feedback data
Date: Wed,  4 Jun 2014 16:25:05 -0700	[thread overview]
Message-ID: <20140604232548.212166443@linuxfoundation.org> (raw)
In-Reply-To: <20140604232546.704156131@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Clemens Ladisch <clemens@ladisch.de>

commit 7040b6d1febfdbd9c1595efb751d492cd2503f96 upstream.

The TEAC UD-H01 firmware sends wrong feedback frequency values, thus
causing the PC to send the samples at a wrong rate, which results in
clicks and crackles in the output.

Add a workaround to detect and fix the corruption.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
[mick37@gmx.de: use sender->udh01_fb_quirk rather than
 ep->udh01_fb_quirk in snd_usb_handle_sync_urb()]
Reported-and-tested-by: Mick <mick37@gmx.de>
Reported-and-tested-by: Andrea Messa <andr.messa@tiscali.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/usb/card.h     |    1 +
 sound/usb/endpoint.c |   15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -90,6 +90,7 @@ struct snd_usb_endpoint {
 	unsigned int curframesize;      /* current packet size in frames (for capture) */
 	unsigned int syncmaxsize;	/* sync endpoint packet size */
 	unsigned int fill_max:1;	/* fill max packet size always */
+	unsigned int udh01_fb_quirk:1;	/* corrupted feedback data */
 	unsigned int datainterval;      /* log_2 of data packet interval */
 	unsigned int syncinterval;	/* P for adaptive mode, 0 otherwise */
 	unsigned char silence_value;
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -467,6 +467,10 @@ struct snd_usb_endpoint *snd_usb_add_end
 			ep->syncinterval = 3;
 
 		ep->syncmaxsize = le16_to_cpu(get_endpoint(alts, 1)->wMaxPacketSize);
+
+		if (chip->usb_id == USB_ID(0x0644, 0x8038) /* TEAC UD-H01 */ &&
+		    ep->syncmaxsize == 4)
+			ep->udh01_fb_quirk = 1;
 	}
 
 	list_add_tail(&ep->list, &chip->ep_list);
@@ -1075,7 +1079,16 @@ void snd_usb_handle_sync_urb(struct snd_
 	if (f == 0)
 		return;
 
-	if (unlikely(ep->freqshift == INT_MIN)) {
+	if (unlikely(sender->udh01_fb_quirk)) {
+		/*
+		 * The TEAC UD-H01 firmware sometimes changes the feedback value
+		 * by +/- 0x1.0000.
+		 */
+		if (f < ep->freqn - 0x8000)
+			f += 0x10000;
+		else if (f > ep->freqn + 0x8000)
+			f -= 0x10000;
+	} else if (unlikely(ep->freqshift == INT_MIN)) {
 		/*
 		 * The first time we see a feedback value, determine its format
 		 * by shifting it left or right until it matches the nominal



  parent reply	other threads:[~2014-06-04 23:38 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 23:24 [PATCH 3.10 000/103] 3.10.42-stable review Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 001/103] futex: Add another early deadlock detection check Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 002/103] futex: Prevent attaching to kernel threads Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 003/103] mips: dts: Fix missing device_type="memory" property in memory nodes Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 004/103] ftrace/module: Hardcode ftrace_module_init() call into load_module() Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 008/103] pata_at91: fix ata_host_activate() failure handling Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 010/103] mm: make fixup_user_fault() check the vma access rights too Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 011/103] serial: 8250: Fix thread unsafe __dma_tx_complete function Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 012/103] 8250_core: Fix unwanted TX chars write Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 013/103] gpu: host1x: handle the correct # of syncpt regs Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 014/103] timer: Prevent overflow in apply_slack Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 015/103] ipmi: Fix a race restarting the timer Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 016/103] ipmi: Reset the KCS timeout when starting error recovery Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 017/103] mac80211: fix suspend vs. authentication race Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 018/103] mm, thp: close race between mremap() and split_huge_page() Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 019/103] x86, mm, hugetlb: Add missing TLB page invalidation for hugetlb_cow() Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 020/103] hwpoison, hugetlb: lock_page/unlock_page does not match for handling a free hugepage Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 021/103] mac80211: fix on-channel remain-on-channel Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 022/103] hwmon: (emc1403) fix inverted store_hyst() Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 023/103] hwmon: (emc1403) Support full range of known chip revision numbers Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 024/103] drivercore: deferral race condition fix Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 025/103] hrtimer: Prevent all reprogramming if hang detected Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 026/103] hrtimer: Prevent remote enqueue of leftmost timers Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 027/103] hrtimer: Set expiry time before switch_hrtimer_base() Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 028/103] md: avoid possible spinning md thread at shutdown Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 029/103] drm/i915: Break encoder->crtc link separately in intel_sanitize_crtc() Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 032/103] drm/tegra: Remove gratuitous pad field Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 033/103] iio:imu:mpu6050: Fixed segfault in Invensens MPU driver due to null dereference Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 034/103] fsl-usb: do not test for PHY_CLK_VALID bit on controller version 1.6 Greg Kroah-Hartman
2014-06-04 23:24 ` [PATCH 3.10 035/103] usb: gadget: at91-udc: fix irq and iomem resource retrieval Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 038/103] usb: storage: shuttle_usbat: fix discs being detected twice Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 039/103] USB: Nokia 305 should be treated as unusual dev Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 040/103] USB: Nokia 5300 " Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 041/103] rt2x00: fix beaconing on USB Greg Kroah-Hartman
2014-06-04 23:25 ` Greg Kroah-Hartman [this message]
2014-06-04 23:25 ` [PATCH 3.10 043/103] Bluetooth: Fix triggering BR/EDR L2CAP Connect too early Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 044/103] Bluetooth: Fix redundant encryption request for reauthentication Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 045/103] Bluetooth: Add support for Lite-on [04ca:3007] Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 046/103] posix_acl: handle NULL ACL in posix_acl_equiv_mode Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 047/103] [media] omap3isp: Defer probe when the IOMMU is not available Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 048/103] ARM: dts: i.MX53: Fix ipu register space size Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 049/103] ARM: 8012/1: kdump: Avoid overflow when converting pfn to physaddr Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 050/103] rtl8192cu: Fix unbalanced irq enable in error path of rtl92cu_hw_init() Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 051/103] drm/nouveau/acpi: allow non-optimus setups to load vbios from acpi Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 053/103] leds: leds-pwm: properly clean up after probe failure Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 054/103] brcmsmac: fix deadlock on missing firmware Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 055/103] Documentation: Update stable address in Chinese and Japanese translations Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 056/103] crypto: crypto_wq - Fix late crypto work queue initialization Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 057/103] clk: vexpress: NULL dereference on error path Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 059/103] i2c: i801: Add Device IDs for Intel Wildcat Point-LP PCH Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 060/103] i2c: i801: enable Intel BayTrail SMBUS Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 061/103] Drivers: hv: vmbus: Negotiate version 3.0 when running on ws2012r2 hosts Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 062/103] trace: module: Maintain a valid user count Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 063/103] Input: atkbd - fix keyboard not working on some LG laptops Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 064/103] Input: elantech - fix touchpad initialization on Gigabyte U2442 Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 065/103] Input: synaptics - add min/max quirk for the ThinkPad W540 Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 066/103] Input: synaptics - T540p - unify with other LEN0034 models Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 067/103] ALSA: hda - Fix onboard audio on Intel H97/Z97 chipsets Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 068/103] NFSd: Move default initialisers from create_client() to alloc_client() Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 069/103] NFSd: call rpc_destroy_wait_queue() from free_client() Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 070/103] NFSD: Call ->set_acl with a NULL ACL structure if no entries Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 071/103] nfsd4: warn on finding lockowner without stateids Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 072/103] nfsd4: remove lockowner when removing lock stateid Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 073/103] workqueue: fix bugs in wq_update_unbound_numa() failure path Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 074/103] workqueue: fix a possible race condition between rescuer and pwq-release Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 075/103] workqueue: make rescuer_thread() empty wq->maydays list before exiting Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 076/103] bus: mvebu-mbus: allow several windows with the same target/attribute Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 077/103] percpu: make pcpu_alloc_chunk() use pcpu_mem_free() instead of kfree() Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 080/103] ASoC: wm8962: Update register CLASS_D_CONTROL_1 to be non-volatile Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 081/103] metag: fix memory barriers Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 082/103] metag: Reduce maximum stack size to 256MB Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 083/103] x86-64, modify_ldt: Make support for 16-bit segments a runtime option Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 084/103] genirq: Provide irq_force_affinity fallback for non-SMP Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 085/103] PCI: shpchp: Check bridges secondary (not primary) bus speed Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 086/103] Target/iser: Fix wrong connection requests list addition Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 087/103] Target/iser: Fix iscsit_accept_np and rdma_cm racy flow Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 088/103] target: Dont allow setting WC emulation if device doesnt support Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 089/103] powerpc/tm: Fix crash when forking inside a transaction Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 090/103] dm crypt: fix cpu hotplug crash by removing per-cpu structure Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 091/103] libata: clean up ZPODD when a port is detached Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 092/103] ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 093/103] i2c: rcar: bail out on zero length transfers Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 094/103] i2c: designware: Mask all interrupts during i2c controller enable Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 095/103] i2c: s3c2410: resume race fix Greg Kroah-Hartman
2014-06-04 23:25 ` [PATCH 3.10 096/103] crypto: caam - add allocation failure handling in SPRINTFCAT macro Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 097/103] crypto: s390 - fix aes,des ctr mode concurrency finding Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 098/103] powerpc: Fix 64 bit builds with binutils 2.24 Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 099/103] libceph: fix corruption when using page_count 0 page in rbd Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 100/103] iommu/amd: Fix interrupt remapping for aliased devices Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 101/103] media: fc2580: fix tuning failure on 32-bit arch Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 102/103] media: V4L2: ov7670: fix a wrong index, potentially Oopsing the kernel from user-space Greg Kroah-Hartman
2014-06-04 23:26 ` [PATCH 3.10 103/103] media: V4L2: fix VIDIOC_CREATE_BUFS in 64- / 32-bit compatibility mode Greg Kroah-Hartman
     [not found] ` <20140604232547.006861681@linuxfoundation.org>
2014-06-05 16:05   ` [PATCH 3.10 005/103] irqchip: Gic: Support forced affinity setting Mark Rutland
2014-06-05 18:05     ` Greg Kroah-Hartman
2014-06-05 18:10       ` Mark Rutland
2014-06-23 11:17       ` Mark Brown
2014-06-05 17:15 ` [PATCH 3.10 000/103] 3.10.42-stable review Guenter Roeck
2014-06-05 17:55 ` Shuah Khan
2014-06-05 23:20 ` 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=20140604232548.212166443@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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