cs4349.h 3.7 KB

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