Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
f_uac2.c File Reference
#include <linux/usb/audio.h>
#include <linux/usb/audio-v2.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>

Go to the source code of this file.

Data Structures

struct  uac2_req
 
struct  uac2_rtd_params
 
struct  snd_uac2_chip
 
struct  audio_dev
 
struct  cntrl_cur_lay3
 
struct  cntrl_range_lay3
 

Macros

#define DMA_ADDR_INVALID   (~(dma_addr_t)0)
 
#define ALT_SET(x, a)   do {(x) &= ~0xff; (x) |= (a); } while (0)
 
#define ALT_GET(x)   ((x) & 0xff)
 
#define INTF_SET(x, i)   do {(x) &= 0xff; (x) |= ((i) << 8); } while (0)
 
#define INTF_GET(x)   ((x >> 8) & 0xff)
 
#define USB_XFERS   2
 
#define USB_OUT_IT_ID   1
 
#define IO_IN_IT_ID   2
 
#define IO_OUT_OT_ID   3
 
#define USB_IN_OT_ID   4
 
#define USB_OUT_CLK_ID   5
 
#define USB_IN_CLK_ID   6
 
#define CONTROL_ABSENT   0
 
#define CONTROL_RDONLY   1
 
#define CONTROL_RDWR   3
 
#define CLK_FREQ_CTRL   0
 
#define CLK_VLD_CTRL   2
 
#define COPY_CTRL   0
 
#define CONN_CTRL   2
 
#define OVRLD_CTRL   4
 
#define CLSTR_CTRL   6
 
#define UNFLW_CTRL   8
 
#define OVFLW_CTRL   10
 
#define BUFF_SIZE_MAX   (PAGE_SIZE * 16)
 
#define PRD_SIZE_MAX   PAGE_SIZE
 
#define MIN_PERIODS   4
 

Enumerations

enum  {
  STR_ASSOC, STR_IF_CTRL, STR_CLKSRC_IN, STR_CLKSRC_OUT,
  STR_USB_IT, STR_IO_IT, STR_USB_OT, STR_IO_OT,
  STR_AS_OUT_ALT0, STR_AS_OUT_ALT1, STR_AS_IN_ALT0, STR_AS_IN_ALT1
}
 

Functions

 module_param (p_chmask, uint, S_IRUGO)
 
 MODULE_PARM_DESC (p_chmask,"Playback Channel Mask")
 
 module_param (p_srate, uint, S_IRUGO)
 
 MODULE_PARM_DESC (p_srate,"Playback Sampling Rate")
 
 module_param (p_ssize, uint, S_IRUGO)
 
 MODULE_PARM_DESC (p_ssize,"Playback Sample Size(bytes)")
 
 module_param (c_chmask, uint, S_IRUGO)
 
 MODULE_PARM_DESC (c_chmask,"Capture Channel Mask")
 
 module_param (c_srate, uint, S_IRUGO)
 
 MODULE_PARM_DESC (c_srate,"Capture Sampling Rate")
 
 module_param (c_ssize, uint, S_IRUGO)
 
 MODULE_PARM_DESC (c_ssize,"Capture Sample Size(bytes)")
 

Variables

const charuac2_name = "snd_uac2"
 
struct uac_clock_source_descriptor in_clk_src_desc
 
struct uac_clock_source_descriptor out_clk_src_desc
 
struct
uac2_input_terminal_descriptor 
usb_out_it_desc
 
struct
uac2_input_terminal_descriptor 
io_in_it_desc
 
struct
uac2_output_terminal_descriptor 
usb_in_ot_desc
 
struct
uac2_output_terminal_descriptor 
io_out_ot_desc
 
struct uac2_ac_header_descriptor ac_hdr_desc
 
struct uac2_as_header_descriptor as_out_hdr_desc
 
struct
uac2_format_type_i_descriptor 
as_out_fmt1_desc
 
struct usb_endpoint_descriptor fs_epout_desc
 
struct usb_endpoint_descriptor hs_epout_desc
 
