tlv320aic23.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * ALSA SoC TLV320AIC23 codec driver
  3. *
  4. * Author: Arun KS, <arunks@mistralsolutions.com>
  5. * Copyright: (C) 2008 Mistral Solutions Pvt Ltd
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _TLV320AIC23_H
  12. #define _TLV320AIC23_H
  13. /* Codec TLV320AIC23 */
  14. #define TLV320AIC23_LINVOL 0x00
  15. #define TLV320AIC23_RINVOL 0x01
  16. #define TLV320AIC23_LCHNVOL 0x02
  17. #define TLV320AIC23_RCHNVOL 0x03
  18. #define TLV320AIC23_ANLG 0x04
  19. #define TLV320AIC23_DIGT 0x05
  20. #define TLV320AIC23_PWR 0x06
  21. #define TLV320AIC23_DIGT_FMT 0x07
  22. #define TLV320AIC23_SRATE 0x08
  23. #define TLV320AIC23_ACTIVE 0x09
  24. #define TLV320AIC23_RESET 0x0F
  25. /* Left (right) line input volume control register */
  26. #define TLV320AIC23_LRS_ENABLED 0x0100
  27. #define TLV320AIC23_LIM_MUTED 0x0080
  28. #define TLV320AIC23_LIV_DEFAULT 0x0017
  29. #define TLV320AIC23_LIV_MAX 0x001f
  30. #define TLV320AIC23_LIV_MIN 0x0000
  31. /* Left (right) channel headphone volume control register */
  32. #define TLV320AIC23_LZC_ON 0x0080
  33. #define TLV320AIC23_LHV_DEFAULT 0x0079
  34. #define TLV320AIC23_LHV_MAX 0x007f
  35. #define TLV320AIC23_LHV_MIN 0x0000
  36. /* Analog audio path control register */
  37. #define TLV320AIC23_STA_REG(x) ((x)<<6)
  38. #define TLV320AIC23_STE_ENABLED 0x0020
  39. #define TLV320AIC23_DAC_SELECTED 0x0010
  40. #define TLV320AIC23_BYPASS_ON 0x0008
  41. #define TLV320AIC23_INSEL_MIC 0x0004
  42. #define TLV320AIC23_MICM_MUTED 0x0002
  43. #define TLV320AIC23_MICB_20DB 0x0001
  44. /* Digital audio path control register */
  45. #define TLV320AIC23_DACM_MUTE 0x0008
  46. #define TLV320AIC23_DEEMP_32K 0x0002
  47. #define TLV320AIC23_DEEMP_44K 0x0004
  48. #define TLV320AIC23_DEEMP_48K 0x0006
  49. #define TLV320AIC23_ADCHP_ON 0x0001
  50. /* Power control down register */
  51. #define TLV320AIC23_DEVICE_PWR_OFF 0x0080
  52. #define TLV320AIC23_CLK_OFF 0x0040
  53. #define TLV320AIC23_OSC_OFF 0x0020
  54. #define TLV320AIC23_OUT_OFF 0x0010
  55. #define TLV320AIC23_DAC_OFF 0x0008
  56. #define TLV320AIC23_ADC_OFF 0x0004
  57. #define TLV320AIC23_MIC_OFF 0x0002
  58. #define TLV320AIC23_LINE_OFF 0x0001
  59. /* Digital audio interface register */
  60. #define TLV320AIC23_MS_MASTER 0x0040
  61. #define TLV320AIC23_LRSWAP_ON 0x0020
  62. #define TLV320AIC23_LRP_ON 0x0010
  63. #define TLV320AIC23_IWL_16 0x0000
  64. #define TLV320AIC23_IWL_20 0x0004
  65. #define TLV320AIC23_IWL_24 0x0008
  66. #define TLV320AIC23_IWL_32 0x000C
  67. #define TLV320AIC23_FOR_I2S 0x0002
  68. #define TLV320AIC23_FOR_DSP 0x0003
  69. #define TLV320AIC23_FOR_LJUST 0x0001
  70. /* Sample rate control register */
  71. #define TLV320AIC23_CLKOUT_HALF 0x0080
  72. #define TLV320AIC23_CLKIN_HALF 0x0040
  73. #define TLV320AIC23_BOSR_384fs 0x0002 /* BOSR_272fs in USB mode */
  74. #define TLV320AIC23_USB_CLK_ON 0x0001
  75. #define TLV320AIC23_SR_MASK 0xf
  76. #define TLV320AIC23_CLKOUT_SHIFT 7
  77. #define TLV320AIC23_CLKIN_SHIFT 6
  78. #define TLV320AIC23_SR_SHIFT 2
  79. #define TLV320AIC23_BOSR_SHIFT 1
  80. /* Digital interface register */
  81. #define TLV320AIC23_ACT_ON 0x0001
  82. /*
  83. * AUDIO related MACROS
  84. */
  85. #define TLV320AIC23_DEFAULT_OUT_VOL 0x70
  86. #define TLV320AIC23_DEFAULT_IN_VOLUME 0x10
  87. #define TLV320AIC23_OUT_VOL_MIN TLV320AIC23_LHV_MIN
  88. #define TLV320AIC23_OUT_VOL_MAX TLV320AIC23_LHV_MAX
  89. #define TLV320AIC23_OUT_VO_RANGE (TLV320AIC23_OUT_VOL_MAX - \
  90. TLV320AIC23_OUT_VOL_MIN)
  91. #define TLV320AIC23_OUT_VOL_MASK TLV320AIC23_OUT_VOL_MAX
  92. #define TLV320AIC23_IN_VOL_MIN TLV320AIC23_LIV_MIN
  93. #define TLV320AIC23_IN_VOL_MAX TLV320AIC23_LIV_MAX
  94. #define TLV320AIC23_IN_VOL_RANGE (TLV320AIC23_IN_VOL_MAX - \
  95. TLV320AIC23_IN_VOL_MIN)
  96. #define TLV320AIC23_IN_VOL_MASK TLV320AIC23_IN_VOL_MAX
  97. #define TLV320AIC23_SIDETONE_MASK 0x1c0
  98. #define TLV320AIC23_SIDETONE_0 0x100
  99. #define TLV320AIC23_SIDETONE_6 0x000
  100. #define TLV320AIC23_SIDETONE_9 0x040
  101. #define TLV320AIC23_SIDETONE_12 0x080
  102. #define TLV320AIC23_SIDETONE_18 0x0c0
  103. #endif /* _TLV320AIC23_H */