sn95031.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * sn95031.h - TI sn95031 Codec driver
  3. *
  4. * Copyright (C) 2010 Intel Corp
  5. * Author: Vinod Koul <vinod.koul@intel.com>
  6. * Author: Harsha Priya <priya.harsha@intel.com>
  7. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; version 2 of the License.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  21. *
  22. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. *
  24. *
  25. */
  26. #ifndef _SN95031_H
  27. #define _SN95031_H
  28. /*register map*/
  29. #define SN95031_VAUD 0xDB
  30. #define SN95031_VHSP 0xDC
  31. #define SN95031_VHSN 0xDD
  32. #define SN95031_VIHF 0xC9
  33. #define SN95031_AUDPLLCTRL 0x240
  34. #define SN95031_DMICBUF0123 0x241
  35. #define SN95031_DMICBUF45 0x242
  36. #define SN95031_DMICGPO 0x244
  37. #define SN95031_DMICMUX 0x245
  38. #define SN95031_DMICLK 0x246
  39. #define SN95031_MICBIAS 0x247
  40. #define SN95031_ADCCONFIG 0x248
  41. #define SN95031_MICAMP1 0x249
  42. #define SN95031_MICAMP2 0x24A
  43. #define SN95031_NOISEMUX 0x24B
  44. #define SN95031_AUDIOMUX12 0x24C
  45. #define SN95031_AUDIOMUX34 0x24D
  46. #define SN95031_AUDIOSINC 0x24E
  47. #define SN95031_AUDIOTXEN 0x24F
  48. #define SN95031_HSEPRXCTRL 0x250
  49. #define SN95031_IHFRXCTRL 0x251
  50. #define SN95031_HSMIXER 0x256
  51. #define SN95031_DACCONFIG 0x257
  52. #define SN95031_SOFTMUTE 0x258
  53. #define SN95031_HSLVOLCTRL 0x259
  54. #define SN95031_HSRVOLCTRL 0x25A
  55. #define SN95031_IHFLVOLCTRL 0x25B
  56. #define SN95031_IHFRVOLCTRL 0x25C
  57. #define SN95031_DRIVEREN 0x25D
  58. #define SN95031_LOCTL 0x25E
  59. #define SN95031_VIB1C1 0x25F
  60. #define SN95031_VIB1C2 0x260
  61. #define SN95031_VIB1C3 0x261
  62. #define SN95031_VIB1SPIPCM1 0x262
  63. #define SN95031_VIB1SPIPCM2 0x263
  64. #define SN95031_VIB1C5 0x264
  65. #define SN95031_VIB2C1 0x265
  66. #define SN95031_VIB2C2 0x266
  67. #define SN95031_VIB2C3 0x267
  68. #define SN95031_VIB2SPIPCM1 0x268
  69. #define SN95031_VIB2SPIPCM2 0x269
  70. #define SN95031_VIB2C5 0x26A
  71. #define SN95031_BTNCTRL1 0x26B
  72. #define SN95031_BTNCTRL2 0x26C
  73. #define SN95031_PCM1TXSLOT01 0x26D
  74. #define SN95031_PCM1TXSLOT23 0x26E
  75. #define SN95031_PCM1TXSLOT45 0x26F
  76. #define SN95031_PCM1RXSLOT0_3 0x270
  77. #define SN95031_PCM1RXSLOT45 0x271
  78. #define SN95031_PCM2TXSLOT01 0x272
  79. #define SN95031_PCM2TXSLOT23 0x273
  80. #define SN95031_PCM2TXSLOT45 0x274
  81. #define SN95031_PCM2RXSLOT01 0x275
  82. #define SN95031_PCM2RXSLOT23 0x276
  83. #define SN95031_PCM2RXSLOT45 0x277
  84. #define SN95031_PCM1C1 0x278
  85. #define SN95031_PCM1C2 0x279
  86. #define SN95031_PCM1C3 0x27A
  87. #define SN95031_PCM2C1 0x27B
  88. #define SN95031_PCM2C2 0x27C
  89. /*end codec register defn*/
  90. /*vendor defn these are not part of avp*/
  91. #define SN95031_SSR2 0x381
  92. #define SN95031_SSR3 0x382
  93. #define SN95031_SSR5 0x384
  94. #define SN95031_SSR6 0x385
  95. /* ADC registers */
  96. #define SN95031_ADC1CNTL1 0x1C0
  97. #define SN95031_ADC_ENBL 0x10
  98. #define SN95031_ADC_START 0x08
  99. #define SN95031_ADC1CNTL3 0x1C2
  100. #define SN95031_ADCTHERM_ENBL 0x04
  101. #define SN95031_ADCRRDATA_ENBL 0x05
  102. #define SN95031_STOPBIT_MASK 16
  103. #define SN95031_ADCTHERM_MASK 4
  104. #define SN95031_ADC_CHANLS_MAX 15 /* Number of ADC channels */
  105. #define SN95031_ADC_LOOP_MAX (SN95031_ADC_CHANLS_MAX - 1)
  106. #define SN95031_ADC_NO_LOOP 0x07
  107. #define SN95031_AUDIO_GPIO_CTRL 0x070
  108. /* ADC channel code values */
  109. #define SN95031_AUDIO_DETECT_CODE 0x06
  110. /* ADC base addresses */
  111. #define SN95031_ADC_CHNL_START_ADDR 0x1C5 /* increments by 1 */
  112. #define SN95031_ADC_DATA_START_ADDR 0x1D4 /* increments by 2 */
  113. /* multipier to convert to mV */
  114. #define SN95031_ADC_ONE_LSB_MULTIPLIER 2346
  115. struct mfld_jack_data {
  116. int intr_id;
  117. int micbias_vol;
  118. struct snd_soc_jack *mfld_jack;
  119. };
  120. extern void sn95031_jack_detection(struct snd_soc_codec *codec,
  121. struct mfld_jack_data *jack_data);
  122. #endif