<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/sound/usb/endpoint.c, branch linux-4.3.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.3.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.3.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-08-26T13:38:25Z</updated>
<entry>
<title>ALSA: usb-audio: Avoid nested autoresume calls</title>
<updated>2015-08-26T13:38:25Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2015-08-25T14:09:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=47ab154593827b1a8f0713a2b9dd445753d551d8'/>
<id>urn:sha1:47ab154593827b1a8f0713a2b9dd445753d551d8</id>
<content type='text'>
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:
   (&amp;chip-&gt;shutdown_rwsem){.+.+.+}, at: [&lt;ffffffffa0355dac&gt;] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]
  but task is already holding lock:
   (&amp;chip-&gt;shutdown_rwsem){.+.+.+}, at: [&lt;ffffffffa0355dac&gt;] 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-&gt;in_pm isn't good enough for
protecting the racy execution of multiple auto-resumes.

This patch rewrites the logic of snd_usb_autoresume() &amp; co; namely,
- The recursive call of autopm is avoided by the new refcount,
  chip-&gt;active.  The chip-&gt;in_pm flag is removed accordingly.
- Instead of rwsem, another refcount, chip-&gt;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: 9003ebb13f61 ('ALSA: usb-audio: Fix runtime PM unbalance')
Reported-and-tested-by: Alexnader Kuleshov &lt;kuleshovmail@gmail.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Add snd_pcm_stop_xrun() helper</title>
<updated>2014-11-09T17:20:40Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2014-11-07T16:08:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1fb8510cdb5b7befe8a59f533c7fc12ef0dac73e'/>
<id>urn:sha1:1fb8510cdb5b7befe8a59f533c7fc12ef0dac73e</id>
<content type='text'>
Add a new helper function snd_pcm_stop_xrun() to the standard sequnce
lock/snd_pcm_stop(XRUN)/unlock by a single call, and replace the
existing open codes with this helper.

The function checks the PCM running state to prevent setting the wrong
state, too, for more safety.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: Trigger PCM XRUN at XRUN</title>
<updated>2014-11-06T12:04:49Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2014-11-06T12:04:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67e225009bb15403341d313f51326113c61af7df'/>
<id>urn:sha1:67e225009bb15403341d313f51326113c61af7df</id>
<content type='text'>
The usb-audio driver detects XRUN at its complete callback, but the
actual code to trigger PCM XRUN is commented out because it caused
deadlock in the past.  This patch revives the PCM trigger properly.
It resulted in more than just enabling snd_pcm_stop(), but it had to
deduce the PCM substream with proper NULL checks and holds the stream
lock around the call.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: Pass direct struct pointer instead of list_head</title>
<updated>2014-11-04T14:09:10Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2014-10-31T10:24:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a6cece9d81990e729c1f9da2a5bff2d29f7df649'/>
<id>urn:sha1:a6cece9d81990e729c1f9da2a5bff2d29f7df649</id>
<content type='text'>
Some functions in mixer.c and endpoint.c receive list_head instead of
the object itself.  This is not obvious and rather error-prone.  Let's
pass the proper object directly instead.

The functions in midi.c still receive list_head and this can't be
changed since the object definition isn't exposed to the outside of
midi.c, so left as is.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: Fix races at disconnection and PCM closing</title>
<updated>2014-06-26T08:33:35Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2014-06-25T12:24:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=92a586bdc06de6629dae1b357dac221253f55ff8'/>
<id>urn:sha1:92a586bdc06de6629dae1b357dac221253f55ff8</id>
<content type='text'>
When a USB-audio device is disconnected while PCM is still running, we
still see some race: the disconnect callback calls
snd_usb_endpoint_free() that calls release_urbs() and then kfree()
while a PCM stream would be closed at the same time and calls
stop_endpoints() that leads to wait_clear_urbs().  That is, the EP
object might be deallocated while a PCM stream is syncing with
wait_clear_urbs() with the same EP.

