summaryrefslogtreecommitdiff
path: root/sound/usb/badd.c
blob: cc6c26cbb6240d7902f013c40dc286dd3cbb731d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/usb.h>
#include <linux/usb/audio.h>
#include <linux/usb/audio-v2.h>
#include <linux/usb/audio-v3.h>

struct uac3_input_terminal_descriptor badd_baif_in_term_desc = {
	.bLength = UAC3_DT_INPUT_TERMINAL_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC_INPUT_TERMINAL,
	.bTerminalID = BADD_IN_TERM_ID_BAIF,
	.bCSourceID = BADD_CLOCK_SOURCE,
	.wExTerminalDescrID = 0x0000,
	.wTerminalDescrStr = 0x0000
};

struct uac3_input_terminal_descriptor badd_baof_in_term_desc = {
	.bLength = UAC3_DT_INPUT_TERMINAL_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC_INPUT_TERMINAL,
	.bTerminalID = BADD_IN_TERM_ID_BAOF,
	.wTerminalType = UAC_TERMINAL_STREAMING,
	.bAssocTerminal = 0x00,
	.bCSourceID = BADD_CLOCK_SOURCE,
	.bmControls = 0x00000000,
	.wExTerminalDescrID = 0x0000,
	.wConnectorsDescrID = 0x0000,
	.wTerminalDescrStr = 0x0000
};

struct uac3_output_terminal_descriptor badd_baif_out_term_desc = {
	.bLength = UAC3_DT_OUTPUT_TERMINAL_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
	.bTerminalID = BADD_OUT_TERM_ID_BAIF,
	.wTerminalType = UAC_TERMINAL_STREAMING,
	.bAssocTerminal = 0x00,		/* No associated terminal */
	.bSourceID = BADD_FU_ID_BAIF,
	.bCSourceID = BADD_CLOCK_SOURCE,
	.bmControls = 0x00000000,	/* No controls */
	.wExTerminalDescrID = 0x0000,
	.wConnectorsDescrID = 0x0000,
	.wTerminalDescrStr = 0x0000
};

struct uac3_output_terminal_descriptor badd_baof_out_term_desc = {
	.bLength = UAC3_DT_OUTPUT_TERMINAL_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
	.bTerminalID = BADD_OUT_TERM_ID_BAOF,
	.bSourceID = BADD_FU_ID_BAOF,
	.bCSourceID = BADD_CLOCK_SOURCE,
	.wExTerminalDescrID = 0x0000,
	.wTerminalDescrStr = 0x0000
};

__u8 monoControls[] = {
	0x03, 0x00, 0x00, 0x00,
	0x0c, 0x00, 0x00, 0x00};

__u8 stereoControls[] = {
	0x03, 0x00, 0x00, 0x00,
	0x0c, 0x00, 0x00, 0x00,
	0x0c, 0x00, 0x00, 0x00
};

__u8 badd_mu_src_ids[] = {BADD_IN_TERM_ID_BAOF, BADD_FU_ID_BAIOF};

struct uac3_mixer_unit_descriptor badd_baiof_mu_desc = {
	.bLength = UAC3_DT_MIXER_UNIT_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC3_MIXER_UNIT_V3,
	.bUnitID = BADD_MU_ID_BAIOF,
	.bNrInPins = 0x02,
	.baSourceID = badd_mu_src_ids,
	.bmMixerControls = 0x00,
	.bmControls = 0x00000000,
	.wMixerDescrStr = 0x0000
};

struct uac3_feature_unit_descriptor badd_baif_fu_desc = {
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC3_FEATURE_UNIT_V3,
	.bUnitID = BADD_FU_ID_BAIF,
	.bSourceID = BADD_IN_TERM_ID_BAIF,
	.wFeatureDescrStr = 0x0000
};

struct uac3_feature_unit_descriptor badd_baof_fu_desc = {
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC3_FEATURE_UNIT_V3,
	.bUnitID = BADD_FU_ID_BAOF,
	.wFeatureDescrStr = 0x0000
};

struct uac3_feature_unit_descriptor badd_baiof_fu_desc = {
	.bLength = 0x0f,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC3_FEATURE_UNIT_V3,
	.bUnitID = BADD_FU_ID_BAIOF,
	.bSourceID = BADD_IN_TERM_ID_BAIF,
	.bmaControls = monoControls,
	.wFeatureDescrStr = 0x0000
};

struct uac3_clock_source_descriptor badd_clock_desc = {
	.bLength = UAC3_DT_CLOCK_SRC_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC3_CLOCK_SOURCE,
	.bClockID = BADD_CLOCK_SOURCE,
	.bmControls = 0x00000001,
	.bReferenceTerminal = 0x00,
	.wClockSourceStr = 0x0000
};

void *badd_desc_list[] = {
	&badd_baif_in_term_desc,
	&badd_baof_in_term_desc,
	&badd_baiof_mu_desc,
	&badd_baif_fu_desc,
	&badd_baof_fu_desc,
	&badd_baiof_fu_desc,
	&badd_clock_desc
};