mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
0591bc2360
This patch adds a new function 'f_uac1' (f_uac1 with virtual "ALSA card") that uses recently created u_audio API. Comparing to legacy f_uac1 function implementation it doesn't require any real Audio codec to be present on the device. In f_uac1 audio streams are simply sinked to and sourced from a virtual ALSA sound card created using u_audio API. Legacy f_uac1 approach is to write audio samples directly to existing ALSA sound card f_uac1 approach is more generic/flexible one - create an ALSA sound card that represents USB Audio function and allows to be used by userspace application that 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. f_uac1 also has capture support (gadget->host) thanks to easy implementation via u_audio. By default, capture interface has 48000kHz/2ch configuration, same as playback channel has. f_uac1 descriptors naming convention uses f_uac2 driver naming convention that makes it more common and meaningful. Comparing to f_uac1_legacy, the f_uac1 doesn't have volume/mute functionality. This is because the f_uac1 volume/mute feature unit was dummy implementation since that driver creation (2009) and never had any real volume control or mute functionality, so there is no any difference here. Since f_uac1 functionality, exposed interface to userspace (virtual ALSA card), input parameters are so different comparing to f_uac1_legacy, that there is no any reason to keep them in the same file/module, and separate function was created. g_audio can be built using one of existing UAC functions (f_uac1, f_uac1_legacy or f_uac2) Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
42 lines
907 B
C
42 lines
907 B
C
/*
|
|
* u_uac1.h - Utility definitions for UAC1 function
|
|
*
|
|
* Copyright (C) 2016 Ruslan Bilovol <ruslan.bilovol@gmail.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef __U_UAC1_H
|
|
#define __U_UAC1_H
|
|
|
|
#include <linux/usb/composite.h>
|
|
|
|
#define UAC1_OUT_EP_MAX_PACKET_SIZE 200
|
|
#define UAC1_DEF_CCHMASK 0x3
|
|
#define UAC1_DEF_CSRATE 48000
|
|
#define UAC1_DEF_CSSIZE 2
|
|
#define UAC1_DEF_PCHMASK 0x3
|
|
#define UAC1_DEF_PSRATE 48000
|
|
#define UAC1_DEF_PSSIZE 2
|
|
#define UAC1_DEF_REQ_NUM 2
|
|
|
|
|
|
struct f_uac1_opts {
|
|
struct usb_function_instance func_inst;
|
|
int c_chmask;
|
|
int c_srate;
|
|
int c_ssize;
|
|
int p_chmask;
|
|
int p_srate;
|
|
int p_ssize;
|
|
int req_number;
|
|
unsigned bound:1;
|
|
|
|
struct mutex lock;
|
|
int refcnt;
|
|
};
|
|
|
|
#endif /* __U_UAC1_H */
|