cs4349.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * ALSA SoC CS4349 codec driver
  4. *
  5. * Copyright 2015 Cirrus Logic, Inc.
  6. *
  7. * Author: Tim Howe <Tim.Howe@cirrus.com>
  8. */
  9. #ifndef __CS4349_H__
  10. #define __CS4349_H__
  11. /* CS4349 registers addresses */
  12. #define CS4349_CHIPID 0x01 /* Device and Rev ID, Read Only */
  13. #define CS4349_MODE 0x02 /* Mode Control */
  14. #define CS4349_VMI 0x03 /* Volume, Mixing, Inversion Control */
  15. #define CS4349_MUTE 0x04 /* Mute Control */
  16. #define CS4349_VOLA 0x05 /* DAC Channel A Volume Control */
  17. #define CS4349_VOLB 0x06 /* DAC Channel B Volume Control */
  18. #define CS4349_RMPFLT 0x07 /* Ramp and Filter Control */
  19. #define CS4349_MISC 0x08 /* Power Down,Freeze Control,Pop Stop*/
  20. #define CS4349_I2C_INCR 0x80
  21. /* Device and Revision ID */
  22. #define CS4349_REVA 0xF0 /* Rev A */
  23. #define CS4349_REVB 0xF1 /* Rev B */
  24. #define CS4349_REVC2 0xFF /* Rev C2 */
  25. /* PDN_DONE Poll Maximum
  26. * If soft ramp is set it will take much longer to power down
  27. * the system.
  28. */
  29. #define PDN_POLL_MAX 900
  30. /* Bitfield Definitions */
  31. /* CS4349_MODE */
  32. /* (Digital Interface Format, De-Emphasis Control, Functional Mode */
  33. #define DIF2 (1 << 6)
  34. #define DIF1 (1 << 5)
  35. #define DIF0 (1 << 4)
  36. #define DEM1 (1 << 3)
  37. #define DEM0 (1 << 2)
  38. #define FM1 (1 << 1)
  39. #define DIF_LEFT_JST 0x00
  40. #define DIF_I2S 0x01
  41. #define DIF_RGHT_JST16 0x02
  42. #define DIF_RGHT_JST24 0x03
  43. #define DIF_TDM0 0x04
  44. #define DIF_TDM1 0x05
  45. #define DIF_TDM2 0x06
  46. #define DIF_TDM3 0x07
  47. #define DIF_MASK 0x70
  48. #define MODE_FORMAT(x) (((x)&7)<<4)
  49. #define DEM_MASK 0x0C
  50. #define NO_DEM 0x00
  51. #define DEM_441 0x04
  52. #define DEM_48K 0x08
  53. #define DEM_32K 0x0C
  54. #define FM_AUTO 0x00
  55. #define FM_SNGL 0x01
  56. #define FM_DBL 0x02
  57. #define FM_QUAD 0x03
  58. #define FM_SNGL_MIN 30000
  59. #define FM_SNGL_MAX 54000
  60. #define FM_DBL_MAX 108000
  61. #define FM_QUAD_MAX 216000
  62. #define FM_MASK 0x03
  63. /* CS4349_VMI (VMI = Volume, Mixing and Inversion Controls) */
  64. #define VOLBISA (1 << 7)
  65. #define VOLAISB (1 << 7)
  66. /* INVERT_A only available for Left Jstfd, Right Jstfd16 and Right Jstfd24 */
  67. #define INVERT_A (1 << 6)
  68. /* INVERT_B only available for Left Jstfd, Right Jstfd16 and Right Jstfd24 */
  69. #define INVERT_B (1 << 5)
  70. #define ATAPI3 (1 << 3)
  71. #define ATAPI2 (1 << 2)
  72. #define ATAPI1 (1 << 1)
  73. #define ATAPI0 (1 << 0)
  74. #define MUTEAB 0x00
  75. #define MUTEA_RIGHTB 0x01
  76. #define MUTEA_LEFTB 0x02
  77. #define MUTEA_SUMLRDIV2B 0x03
  78. #define RIGHTA_MUTEB 0x04
  79. #define RIGHTA_RIGHTB 0x05
  80. #define RIGHTA_LEFTB 0x06
  81. #define RIGHTA_SUMLRDIV2B 0x07
  82. #define LEFTA_MUTEB 0x08
  83. #define LEFTA_RIGHTB 0x09 /* Default */
  84. #define LEFTA_LEFTB 0x0A
  85. #define LEFTA_SUMLRDIV2B 0x0B
  86. #define SUMLRDIV2A_MUTEB 0x0C
  87. #define SUMLRDIV2A_RIGHTB 0x0D
  88. #define SUMLRDIV2A_LEFTB 0x0E
  89. #define SUMLRDIV2_AB 0x0F
  90. #define CHMIX_MASK 0x0F
  91. /* CS4349_MUTE */
  92. #define AUTOMUTE (1 << 7)
  93. #define MUTEC_AB (1 << 5)
  94. #define MUTE_A (1 << 4)
  95. #define MUTE_B (1 << 3)
  96. #define MUTE_AB_MASK 0x18
  97. /* CS4349_RMPFLT (Ramp and Filter Control) */
  98. #define SCZ1 (1 << 7)
  99. #define SCZ0 (1 << 6)
  100. #define RMP_UP (1 << 5)
  101. #define RMP_DN (1 << 4)
  102. #define FILT_SEL (1 << 2)
  103. #define IMMDT_CHNG 0x31
  104. #define ZEROCRSS 0x71
  105. #define SOFT_RMP 0xB1
  106. #define SFTRMP_ZEROCRSS 0xF1
  107. #define SR_ZC_MASK 0xC0
  108. /* CS4349_MISC */
  109. #define PWR_DWN (1 << 7)
  110. #define FREEZE (1 << 5)
  111. #define POPG_EN (1 << 4)
  112. #endif /* __CS4349_H__ */