tas2764.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * tas2764.h - ALSA SoC Texas Instruments TAS2764 Mono Audio Amplifier
  4. *
  5. * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com
  6. *
  7. * Author: Dan Murphy <[email protected]>
  8. */
  9. #ifndef __TAS2764__
  10. #define __TAS2764__
  11. /* Book Control Register */
  12. #define TAS2764_BOOKCTL_PAGE 0
  13. #define TAS2764_BOOKCTL_REG 127
  14. #define TAS2764_REG(page, reg) ((page * 128) + reg)
  15. /* Page */
  16. #define TAS2764_PAGE TAS2764_REG(0X0, 0x00)
  17. #define TAS2764_PAGE_PAGE_MASK 255
  18. /* Software Reset */
  19. #define TAS2764_SW_RST TAS2764_REG(0X0, 0x01)
  20. #define TAS2764_RST BIT(0)
  21. /* Power Control */
  22. #define TAS2764_PWR_CTRL TAS2764_REG(0X0, 0x02)
  23. #define TAS2764_PWR_CTRL_MASK GENMASK(1, 0)
  24. #define TAS2764_PWR_CTRL_ACTIVE 0x0
  25. #define TAS2764_PWR_CTRL_MUTE BIT(0)
  26. #define TAS2764_PWR_CTRL_SHUTDOWN BIT(1)
  27. #define TAS2764_VSENSE_POWER_EN 3
  28. #define TAS2764_ISENSE_POWER_EN 4
  29. /* DC Blocker Control */
  30. #define TAS2764_DC_BLK0 TAS2764_REG(0x0, 0x04)
  31. #define TAS2764_DC_BLK0_HPF_FREQ_PB_SHIFT 0
  32. /* Digital Volume Control */
  33. #define TAS2764_DVC TAS2764_REG(0X0, 0x1a)
  34. #define TAS2764_DVC_MAX 0xc9
  35. #define TAS2764_CHNL_0 TAS2764_REG(0X0, 0x03)
  36. /* TDM Configuration Reg0 */
  37. #define TAS2764_TDM_CFG0 TAS2764_REG(0X0, 0x08)
  38. #define TAS2764_TDM_CFG0_SMP_MASK BIT(5)
  39. #define TAS2764_TDM_CFG0_SMP_48KHZ 0x0
  40. #define TAS2764_TDM_CFG0_SMP_44_1KHZ BIT(5)
  41. #define TAS2764_TDM_CFG0_MASK GENMASK(3, 1)
  42. #define TAS2764_TDM_CFG0_44_1_48KHZ BIT(3)
  43. #define TAS2764_TDM_CFG0_88_2_96KHZ (BIT(3) | BIT(1))
  44. #define TAS2764_TDM_CFG0_FRAME_START BIT(0)
  45. /* TDM Configuration Reg1 */
  46. #define TAS2764_TDM_CFG1 TAS2764_REG(0X0, 0x09)
  47. #define TAS2764_TDM_CFG1_MASK GENMASK(5, 1)
  48. #define TAS2764_TDM_CFG1_51_SHIFT 1
  49. #define TAS2764_TDM_CFG1_RX_MASK BIT(0)
  50. #define TAS2764_TDM_CFG1_RX_RISING 0x0
  51. #define TAS2764_TDM_CFG1_RX_FALLING BIT(0)
  52. /* TDM Configuration Reg2 */
  53. #define TAS2764_TDM_CFG2 TAS2764_REG(0X0, 0x0a)
  54. #define TAS2764_TDM_CFG2_RXW_MASK GENMASK(3, 2)
  55. #define TAS2764_TDM_CFG2_RXW_16BITS 0x0
  56. #define TAS2764_TDM_CFG2_RXW_24BITS BIT(3)
  57. #define TAS2764_TDM_CFG2_RXW_32BITS (BIT(3) | BIT(2))
  58. #define TAS2764_TDM_CFG2_RXS_MASK GENMASK(1, 0)
  59. #define TAS2764_TDM_CFG2_RXS_16BITS 0x0
  60. #define TAS2764_TDM_CFG2_RXS_24BITS BIT(0)
  61. #define TAS2764_TDM_CFG2_RXS_32BITS BIT(1)
  62. #define TAS2764_TDM_CFG2_SCFG_SHIFT 4
  63. /* TDM Configuration Reg3 */
  64. #define TAS2764_TDM_CFG3 TAS2764_REG(0X0, 0x0c)
  65. #define TAS2764_TDM_CFG3_RXS_MASK GENMASK(7, 4)
  66. #define TAS2764_TDM_CFG3_RXS_SHIFT 0x4
  67. #define TAS2764_TDM_CFG3_MASK GENMASK(3, 0)
  68. /* TDM Configuration Reg5 */
  69. #define TAS2764_TDM_CFG5 TAS2764_REG(0X0, 0x0e)
  70. #define TAS2764_TDM_CFG5_VSNS_MASK BIT(6)
  71. #define TAS2764_TDM_CFG5_VSNS_ENABLE BIT(6)
  72. #define TAS2764_TDM_CFG5_50_MASK GENMASK(5, 0)
  73. /* TDM Configuration Reg6 */
  74. #define TAS2764_TDM_CFG6 TAS2764_REG(0X0, 0x0f)
  75. #define TAS2764_TDM_CFG6_ISNS_MASK BIT(6)
  76. #define TAS2764_TDM_CFG6_ISNS_ENABLE BIT(6)
  77. #define TAS2764_TDM_CFG6_50_MASK GENMASK(5, 0)
  78. /* Interrupt Masks */
  79. #define TAS2764_INT_MASK0 TAS2764_REG(0x0, 0x3b)
  80. #define TAS2764_INT_MASK1 TAS2764_REG(0x0, 0x3c)
  81. #define TAS2764_INT_MASK2 TAS2764_REG(0x0, 0x40)
  82. #define TAS2764_INT_MASK3 TAS2764_REG(0x0, 0x41)
  83. #define TAS2764_INT_MASK4 TAS2764_REG(0x0, 0x3d)
  84. /* Latched Fault Registers */
  85. #define TAS2764_INT_LTCH0 TAS2764_REG(0x0, 0x49)
  86. #define TAS2764_INT_LTCH1 TAS2764_REG(0x0, 0x4a)
  87. #define TAS2764_INT_LTCH1_0 TAS2764_REG(0x0, 0x4b)
  88. #define TAS2764_INT_LTCH2 TAS2764_REG(0x0, 0x4f)
  89. #define TAS2764_INT_LTCH3 TAS2764_REG(0x0, 0x50)
  90. #define TAS2764_INT_LTCH4 TAS2764_REG(0x0, 0x51)
  91. /* Clock/IRQ Settings */
  92. #define TAS2764_INT_CLK_CFG TAS2764_REG(0x0, 0x5c)
  93. #define TAS2764_INT_CLK_CFG_IRQZ_CLR BIT(2)
  94. #endif /* __TAS2764__ */