usb: gadget: u_audio: update hw_ptr in iso_complete after data copied
authorJoshua Frkuska <joshua_frkuska@mentor.com>
Thu, 21 Jun 2018 15:22:48 +0000 (17:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2018 07:26:26 +0000 (09:26 +0200)
commit224c0d0894ff7c3e85add1ce02a523d7f49cfdda
treebab2bdea234c5569d4055332615a1250306c4a04
parentdc126a1e5fb832f1f5094b4d3faf297d08314dfb
usb: gadget: u_audio: update hw_ptr in iso_complete after data copied

[ Upstream commit 6b37bd78d30c890e575a1bda22978d1d2a233362 ]

In u_audio_iso_complete, the runtime hw_ptr is updated before the
data is actually copied over to/from the buffer/dma area. When
ALSA uses this hw_ptr, the data may not actually be available to
be used. This causes trash/stale audio to play/record. This
patch updates the hw_ptr after the data has been copied to avoid
this.

Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
Signed-off-by: Joshua Frkuska <joshua_frkuska@mentor.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/u_audio.c