twl6040.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * ALSA SoC TWL6040 codec driver
  3. *
  4. * Author: Misael Lopez Cruz <x0052729@ti.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. *
  20. */
  21. #ifndef __TWL6040_H__
  22. #define __TWL6040_H__
  23. #define TWL6040_REG_ASICID 0x01
  24. #define TWL6040_REG_ASICREV 0x02
  25. #define TWL6040_REG_INTID 0x03
  26. #define TWL6040_REG_INTMR 0x04
  27. #define TWL6040_REG_NCPCTL 0x05
  28. #define TWL6040_REG_LDOCTL 0x06
  29. #define TWL6040_REG_HPPLLCTL 0x07
  30. #define TWL6040_REG_LPPLLCTL 0x08
  31. #define TWL6040_REG_LPPLLDIV 0x09
  32. #define TWL6040_REG_AMICBCTL 0x0A
  33. #define TWL6040_REG_DMICBCTL 0x0B
  34. #define TWL6040_REG_MICLCTL 0x0C
  35. #define TWL6040_REG_MICRCTL 0x0D
  36. #define TWL6040_REG_MICGAIN 0x0E
  37. #define TWL6040_REG_LINEGAIN 0x0F
  38. #define TWL6040_REG_HSLCTL 0x10
  39. #define TWL6040_REG_HSRCTL 0x11
  40. #define TWL6040_REG_HSGAIN 0x12
  41. #define TWL6040_REG_EARCTL 0x13
  42. #define TWL6040_REG_HFLCTL 0x14
  43. #define TWL6040_REG_HFLGAIN 0x15
  44. #define TWL6040_REG_HFRCTL 0x16
  45. #define TWL6040_REG_HFRGAIN 0x17
  46. #define TWL6040_REG_VIBCTLL 0x18
  47. #define TWL6040_REG_VIBDATL 0x19
  48. #define TWL6040_REG_VIBCTLR 0x1A
  49. #define TWL6040_REG_VIBDATR 0x1B
  50. #define TWL6040_REG_HKCTL1 0x1C
  51. #define TWL6040_REG_HKCTL2 0x1D
  52. #define TWL6040_REG_GPOCTL 0x1E
  53. #define TWL6040_REG_ALB 0x1F
  54. #define TWL6040_REG_DLB 0x20
  55. #define TWL6040_REG_TRIM1 0x28
  56. #define TWL6040_REG_TRIM2 0x29
  57. #define TWL6040_REG_TRIM3 0x2A
  58. #define TWL6040_REG_HSOTRIM 0x2B
  59. #define TWL6040_REG_HFOTRIM 0x2C
  60. #define TWL6040_REG_ACCCTL 0x2D
  61. #define TWL6040_REG_STATUS 0x2E
  62. #define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1)
  63. #define TWL6040_VIOREGNUM 18
  64. #define TWL6040_VDDREGNUM 21
  65. /* INTID (0x03) fields */
  66. #define TWL6040_THINT 0x01
  67. #define TWL6040_PLUGINT 0x02
  68. #define TWL6040_UNPLUGINT 0x04
  69. #define TWL6040_HOOKINT 0x08
  70. #define TWL6040_HFINT 0x10
  71. #define TWL6040_VIBINT 0x20
  72. #define TWL6040_READYINT 0x40
  73. /* INTMR (0x04) fields */
  74. #define TWL6040_PLUGMSK 0x02
  75. #define TWL6040_READYMSK 0x40
  76. #define TWL6040_ALLINT_MSK 0x7B
  77. /* NCPCTL (0x05) fields */
  78. #define TWL6040_NCPENA 0x01
  79. #define TWL6040_NCPOPEN 0x40
  80. /* LDOCTL (0x06) fields */
  81. #define TWL6040_LSLDOENA 0x01
  82. #define TWL6040_HSLDOENA 0x04
  83. #define TWL6040_REFENA 0x40
  84. #define TWL6040_OSCENA 0x80
  85. /* HPPLLCTL (0x07) fields */
  86. #define TWL6040_HPLLENA 0x01
  87. #define TWL6040_HPLLRST 0x02
  88. #define TWL6040_HPLLBP 0x04
  89. #define TWL6040_HPLLSQRENA 0x08
  90. #define TWL6040_HPLLSQRBP 0x10
  91. #define TWL6040_MCLK_12000KHZ (0 << 5)
  92. #define TWL6040_MCLK_19200KHZ (1 << 5)
  93. #define TWL6040_MCLK_26000KHZ (2 << 5)
  94. #define TWL6040_MCLK_38400KHZ (3 << 5)
  95. #define TWL6040_MCLK_MSK 0x60
  96. /* LPPLLCTL (0x08) fields */
  97. #define TWL6040_LPLLENA 0x01
  98. #define TWL6040_LPLLRST 0x02
  99. #define TWL6040_LPLLSEL 0x04
  100. #define TWL6040_LPLLFIN 0x08
  101. #define TWL6040_HPLLSEL 0x10
  102. /* HSLCTL (0x10) fields */
  103. #define TWL6040_HSDACMODEL 0x02
  104. #define TWL6040_HSDRVMODEL 0x08
  105. /* HSRCTL (0x11) fields */
  106. #define TWL6040_HSDACMODER 0x02
  107. #define TWL6040_HSDRVMODER 0x08
  108. /* ACCCTL (0x2D) fields */
  109. #define TWL6040_RESETSPLIT 0x04
  110. #define TWL6040_SYSCLK_SEL_LPPLL 1
  111. #define TWL6040_SYSCLK_SEL_HPPLL 2
  112. #define TWL6040_HPPLL_ID 1
  113. #define TWL6040_LPPLL_ID 2
  114. /* STATUS (0x2E) fields */
  115. #define TWL6040_PLUGCOMP 0x02
  116. void twl6040_hs_jack_detect(struct snd_soc_codec *codec,
  117. struct snd_soc_jack *jack, int report);
  118. #endif /* End of __TWL6040_H__ */