tlv320aic3x.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * ALSA SoC TLV320AIC3X codec driver
  3. *
  4. * Author: Vladimir Barinov, <vbarinov@ru.mvista.com>
  5. * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _AIC3X_H
  12. #define _AIC3X_H
  13. /* AIC3X register space */
  14. #define AIC3X_CACHEREGNUM 103
  15. /* Page select register */
  16. #define AIC3X_PAGE_SELECT 0
  17. /* Software reset register */
  18. #define AIC3X_RESET 1
  19. /* Codec Sample rate select register */
  20. #define AIC3X_SAMPLE_RATE_SEL_REG 2
  21. /* PLL progrramming register A */
  22. #define AIC3X_PLL_PROGA_REG 3
  23. /* PLL progrramming register B */
  24. #define AIC3X_PLL_PROGB_REG 4
  25. /* PLL progrramming register C */
  26. #define AIC3X_PLL_PROGC_REG 5
  27. /* PLL progrramming register D */
  28. #define AIC3X_PLL_PROGD_REG 6
  29. /* Codec datapath setup register */
  30. #define AIC3X_CODEC_DATAPATH_REG 7
  31. /* Audio serial data interface control register A */
  32. #define AIC3X_ASD_INTF_CTRLA 8
  33. /* Audio serial data interface control register B */
  34. #define AIC3X_ASD_INTF_CTRLB 9
  35. /* Audio overflow status and PLL R value programming register */
  36. #define AIC3X_OVRF_STATUS_AND_PLLR_REG 11
  37. /* ADC PGA Gain control registers */
  38. #define LADC_VOL 15
  39. #define RADC_VOL 16
  40. /* MIC3 control registers */
  41. #define MIC3LR_2_LADC_CTRL 17
  42. #define MIC3LR_2_RADC_CTRL 18
  43. /* Line1 Input control registers */
  44. #define LINE1L_2_LADC_CTRL 19
  45. #define LINE1R_2_RADC_CTRL 22
  46. /* Line2 Input control registers */
  47. #define LINE2L_2_LADC_CTRL 20
  48. #define LINE2R_2_RADC_CTRL 23
  49. /* MICBIAS Control Register */
  50. #define MICBIAS_CTRL 25
  51. /* AGC Control Registers A, B, C */
  52. #define LAGC_CTRL_A 26
  53. #define LAGC_CTRL_B 27
  54. #define LAGC_CTRL_C 28
  55. #define RAGC_CTRL_A 29
  56. #define RAGC_CTRL_B 30
  57. #define RAGC_CTRL_C 31
  58. /* DAC Power and Left High Power Output control registers */
  59. #define DAC_PWR 37
  60. #define HPLCOM_CFG 37
  61. /* Right High Power Output control registers */
  62. #define HPRCOM_CFG 38
  63. /* DAC Output Switching control registers */
  64. #define DAC_LINE_MUX 41
  65. /* High Power Output Driver Pop Reduction registers */
  66. #define HPOUT_POP_REDUCTION 42
  67. /* DAC Digital control registers */
  68. #define LDAC_VOL 43
  69. #define RDAC_VOL 44
  70. /* High Power Output control registers */
  71. #define LINE2L_2_HPLOUT_VOL 45
  72. #define LINE2R_2_HPROUT_VOL 62
  73. #define PGAL_2_HPLOUT_VOL 46
  74. #define PGAR_2_HPROUT_VOL 63
  75. #define DACL1_2_HPLOUT_VOL 47
  76. #define DACR1_2_HPROUT_VOL 64
  77. #define HPLOUT_CTRL 51
  78. #define HPROUT_CTRL 65
  79. /* High Power COM control registers */
  80. #define LINE2L_2_HPLCOM_VOL 52
  81. #define LINE2R_2_HPRCOM_VOL 69
  82. #define PGAL_2_HPLCOM_VOL 53
  83. #define PGAR_2_HPRCOM_VOL 70
  84. #define DACL1_2_HPLCOM_VOL 54
  85. #define DACR1_2_HPRCOM_VOL 71
  86. #define HPLCOM_CTRL 58
  87. #define HPRCOM_CTRL 72
  88. /* Mono Line Output Plus/Minus control registers */
  89. #define LINE2L_2_MONOLOPM_VOL 73
  90. #define LINE2R_2_MONOLOPM_VOL 76
  91. #define PGAL_2_MONOLOPM_VOL 74
  92. #define PGAR_2_MONOLOPM_VOL 77
  93. #define DACL1_2_MONOLOPM_VOL 75
  94. #define DACR1_2_MONOLOPM_VOL 78
  95. #define MONOLOPM_CTRL 79
  96. /* Line Output Plus/Minus control registers */
  97. #define LINE2L_2_LLOPM_VOL 80
  98. #define LINE2R_2_RLOPM_VOL 90
  99. #define PGAL_2_LLOPM_VOL 81
  100. #define PGAR_2_RLOPM_VOL 91
  101. #define DACL1_2_LLOPM_VOL 82
  102. #define DACR1_2_RLOPM_VOL 92
  103. #define LLOPM_CTRL 86
  104. #define RLOPM_CTRL 93
  105. /* Clock generation control register */
  106. #define AIC3X_CLKGEN_CTRL_REG 102
  107. /* Page select register bits */
  108. #define PAGE0_SELECT 0
  109. #define PAGE1_SELECT 1
  110. /* Audio serial data interface control register A bits */
  111. #define BIT_CLK_MASTER 0x80
  112. #define WORD_CLK_MASTER 0x40
  113. /* Codec Datapath setup register 7 */
  114. #define FSREF_44100 (1 << 7)
  115. #define FSREF_48000 (0 << 7)
  116. #define DUAL_RATE_MODE ((1 << 5) | (1 << 6))
  117. #define LDAC2LCH (0x1 << 3)
  118. #define RDAC2RCH (0x1 << 1)
  119. /* PLL registers bitfields */
  120. #define PLLP_SHIFT 0
  121. #define PLLR_SHIFT 0
  122. #define PLLJ_SHIFT 2
  123. #define PLLD_MSB_SHIFT 0
  124. #define PLLD_LSB_SHIFT 2
  125. /* Clock generation register bits */
  126. #define PLL_CLKIN_SHIFT 4
  127. #define MCLK_SOURCE 0x0
  128. #define PLL_CLKDIV_SHIFT 0
  129. /* Software reset register bits */
  130. #define SOFT_RESET 0x80
  131. /* PLL progrramming register A bits */
  132. #define PLL_ENABLE 0x80
  133. /* Route bits */
  134. #define ROUTE_ON 0x80
  135. /* Mute bits */
  136. #define UNMUTE 0x08
  137. #define MUTE_ON 0x80
  138. /* Power bits */
  139. #define LADC_PWR_ON 0x04
  140. #define RADC_PWR_ON 0x04
  141. #define LDAC_PWR_ON 0x80
  142. #define RDAC_PWR_ON 0x40
  143. #define HPLOUT_PWR_ON 0x01
  144. #define HPROUT_PWR_ON 0x01
  145. #define HPLCOM_PWR_ON 0x01
  146. #define HPRCOM_PWR_ON 0x01
  147. #define MONOLOPM_PWR_ON 0x01
  148. #define LLOPM_PWR_ON 0x01
  149. #define RLOPM_PWR_ON 0x01
  150. #define INVERT_VOL(val) (0x7f - val)
  151. /* Default output volume (inverted) */
  152. #define DEFAULT_VOL INVERT_VOL(0x50)
  153. /* Default input volume */
  154. #define DEFAULT_GAIN 0x20
  155. struct aic3x_setup_data {
  156. unsigned short i2c_address;
  157. };
  158. extern struct snd_soc_codec_dai aic3x_dai;
  159. extern struct snd_soc_codec_device soc_codec_dev_aic3x;
  160. #endif /* _AIC3X_H */