Ajay Agarwal | 045e374 | 2017-02-07 18:41:34 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/usb.h> |
| 15 | #include <linux/usb/audio.h> |
| 16 | #include <linux/usb/audio-v2.h> |
| 17 | #include <linux/usb/audio-v3.h> |
| 18 | |
| 19 | struct uac3_input_terminal_descriptor badd_baif_in_term_desc = { |
| 20 | .bLength = UAC3_DT_INPUT_TERMINAL_SIZE, |
| 21 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 22 | .bDescriptorSubtype = UAC_INPUT_TERMINAL, |
| 23 | .bTerminalID = BADD_IN_TERM_ID_BAIF, |
| 24 | .bCSourceID = BADD_CLOCK_SOURCE, |
| 25 | .wExTerminalDescrID = 0x0000, |
| 26 | .wTerminalDescrStr = 0x0000 |
| 27 | }; |
| 28 | |
| 29 | struct uac3_input_terminal_descriptor badd_baof_in_term_desc = { |
| 30 | .bLength = UAC3_DT_INPUT_TERMINAL_SIZE, |
| 31 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 32 | .bDescriptorSubtype = UAC_INPUT_TERMINAL, |
| 33 | .bTerminalID = BADD_IN_TERM_ID_BAOF, |
| 34 | .wTerminalType = UAC_TERMINAL_STREAMING, |
| 35 | .bAssocTerminal = 0x00, |
| 36 | .bCSourceID = BADD_CLOCK_SOURCE, |
| 37 | .bmControls = 0x00000000, |
| 38 | .wExTerminalDescrID = 0x0000, |
| 39 | .wConnectorsDescrID = 0x0000, |
| 40 | .wTerminalDescrStr = 0x0000 |
| 41 | }; |
| 42 | |
| 43 | struct uac3_output_terminal_descriptor badd_baif_out_term_desc = { |
| 44 | .bLength = UAC3_DT_OUTPUT_TERMINAL_SIZE, |
| 45 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 46 | .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, |
| 47 | .bTerminalID = BADD_OUT_TERM_ID_BAIF, |
| 48 | .wTerminalType = UAC_TERMINAL_STREAMING, |
| 49 | .bAssocTerminal = 0x00, /* No associated terminal */ |
| 50 | .bSourceID = BADD_FU_ID_BAIF, |
| 51 | .bCSourceID = BADD_CLOCK_SOURCE, |
| 52 | .bmControls = 0x00000000, /* No controls */ |
| 53 | .wExTerminalDescrID = 0x0000, |
| 54 | .wConnectorsDescrID = 0x0000, |
| 55 | .wTerminalDescrStr = 0x0000 |
| 56 | }; |
| 57 | |
| 58 | struct uac3_output_terminal_descriptor badd_baof_out_term_desc = { |
| 59 | .bLength = UAC3_DT_OUTPUT_TERMINAL_SIZE, |
| 60 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 61 | .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, |
| 62 | .bTerminalID = BADD_OUT_TERM_ID_BAOF, |
| 63 | .bSourceID = BADD_FU_ID_BAOF, |
| 64 | .bCSourceID = BADD_CLOCK_SOURCE, |
| 65 | .wExTerminalDescrID = 0x0000, |
| 66 | .wTerminalDescrStr = 0x0000 |
| 67 | }; |
| 68 | |
| 69 | __u8 monoControls[] = { |
| 70 | 0x03, 0x00, 0x00, 0x00, |
| 71 | 0x0c, 0x00, 0x00, 0x00}; |
| 72 | |
| 73 | __u8 stereoControls[] = { |
| 74 | 0x03, 0x00, 0x00, 0x00, |
| 75 | 0x0c, 0x00, 0x00, 0x00, |
| 76 | 0x0c, 0x00, 0x00, 0x00 |
| 77 | }; |
| 78 | |
| 79 | __u8 badd_mu_src_ids[] = {BADD_IN_TERM_ID_BAOF, BADD_FU_ID_BAIOF}; |
| 80 | |
| 81 | struct uac3_mixer_unit_descriptor badd_baiof_mu_desc = { |
| 82 | .bLength = UAC3_DT_MIXER_UNIT_SIZE, |
| 83 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 84 | .bDescriptorSubtype = UAC3_MIXER_UNIT_V3, |
| 85 | .bUnitID = BADD_MU_ID_BAIOF, |
| 86 | .bNrInPins = 0x02, |
| 87 | .baSourceID = badd_mu_src_ids, |
| 88 | .bmMixerControls = 0x00, |
| 89 | .bmControls = 0x00000000, |
| 90 | .wMixerDescrStr = 0x0000 |
| 91 | }; |
| 92 | |
| 93 | struct uac3_feature_unit_descriptor badd_baif_fu_desc = { |
| 94 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 95 | .bDescriptorSubtype = UAC3_FEATURE_UNIT_V3, |
| 96 | .bUnitID = BADD_FU_ID_BAIF, |
| 97 | .bSourceID = BADD_IN_TERM_ID_BAIF, |
| 98 | .wFeatureDescrStr = 0x0000 |
| 99 | }; |
| 100 | |
| 101 | struct uac3_feature_unit_descriptor badd_baof_fu_desc = { |
| 102 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 103 | .bDescriptorSubtype = UAC3_FEATURE_UNIT_V3, |
| 104 | .bUnitID = BADD_FU_ID_BAOF, |
| 105 | .wFeatureDescrStr = 0x0000 |
| 106 | }; |
| 107 | |
| 108 | struct uac3_feature_unit_descriptor badd_baiof_fu_desc = { |
| 109 | .bLength = 0x0f, |
| 110 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 111 | .bDescriptorSubtype = UAC3_FEATURE_UNIT_V3, |
| 112 | .bUnitID = BADD_FU_ID_BAIOF, |
| 113 | .bSourceID = BADD_IN_TERM_ID_BAIF, |
| 114 | .bmaControls = monoControls, |
| 115 | .wFeatureDescrStr = 0x0000 |
| 116 | }; |
| 117 | |
| 118 | struct uac3_clock_source_descriptor badd_clock_desc = { |
| 119 | .bLength = UAC3_DT_CLOCK_SRC_SIZE, |
| 120 | .bDescriptorType = USB_DT_CS_INTERFACE, |
| 121 | .bDescriptorSubtype = UAC3_CLOCK_SOURCE, |
| 122 | .bClockID = BADD_CLOCK_SOURCE, |
| 123 | .bmControls = 0x00000001, |
| 124 | .bReferenceTerminal = 0x00, |
| 125 | .wClockSourceStr = 0x0000 |
| 126 | }; |
| 127 | |
| 128 | void *badd_desc_list[] = { |
| 129 | &badd_baif_in_term_desc, |
| 130 | &badd_baof_in_term_desc, |
| 131 | &badd_baiof_mu_desc, |
| 132 | &badd_baif_fu_desc, |
| 133 | &badd_baof_fu_desc, |
| 134 | &badd_baiof_fu_desc, |
| 135 | &badd_clock_desc |
| 136 | }; |
| 137 | |