cs4245.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #define CS4245_CHIP_ID 0x01
  2. #define CS4245_POWER_CTRL 0x02
  3. #define CS4245_DAC_CTRL_1 0x03
  4. #define CS4245_ADC_CTRL 0x04
  5. #define CS4245_MCLK_FREQ 0x05
  6. #define CS4245_SIGNAL_SEL 0x06
  7. #define CS4245_PGA_B_CTRL 0x07
  8. #define CS4245_PGA_A_CTRL 0x08
  9. #define CS4245_ANALOG_IN 0x09
  10. #define CS4245_DAC_A_CTRL 0x0a
  11. #define CS4245_DAC_B_CTRL 0x0b
  12. #define CS4245_DAC_CTRL_2 0x0c
  13. #define CS4245_INT_STATUS 0x0d
  14. #define CS4245_INT_MASK 0x0e
  15. #define CS4245_INT_MODE_MSB 0x0f
  16. #define CS4245_INT_MODE_LSB 0x10
  17. /* Chip ID */
  18. #define CS4245_CHIP_PART_MASK 0xf0
  19. #define CS4245_CHIP_REV_MASK 0x0f
  20. /* Power Control */
  21. #define CS4245_FREEZE 0x80
  22. #define CS4245_PDN_MIC 0x08
  23. #define CS4245_PDN_ADC 0x04
  24. #define CS4245_PDN_DAC 0x02
  25. #define CS4245_PDN 0x01
  26. /* DAC Control */
  27. #define CS4245_DAC_FM_MASK 0xc0
  28. #define CS4245_DAC_FM_SINGLE 0x00
  29. #define CS4245_DAC_FM_DOUBLE 0x40
  30. #define CS4245_DAC_FM_QUAD 0x80
  31. #define CS4245_DAC_DIF_MASK 0x30
  32. #define CS4245_DAC_DIF_LJUST 0x00
  33. #define CS4245_DAC_DIF_I2S 0x10
  34. #define CS4245_DAC_DIF_RJUST_16 0x20
  35. #define CS4245_DAC_DIF_RJUST_24 0x30
  36. #define CS4245_RESERVED_1 0x08
  37. #define CS4245_MUTE_DAC 0x04
  38. #define CS4245_DEEMPH 0x02
  39. #define CS4245_DAC_MASTER 0x01
  40. /* ADC Control */
  41. #define CS4245_ADC_FM_MASK 0xc0
  42. #define CS4245_ADC_FM_SINGLE 0x00
  43. #define CS4245_ADC_FM_DOUBLE 0x40
  44. #define CS4245_ADC_FM_QUAD 0x80
  45. #define CS4245_ADC_DIF_MASK 0x10
  46. #define CS4245_ADC_DIF_LJUST 0x00
  47. #define CS4245_ADC_DIF_I2S 0x10
  48. #define CS4245_MUTE_ADC 0x04
  49. #define CS4245_HPF_FREEZE 0x02
  50. #define CS4245_ADC_MASTER 0x01
  51. /* MCLK Frequency */
  52. #define CS4245_MCLK1_MASK 0x70
  53. #define CS4245_MCLK1_SHIFT 4
  54. #define CS4245_MCLK2_MASK 0x07
  55. #define CS4245_MCLK2_SHIFT 0
  56. #define CS4245_MCLK_1 0
  57. #define CS4245_MCLK_1_5 1
  58. #define CS4245_MCLK_2 2
  59. #define CS4245_MCLK_3 3
  60. #define CS4245_MCLK_4 4
  61. /* Signal Selection */
  62. #define CS4245_A_OUT_SEL_MASK 0x60
  63. #define CS4245_A_OUT_SEL_HIZ 0x00
  64. #define CS4245_A_OUT_SEL_DAC 0x20
  65. #define CS4245_A_OUT_SEL_PGA 0x40
  66. #define CS4245_LOOP 0x02
  67. #define CS4245_ASYNCH 0x01
  68. /* Channel B/A PGA Control */
  69. #define CS4245_PGA_GAIN_MASK 0x3f
  70. /* ADC Input Control */
  71. #define CS4245_PGA_SOFT 0x10
  72. #define CS4245_PGA_ZERO 0x08
  73. #define CS4245_SEL_MASK 0x07
  74. #define CS4245_SEL_MIC 0x00
  75. #define CS4245_SEL_INPUT_1 0x01
  76. #define CS4245_SEL_INPUT_2 0x02
  77. #define CS4245_SEL_INPUT_3 0x03
  78. #define CS4245_SEL_INPUT_4 0x04
  79. #define CS4245_SEL_INPUT_5 0x05
  80. #define CS4245_SEL_INPUT_6 0x06
  81. /* DAC Channel A/B Volume Control */
  82. #define CS4245_VOL_MASK 0xff
  83. /* DAC Control 2 */
  84. #define CS4245_DAC_SOFT 0x80
  85. #define CS4245_DAC_ZERO 0x40
  86. #define CS4245_INVERT_DAC 0x20
  87. #define CS4245_INT_ACTIVE_HIGH 0x01
  88. /* Interrupt Status/Mask/Mode */
  89. #define CS4245_ADC_CLK_ERR 0x08
  90. #define CS4245_DAC_CLK_ERR 0x04
  91. #define CS4245_ADC_OVFL 0x02
  92. #define CS4245_ADC_UNDRFL 0x01
  93. #define CS4245_SPI_ADDRESS (0x9e << 16)
  94. #define CS4245_SPI_WRITE (0 << 16)