mt8183-afe-common.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * mt8183-afe-common.h -- Mediatek 8183 audio driver definitions
  4. *
  5. * Copyright (c) 2018 MediaTek Inc.
  6. * Author: KaiChieh Chuang <[email protected]>
  7. */
  8. #ifndef _MT_8183_AFE_COMMON_H_
  9. #define _MT_8183_AFE_COMMON_H_
  10. #include <sound/soc.h>
  11. #include <linux/list.h>
  12. #include <linux/regmap.h>
  13. #include "../common/mtk-base-afe.h"
  14. enum {
  15. MT8183_MEMIF_DL1,
  16. MT8183_MEMIF_DL2,
  17. MT8183_MEMIF_DL3,
  18. MT8183_MEMIF_VUL12,
  19. MT8183_MEMIF_VUL2,
  20. MT8183_MEMIF_AWB,
  21. MT8183_MEMIF_AWB2,
  22. MT8183_MEMIF_MOD_DAI,
  23. MT8183_MEMIF_HDMI,
  24. MT8183_MEMIF_NUM,
  25. MT8183_DAI_ADDA = MT8183_MEMIF_NUM,
  26. MT8183_DAI_PCM_1,
  27. MT8183_DAI_PCM_2,
  28. MT8183_DAI_I2S_0,
  29. MT8183_DAI_I2S_1,
  30. MT8183_DAI_I2S_2,
  31. MT8183_DAI_I2S_3,
  32. MT8183_DAI_I2S_5,
  33. MT8183_DAI_TDM,
  34. MT8183_DAI_HOSTLESS_LPBK,
  35. MT8183_DAI_HOSTLESS_SPEECH,
  36. MT8183_DAI_NUM,
  37. };
  38. enum {
  39. MT8183_IRQ_0,
  40. MT8183_IRQ_1,
  41. MT8183_IRQ_2,
  42. MT8183_IRQ_3,
  43. MT8183_IRQ_4,
  44. MT8183_IRQ_5,
  45. MT8183_IRQ_6,
  46. MT8183_IRQ_7,
  47. MT8183_IRQ_8, /* hw bundle to TDM */
  48. MT8183_IRQ_11,
  49. MT8183_IRQ_12,
  50. MT8183_IRQ_NUM,
  51. };
  52. enum {
  53. MT8183_MTKAIF_PROTOCOL_1 = 0,
  54. MT8183_MTKAIF_PROTOCOL_2,
  55. MT8183_MTKAIF_PROTOCOL_2_CLK_P2,
  56. };
  57. /* MCLK */
  58. enum {
  59. MT8183_I2S0_MCK = 0,
  60. MT8183_I2S1_MCK,
  61. MT8183_I2S2_MCK,
  62. MT8183_I2S3_MCK,
  63. MT8183_I2S4_MCK,
  64. MT8183_I2S4_BCK,
  65. MT8183_I2S5_MCK,
  66. MT8183_MCK_NUM,
  67. };
  68. struct clk;
  69. struct mt8183_afe_private {
  70. struct clk **clk;
  71. int pm_runtime_bypass_reg_ctl;
  72. /* dai */
  73. void *dai_priv[MT8183_DAI_NUM];
  74. /* adda */
  75. int mtkaif_protocol;
  76. int mtkaif_calibration_ok;
  77. int mtkaif_chosen_phase[4];
  78. int mtkaif_phase_cycle[4];
  79. int mtkaif_calibration_num_phase;
  80. int mtkaif_dmic;
  81. /* mck */
  82. int mck_rate[MT8183_MCK_NUM];
  83. };
  84. unsigned int mt8183_general_rate_transform(struct device *dev,
  85. unsigned int rate);
  86. unsigned int mt8183_rate_transform(struct device *dev,
  87. unsigned int rate, int aud_blk);
  88. int mt8183_dai_i2s_set_share(struct mtk_base_afe *afe, const char *main_i2s_name,
  89. const char *secondary_i2s_name);
  90. /* dai register */
  91. int mt8183_dai_adda_register(struct mtk_base_afe *afe);
  92. int mt8183_dai_pcm_register(struct mtk_base_afe *afe);
  93. int mt8183_dai_i2s_register(struct mtk_base_afe *afe);
  94. int mt8183_dai_tdm_register(struct mtk_base_afe *afe);
  95. int mt8183_dai_hostless_register(struct mtk_base_afe *afe);
  96. #endif