ad193x.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * AD193X Audio Codec driver
  3. *
  4. * Copyright 2010 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __AD193X_H__
  9. #define __AD193X_H__
  10. #include <linux/regmap.h>
  11. struct device;
  12. enum ad193x_type {
  13. AD193X,
  14. AD1933,
  15. AD1934,
  16. };
  17. extern const struct regmap_config ad193x_regmap_config;
  18. int ad193x_probe(struct device *dev, struct regmap *regmap,
  19. enum ad193x_type type);
  20. #define AD193X_PLL_CLK_CTRL0 0x00
  21. #define AD193X_PLL_POWERDOWN 0x01
  22. #define AD193X_PLL_INPUT_MASK 0x6
  23. #define AD193X_PLL_INPUT_256 (0 << 1)
  24. #define AD193X_PLL_INPUT_384 (1 << 1)
  25. #define AD193X_PLL_INPUT_512 (2 << 1)
  26. #define AD193X_PLL_INPUT_768 (3 << 1)
  27. #define AD193X_PLL_CLK_CTRL1 0x01
  28. #define AD193X_DAC_CTRL0 0x02
  29. #define AD193X_DAC_POWERDOWN 0x01
  30. #define AD193X_DAC_SERFMT_MASK 0xC0
  31. #define AD193X_DAC_SERFMT_STEREO (0 << 6)
  32. #define AD193X_DAC_SERFMT_TDM (1 << 6)
  33. #define AD193X_DAC_CTRL1 0x03
  34. #define AD193X_DAC_CHAN_SHFT 1
  35. #define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT)
  36. #define AD193X_DAC_LCR_MASTER (1 << 4)
  37. #define AD193X_DAC_BCLK_MASTER (1 << 5)
  38. #define AD193X_DAC_LEFT_HIGH (1 << 3)
  39. #define AD193X_DAC_BCLK_INV (1 << 7)
  40. #define AD193X_DAC_FMT_MASK (AD193X_DAC_LCR_MASTER | \
  41. AD193X_DAC_BCLK_MASTER | AD193X_DAC_LEFT_HIGH | AD193X_DAC_BCLK_INV)
  42. #define AD193X_DAC_CTRL2 0x04
  43. #define AD193X_DAC_WORD_LEN_SHFT 3
  44. #define AD193X_DAC_WORD_LEN_MASK 0x18
  45. #define AD193X_DAC_MASTER_MUTE 1
  46. #define AD193X_DAC_CHNL_MUTE 0x05
  47. #define AD193X_DACL1_MUTE 0
  48. #define AD193X_DACR1_MUTE 1
  49. #define AD193X_DACL2_MUTE 2
  50. #define AD193X_DACR2_MUTE 3
  51. #define AD193X_DACL3_MUTE 4
  52. #define AD193X_DACR3_MUTE 5
  53. #define AD193X_DACL4_MUTE 6
  54. #define AD193X_DACR4_MUTE 7
  55. #define AD193X_DAC_L1_VOL 0x06
  56. #define AD193X_DAC_R1_VOL 0x07
  57. #define AD193X_DAC_L2_VOL 0x08
  58. #define AD193X_DAC_R2_VOL 0x09
  59. #define AD193X_DAC_L3_VOL 0x0a
  60. #define AD193X_DAC_R3_VOL 0x0b
  61. #define AD193X_DAC_L4_VOL 0x0c
  62. #define AD193X_DAC_R4_VOL 0x0d
  63. #define AD193X_ADC_CTRL0 0x0e
  64. #define AD193X_ADC_POWERDOWN 0x01
  65. #define AD193X_ADC_HIGHPASS_FILTER 1
  66. #define AD193X_ADCL1_MUTE 2
  67. #define AD193X_ADCR1_MUTE 3
  68. #define AD193X_ADCL2_MUTE 4
  69. #define AD193X_ADCR2_MUTE 5
  70. #define AD193X_ADC_CTRL1 0x0f
  71. #define AD193X_ADC_SERFMT_MASK 0x60
  72. #define AD193X_ADC_SERFMT_STEREO (0 << 5)
  73. #define AD193X_ADC_SERFMT_TDM (1 << 5)
  74. #define AD193X_ADC_SERFMT_AUX (2 << 5)
  75. #define AD193X_ADC_WORD_LEN_MASK 0x3
  76. #define AD193X_ADC_CTRL2 0x10
  77. #define AD193X_ADC_CHAN_SHFT 4
  78. #define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT)
  79. #define AD193X_ADC_LCR_MASTER (1 << 3)
  80. #define AD193X_ADC_BCLK_MASTER (1 << 6)
  81. #define AD193X_ADC_LEFT_HIGH (1 << 2)
  82. #define AD193X_ADC_BCLK_INV (1 << 1)
  83. #define AD193X_ADC_FMT_MASK (AD193X_ADC_LCR_MASTER | \
  84. AD193X_ADC_BCLK_MASTER | AD193X_ADC_LEFT_HIGH | AD193X_ADC_BCLK_INV)
  85. #define AD193X_2_CHANNELS 0
  86. #define AD193X_4_CHANNELS 1
  87. #define AD193X_8_CHANNELS 2
  88. #define AD193X_16_CHANNELS 3
  89. #define AD193X_NUM_REGS 17
  90. #endif