Hi Felipe, This is v5 of audio gadget refactoring. Note, that legacy f_uac1 function is broken since v4.10 by commit 7e4da3fcf7c9 ("usb: gadget: composite: Test get_alt() presence instead of set_alt()"). The fact that at v4.12-rc5 time nobody cares about may be a good sign that number of users is small if any. Thus making it legacy makes sence. This series depends on legacy f_uac1 fix I posted before: http://www.spinics.net/lists/linux-usb/msg158373.html Without this fix it's not possible to check that refactoring didn't break legacy f_uac1 functionality ======================================== I came to this patch series when wanted to do two things: - use UAC1 as virtual ALSA sound card on gadget side, just like UAC2 is used so it's possible to do rate resampling - have both playback/capture support in UAC1 Since I wanted to have same behavior for both UAC1/UAC2, obviously I've got an utility part (u_audio.c) for virtual ALSA sound card handling like we have for ethernet(u_ether) or serial(u_serial) functions. Function-specific parts (f_uac1/f_uac2) became almost as storage for class-specific USB descriptors, some boilerplate for configfs, binding and few USB config request handling. Originally in RFC [1] I've posted before, there was major change to f_uac1 after that it couldn't do direct play to existing ALSA sound card anymore, representing audio on gadget side as virtual ALSA sound card where audio streams are simply sinked to and sourced from it, so it may break current usecase for some people (and that's why it was RFC). During RFC discussion, it was agreed to not touch existing f_uac1 implementation and create new one instead. At v4 patchet discussion another approach was agreed - current f_uac1.c gets renamed to f_uac1_legacy.c and introduced a *new* f_uac1.c instead that is done in current patchset (v5) Now, it's possible to use existing user-space applications for audio routing between Audio Gadget and real sound card. I personally use alsaloop tool from alsautils and have ability to create PCM loopback between two different ALSA cards using rate resampling, which was not possible with previous "direct play to ALSA card" approach in f_uac1. While here, also dropped redundant platform driver/device creation in f_uac2 driver (as well as didn't add "never implemented" volume/mute functionality in f_uac1_legacy to f_uac1) that made this work even easier to do. This series is tested with both legacy g_audio.ko and modern configfs approaches under Ubuntu 14.04 (UAC1 and UAC2) and under Windows7 x64 (UAC1 only) having perfect results in all cases. Comments, testing are welcome. v5 changes: - after discussion with Felipe, switched to another approach with making current f_uac1 legacy and introducing a new f_uac1.c instead - addressed Jassi's copyright comments v4 changes: - renamed f_uac1_newapi to f_uac1_acard that is more meaningful - rebased on top of balbi/next v3 changes: - renamed u_audio exported symbols so they don't conflict with old f_uac1 if both are built-in. v2 changes: - do not touch f_uac1, instead created f_uac1_newapi - added documentation for f_uac1_newapi - rebased on top of v4.8-rc1 [1] https://lkml.org/lkml/2016/5/23/649 Ruslan Bilovol (4): usb: gadget: f_uac2: remove platform driver/device creation usb: gadget: f_uac2: split out audio core usb: gadget: function: make current f_uac1 implementation legacy usb: gadget: add f_uac1 variant based on a new u_audio api Documentation/ABI/testing/configfs-usb-gadget-uac1 | 18 +- .../ABI/testing/configfs-usb-gadget-uac1_legacy | 12 + Documentation/usb/gadget-testing.txt | 53 +- drivers/usb/gadget/Kconfig | 29 +- drivers/usb/gadget/function/Makefile | 5 +- drivers/usb/gadget/function/f_uac1.c | 906 +++++++---------- drivers/usb/gadget/function/f_uac1_legacy.c | 1021 ++++++++++++++++++++ drivers/usb/gadget/function/f_uac2.c | 795 ++------------- drivers/usb/gadget/function/u_audio.c | 662 +++++++++++++ drivers/usb/gadget/function/u_audio.h | 95 ++ drivers/usb/gadget/function/u_uac1.h | 87 +- .../gadget/function/{u_uac1.c => u_uac1_legacy.c} | 7 +- drivers/usb/gadget/function/u_uac1_legacy.h | 82 ++ drivers/usb/gadget/legacy/Kconfig | 15 +- drivers/usb/gadget/legacy/audio.c | 55 +- 15 files changed, 2494 insertions(+), 1348 deletions(-) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy create mode 100644 drivers/usb/gadget/function/f_uac1_legacy.c create mode 100644 drivers/usb/gadget/function/u_audio.c create mode 100644 drivers/usb/gadget/function/u_audio.h rename drivers/usb/gadget/function/{u_uac1.c => u_uac1_legacy.c} (98%) create mode 100644 drivers/usb/gadget/function/u_uac1_legacy.h -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html