pcm3060.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * PCM3060 codec driver
  4. *
  5. * Copyright (C) 2018 Kirill Marinushkin <[email protected]>
  6. */
  7. #ifndef _SND_SOC_PCM3060_H
  8. #define _SND_SOC_PCM3060_H
  9. #include <linux/device.h>
  10. #include <linux/regmap.h>
  11. extern const struct regmap_config pcm3060_regmap;
  12. #define PCM3060_DAI_ID_DAC 0
  13. #define PCM3060_DAI_ID_ADC 1
  14. #define PCM3060_DAI_IDS_NUM 2
  15. /* ADC and DAC can be clocked from separate or same sources CLK1 and CLK2 */
  16. #define PCM3060_CLK_DEF 0 /* default: CLK1->ADC, CLK2->DAC */
  17. #define PCM3060_CLK1 1
  18. #define PCM3060_CLK2 2
  19. struct pcm3060_priv_dai {
  20. bool is_provider;
  21. unsigned int sclk_freq;
  22. };
  23. struct pcm3060_priv {
  24. struct regmap *regmap;
  25. struct pcm3060_priv_dai dai[PCM3060_DAI_IDS_NUM];
  26. u8 out_se: 1;
  27. };
  28. int pcm3060_probe(struct device *dev);
  29. int pcm3060_remove(struct device *dev);
  30. /* registers */
  31. #define PCM3060_REG64 0x40
  32. #define PCM3060_REG_MRST 0x80
  33. #define PCM3060_REG_SRST 0x40
  34. #define PCM3060_REG_ADPSV 0x20
  35. #define PCM3060_REG_SHIFT_ADPSV 0x05
  36. #define PCM3060_REG_DAPSV 0x10
  37. #define PCM3060_REG_SHIFT_DAPSV 0x04
  38. #define PCM3060_REG_SE 0x01
  39. #define PCM3060_REG65 0x41
  40. #define PCM3060_REG66 0x42
  41. #define PCM3060_REG_AT2_MIN 0x36
  42. #define PCM3060_REG_AT2_MAX 0xFF
  43. #define PCM3060_REG67 0x43
  44. #define PCM3060_REG72 0x48
  45. #define PCM3060_REG_CSEL 0x80
  46. #define PCM3060_REG_MASK_MS 0x70
  47. #define PCM3060_REG_MS_S 0x00
  48. #define PCM3060_REG_MS_M768 (0x01 << 4)
  49. #define PCM3060_REG_MS_M512 (0x02 << 4)
  50. #define PCM3060_REG_MS_M384 (0x03 << 4)
  51. #define PCM3060_REG_MS_M256 (0x04 << 4)
  52. #define PCM3060_REG_MS_M192 (0x05 << 4)
  53. #define PCM3060_REG_MS_M128 (0x06 << 4)
  54. #define PCM3060_REG_MASK_FMT 0x03
  55. #define PCM3060_REG_FMT_I2S 0x00
  56. #define PCM3060_REG_FMT_LJ 0x01
  57. #define PCM3060_REG_FMT_RJ 0x02
  58. #define PCM3060_REG68 0x44
  59. #define PCM3060_REG_OVER 0x40
  60. #define PCM3060_REG_DREV2 0x04
  61. #define PCM3060_REG_SHIFT_MUT21 0x00
  62. #define PCM3060_REG_SHIFT_MUT22 0x01
  63. #define PCM3060_REG69 0x45
  64. #define PCM3060_REG_FLT 0x80
  65. #define PCM3060_REG_MASK_DMF 0x60
  66. #define PCM3060_REG_DMC 0x10
  67. #define PCM3060_REG_ZREV 0x02
  68. #define PCM3060_REG_AZRO 0x01
  69. #define PCM3060_REG70 0x46
  70. #define PCM3060_REG71 0x47
  71. #define PCM3060_REG_AT1_MIN 0x0E
  72. #define PCM3060_REG_AT1_MAX 0xFF
  73. #define PCM3060_REG73 0x49
  74. #define PCM3060_REG_ZCDD 0x10
  75. #define PCM3060_REG_BYP 0x08
  76. #define PCM3060_REG_DREV1 0x04
  77. #define PCM3060_REG_SHIFT_MUT11 0x00
  78. #define PCM3060_REG_SHIFT_MUT12 0x01
  79. #endif /* _SND_SOC_PCM3060_H */