es8316.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright Everest Semiconductor Co.,Ltd
  4. *
  5. * Author: David Yang <[email protected]>
  6. */
  7. #ifndef _ES8316_H
  8. #define _ES8316_H
  9. /*
  10. * ES8316 register space
  11. */
  12. /* Reset Control */
  13. #define ES8316_RESET 0x00
  14. /* Clock Management */
  15. #define ES8316_CLKMGR_CLKSW 0x01
  16. #define ES8316_CLKMGR_CLKSEL 0x02
  17. #define ES8316_CLKMGR_ADCOSR 0x03
  18. #define ES8316_CLKMGR_ADCDIV1 0x04
  19. #define ES8316_CLKMGR_ADCDIV2 0x05
  20. #define ES8316_CLKMGR_DACDIV1 0x06
  21. #define ES8316_CLKMGR_DACDIV2 0x07
  22. #define ES8316_CLKMGR_CPDIV 0x08
  23. /* Serial Data Port Control */
  24. #define ES8316_SERDATA1 0x09
  25. #define ES8316_SERDATA_ADC 0x0a
  26. #define ES8316_SERDATA_DAC 0x0b
  27. /* System Control */
  28. #define ES8316_SYS_VMIDSEL 0x0c
  29. #define ES8316_SYS_PDN 0x0d
  30. #define ES8316_SYS_LP1 0x0e
  31. #define ES8316_SYS_LP2 0x0f
  32. #define ES8316_SYS_VMIDLOW 0x10
  33. #define ES8316_SYS_VSEL 0x11
  34. #define ES8316_SYS_REF 0x12
  35. /* Headphone Mixer */
  36. #define ES8316_HPMIX_SEL 0x13
  37. #define ES8316_HPMIX_SWITCH 0x14
  38. #define ES8316_HPMIX_PDN 0x15
  39. #define ES8316_HPMIX_VOL 0x16
  40. /* Charge Pump Headphone driver */
  41. #define ES8316_CPHP_OUTEN 0x17
  42. #define ES8316_CPHP_ICAL_VOL 0x18
  43. #define ES8316_CPHP_PDN1 0x19
  44. #define ES8316_CPHP_PDN2 0x1a
  45. #define ES8316_CPHP_LDOCTL 0x1b
  46. /* Calibration */
  47. #define ES8316_CAL_TYPE 0x1c
  48. #define ES8316_CAL_SET 0x1d
  49. #define ES8316_CAL_HPLIV 0x1e
  50. #define ES8316_CAL_HPRIV 0x1f
  51. #define ES8316_CAL_HPLMV 0x20
  52. #define ES8316_CAL_HPRMV 0x21
  53. /* ADC Control */
  54. #define ES8316_ADC_PDN_LINSEL 0x22
  55. #define ES8316_ADC_PGAGAIN 0x23
  56. #define ES8316_ADC_D2SEPGA 0x24
  57. #define ES8316_ADC_DMIC 0x25
  58. #define ES8316_ADC_MUTE 0x26
  59. #define ES8316_ADC_VOLUME 0x27
  60. #define ES8316_ADC_ALC1 0x29
  61. #define ES8316_ADC_ALC2 0x2a
  62. #define ES8316_ADC_ALC3 0x2b
  63. #define ES8316_ADC_ALC4 0x2c
  64. #define ES8316_ADC_ALC5 0x2d
  65. #define ES8316_ADC_ALC_NG 0x2e
  66. /* DAC Control */
  67. #define ES8316_DAC_PDN 0x2f
  68. #define ES8316_DAC_SET1 0x30
  69. #define ES8316_DAC_SET2 0x31
  70. #define ES8316_DAC_SET3 0x32
  71. #define ES8316_DAC_VOLL 0x33
  72. #define ES8316_DAC_VOLR 0x34
  73. /* GPIO */
  74. #define ES8316_GPIO_SEL 0x4d
  75. #define ES8316_GPIO_DEBOUNCE 0x4e
  76. #define ES8316_GPIO_FLAG 0x4f
  77. /* Test mode */
  78. #define ES8316_TESTMODE 0x50
  79. #define ES8316_TEST1 0x51
  80. #define ES8316_TEST2 0x52
  81. #define ES8316_TEST3 0x53
  82. /*
  83. * Field definitions
  84. */
  85. /* ES8316_RESET */
  86. #define ES8316_RESET_CSM_ON 0x80
  87. /* ES8316_CLKMGR_CLKSW */
  88. #define ES8316_CLKMGR_CLKSW_MCLK_ON 0x40
  89. #define ES8316_CLKMGR_CLKSW_BCLK_ON 0x20
  90. /* ES8316_SERDATA1 */
  91. #define ES8316_SERDATA1_MASTER 0x80
  92. #define ES8316_SERDATA1_BCLK_INV 0x20
  93. /* ES8316_SERDATA_ADC and _DAC */
  94. #define ES8316_SERDATA2_FMT_MASK 0x3
  95. #define ES8316_SERDATA2_FMT_I2S 0x00
  96. #define ES8316_SERDATA2_FMT_LEFTJ 0x01
  97. #define ES8316_SERDATA2_FMT_RIGHTJ 0x02
  98. #define ES8316_SERDATA2_FMT_PCM 0x03
  99. #define ES8316_SERDATA2_ADCLRP 0x20
  100. #define ES8316_SERDATA2_LEN_MASK 0x1c
  101. #define ES8316_SERDATA2_LEN_24 0x00
  102. #define ES8316_SERDATA2_LEN_20 0x04
  103. #define ES8316_SERDATA2_LEN_18 0x08
  104. #define ES8316_SERDATA2_LEN_16 0x0c
  105. #define ES8316_SERDATA2_LEN_32 0x10
  106. /* ES8316_GPIO_DEBOUNCE */
  107. #define ES8316_GPIO_ENABLE_INTERRUPT 0x02
  108. /* ES8316_GPIO_FLAG */
  109. #define ES8316_GPIO_FLAG_GM_NOT_SHORTED 0x02
  110. #define ES8316_GPIO_FLAG_HP_NOT_INSERTED 0x04
  111. #endif