struct uac2_as_header_descriptor as_in_hdr_desc
 
struct
uac2_format_type_i_descriptor 
as_in_fmt1_desc
 
struct usb_endpoint_descriptor fs_epin_desc
 
struct usb_endpoint_descriptor hs_epin_desc
 
struct cntrl_range_lay3 __packed
 

Macro Definition Documentation

#define ALT_GET (   x)    ((x) & 0xff)

Definition at line 56 of file f_uac2.c.

#define ALT_SET (   x,
  a 
)    do {(x) &= ~0xff; (x) |= (a); } while (0)

Definition at line 55 of file f_uac2.c.

#define BUFF_SIZE_MAX   (PAGE_SIZE * 16)

Definition at line 131 of file f_uac2.c.

#define CLK_FREQ_CTRL   0

Definition at line 82 of file f_uac2.c.

#define CLK_VLD_CTRL   2

Definition at line 83 of file f_uac2.c.

#define CLSTR_CTRL   6

Definition at line 88 of file f_uac2.c.

#define CONN_CTRL   2

Definition at line 86 of file f_uac2.c.

#define CONTROL_ABSENT   0

Definition at line 78 of file f_uac2.c.

#define CONTROL_RDONLY   1

Definition at line 79 of file f_uac2.c.

#define CONTROL_RDWR   3

Definition at line 80 of file f_uac2.c.

#define COPY_CTRL   0

Definition at line 85 of file f_uac2.c.

#define DMA_ADDR_INVALID   (~(dma_addr_t)0)

Definition at line 53 of file f_uac2.c.

#define INTF_GET (   x)    ((x >> 8) & 0xff)

Definition at line 58 of file f_uac2.c.

#define INTF_SET (   x,
  i 
)    do {(x) &= 0xff; (x) |= ((i) << 8); } while (0)

Definition at line 57 of file f_uac2.c.

#define IO_IN_IT_ID   2

Definition at line 72 of file f_uac2.c.

#define IO_OUT_OT_ID   3

Definition at line 73 of file f_uac2.c.

#define MIN_PERIODS   4

Definition at line 133 of file f_uac2.c.

#define OVFLW_CTRL   10

Definition at line 90 of file f_uac2.c.

#define OVRLD_CTRL   4

Definition at line 87 of file f_uac2.c.

#define PRD_SIZE_MAX   PAGE_SIZE

Definition at line 132 of file f_uac2.c.

#define UNFLW_CTRL   8

Definition at line 89 of file f_uac2.c.

#define USB_IN_CLK_ID   6

Definition at line 76 of file f_uac2.c.

#define USB_IN_OT_ID   4

Definition at line 74 of file f_uac2.c.

#define USB_OUT_CLK_ID   5

Definition at line 75 of file f_uac2.c.

#define USB_OUT_IT_ID   1

Definition at line 71 of file f_uac2.c.

#define USB_XFERS   2

Definition at line 61 of file f_uac2.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
STR_ASSOC 
STR_IF_CTRL 
STR_CLKSRC_IN 
STR_CLKSRC_OUT 
STR_USB_IT 
STR_IO_IT 
STR_USB_OT 
STR_IO_OT 
STR_AS_OUT_ALT0 
STR_AS_OUT_ALT1 
STR_AS_IN_ALT0 
STR_AS_IN_ALT1 

Definition at line 514 of file f_uac2.c.

Function Documentation

module_param ( p_chmask  ,
uint  ,
S_IRUGO   
)
module_param ( p_srate  ,
uint  ,
S_IRUGO   
)
module_param ( p_ssize  ,
uint  ,
S_IRUGO   
)
module_param ( c_chmask  ,
uint  ,
S_IRUGO   
)
module_param ( c_srate  ,
uint  ,
S_IRUGO   
)
module_param ( c_ssize  ,
uint  ,
S_IRUGO   
)
MODULE_PARM_DESC ( p_chmask  ,
"Playback Channel Mask"   
)
MODULE_PARM_DESC ( p_srate  ,
"Playback Sampling Rate"   
)
MODULE_PARM_DESC ( p_ssize  ,
"Playback Sample Size(bytes)"   
)
MODULE_PARM_DESC ( c_chmask  ,
"Capture Channel Mask"   
)
MODULE_PARM_DESC ( c_srate  ,
"Capture Sampling Rate"   
)
MODULE_PARM_DESC ( c_ssize  ,
"Capture Sample Size(bytes)"   
)

