wmt_detect.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (C) 2011-2014 MediaTek Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify it under the terms of the
  5. * GNU General Public License version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  8. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. * See the GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License along with this program.
  12. * If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef _WMT_DETECT_H_
  15. #define _WMT_DETECT_H_
  16. #include <linux/version.h>
  17. #include <linux/init.h>
  18. #include <linux/module.h>
  19. #include <linux/types.h>
  20. #include <linux/kernel.h>
  21. #include <linux/fs.h>
  22. #include <linux/cdev.h>
  23. #include <linux/sched.h>
  24. #include <linux/poll.h>
  25. #include <asm/current.h>
  26. #include <asm/uaccess.h>
  27. #include <linux/proc_fs.h>
  28. #include <linux/wait.h>
  29. #include <linux/time.h>
  30. #include <linux/delay.h>
  31. /*******************************************************************************
  32. * C O N S T A N T S
  33. ********************************************************************************
  34. */
  35. #ifdef MTK_WCN_REMOVE_KERNEL_MODULE
  36. #define MTK_WCN_REMOVE_KO 1
  37. #else
  38. #define MTK_WCN_REMOVE_KO 0
  39. #endif
  40. #include "sdio_detect.h"
  41. #include "wmt_detect_pwr.h"
  42. #include <mtk_wcn_cmb_stub.h>
  43. #define WMT_DETECT_LOG_LOUD 4
  44. #define WMT_DETECT_LOG_DBG 3
  45. #define WMT_DETECT_LOG_INFO 2
  46. #define WMT_DETECT_LOG_WARN 1
  47. #define WMT_DETECT_LOG_ERR 0
  48. extern unsigned int gWmtDetectDbgLvl;
  49. #define WMT_DETECT_LOUD_FUNC(fmt, arg...) \
  50. do { \
  51. if (gWmtDetectDbgLvl >= WMT_DETECT_LOG_LOUD) \
  52. pr_debug(DFT_TAG"[L]%s:" fmt, __func__ , ##arg); \
  53. } while (0)
  54. #define WMT_DETECT_DBG_FUNC(fmt, arg...) \
  55. do { \
  56. if (gWmtDetectDbgLvl >= WMT_DETECT_LOG_DBG) \
  57. pr_debug(DFT_TAG"[D]%s:" fmt, __func__ , ##arg); \
  58. } while (0)
  59. #define WMT_DETECT_INFO_FUNC(fmt, arg...) \
  60. do { \
  61. if (gWmtDetectDbgLvl >= WMT_DETECT_LOG_INFO) \
  62. pr_err(DFT_TAG"[I]%s:" fmt, __func__ , ##arg); \
  63. } while (0)
  64. #define WMT_DETECT_WARN_FUNC(fmt, arg...) \
  65. do { \
  66. if (gWmtDetectDbgLvl >= WMT_DETECT_LOG_WARN) \
  67. pr_warn(DFT_TAG"[W]%s(%d):" fmt, __func__ , __LINE__, ##arg); \
  68. } while (0)
  69. #define WMT_DETECT_ERR_FUNC(fmt, arg...) \
  70. do { \
  71. if (gWmtDetectDbgLvl >= WMT_DETECT_LOG_ERR) \
  72. pr_err(DFT_TAG"[E]%s(%d):" fmt, __func__ , __LINE__, ##arg); \
  73. } while (0)
  74. #define WMT_IOC_MAGIC 'w'
  75. #define COMBO_IOCTL_GET_CHIP_ID _IOR(WMT_IOC_MAGIC, 0, int)
  76. #define COMBO_IOCTL_SET_CHIP_ID _IOW(WMT_IOC_MAGIC, 1, int)
  77. #define COMBO_IOCTL_EXT_CHIP_DETECT _IOR(WMT_IOC_MAGIC, 2, int)
  78. #define COMBO_IOCTL_GET_SOC_CHIP_ID _IOR(WMT_IOC_MAGIC, 3, int)
  79. #define COMBO_IOCTL_DO_MODULE_INIT _IOR(WMT_IOC_MAGIC, 4, int)
  80. #define COMBO_IOCTL_MODULE_CLEANUP _IOR(WMT_IOC_MAGIC, 5, int)
  81. #define COMBO_IOCTL_EXT_CHIP_PWR_ON _IOR(WMT_IOC_MAGIC, 6, int)
  82. #define COMBO_IOCTL_EXT_CHIP_PWR_OFF _IOR(WMT_IOC_MAGIC, 7, int)
  83. #define COMBO_IOCTL_DO_SDIO_AUDOK _IOR(WMT_IOC_MAGIC, 8, int)
  84. /*******************************************************************************
  85. * F U N C T I O N D E C L A R A T I O N S
  86. ********************************************************************************/
  87. extern int wmt_detect_ext_chip_detect(void);
  88. extern int wmt_detect_ext_chip_pwr_on(void);
  89. extern int wmt_detect_ext_chip_pwr_off(void);
  90. #ifdef MTK_WCN_SOC_CHIP_SUPPORT
  91. extern unsigned int wmt_plat_get_soc_chipid(void);
  92. #endif
  93. #ifdef MTK_WCN_COMBO_CHIP_SUPPORT
  94. /* mtk_uart_pdn_enable -- request uart port enter/exit deep idle mode, this API is defined in uart driver
  95. *
  96. * @ port - uart port name, Eg: "ttyMT0", "ttyMT1", "ttyMT2"
  97. * @ enable - "1", enable deep idle; "0", disable deep idle
  98. *
  99. * Return 0 if success, else -1
  100. */
  101. extern unsigned int mtk_uart_pdn_enable(char *port, int enable);
  102. #endif
  103. #endif