badd.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. #include <linux/usb.h>
  14. #include <linux/usb/audio.h>
  15. #include <linux/usb/audio-v2.h>
  16. #include <linux/usb/audio-v3.h>
  17. struct uac3_input_terminal_descriptor badd_baif_in_term_desc = {
  18. .bLength = UAC3_DT_INPUT_TERMINAL_SIZE,
  19. .bDescriptorType = USB_DT_CS_INTERFACE,
  20. .bDescriptorSubtype = UAC_INPUT_TERMINAL,
  21. .bTerminalID = BADD_IN_TERM_ID_BAIF,
  22. .bCSourceID = BADD_CLOCK_SOURCE,
  23. .wExTerminalDescrID = 0x0000,
  24. .wTerminalDescrStr = 0x0000
  25. };
  26. struct uac3_input_terminal_descriptor badd_baof_in_term_desc = {
  27. .bLength = UAC3_DT_INPUT_TERMINAL_SIZE,
  28. .bDescriptorType = USB_DT_CS_INTERFACE,
  29. .bDescriptorSubtype = UAC_INPUT_TERMINAL,
  30. .bTerminalID = BADD_IN_TERM_ID_BAOF,
  31. .wTerminalType = UAC_TERMINAL_STREAMING,
  32. .bAssocTerminal = 0x00,
  33. .bCSourceID = BADD_CLOCK_SOURCE,
  34. .bmControls = 0x00000000,
  35. .wExTerminalDescrID = 0x0000,
  36. .wConnectorsDescrID = 0x0000,
  37. .wTerminalDescrStr = 0x0000
  38. };
  39. struct uac3_output_terminal_descriptor badd_baif_out_term_desc = {
  40. .bLength = UAC3_DT_OUTPUT_TERMINAL_SIZE,
  41. .bDescriptorType = USB_DT_CS_INTERFACE,
  42. .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
  43. .bTerminalID = BADD_OUT_TERM_ID_BAIF,
  44. .wTerminalType = UAC_TERMINAL_STREAMING,
  45. .bAssocTerminal = 0x00, /* No associated terminal */
  46. .bSourceID = BADD_FU_ID_BAIF,
  47. .bCSourceID = BADD_CLOCK_SOURCE,
  48. .bmControls = 0x00000000, /* No controls */
  49. .wExTerminalDescrID = 0x0000,
  50. .wConnectorsDescrID = 0x0000,
  51. .wTerminalDescrStr = 0x0000
  52. };
  53. struct uac3_output_terminal_descriptor badd_baof_out_term_desc = {
  54. .bLength = UAC3_DT_OUTPUT_TERMINAL_SIZE,
  55. .bDescriptorType = USB_DT_CS_INTERFACE,
  56. .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
  57. .bTerminalID = BADD_OUT_TERM_ID_BAOF,
  58. .bSourceID = BADD_FU_ID_BAOF,
  59. .bCSourceID = BADD_CLOCK_SOURCE,
  60. .wExTerminalDescrID = 0x0000,
  61. .wTerminalDescrStr = 0x0000
  62. };
  63. __u8 monoControls[] = {
  64. 0x03, 0x00, 0x00, 0x00,
  65. 0x0c, 0x00, 0x00, 0x00};
  66. __u8 stereoControls[] = {
  67. 0x03, 0x00, 0x00, 0x00,
  68. 0x0c, 0x00, 0x00, 0x00,
  69. 0x0c, 0x00, 0x00, 0x00
  70. };
  71. __u8 badd_mu_src_ids[] = {BADD_IN_TERM_ID_BAOF, BADD_FU_ID_BAIOF};
  72. struct uac3_mixer_unit_descriptor badd_baiof_mu_desc = {
  73. .bLength = UAC3_DT_MIXER_UNIT_SIZE,
  74. .bDescriptorType = USB_DT_CS_INTERFACE,
  75. .bDescriptorSubtype = UAC3_MIXER_UNIT_V3,
  76. .bUnitID = BADD_MU_ID_BAIOF,
  77. .bNrInPins = 0x02,
  78. .baSourceID = badd_mu_src_ids,
  79. .bmMixerControls = 0x00,
  80. .bmControls = 0x00000000,
  81. .wMixerDescrStr = 0x0000
  82. };
  83. struct uac3_feature_unit_descriptor badd_baif_fu_desc = {
  84. .bDescriptorType = USB_DT_CS_INTERFACE,
  85. .bDescriptorSubtype = UAC3_FEATURE_UNIT_V3,
  86. .bUnitID = BADD_FU_ID_BAIF,
  87. .bSourceID = BADD_IN_TERM_ID_BAIF,
  88. .wFeatureDescrStr = 0x0000
  89. };
  90. struct uac3_feature_unit_descriptor badd_baof_fu_desc = {
  91. .bDescriptorType = USB_DT_CS_INTERFACE,
  92. .bDescriptorSubtype = UAC3_FEATURE_UNIT_V3,
  93. .bUnitID = BADD_FU_ID_BAOF,
  94. .wFeatureDescrStr = 0x0000
  95. };
  96. struct uac3_feature_unit_descriptor badd_baiof_fu_desc = {
  97. .bLength = 0x0f,
  98. .bDescriptorType = USB_DT_CS_INTERFACE,
  99. .bDescriptorSubtype = UAC3_FEATURE_UNIT_V3,
  100. .bUnitID = BADD_FU_ID_BAIOF,
  101. .bSourceID = BADD_IN_TERM_ID_BAIF,
  102. .bmaControls = monoControls,
  103. .wFeatureDescrStr = 0x0000
  104. };
  105. struct uac3_clock_source_descriptor badd_clock_desc = {
  106. .bLength = UAC3_DT_CLOCK_SRC_SIZE,
  107. .bDescriptorType = USB_DT_CS_INTERFACE,
  108. .bDescriptorSubtype = UAC3_CLOCK_SOURCE,
  109. .bClockID = BADD_CLOCK_SOURCE,
  110. .bmControls = 0x00000001,
  111. .bReferenceTerminal = 0x00,
  112. .wClockSourceStr = 0x0000
  113. };
  114. void *badd_desc_list[] = {
  115. &badd_baif_in_term_desc,
  116. &badd_baof_in_term_desc,
  117. &badd_baiof_mu_desc,
  118. &badd_baif_fu_desc,
  119. &badd_baof_fu_desc,
  120. &badd_baiof_fu_desc,
  121. &badd_clock_desc
  122. };