tlv320aic23.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. struct device;
  14. struct regmap_config;
  15. extern const struct regmap_config tlv320aic23_regmap;
  16. int tlv320aic23_probe(struct device *dev, struct regmap *regmap);
  17. /* Codec TLV320AIC23 */
  18. #define TLV320AIC23_LINVOL 0x00
  19. #define TLV320AIC23_RINVOL 0x01
  20. #define TLV320AIC23_LCHNVOL 0x02
  21. #define TLV320AIC23_RCHNVOL 0x03
  22. #define TLV320AIC23_ANLG 0x04
  23. #define TLV320AIC23_DIGT 0x05
  24. #define TLV320AIC23_PWR 0x06
  25. #define TLV320AIC23_DIGT_FMT 0x07
  26. #define TLV320AIC23_SRATE 0x08
  27. #define TLV320AIC23_ACTIVE 0x09
  28. #define TLV320AIC23_RESET 0x0F
  29. /* Left (right) line input volume control register */
  30. #define TLV320AIC23_LRS_ENABLED 0x0100
  31. #define TLV320AIC23_LIM_MUTED 0x0080
  32. #define TLV320AIC23_LIV_DEFAULT 0x0017
  33. #define TLV320AIC23_LIV_MAX 0x001f
  34. #define TLV320AIC23_LIV_MIN 0x0000
  35. /* Left (right) channel headphone volume control register */
  36. #define TLV320AIC23_LZC_ON 0x0080
  37. #define TLV320AIC23_LHV_DEFAULT 0x0079
  38. #define TLV320AIC23_LHV_MAX 0x007f
  39. #define TLV320AIC23_LHV_MIN 0x0000
  40. /* Analog audio path control register */
  41. #define TLV320AIC23_STA_REG(x) ((x)<<6)
  42. #define TLV320AIC23_STE_ENABLED 0x0020
  43. #define TLV320AIC23_DAC_SELECTED 0x0010
  44. #define TLV320AIC23_BYPASS_ON 0x0008
  45. #define TLV320AIC23_INSEL_MIC 0x0004
  46. #define TLV320AIC23_MICM_MUTED 0x0002
  47. #define TLV320AIC23_MICB_20DB 0x0001
  48. /* Digital audio path control register */
  49. #define TLV320AIC23_DACM_MUTE 0x0008
  50. #define TLV320AIC23_DEEMP_32K 0x0002
  51. #define TLV320AIC23_DEEMP_44K 0x0004
  52. #define TLV320AIC23_DEEMP_48K 0x0006
  53. #define TLV320AIC23_ADCHP_ON 0x0001
  54. /* Power control down register */
  55. #define TLV320AIC23_DEVICE_PWR_OFF 0x0080
  56. #define TLV320AIC23_CLK_OFF 0x0040
  57. #define TLV320AIC23_OSC_OFF 0x0020
  58. #define TLV320AIC23_OUT_OFF 0x0010
  59. #define TLV320AIC23_DAC_OFF 0x0008
  60. #define TLV320AIC23_ADC_OFF 0x0004
  61. #define TLV320AIC23_MIC_OFF 0x0002
  62. #define TLV320AIC23_LINE_OFF 0x0001
  63. /* Digital audio interface register */
  64. #define TLV320AIC23_MS_MASTER 0x0040
  65. #define TLV320AIC23_LRSWAP_ON 0x0020
  66. #define TLV320AIC23_LRP_ON 0x0010
  67. #define TLV320AIC23_IWL_16 0x0000
  68. #define TLV320AIC23_IWL_20 0x0004
  69. #define TLV320AIC23_IWL_24 0x0008
  70. #define TLV320AIC23_IWL_32 0x000C
  71. #define TLV320AIC23_FOR_I2S 0x0002
  72. #define TLV320AIC23_FOR_DSP 0x0003
  73. #define TLV320AIC23_FOR_LJUST 0x0001
  74. /* Sample rate control register */
  75. #define TLV320AIC23_CLKOUT_HALF 0x0080
  76. #define TLV320AIC23_CLKIN_HALF 0x0040
  77. #define TLV320AIC23_BOSR_384fs 0x0002 /* BOSR_272fs in USB mode */
  78. #define TLV320AIC23_USB_CLK_ON 0x0001
  79. #define TLV320AIC23_SR_MASK 0xf
  80. #define TLV320AIC23_CLKOUT_SHIFT 7
  81. #define TLV320AIC23_CLKIN_SHIFT 6
  82. #define TLV320AIC23_SR_SHIFT 2
  83. #define TLV320AIC23_BOSR_SHIFT 1
  84. /* Digital interface register */
  85. #define TLV320AIC23_ACT_ON 0x0001
  86. /*
  87. * AUDIO related MACROS
  88. */
  89. #define TLV320AIC23_DEFAULT_OUT_VOL 0x70
  90. #define TLV320AIC23_DEFAULT_IN_VOLUME 0x10
  91. #define TLV320AIC23_OUT_VOL_MIN TLV320AIC23_LHV_MIN
  92. #define TLV320AIC23_OUT_VOL_MAX TLV320AIC23_LHV_MAX
  93. #define TLV320AIC23_OUT_VO_RANGE (TLV320AIC23_OUT_VOL_MAX - \
  94. TLV320AIC23_OUT_VOL_MIN)
  95. #define TLV320AIC23_OUT_VOL_MASK TLV320AIC23_OUT_VOL_MAX
  96. #define TLV320AIC23_IN_VOL_MIN TLV320AIC23_LIV_MIN
  97. #define TLV320AIC23_IN_VOL_MAX TLV320AIC23_LIV_MAX
  98. #define TLV320AIC23_IN_VOL_RANGE (TLV320AIC23_IN_VOL_MAX - \
  99. TLV320AIC23_IN_VOL_MIN)
  100. #define TLV320AIC23_IN_VOL_MASK TLV320AIC23_IN_VOL_MAX
  101. #define TLV320AIC23_SIDETONE_MASK 0x1c0
  102. #define TLV320AIC23_SIDETONE_0 0x100
  103. #define TLV320AIC23_SIDETONE_6 0x000
  104. #define TLV320AIC23_SIDETONE_9 0x040
  105. #define TLV320AIC23_SIDETONE_12 0x080
  106. #define TLV320AIC23_SIDETONE_18 0x0c0
  107. #endif /* _TLV320AIC23_H */