ep92.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * Copyright (c) 2018, 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. #ifndef __EP92_H__
  14. #define __EP92_H__
  15. /* EP92 register addresses */
  16. /* BI = Basic Info */
  17. #define EP92_BI_VENDOR_ID_0 0x00
  18. #define EP92_BI_VENDOR_ID_1 0x01
  19. #define EP92_BI_DEVICE_ID_0 0x02
  20. #define EP92_BI_DEVICE_ID_1 0x03
  21. #define EP92_BI_VERSION_NUM 0x04
  22. #define EP92_BI_VERSION_YEAR 0x05
  23. #define EP92_BI_VERSION_MONTH 0x06
  24. #define EP92_BI_VERSION_DATE 0x07
  25. #define EP92_BI_GENERAL_INFO_0 0x08
  26. #define EP92_BI_GENERAL_INFO_1 0x09
  27. #define EP92_BI_GENERAL_INFO_2 0x0A
  28. #define EP92_BI_GENERAL_INFO_3 0x0B
  29. #define EP92_BI_GENERAL_INFO_4 0x0C
  30. #define EP92_BI_GENERAL_INFO_5 0x0D
  31. #define EP92_BI_GENERAL_INFO_6 0x0E
  32. #define EP92_ISP_MODE_ENTER_ISP 0x0F
  33. #define EP92_GENERAL_CONTROL_0 0x10
  34. #define EP92_GENERAL_CONTROL_1 0x11
  35. #define EP92_GENERAL_CONTROL_2 0x12
  36. #define EP92_GENERAL_CONTROL_3 0x13
  37. #define EP92_GENERAL_CONTROL_4 0x14
  38. #define EP92_CEC_EVENT_CODE 0x15
  39. #define EP92_CEC_EVENT_PARAM_1 0x16
  40. #define EP92_CEC_EVENT_PARAM_2 0x17
  41. #define EP92_CEC_EVENT_PARAM_3 0x18
  42. #define EP92_CEC_EVENT_PARAM_4 0x19
  43. /* RESERVED 0x1A */
  44. /* ... ... */
  45. /* RESERVED 0x1F */
  46. #define EP92_AUDIO_INFO_SYSTEM_STATUS_0 0x20
  47. #define EP92_AUDIO_INFO_SYSTEM_STATUS_1 0x21
  48. #define EP92_AUDIO_INFO_AUDIO_STATUS 0x22
  49. #define EP92_AUDIO_INFO_CHANNEL_STATUS_0 0x23
  50. #define EP92_AUDIO_INFO_CHANNEL_STATUS_1 0x24
  51. #define EP92_AUDIO_INFO_CHANNEL_STATUS_2 0x25
  52. #define EP92_AUDIO_INFO_CHANNEL_STATUS_3 0x26
  53. #define EP92_AUDIO_INFO_CHANNEL_STATUS_4 0x27
  54. #define EP92_AUDIO_INFO_ADO_INFO_FRAME_0 0x28
  55. #define EP92_AUDIO_INFO_ADO_INFO_FRAME_1 0x29
  56. #define EP92_AUDIO_INFO_ADO_INFO_FRAME_2 0x2A
  57. #define EP92_AUDIO_INFO_ADO_INFO_FRAME_3 0x2B
  58. #define EP92_AUDIO_INFO_ADO_INFO_FRAME_4 0x2C
  59. #define EP92_AUDIO_INFO_ADO_INFO_FRAME_5 0x2D
  60. #define EP92_OTHER_PACKETS_HDMI_VS_0 0x2E
  61. #define EP92_OTHER_PACKETS_HDMI_VS_1 0x2F
  62. #define EP92_OTHER_PACKETS_ACP_PACKET 0x30
  63. #define EP92_OTHER_PACKETS_AVI_INFO_FRAME_0 0x31
  64. #define EP92_OTHER_PACKETS_AVI_INFO_FRAME_1 0x32
  65. #define EP92_OTHER_PACKETS_AVI_INFO_FRAME_2 0x33
  66. #define EP92_OTHER_PACKETS_AVI_INFO_FRAME_3 0x34
  67. #define EP92_OTHER_PACKETS_AVI_INFO_FRAME_4 0x35
  68. #define EP92_OTHER_PACKETS_GC_PACKET_0 0x36
  69. #define EP92_OTHER_PACKETS_GC_PACKET_1 0x37
  70. #define EP92_OTHER_PACKETS_GC_PACKET_2 0x38
  71. #define EP92_MAX_REGISTER_ADDR EP92_OTHER_PACKETS_GC_PACKET_2
  72. /* EP92 register default values */
  73. static struct reg_default ep92_reg_defaults[] = {
  74. {EP92_BI_VENDOR_ID_0, 0x17},
  75. {EP92_BI_VENDOR_ID_1, 0x7A},
  76. {EP92_BI_DEVICE_ID_0, 0x94},
  77. {EP92_BI_DEVICE_ID_1, 0xA3},
  78. {EP92_BI_VERSION_NUM, 0x10},
  79. {EP92_BI_VERSION_YEAR, 0x09},
  80. {EP92_BI_VERSION_MONTH, 0x07},
  81. {EP92_BI_VERSION_DATE, 0x06},
  82. {EP92_BI_GENERAL_INFO_0, 0x00},
  83. {EP92_BI_GENERAL_INFO_1, 0x00},
  84. {EP92_BI_GENERAL_INFO_2, 0x00},
  85. {EP92_BI_GENERAL_INFO_3, 0x00},
  86. {EP92_BI_GENERAL_INFO_4, 0x00},
  87. {EP92_BI_GENERAL_INFO_5, 0x00},
  88. {EP92_BI_GENERAL_INFO_6, 0x00},
  89. {EP92_ISP_MODE_ENTER_ISP, 0x00},
  90. {EP92_GENERAL_CONTROL_0, 0x20},
  91. {EP92_GENERAL_CONTROL_1, 0x00},
  92. {EP92_GENERAL_CONTROL_2, 0x00},
  93. {EP92_GENERAL_CONTROL_3, 0x10},
  94. {EP92_GENERAL_CONTROL_4, 0x00},
  95. {EP92_CEC_EVENT_CODE, 0x00},
  96. {EP92_CEC_EVENT_PARAM_1, 0x00},
  97. {EP92_CEC_EVENT_PARAM_2, 0x00},
  98. {EP92_CEC_EVENT_PARAM_3, 0x00},
  99. {EP92_CEC_EVENT_PARAM_4, 0x00},
  100. {EP92_AUDIO_INFO_SYSTEM_STATUS_0, 0x00},
  101. {EP92_AUDIO_INFO_SYSTEM_STATUS_1, 0x00},
  102. {EP92_AUDIO_INFO_AUDIO_STATUS, 0x00},
  103. {EP92_AUDIO_INFO_CHANNEL_STATUS_0, 0x00},
  104. {EP92_AUDIO_INFO_CHANNEL_STATUS_1, 0x00},
  105. {EP92_AUDIO_INFO_CHANNEL_STATUS_2, 0x00},
  106. {EP92_AUDIO_INFO_CHANNEL_STATUS_3, 0x00},
  107. {EP92_AUDIO_INFO_CHANNEL_STATUS_4, 0x00},
  108. {EP92_AUDIO_INFO_ADO_INFO_FRAME_0, 0x00},
  109. {EP92_AUDIO_INFO_ADO_INFO_FRAME_1, 0x00},
  110. {EP92_AUDIO_INFO_ADO_INFO_FRAME_2, 0x00},
  111. {EP92_AUDIO_INFO_ADO_INFO_FRAME_3, 0x00},
  112. {EP92_AUDIO_INFO_ADO_INFO_FRAME_4, 0x00},
  113. {EP92_AUDIO_INFO_ADO_INFO_FRAME_5, 0x00},
  114. {EP92_OTHER_PACKETS_HDMI_VS_0, 0x00},
  115. {EP92_OTHER_PACKETS_HDMI_VS_1, 0x00},
  116. {EP92_OTHER_PACKETS_ACP_PACKET, 0x00},
  117. {EP92_OTHER_PACKETS_AVI_INFO_FRAME_0, 0x00},
  118. {EP92_OTHER_PACKETS_AVI_INFO_FRAME_1, 0x00},
  119. {EP92_OTHER_PACKETS_AVI_INFO_FRAME_2, 0x00},
  120. {EP92_OTHER_PACKETS_AVI_INFO_FRAME_3, 0x00},
  121. {EP92_OTHER_PACKETS_AVI_INFO_FRAME_4, 0x00},
  122. {EP92_OTHER_PACKETS_GC_PACKET_0, 0x00},
  123. {EP92_OTHER_PACKETS_GC_PACKET_1, 0x00},
  124. {EP92_OTHER_PACKETS_GC_PACKET_2, 0x00},
  125. };
  126. /* shift/masks for register bits
  127. * GI = General Info
  128. * GC = General Control
  129. * AI = Audio Info
  130. */
  131. #define EP92_GI_ADO_CHF_MASK 0x01
  132. #define EP92_GI_CEC_ECF_MASK 0x02
  133. #define EP92_GC_POWER_SHIFT 7
  134. #define EP92_GC_POWER_MASK 0x80
  135. #define EP92_GC_AUDIO_PATH_SHIFT 5
  136. #define EP92_GC_AUDIO_PATH_MASK 0x20
  137. #define EP92_GC_CEC_MUTE_SHIFT 1
  138. #define EP92_GC_CEC_MUTE_MASK 0x02
  139. #define EP92_GC_ARC_EN_SHIFT 0
  140. #define EP92_GC_ARC_EN_MASK 0x01
  141. #define EP92_GC_RX_SEL_SHIFT 0
  142. #define EP92_GC_RX_SEL_MASK 0x07
  143. #define EP92_GC_CEC_VOLUME_SHIFT 0
  144. #define EP92_GC_CEC_VOLUME_MASK 0xff
  145. #define EP92_AI_MCLK_ON_SHIFT 6
  146. #define EP92_AI_MCLK_ON_MASK 0x40
  147. #define EP92_AI_AVMUTE_SHIFT 5
  148. #define EP92_AI_AVMUTE_MASK 0x20
  149. #define EP92_AI_LAYOUT_SHIFT 0
  150. #define EP92_AI_LAYOUT_MASK 0x01
  151. #define EP92_AI_HBR_ADO_SHIFT 5
  152. #define EP92_AI_HBR_ADO_MASK 0x20
  153. #define EP92_AI_STD_ADO_SHIFT 3
  154. #define EP92_AI_STD_ADO_MASK 0x08
  155. #define EP92_AI_RATE_MASK 0x07
  156. #define EP92_AI_NPCM_MASK 0x02
  157. #define EP92_AI_CH_COUNT_MASK 0x07
  158. #define EP92_AI_CH_ALLOC_MASK 0xff
  159. #define EP92_2CHOICE_MASK 1
  160. #define EP92_GC_CEC_VOLUME_MIN 0
  161. #define EP92_GC_CEC_VOLUME_MAX 100
  162. #define EP92_AI_RATE_MIN 0
  163. #define EP92_AI_RATE_MAX 768000
  164. #define EP92_AI_CH_COUNT_MIN 0
  165. #define EP92_AI_CH_COUNT_MAX 8
  166. #define EP92_AI_CH_ALLOC_MIN 0
  167. #define EP92_AI_CH_ALLOC_MAX 0xff
  168. #define EP92_STATUS_NO_SIGNAL 0
  169. #define EP92_STATUS_AUDIO_ACTIVE 1
  170. /* kcontrol storage indices */
  171. enum {
  172. EP92_KCTL_POWER = 0,
  173. EP92_KCTL_AUDIO_PATH,
  174. EP92_KCTL_CEC_MUTE,
  175. EP92_KCTL_ARC_EN,
  176. EP92_KCTL_RX_SEL,
  177. EP92_KCTL_CEC_VOLUME,
  178. EP92_KCTL_STATE,
  179. EP92_KCTL_AVMUTE,
  180. EP92_KCTL_LAYOUT,
  181. EP92_KCTL_MODE,
  182. EP92_KCTL_RATE,
  183. EP92_KCTL_CH_COUNT,
  184. EP92_KCTL_CH_ALLOC,
  185. EP92_KCTL_MAX
  186. };
  187. #endif /* __EP92_H__ */