acodec.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /******************************************************************************
  2. Copyright (C), 2016-2018, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : acodec.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2016/6/15
  8. Last Modified :
  9. Description :
  10. Function List :
  11. ******************************************************************************/
  12. #ifndef _ACODEC_H_
  13. #define _ACODEC_H_
  14. #define IOC_TYPE_ACODEC 'A'
  15. typedef enum hiACODEC_FS_E {
  16. ACODEC_FS_48000 = 0x1a,
  17. ACODEC_FS_24000 = 0x19,
  18. ACODEC_FS_12000 = 0x18,
  19. ACODEC_FS_44100 = 0x1a,
  20. ACODEC_FS_22050 = 0x19,
  21. ACODEC_FS_11025 = 0x18,
  22. ACODEC_FS_32000 = 0x1a,
  23. ACODEC_FS_16000 = 0x19,
  24. ACODEC_FS_8000 = 0x18,
  25. ACODEC_FS_64000 = 0x1b,
  26. ACODEC_FS_96000 = 0x1b,
  27. ACODEC_FS_BUTT = 0x1c,
  28. } ACODEC_FS_E;
  29. typedef enum hiACODEC_MIXER_E {
  30. ACODEC_MIXER_IN0 = 0x0,
  31. ACODEC_MIXER_IN1 = 0x1,
  32. ACODEC_MIXER_IN_D = 0x2,
  33. ACODEC_MIXER_BUTT,
  34. } ACODEC_MIXER_E;
  35. typedef struct {
  36. /*volume control, 0x00~0x7e, 0x7F:mute*/
  37. unsigned int vol_ctrl;
  38. /*adc/dac mute control, 1:mute, 0:unmute*/
  39. unsigned int vol_ctrl_mute;
  40. } ACODEC_VOL_CTRL;
  41. typedef enum hiACODEC_IOCTL_E {
  42. IOC_NR_SOFT_RESET_CTRL = 0x0,
  43. IOC_NR_SET_INPUT_VOL ,
  44. IOC_NR_SET_OUTPUT_VOL,
  45. IOC_NR_GET_INPUT_VOL,
  46. IOC_NR_GET_OUTPUT_VOL,
  47. IOC_NR_SET_I2S1_FS,
  48. IOC_NR_SET_MIXER_MIC,
  49. IOC_NR_SEL_DAC_CLK,
  50. IOC_NR_SEL_ADC_CLK,
  51. IOC_NR_SEL_ANA_MCLK,
  52. IOC_NR_SET_GAIN_MICL,
  53. IOC_NR_SET_GAIN_MICR,
  54. IOC_NR_SET_DACL_VOL,
  55. IOC_NR_SET_DACR_VOL,
  56. IOC_NR_SET_ADCL_VOL,
  57. IOC_NR_SET_ADCR_VOL,
  58. IOC_NR_SET_MICL_MUTE,
  59. IOC_NR_SET_MICR_MUTE,
  60. IOC_NR_SET_DACL_MUTE,
  61. IOC_NR_SET_DACR_MUTE,
  62. IOC_NR_BOOSTL_ENABLE,
  63. IOC_NR_BOOSTR_ENABLE,
  64. IOC_NR_GET_GAIN_MICL,
  65. IOC_NR_GET_GAIN_MICR,
  66. IOC_NR_GET_DACL_VOL,
  67. IOC_NR_GET_DACR_VOL,
  68. IOC_NR_GET_ADCL_VOL,
  69. IOC_NR_GET_ADCR_VOL,
  70. IOC_NR_SET_PD_DACL,
  71. IOC_NR_SET_PD_DACR,
  72. IOC_NR_SET_PD_ADCL,
  73. IOC_NR_SET_PD_ADCR,
  74. IOC_NR_SET_PD_LINEINL,
  75. IOC_NR_SET_PD_LINEINR,
  76. IOC_NR_SET_DAC_DE_EMPHASIS,
  77. IOC_NR_SET_ADC_HP_FILTER,
  78. IOC_NR_SET_I2S1_DATAWIDTH,
  79. } ACODEC_IOCTL_E;
  80. /*reset the audio code to the default config*/
  81. #define ACODEC_SOFT_RESET_CTRL \
  82. _IO(IOC_TYPE_ACODEC, IOC_NR_SOFT_RESET_CTRL)
  83. /*ACODEC_FS_E*/
  84. #define ACODEC_SET_I2S1_FS \
  85. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_I2S1_FS, unsigned int)
  86. /*select the micpga's input, micin linein, or differential input(ACODEC_MIXER_E)*/
  87. #define ACODEC_SET_MIXER_MIC \
  88. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_MIXER_MIC, unsigned int)
  89. /*analog part input volume control(left channel 0~0x1f)*/
  90. #define ACODEC_SET_GAIN_MICL \
  91. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_GAIN_MICL, unsigned int)
  92. /*analog part input volume control(right channel 0~0x1f)*/
  93. #define ACODEC_SET_GAIN_MICR \
  94. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_GAIN_MICR, unsigned int)
  95. /*Output volume control(left channel) ACODEC_VOL_CTRL*/
  96. #define ACODEC_SET_DACL_VOL \
  97. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_DACL_VOL, ACODEC_VOL_CTRL)
  98. /*Output volume control(right channel) ACODEC_VOL_CTRL*/
  99. #define ACODEC_SET_DACR_VOL \
  100. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_DACR_VOL, ACODEC_VOL_CTRL)
  101. /*Input volume control(left channel) ACODEC_VOL_CTRL*/
  102. #define ACODEC_SET_ADCL_VOL \
  103. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_ADCL_VOL, ACODEC_VOL_CTRL)
  104. /*Input volume control(right channel) ACODEC_VOL_CTRL*/
  105. #define ACODEC_SET_ADCR_VOL \
  106. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_ADCR_VOL, ACODEC_VOL_CTRL)
  107. /*Input mute control(left channel), 1:mute, 0:unmute*/
  108. #define ACODEC_SET_MICL_MUTE \
  109. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_MICL_MUTE, unsigned int)
  110. /*Input mute control(right channel), 1:mute, 0:unmute*/
  111. #define ACODEC_SET_MICR_MUTE \
  112. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_MICR_MUTE, unsigned int)
  113. /*Output mute control(left channel), 1:mute, 0:unmute*/
  114. #define ACODEC_SET_DACL_MUTE \
  115. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_DACL_MUTE, unsigned int)
  116. /*Output mute control(right channel), 1:mute, 0:unmute*/
  117. #define ACODEC_SET_DACR_MUTE \
  118. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_DACR_MUTE, unsigned int)
  119. /*Audio AD BOOST Control, 1:on, 0:off*/
  120. #define ACODEC_ENABLE_BOOSTL \
  121. _IOWR(IOC_TYPE_ACODEC, IOC_NR_BOOSTL_ENABLE, unsigned int)
  122. #define ACODEC_ENABLE_BOOSTR \
  123. _IOWR(IOC_TYPE_ACODEC, IOC_NR_BOOSTR_ENABLE, unsigned int)
  124. #define ACODEC_GET_GAIN_MICL \
  125. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_GAIN_MICL, unsigned int)
  126. #define ACODEC_GET_GAIN_MICR \
  127. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_GAIN_MICR, unsigned int)
  128. #define ACODEC_GET_DACL_VOL \
  129. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_DACL_VOL, ACODEC_VOL_CTRL)
  130. #define ACODEC_GET_DACR_VOL \
  131. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_DACR_VOL, ACODEC_VOL_CTRL)
  132. #define ACODEC_GET_ADCL_VOL \
  133. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_ADCL_VOL, ACODEC_VOL_CTRL)
  134. #define ACODEC_GET_ADCR_VOL \
  135. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_ADCR_VOL, ACODEC_VOL_CTRL)
  136. /*set adcl power, 0: power up, 1: power down*/
  137. #define ACODEC_SET_PD_DACL \
  138. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_PD_DACL, unsigned int)
  139. /*set adcr power, 0: power up, 1: power down*/
  140. #define ACODEC_SET_PD_DACR \
  141. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_PD_DACR, unsigned int)
  142. /*set adcl power, 0: power up, 1: power down*/
  143. #define ACODEC_SET_PD_ADCL \
  144. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_PD_ADCL, unsigned int)
  145. /*set adcr power, 0: power up, 1: power down*/
  146. #define ACODEC_SET_PD_ADCR \
  147. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_PD_ADCR, unsigned int)
  148. /*set adcl power, 0: power up, 1: power down*/
  149. #define ACODEC_SET_PD_LINEINL \
  150. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_PD_LINEINL, unsigned int)
  151. /*set adcr power, 0: power up, 1: power down*/
  152. #define ACODEC_SET_PD_LINEINR \
  153. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_PD_LINEINR, unsigned int)
  154. /* Don't need to set, the driver will set a default value */
  155. /*clock of dac and adc is reverse or obverse*/
  156. #define ACODEC_SEL_DAC_CLK \
  157. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SEL_DAC_CLK, unsigned int)
  158. #define ACODEC_SEL_ADC_CLK \
  159. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SEL_ADC_CLK, unsigned int)
  160. /*clock of analog part and digital part is reverse or obverse*/
  161. #define ACODEC_SEL_ANA_MCLK \
  162. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SEL_ANA_MCLK, unsigned int)
  163. #define ACODEC_SET_DAC_DE_EMPHASIS \
  164. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_DAC_DE_EMPHASIS, unsigned int)
  165. #define ACODEC_SET_ADC_HP_FILTER \
  166. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_ADC_HP_FILTER, unsigned int)
  167. #define ACODEC_SET_INPUT_VOL \
  168. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_INPUT_VOL, unsigned int)
  169. #define ACODEC_SET_OUTPUT_VOL \
  170. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_OUTPUT_VOL, unsigned int)
  171. #define ACODEC_GET_INPUT_VOL \
  172. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_INPUT_VOL, unsigned int)
  173. #define ACODEC_GET_OUTPUT_VOL \
  174. _IOWR(IOC_TYPE_ACODEC, IOC_NR_GET_OUTPUT_VOL, unsigned int)
  175. /* Reserved ioctl cmd */
  176. #define ACODEC_SET_I2S1_DATAWIDTH \
  177. _IOWR(IOC_TYPE_ACODEC, IOC_NR_SET_I2S1_DATAWIDTH, unsigned int)
  178. #endif /* End of #ifndef _ACODEC_H_ */