mtk_wcn_cmb_stub.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*! \file
  2. \brief Declaration of library functions
  3. Any definitions in this file will be shared among GLUE Layer and internal Driver Stack.
  4. */
  5. #ifndef _MTK_WCN_CMB_STUB_H_
  6. #define _MTK_WCN_CMB_STUB_H_
  7. #include <linux/pm.h>
  8. /*******************************************************************************
  9. * C O M P I L E R F L A G S
  10. ********************************************************************************
  11. */
  12. /*******************************************************************************
  13. * M A C R O S
  14. ********************************************************************************
  15. */
  16. /* Audio GPIO naming style for 73/75/77 */
  17. /* #define MTK_WCN_CMB_AUD_IO_NAMING_STYLE_0 1 */
  18. /* Audio GPIO naming style for 89/8135 */
  19. /* #define MTK_WCN_CMB_AUD_IO_NAMING_STYLE_1 1 */
  20. /* Audio GPIO naming style for 6592 */
  21. /* #define MTK_WCN_CMB_AUD_IO_NAMING_STYLE_2 1 */
  22. /* Audio GPIO naming style for 6595 */
  23. #define MTK_WCN_CMB_AUD_IO_NAMING_STYLE_3 1
  24. /*******************************************************************************
  25. * E X T E R N A L R E F E R E N C E S
  26. ********************************************************************************
  27. */
  28. /*******************************************************************************
  29. * C O N S T A N T S
  30. ********************************************************************************
  31. */
  32. /*******************************************************************************
  33. * D A T A T Y P E S
  34. ********************************************************************************
  35. */
  36. typedef enum {
  37. CMB_STUB_AIF_0 = 0, /* 0000: BT_PCM_OFF & FM analog (line in/out) */
  38. CMB_STUB_AIF_1 = 1, /* 0001: BT_PCM_ON & FM analog (in/out) */
  39. CMB_STUB_AIF_2 = 2, /* 0010: BT_PCM_OFF & FM digital (I2S) */
  40. CMB_STUB_AIF_3 = 3, /* 0011: BT_PCM_ON & FM digital (I2S) (invalid in 73evb & 1.2 phone configuration) */
  41. CMB_STUB_AIF_4 = 4, /* 0100: BT_I2S & FM disable in special projects, e.g. protea*/
  42. CMB_STUB_AIF_MAX = 5,
  43. } CMB_STUB_AIF_X;
  44. /*COMBO_CHIP_AUDIO_PIN_CTRL*/
  45. typedef enum {
  46. CMB_STUB_AIF_CTRL_DIS = 0,
  47. CMB_STUB_AIF_CTRL_EN = 1,
  48. CMB_STUB_AIF_CTRL_MAX = 2,
  49. } CMB_STUB_AIF_CTRL;
  50. typedef enum {
  51. COMBO_FUNC_TYPE_BT = 0,
  52. COMBO_FUNC_TYPE_FM = 1,
  53. COMBO_FUNC_TYPE_GPS = 2,
  54. COMBO_FUNC_TYPE_WIFI = 3,
  55. COMBO_FUNC_TYPE_WMT = 4,
  56. COMBO_FUNC_TYPE_STP = 5,
  57. COMBO_FUNC_TYPE_NUM = 6
  58. } COMBO_FUNC_TYPE;
  59. typedef enum {
  60. COMBO_IF_UART = 0,
  61. COMBO_IF_MSDC = 1,
  62. COMBO_IF_BTIF = 2,
  63. COMBO_IF_MAX,
  64. } COMBO_IF;
  65. typedef void (*wmt_bgf_eirq_cb) (void);
  66. typedef int (*wmt_aif_ctrl_cb) (CMB_STUB_AIF_X, CMB_STUB_AIF_CTRL);
  67. typedef void (*wmt_func_ctrl_cb) (unsigned int, unsigned int);
  68. typedef signed long (*wmt_thermal_query_cb) (void);
  69. typedef int (*wmt_deep_idle_ctrl_cb) (unsigned int);
  70. typedef int (*wmt_func_do_reset) (unsigned int);
  71. typedef void (*msdc_sdio_irq_handler_t) (void *); /* external irq handler */
  72. typedef void (*pm_callback_t) (pm_message_t state, void *data);
  73. struct sdio_ops {
  74. void (*sdio_request_eirq)(msdc_sdio_irq_handler_t irq_handler, void *data);
  75. void (*sdio_enable_eirq)(void);
  76. void (*sdio_disable_eirq)(void);
  77. void (*sdio_register_pm)(pm_callback_t pm_cb, void *data);
  78. };
  79. typedef struct _CMB_STUB_CB_ {
  80. unsigned int size; /* structure size */
  81. /*wmt_bgf_eirq_cb bgf_eirq_cb; *//* remove bgf_eirq_cb from stub. handle it in platform */
  82. wmt_aif_ctrl_cb aif_ctrl_cb;
  83. wmt_func_ctrl_cb func_ctrl_cb;
  84. wmt_thermal_query_cb thermal_query_cb;
  85. wmt_deep_idle_ctrl_cb deep_idle_ctrl_cb;
  86. wmt_func_do_reset wmt_do_reset_cb;
  87. } CMB_STUB_CB, *P_CMB_STUB_CB;
  88. /*******************************************************************************
  89. * P U B L I C D A T A
  90. ********************************************************************************
  91. */
  92. /*******************************************************************************
  93. * P R I V A T E D A T A
  94. ********************************************************************************
  95. */
  96. /*******************************************************************************
  97. * F U N C T I O N D E C L A R A T I O N S
  98. ********************************************************************************
  99. */
  100. extern struct sdio_ops mt_sdio_ops[4];
  101. extern int mtk_wcn_cmb_stub_reg(P_CMB_STUB_CB p_stub_cb);
  102. extern int mtk_wcn_cmb_stub_unreg(void);
  103. extern int mtk_wcn_cmb_stub_aif_ctrl(CMB_STUB_AIF_X state, CMB_STUB_AIF_CTRL ctrl);
  104. static inline int mtk_wcn_cmb_stub_audio_ctrl(CMB_STUB_AIF_X state)
  105. {
  106. /* return mtk_wcn_cmb_stub_aif_ctrl(state, 1); */
  107. return 0;
  108. }
  109. extern int mt_combo_plt_enter_deep_idle(COMBO_IF src);
  110. extern int mt_combo_plt_exit_deep_idle(COMBO_IF src);
  111. /* Use new mtk_wcn_stub APIs instead of old mt_combo ones for kernel to control
  112. * function on/off.
  113. */
  114. extern void mtk_wcn_cmb_stub_func_ctrl(unsigned int type, unsigned int on);
  115. extern int mtk_wcn_cmb_stub_query_ctrl(void);
  116. extern int board_sdio_ctrl(unsigned int sdio_port_num, unsigned int on);
  117. extern int mtk_wcn_sdio_irq_flag_set(int falg);
  118. extern int mtk_wcn_wmt_chipid_query(void);
  119. extern void mtk_wcn_wmt_set_chipid(int chipid);
  120. /* mtk_uart_pdn_enable -- request uart port enter/exit deep idle mode, this API is defined in uart driver
  121. *
  122. * @ port - uart port name, Eg: "ttyMT0", "ttyMT1", "ttyMT2"
  123. * @ enable - "1", enable deep idle; "0", disable deep idle
  124. *
  125. * Return 0 if success, else -1
  126. */
  127. extern unsigned int mtk_uart_pdn_enable(char *port, int enable);
  128. /*******************************************************************************
  129. * F U N C T I O N S
  130. ********************************************************************************
  131. */
  132. #endif /* _MTK_WCN_CMB_STUB_H_ */