aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_audio.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@skynet.be>2009-06-21 17:23:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:20 -0400
commit512ad27d8667158747de2e8da8a23e8f50e91856 (patch)
tree3c56c7265a1e2d7530ddb9c31806d3c1086ac6f5 /drivers/usb/gadget/f_audio.c
parent315ad3028c8aae14891797040f855fc3291a076b (diff)
USB audio gadget: Prefix all macro definitions with UAC_ in linux/usb/audio.h
linux/usb/audio.h is a public header file that includes definitions exported to userspace. To avoid namespace clashes, prefix all macro definitions with UAC_. Existing macros and structures prefixed with USB_AC_ and USB_AS_ are renamed for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/f_audio.c')
-rw-r--r--drivers/usb/gadget/f_audio.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
index 76afbd1b515f..7b05b3c8c0b1 100644
--- a/drivers/usb/gadget/f_audio.c
+++ b/drivers/usb/gadget/f_audio.c
@@ -50,16 +50,16 @@ static struct usb_interface_descriptor ac_interface_desc __initdata = {
50 .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 50 .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
51}; 51};
52 52
53DECLARE_USB_AC_HEADER_DESCRIPTOR(2); 53DECLARE_UAC_AC_HEADER_DESCRIPTOR(2);
54 54
55#define USB_DT_AC_HEADER_LENGH USB_DT_AC_HEADER_SIZE(F_AUDIO_NUM_INTERFACES) 55#define UAC_DT_AC_HEADER_LENGTH UAC_DT_AC_HEADER_SIZE(F_AUDIO_NUM_INTERFACES)
56/* B.3.2 Class-Specific AC Interface Descriptor */ 56/* B.3.2 Class-Specific AC Interface Descriptor */
57static struct usb_ac_header_descriptor_2 ac_header_desc = { 57static struct uac_ac_header_descriptor_2 ac_header_desc = {
58 .bLength = USB_DT_AC_HEADER_LENGH, 58 .bLength = UAC_DT_AC_HEADER_LENGTH,
59 .bDescriptorType = USB_DT_CS_INTERFACE, 59 .bDescriptorType = USB_DT_CS_INTERFACE,
60 .bDescriptorSubtype = HEADER, 60 .bDescriptorSubtype = UAC_HEADER,
61 .bcdADC = __constant_cpu_to_le16(0x0100), 61 .bcdADC = __constant_cpu_to_le16(0x0100),
62 .wTotalLength = __constant_cpu_to_le16(USB_DT_AC_HEADER_LENGH), 62 .wTotalLength = __constant_cpu_to_le16(UAC_DT_AC_HEADER_LENGTH),
63 .bInCollection = F_AUDIO_NUM_INTERFACES, 63 .bInCollection = F_AUDIO_NUM_INTERFACES,
64 .baInterfaceNr = { 64 .baInterfaceNr = {
65 [0] = F_AUDIO_AC_INTERFACE, 65 [0] = F_AUDIO_AC_INTERFACE,
@@ -68,33 +68,33 @@ static struct usb_ac_header_descriptor_2 ac_header_desc = {
68}; 68};
69 69
70#define INPUT_TERMINAL_ID 1 70#define INPUT_TERMINAL_ID 1
71static struct usb_input_terminal_descriptor input_terminal_desc = { 71static struct uac_input_terminal_descriptor input_terminal_desc = {
72 .bLength = USB_DT_AC_INPUT_TERMINAL_SIZE, 72 .bLength = UAC_DT_INPUT_TERMINAL_SIZE,
73 .bDescriptorType = USB_DT_CS_INTERFACE, 73 .bDescriptorType = USB_DT_CS_INTERFACE,
74 .bDescriptorSubtype = INPUT_TERMINAL, 74 .bDescriptorSubtype = UAC_INPUT_TERMINAL,
75 .bTerminalID = INPUT_TERMINAL_ID, 75 .bTerminalID = INPUT_TERMINAL_ID,
76 .wTerminalType = USB_AC_TERMINAL_STREAMING, 76 .wTerminalType = UAC_TERMINAL_STREAMING,
77 .bAssocTerminal = 0, 77 .bAssocTerminal = 0,
78 .wChannelConfig = 0x3, 78 .wChannelConfig = 0x3,
79}; 79};
80 80
81DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(0); 81DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(0);
82 82
83#define FEATURE_UNIT_ID 2 83#define FEATURE_UNIT_ID 2
84static struct usb_ac_feature_unit_descriptor_0 feature_unit_desc = { 84static struct uac_feature_unit_descriptor_0 feature_unit_desc = {
85 .bLength = USB_DT_AC_FEATURE_UNIT_SIZE(0), 85 .bLength = UAC_DT_FEATURE_UNIT_SIZE(0),
86 .bDescriptorType = USB_DT_CS_INTERFACE, 86 .bDescriptorType = USB_DT_CS_INTERFACE,
87 .bDescriptorSubtype = FEATURE_UNIT, 87 .bDescriptorSubtype = UAC_FEATURE_UNIT,
88 .bUnitID = FEATURE_UNIT_ID, 88 .bUnitID = FEATURE_UNIT_ID,
89 .bSourceID = INPUT_TERMINAL_ID, 89 .bSourceID = INPUT_TERMINAL_ID,
90 .bControlSize = 2, 90 .bControlSize = 2,
91 .bmaControls[0] = (FU_MUTE | FU_VOLUME), 91 .bmaControls[0] = (UAC_FU_MUTE | UAC_FU_VOLUME),
92}; 92};
93 93
94static struct usb_audio_control mute_control = { 94static struct usb_audio_control mute_control = {
95 .list = LIST_HEAD_INIT(mute_control.list), 95 .list = LIST_HEAD_INIT(mute_control.list),
96 .name = "Mute Control", 96 .name = "Mute Control",
97 .type = MUTE_CONTROL, 97 .type = UAC_MUTE_CONTROL,
98 /* Todo: add real Mute control code */ 98 /* Todo: add real Mute control code */
99 .set = generic_set_cmd, 99 .set = generic_set_cmd,
100 .get = generic_get_cmd, 100 .get = generic_get_cmd,
@@ -103,7 +103,7 @@ static struct usb_audio_control mute_control = {
103static struct usb_audio_control volume_control = { 103static struct usb_audio_control volume_control = {
104 .list = LIST_HEAD_INIT(volume_control.list), 104 .list = LIST_HEAD_INIT(volume_control.list),
105 .name = "Volume Control", 105 .name = "Volume Control",
106 .type = VOLUME_CONTROL, 106 .type = UAC_VOLUME_CONTROL,
107 /* Todo: add real Volume control code */ 107 /* Todo: add real Volume control code */
108 .set = generic_set_cmd, 108 .set = generic_set_cmd,
109 .get = generic_get_cmd, 109 .get = generic_get_cmd,
@@ -113,17 +113,17 @@ static struct usb_audio_control_selector feature_unit = {
113 .list = LIST_HEAD_INIT(feature_unit.list), 113 .list = LIST_HEAD_INIT(feature_unit.list),
114 .id = FEATURE_UNIT_ID, 114 .id = FEATURE_UNIT_ID,
115 .name = "Mute & Volume Control", 115 .name = "Mute & Volume Control",
116 .type = FEATURE_UNIT, 116 .type = UAC_FEATURE_UNIT,
117 .desc = (struct usb_descriptor_header *)&feature_unit_desc, 117 .desc = (struct usb_descriptor_header *)&feature_unit_desc,
118}; 118};
119 119
120#define OUTPUT_TERMINAL_ID 3 120#define OUTPUT_TERMINAL_ID 3
121static struct usb_output_terminal_descriptor output_terminal_desc = { 121static struct uac_output_terminal_descriptor output_terminal_desc = {
122 .bLength = USB_DT_AC_OUTPUT_TERMINAL_SIZE, 122 .bLength = UAC_DT_OUTPUT_TERMINAL_SIZE,
123 .bDescriptorType = USB_DT_CS_INTERFACE, 123 .bDescriptorType = USB_DT_CS_INTERFACE,
124 .bDescriptorSubtype = OUTPUT_TERMINAL, 124 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
125 .bTerminalID = OUTPUT_TERMINAL_ID, 125 .bTerminalID = OUTPUT_TERMINAL_ID,
126 .wTerminalType = USB_AC_OUTPUT_TERMINAL_SPEAKER, 126 .wTerminalType = UAC_OUTPUT_TERMINAL_SPEAKER,
127 .bAssocTerminal = FEATURE_UNIT_ID, 127 .bAssocTerminal = FEATURE_UNIT_ID,
128 .bSourceID = FEATURE_UNIT_ID, 128 .bSourceID = FEATURE_UNIT_ID,
129}; 129};
@@ -148,22 +148,22 @@ static struct usb_interface_descriptor as_interface_alt_1_desc = {
148}; 148};
149 149
150/* B.4.2 Class-Specific AS Interface Descriptor */ 150/* B.4.2 Class-Specific AS Interface Descriptor */
151static struct usb_as_header_descriptor as_header_desc = { 151static struct uac_as_header_descriptor as_header_desc = {
152 .bLength = USB_DT_AS_HEADER_SIZE, 152 .bLength = UAC_DT_AS_HEADER_SIZE,
153 .bDescriptorType = USB_DT_CS_INTERFACE, 153 .bDescriptorType = USB_DT_CS_INTERFACE,
154 .bDescriptorSubtype = AS_GENERAL, 154 .bDescriptorSubtype = UAC_AS_GENERAL,
155 .bTerminalLink = INPUT_TERMINAL_ID, 155 .bTerminalLink = INPUT_TERMINAL_ID,
156 .bDelay = 1, 156 .bDelay = 1,
157 .wFormatTag = USB_AS_AUDIO_FORMAT_TYPE_I_PCM, 157 .wFormatTag = UAC_FORMAT_TYPE_I_PCM,
158}; 158};
159 159
160DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(1); 160DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1);
161 161
162static struct usb_as_formate_type_i_discrete_descriptor_1 as_type_i_desc = { 162static struct uac_format_type_i_discrete_descriptor_1 as_type_i_desc = {
163 .bLength = USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(1), 163 .bLength = UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(1),
164 .bDescriptorType = USB_DT_CS_INTERFACE, 164 .bDescriptorType = USB_DT_CS_INTERFACE,
165 .bDescriptorSubtype = FORMAT_TYPE, 165 .bDescriptorSubtype = UAC_FORMAT_TYPE,
166 .bFormatType = USB_AS_FORMAT_TYPE_I, 166 .bFormatType = UAC_FORMAT_TYPE_I,
167 .bSubframeSize = 2, 167 .bSubframeSize = 2,
168 .bBitResolution = 16, 168 .bBitResolution = 16,
169 .bSamFreqType = 1, 169 .bSamFreqType = 1,
@@ -181,10 +181,10 @@ static struct usb_endpoint_descriptor as_out_ep_desc __initdata = {
181}; 181};
182 182
183/* Class-specific AS ISO OUT Endpoint Descriptor */ 183/* Class-specific AS ISO OUT Endpoint Descriptor */
184static struct usb_as_iso_endpoint_descriptor as_iso_out_desc __initdata = { 184static struct uac_iso_endpoint_descriptor as_iso_out_desc __initdata = {
185 .bLength = USB_AS_ISO_ENDPOINT_DESC_SIZE, 185 .bLength = UAC_ISO_ENDPOINT_DESC_SIZE,
186 .bDescriptorType = USB_DT_CS_ENDPOINT, 186 .bDescriptorType = USB_DT_CS_ENDPOINT,
187 .bDescriptorSubtype = EP_GENERAL, 187 .bDescriptorSubtype = UAC_EP_GENERAL,
188 .bmAttributes = 1, 188 .bmAttributes = 1,
189 .bLockDelayUnits = 1, 189 .bLockDelayUnits = 1,
190 .wLockDelay = __constant_cpu_to_le16(1), 190 .wLockDelay = __constant_cpu_to_le16(1),
@@ -456,11 +456,11 @@ f_audio_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
456 * Audio class messages; interface activation uses set_alt(). 456 * Audio class messages; interface activation uses set_alt().
457 */ 457 */
458 switch (ctrl->bRequestType) { 458 switch (ctrl->bRequestType) {
459 case USB_AUDIO_SET_INTF: 459 case USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE:
460 value = audio_set_intf_req(f, ctrl); 460 value = audio_set_intf_req(f, ctrl);
461 break; 461 break;
462 462
463 case USB_AUDIO_GET_INTF: 463 case USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE:
464 value = audio_get_intf_req(f, ctrl); 464 value = audio_get_intf_req(f, ctrl);
465 break; 465 break;
466 466
@@ -642,10 +642,10 @@ int __init control_selector_init(struct f_audio *audio)
642 list_add(&mute_control.list, &feature_unit.control); 642 list_add(&mute_control.list, &feature_unit.control);
643 list_add(&volume_control.list, &feature_unit.control); 643 list_add(&volume_control.list, &feature_unit.control);
644 644
645 volume_control.data[_CUR] = 0xffc0; 645 volume_control.data[UAC__CUR] = 0xffc0;
646 volume_control.data[_MIN] = 0xe3a0; 646 volume_control.data[UAC__MIN] = 0xe3a0;
647 volume_control.data[_MAX] = 0xfff0; 647 volume_control.data[UAC__MAX] = 0xfff0;
648 volume_control.data[_RES] = 0x0030; 648 volume_control.data[UAC__RES] = 0x0030;
649 649
650 return 0; 650 return 0;
651} 651}