Variable Documentation

Initial value:
= {
.bLength = sizeof ac_hdr_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_MS_HEADER,
.bcdADC = cpu_to_le16(0x200),
.bCategory = UAC2_FUNCTION_IO_BOX,
.wTotalLength = sizeof in_clk_src_desc + sizeof out_clk_src_desc
+ sizeof usb_out_it_desc + sizeof io_in_it_desc
+ sizeof usb_in_ot_desc + sizeof io_out_ot_desc,
.bmControls = 0,
}

Definition at line 683 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof as_in_fmt1_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_FORMAT_TYPE,
.bFormatType = UAC_FORMAT_TYPE_I,
}

Definition at line 809 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof as_in_hdr_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_AS_GENERAL,
.bTerminalLink = USB_IN_OT_ID,
.bmControls = 0,
.bFormatType = UAC_FORMAT_TYPE_I,
.iChannelNames = 0,
}

Definition at line 796 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof as_out_fmt1_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_FORMAT_TYPE,
.bFormatType = UAC_FORMAT_TYPE_I,
}

Definition at line 734 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof as_out_hdr_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_AS_GENERAL,
.bTerminalLink = USB_OUT_IT_ID,
.bmControls = 0,
.bFormatType = UAC_FORMAT_TYPE_I,
.iChannelNames = 0,
}

Definition at line 721 of file f_uac2.c.

Initial value:
= {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bInterval = 1,
}

Definition at line 817 of file f_uac2.c.

Initial value:
= {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bInterval = 1,
}

Definition at line 742 of file f_uac2.c.

Initial value:
= {
.bDescriptorType = USB_DT_ENDPOINT,
.bInterval = 4,
}

Definition at line 826 of file f_uac2.c.

Initial value:
= {
.bDescriptorType = USB_DT_ENDPOINT,
.bInterval = 4,
}

Definition at line 751 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof in_clk_src_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC2_CLOCK_SOURCE,
.bClockID = USB_IN_CLK_ID,
.bmControls = (CONTROL_RDONLY << CLK_FREQ_CTRL),
}

Definition at line 604 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof io_in_it_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_INPUT_TERMINAL,
.bTerminalID = IO_IN_IT_ID,
.bAssocTerminal = 0,
.bCSourceID = USB_IN_CLK_ID,
.iChannelNames = 0,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
}

Definition at line 642 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof io_out_ot_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
.bTerminalID = IO_OUT_OT_ID,
.bAssocTerminal = 0,
.bSourceID = USB_OUT_IT_ID,
.bCSourceID = USB_OUT_CLK_ID,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
}

Definition at line 670 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof out_clk_src_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC2_CLOCK_SOURCE,
.bClockID = USB_OUT_CLK_ID,
.bmControls = (CONTROL_RDONLY << CLK_FREQ_CTRL),
}

Definition at line 616 of file f_uac2.c.

const char* uac2_name = "snd_uac2"

Definition at line 92 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof usb_in_ot_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
.bTerminalID = USB_IN_OT_ID,
.bAssocTerminal = 0,
.bSourceID = IO_IN_IT_ID,
.bCSourceID = USB_IN_CLK_ID,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
}

Definition at line 656 of file f_uac2.c.

Initial value:
= {
.bLength = sizeof usb_out_it_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubtype = UAC_INPUT_TERMINAL,
.bTerminalID = USB_OUT_IT_ID,
.bAssocTerminal = 0,
.bCSourceID = USB_OUT_CLK_ID,
.iChannelNames = 0,
.bmControls = (CONTROL_RDWR << COPY_CTRL),
}

Definition at line 628 of file f_uac2.c.