Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 391be96e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: u_audio: remove caching of stream buffer parameters"

parents cdd23bac 32c666f9
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
What:		/config/usb-gadget/gadget/functions/uac1.name
Date:		Sep 2014
KernelVersion:	3.18
Date:		June 2017
KernelVersion:	4.14
Description:
		The attributes:

		audio_buf_size - audio buffer size
		fn_cap - capture pcm device file name
		fn_cntl - control device file name
		fn_play - playback pcm device file name
		req_buf_size - ISO OUT endpoint request buffer size
		req_count - ISO OUT endpoint request count
		c_chmask - capture channel mask
		c_srate - capture sampling rate
		c_ssize - capture sample size (bytes)
		p_chmask - playback channel mask
		p_srate - playback sampling rate
		p_ssize - playback sample size (bytes)
		req_number - the number of pre-allocated request
			for both capture and playback
+12 −0
Original line number Diff line number Diff line
What:		/config/usb-gadget/gadget/functions/uac1_legacy.name
Date:		Sep 2014
KernelVersion:	3.18
Description:
		The attributes:

		audio_buf_size - audio buffer size
		fn_cap - capture pcm device file name
		fn_cntl - control device file name
		fn_play - playback pcm device file name
		req_buf_size - ISO OUT endpoint request buffer size
		req_count - ISO OUT endpoint request count
+49 −4
Original line number Diff line number Diff line
@@ -16,10 +16,11 @@ provided by gadgets.
13. RNDIS function
14. SERIAL function
15. SOURCESINK function
16. UAC1 function
16. UAC1 function (legacy implementation)
17. UAC2 function
18. UVC function
19. PRINTER function
20. UAC1 function (new API)


1. ACM function
@@ -587,15 +588,16 @@ device: run the gadget
host: test-usb (tools/usb/testusb.c)


16. UAC1 function
16. UAC1 function (legacy implementation)
=================

The function is provided by usb_f_uac1.ko module.
The function is provided by usb_f_uac1_legacy.ko module.

Function-specific configfs interface
------------------------------------

The function name to use when creating the function directory is "uac1".
The function name to use when creating the function directory
is "uac1_legacy".
The uac1 function provides these attributes in its function directory:

	audio_buf_size - audio buffer size
@@ -768,3 +770,46 @@ host:

More advanced testing can be done with the prn_example
described in Documentation/usb/gadget-printer.txt.


20. UAC1 function (virtual ALSA card, using u_audio API)
=================

The function is provided by usb_f_uac1.ko module.
It will create a virtual ALSA card and the audio streams are simply
sinked to and sourced from it.

Function-specific configfs interface
------------------------------------

The function name to use when creating the function directory is "uac1".
The uac1 function provides these attributes in its function directory:

	c_chmask - capture channel mask
	c_srate - capture sampling rate
	c_ssize - capture sample size (bytes)
	p_chmask - playback channel mask
	p_srate - playback sampling rate
	p_ssize - playback sample size (bytes)
	req_number - the number of pre-allocated request for both capture
		     and playback

The attributes have sane default values.

Testing the UAC1 function
-------------------------

device: run the gadget
host: aplay -l # should list our USB Audio Gadget

This function does not require real hardware support, it just
sends a stream of audio data to/from the host. In order to
actually hear something at the device side, a command similar
to this must be used at the device side:

$ arecord -f dat -t wav -D hw:2,0 | aplay -D hw:0,0 &

e.g.:

$ arecord -f dat -t wav -D hw:CARD=UAC1Gadget,DEV=0 | \
aplay -D default:CARD=OdroidU3
+26 −2
Original line number Diff line number Diff line
@@ -151,6 +151,9 @@ config USB_U_SERIAL
config USB_U_ETHER
	tristate

config USB_U_AUDIO
	tristate

config USB_F_SERIAL
	tristate

@@ -190,6 +193,9 @@ config USB_F_FS
config USB_F_UAC1
	tristate

config USB_F_UAC1_LEGACY
	tristate

config USB_F_UAC2
	tristate

@@ -462,12 +468,30 @@ config USB_CONFIGFS_F_UAC1
	depends on SND
	select USB_LIBCOMPOSITE
	select SND_PCM
	select USB_U_AUDIO
	select USB_F_UAC1
	help
	  This Audio function implements 1 AudioControl interface,
	  1 AudioStreaming Interface each for USB-OUT and USB-IN.
	  This driver requires a real Audio codec to be present
	  on the device.
	  This driver doesn't expect any real Audio codec to be present
	  on the device - the audio streams are simply sinked to and
	  sourced from a virtual ALSA sound card created. The user-space
	  application may choose to do whatever it wants with the data
	  received from the USB Host and choose to provide whatever it
	  wants as audio data to the USB Host.

config USB_CONFIGFS_F_UAC1_LEGACY
	bool "Audio Class 1.0 (legacy implementation)"
	depends on USB_CONFIGFS
	depends on SND
	select USB_LIBCOMPOSITE
	select SND_PCM
	select USB_F_UAC1_LEGACY
	help
	  This Audio function implements 1 AudioControl interface,
	  1 AudioStreaming Interface each for USB-OUT and USB-IN.
	  This is a legacy driver and requires a real Audio codec
	  to be present on the device.

config USB_CONFIGFS_F_UAC2
	bool "Audio Class 2.0"
+4 −1
Original line number Diff line number Diff line
@@ -32,8 +32,11 @@ usb_f_mass_storage-y := f_mass_storage.o storage_common.o
obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o
usb_f_fs-y			:= f_fs.o
obj-$(CONFIG_USB_F_FS)		+= usb_f_fs.o
usb_f_uac1-y			:= f_uac1.o u_uac1.o
obj-$(CONFIG_USB_U_AUDIO)	+= u_audio.o
usb_f_uac1-y			:= f_uac1.o
obj-$(CONFIG_USB_F_UAC1)	+= usb_f_uac1.o
usb_f_uac1_legacy-y		:= f_uac1_legacy.o u_uac1_legacy.o
obj-$(CONFIG_USB_F_UAC1_LEGACY)	+= usb_f_uac1_legacy.o
usb_f_uac2-y			:= f_uac2.o
obj-$(CONFIG_USB_F_UAC2)	+= usb_f_uac2.o
usb_f_uvc-y			:= f_uvc.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_configfs.o
Loading