Basically calling multiple wait_clear_urbs() would work fine, also
calling wait_clear_urbs() and release_urbs() would work, too, as
wait_clear_urbs() just reads some fields in ep.  The problem is the
succeeding kfree() in snd_pcm_endpoint_free().

This patch moves out the EP deallocation into the later point, the
destructor callback.  At this stage, all PCMs must have been already
closed, so it's safe to free the objects.

Reported-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: work around corrupted TEAC UD-H01 feedback data</title>
<updated>2014-05-02T16:21:55Z</updated>
<author>
<name>Clemens Ladisch</name>
</author>
<published>2014-05-01T10:20:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7040b6d1febfdbd9c1595efb751d492cd2503f96'/>
<id>urn:sha1:7040b6d1febfdbd9c1595efb751d492cd2503f96</id>
<content type='text'>
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 &lt;clemens@ladisch.de&gt;
[mick37@gmx.de: use sender-&gt;udh01_fb_quirk rather than
 ep-&gt;udh01_fb_quirk in snd_usb_handle_sync_urb()]
Reported-and-tested-by: Mick &lt;mick37@gmx.de&gt;
Reported-and-tested-by: Andrea Messa &lt;andr.messa@tiscali.it&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: Use standard printk helpers</title>
<updated>2014-02-26T15:45:34Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2014-02-26T12:02:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0ba41d917eeb87f608cf147f870ff2f4c1056bab'/>
<id>urn:sha1:0ba41d917eeb87f608cf147f870ff2f4c1056bab</id>
<content type='text'>
Convert with dev_err() and co from snd_printk(), etc.
As there are too deep indirections (e.g. ep-&gt;chip-&gt;dev-&gt;dev),
a few new local macros, usb_audio_err() &amp; co, are introduced.

Also, the device numbers in some messages are dropped, as they are
shown in the prefix automatically.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb: use multiple packets per urb for Wireless USB inbound audio</title>
<updated>2013-11-27T10:55:13Z</updated>
<author>
<name>Thomas Pugliese</name>
</author>
<published>2013-11-26T19:58:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a93455e1c301ce2a4cae11682359fd2067a8fd30'/>
<id>urn:sha1:a93455e1c301ce2a4cae11682359fd2067a8fd30</id>
<content type='text'>
For Wireless USB audio devices, use multiple isoc packets per URB for
inbound endpoints with a datainterval &lt; 5.  This allows the WUSB host
controller to take advantage of bursting to service endpoints whose
logical polling interval is less than the 4ms minimum polling interval
limit in WUSB.

Signed-off-by: Thomas Pugliese &lt;thomas.pugliese@gmail.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: remove unused endpoint flag EP_FLAG_ACTIVATED</title>
<updated>2013-10-07T09:22:43Z</updated>
<author>
<name>Eldad Zack</name>
</author>
<published>2013-10-06T20:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=05c79b772f0236b857abf8034d9b0af2ecae901c'/>
<id>urn:sha1:05c79b772f0236b857abf8034d9b0af2ecae901c</id>
<content type='text'>
EP_FLAG_ACTIVATED is never tested for, remove it.

Signed-off-by: Eldad Zack &lt;eldad@fogrefinery.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: usb-audio: rename alt_idx to altsetting</title>
<updated>2013-10-07T09:22:03Z</updated>
<author>
<name>Eldad Zack</name>
</author>
<published>2013-10-06T20:31:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=df23a2466a4961092625b487ead60f526e401062'/>
<id>urn:sha1:df23a2466a4961092625b487ead60f526e401062</id>
<content type='text'>
As Clemens Ladisch kindly explained:
 "Please note that there are two methods to identify alternate settings:
  the number, which is the value in bAlternateSetting, and the index,
  which is the index in the descriptor array.  There might be some wording
  in the USB spec that these two values must be the same, but in reality,
  [insert standard rant about firmware writers], bAlternateSetting
  must be treated as a random ID value."

This patch changes the name to express the correct usage semantics.
No functional change.

Signed-off-by: Eldad Zack &lt;eldad@fogrefinery.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
</feed>
