mbox series

[v2,00/11] usb: gadget: audio: Multiple rates, dyn. bInterval

Message ID 20211220211130.88590-1-pavel.hofman@ivitera.com
Headers show
Series usb: gadget: audio: Multiple rates, dyn. bInterval | expand

Message

Pavel Hofman Dec. 20, 2021, 9:11 p.m. UTC
Hi all,

This series implements:
* Support for multiple rates in the audio gadget
* Notification of gadget-side alsa processes about playback/capture
start/stop on the host side via Playback/Capture Rate controls.
* Detection of the USB cable disconnection by handling SUSPEND call
in f_uac1/2. The disconnection generates a stop notification.
* Dynamic bInterval calculation for HS and SS

Patches for the multirate support, originally authored by Julian Scheel,
were rebased and modified for the current code base. Julian has
acknowledged the presented patches.

The detection of cable disconnection was discussed with dwc2 maintainer
Minas Harutyunyan who confirmed that the suspend event can be used
(https://lore.kernel.org/all/5aada8e3-f385-0589-8d58-187abd1a924d@synopsys.com/T/).
Tests on dwc2 have confirmed reliable detection, the gadget correctly
reports playback/capture stop at cable disconnection.

The start/stop/current rate notification feature is accompanied by
example implementation of audio gadget controller
https://github.com/pavhofman/gaudio_ctl. The controller also handles
debouncing fast start/stop events when USB host audio driver is loaded
and/or audio daemon re/started.

Changes:
--------

v2: Fixed compilation of "usb: gadget: f_uac1: Support multiple sampling
rates" - added changes for CONFIG_GADGET_UAC1

---------
Julian Scheel (4):
  usb: gadget: u_audio: Support multiple sampling rates
  usb: gadget: f_uac2: Support multiple sampling rates
  usb: gadget: f_uac1: Support multiple sampling rates
  usb: gadget: f_uac2: Renaming Clock Sources to fixed names

Pavel Hofman (7):
  usb: gadget: u_audio: Subdevice 0 for capture ctls
  usb: gadget: u_audio: Rate ctl notifies about current srate
    (0=stopped)
  usb: gadget: u_audio: Stopping PCM substream at capture/playback stop
  usb: gadget: u_audio: Adding suspend call
  usb: gadget: f_uac2: Adding suspend callback
  usb: gadget: f_uac1: Adding suspend callback
  usb: gadget: f_uac2: Determining bInterval for HS and SS

 .../ABI/testing/configfs-usb-gadget-uac1      |   4 +-
 .../ABI/testing/configfs-usb-gadget-uac2      |   4 +-
 Documentation/usb/gadget-testing.rst          |   8 +-
 drivers/usb/gadget/function/f_uac1.c          | 121 ++++++++--
 drivers/usb/gadget/function/f_uac2.c          | 221 ++++++++++++------
 drivers/usb/gadget/function/u_audio.c         | 162 ++++++++++++-
 drivers/usb/gadget/function/u_audio.h         |  12 +-
 drivers/usb/gadget/function/u_uac1.h          |  63 ++++-
 drivers/usb/gadget/function/u_uac2.h          |  62 +++++
 drivers/usb/gadget/function/uac_common.h      |   9 +
 drivers/usb/gadget/legacy/audio.c             |  40 +++-
 11 files changed, 597 insertions(+), 109 deletions(-)
 create mode 100644 drivers/usb/gadget/function/uac_common.h

Comments

Greg Kroah-Hartman Dec. 21, 2021, 7:59 a.m. UTC | #1
On Mon, Dec 20, 2021 at 10:11:19PM +0100, Pavel Hofman wrote:
> Hi all,
> 
> This series implements:
> * Support for multiple rates in the audio gadget
> * Notification of gadget-side alsa processes about playback/capture
> start/stop on the host side via Playback/Capture Rate controls.
> * Detection of the USB cable disconnection by handling SUSPEND call
> in f_uac1/2. The disconnection generates a stop notification.
> * Dynamic bInterval calculation for HS and SS
> 
> Patches for the multirate support, originally authored by Julian Scheel,
> were rebased and modified for the current code base. Julian has
> acknowledged the presented patches.
> 
> The detection of cable disconnection was discussed with dwc2 maintainer
> Minas Harutyunyan who confirmed that the suspend event can be used
> (https://lore.kernel.org/all/5aada8e3-f385-0589-8d58-187abd1a924d@synopsys.com/T/).
> Tests on dwc2 have confirmed reliable detection, the gadget correctly
> reports playback/capture stop at cable disconnection.
> 
> The start/stop/current rate notification feature is accompanied by
> example implementation of audio gadget controller
> https://github.com/pavhofman/gaudio_ctl. The controller also handles
> debouncing fast start/stop events when USB host audio driver is loaded
> and/or audio daemon re/started.
> 
> Changes:
> --------
> 
> v2: Fixed compilation of "usb: gadget: f_uac1: Support multiple sampling
> rates" - added changes for CONFIG_GADGET_UAC1

I get the following build warning and error with this series applied to
my tree:

drivers/usb/gadget/legacy/audio.c: In function ‘audio_bind’:
drivers/usb/gadget/legacy/audio.c:251:21: error: unused variable ‘i’ [-Werror=unused-variable]
  251 |         int status, i;
      |                     ^
cc1: all warnings being treated as errors

Please fix up.

thanks,

greg k-h
Pavel Hofman Dec. 22, 2021, 1:38 p.m. UTC | #2
Dne 21. 12. 21 v 8:59 Greg Kroah-Hartman napsal(a):
> On Mon, Dec 20, 2021 at 10:11:19PM +0100, Pavel Hofman wrote:
>> Hi all,
>>
>> This series implements:
>> * Support for multiple rates in the audio gadget
>> * Notification of gadget-side alsa processes about playback/capture
>> start/stop on the host side via Playback/Capture Rate controls.
>> * Detection of the USB cable disconnection by handling SUSPEND call
>> in f_uac1/2. The disconnection generates a stop notification.
>> * Dynamic bInterval calculation for HS and SS
>>
>> Patches for the multirate support, originally authored by Julian Scheel,
>> were rebased and modified for the current code base. Julian has
>> acknowledged the presented patches.
>>
>> The detection of cable disconnection was discussed with dwc2 maintainer
>> Minas Harutyunyan who confirmed that the suspend event can be used
>> (https://lore.kernel.org/all/5aada8e3-f385-0589-8d58-187abd1a924d@synopsys.com/T/).
>> Tests on dwc2 have confirmed reliable detection, the gadget correctly
>> reports playback/capture stop at cable disconnection.
>>
>> The start/stop/current rate notification feature is accompanied by
>> example implementation of audio gadget controller
>> https://github.com/pavhofman/gaudio_ctl. The controller also handles
>> debouncing fast start/stop events when USB host audio driver is loaded
>> and/or audio daemon re/started.
>>
>> Changes:
>> --------
>>
>> v2: Fixed compilation of "usb: gadget: f_uac1: Support multiple sampling
>> rates" - added changes for CONFIG_GADGET_UAC1
> 
> I get the following build warning and error with this series applied to
> my tree:
> 
> drivers/usb/gadget/legacy/audio.c: In function ‘audio_bind’:
> drivers/usb/gadget/legacy/audio.c:251:21: error: unused variable ‘i’ [-Werror=unused-variable]
>    251 |         int status, i;
>        |                     ^
> cc1: all warnings being treated as errors
> 
> Please fix up.

I am sorry for the inconvenience. I  will send fixed v3 tomorrow.

Thanks for your patience.

Pavel.