qmi.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _CNSS_QMI_H
  7. #define _CNSS_QMI_H
  8. #include "wlan_firmware_service_v01.h"
  9. struct cnss_plat_data;
  10. struct cnss_qmi_event_server_arrive_data {
  11. unsigned int node;
  12. unsigned int port;
  13. };
  14. struct cnss_mem_seg {
  15. u64 addr;
  16. u32 size;
  17. };
  18. struct cnss_qmi_event_fw_mem_file_save_data {
  19. u32 total_size;
  20. u32 mem_seg_len;
  21. enum wlfw_mem_type_enum_v01 mem_type;
  22. struct cnss_mem_seg mem_seg[QMI_WLFW_MAX_NUM_MEM_SEG_V01];
  23. char file_name[QMI_WLFW_MAX_STR_LEN_V01 + 1];
  24. };
  25. #ifdef CONFIG_CNSS2_QMI
  26. #include "coexistence_service_v01.h"
  27. #include "ip_multimedia_subsystem_private_service_v01.h"
  28. #include "device_management_service_v01.h"
  29. int cnss_qmi_init(struct cnss_plat_data *plat_priv);
  30. void cnss_qmi_deinit(struct cnss_plat_data *plat_priv);
  31. unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv);
  32. int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv, void *data);
  33. int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv);
  34. int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv);
  35. int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv);
  36. int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
  37. u32 bdf_type);
  38. int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv);
  39. int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
  40. enum cnss_driver_mode mode);
  41. int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
  42. struct cnss_wlan_enable_cfg *config,
  43. const char *host_version);
  44. int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv,
  45. u32 offset, u32 mem_type,
  46. u32 data_len, u8 *data);
  47. int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
  48. u32 offset, u32 mem_type,
  49. u32 data_len, u8 *data);
  50. int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
  51. u8 fw_log_mode);
  52. int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv);
  53. int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv);
  54. int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv);
  55. int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
  56. void *cmd, int cmd_len);
  57. int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
  58. void *data);
  59. int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
  60. void *data);
  61. int cnss_register_coex_service(struct cnss_plat_data *plat_priv);
  62. void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv);
  63. int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv);
  64. int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv);
  65. int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv);
  66. int cnss_register_ims_service(struct cnss_plat_data *plat_priv);
  67. void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv);
  68. int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv);
  69. void cnss_ignore_qmi_failure(bool ignore);
  70. int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv);
  71. int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
  72. u8 *mac, u32 mac_len);
  73. int cnss_dms_init(struct cnss_plat_data *plat_priv);
  74. void cnss_dms_deinit(struct cnss_plat_data *plat_priv);
  75. int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv);
  76. int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
  77. u32 total_size);
  78. int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv);
  79. int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option);
  80. int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
  81. u32 cal_file_download_size);
  82. int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv);
  83. #else
  84. #define QMI_WLFW_TIMEOUT_MS 10000
  85. static inline int cnss_qmi_init(struct cnss_plat_data *plat_priv)
  86. {
  87. return 0;
  88. }
  89. static inline void cnss_qmi_deinit(struct cnss_plat_data *plat_priv)
  90. {
  91. }
  92. static inline
  93. unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv)
  94. {
  95. return QMI_WLFW_TIMEOUT_MS;
  96. }
  97. static inline int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv,
  98. void *data)
  99. {
  100. return 0;
  101. }
  102. static inline int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv)
  103. {
  104. return 0;
  105. }
  106. static inline
  107. int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv)
  108. {
  109. return 0;
  110. }
  111. static inline int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
  112. {
  113. return 0;
  114. }
  115. static inline int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
  116. u32 bdf_type)
  117. {
  118. return 0;
  119. }
  120. static inline int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv)
  121. {
  122. return 0;
  123. }
  124. static inline
  125. int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
  126. enum cnss_driver_mode mode)
  127. {
  128. return 0;
  129. }
  130. static inline
  131. int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
  132. struct cnss_wlan_enable_cfg *config,
  133. const char *host_version)
  134. {
  135. return 0;
  136. }
  137. static inline
  138. int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv,
  139. u32 offset, u32 mem_type,
  140. u32 data_len, u8 *data)
  141. {
  142. return 0;
  143. }
  144. static inline
  145. int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
  146. u32 offset, u32 mem_type,
  147. u32 data_len, u8 *data)
  148. {
  149. return 0;
  150. }
  151. static inline
  152. int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
  153. u8 fw_log_mode)
  154. {
  155. return 0;
  156. }
  157. static inline
  158. int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv)
  159. {
  160. return 0;
  161. }
  162. static inline
  163. int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv)
  164. {
  165. return 0;
  166. }
  167. static inline
  168. int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv)
  169. {
  170. return 0;
  171. }
  172. static inline
  173. int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
  174. void *cmd, int cmd_len)
  175. {
  176. return 0;
  177. }
  178. static inline
  179. int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
  180. void *data)
  181. {
  182. return 0;
  183. }
  184. static inline
  185. int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
  186. void *data)
  187. {
  188. return 0;
  189. }
  190. static inline
  191. int cnss_register_coex_service(struct cnss_plat_data *plat_priv)
  192. {
  193. return 0;
  194. }
  195. static inline
  196. void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv) {}
  197. static inline
  198. int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv)
  199. {
  200. return 0;
  201. }
  202. static inline
  203. int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv)
  204. {
  205. return 0;
  206. }
  207. static inline
  208. int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv)
  209. {
  210. return 0;
  211. }
  212. static inline
  213. int cnss_register_ims_service(struct cnss_plat_data *plat_priv)
  214. {
  215. return 0;
  216. }
  217. static inline
  218. void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv) {}
  219. static inline
  220. int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv)
  221. {
  222. return 0;
  223. }
  224. void cnss_ignore_qmi_failure(bool ignore) {};
  225. static inline int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv)
  226. {
  227. return 0;
  228. }
  229. int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
  230. u8 *mac, u32 mac_len)
  231. {
  232. return 0;
  233. }
  234. static inline int cnss_dms_init(struct cnss_plat_data *plat_priv)
  235. {
  236. return 0;
  237. }
  238. int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv)
  239. {
  240. return 0;
  241. }
  242. int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
  243. u32 total_size)
  244. {
  245. return 0;
  246. }
  247. static inline void cnss_dms_deinit(struct cnss_plat_data *plat_priv) {}
  248. int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv)
  249. {
  250. return 0;
  251. }
  252. int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option)
  253. {
  254. return 0;
  255. }
  256. static inline
  257. int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
  258. u32 cal_file_download_size)
  259. {
  260. return 0;
  261. }
  262. static inline
  263. int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv)
  264. {
  265. return 0;
  266. }
  267. #endif /* CONFIG_CNSS2_QMI */
  268. #ifdef CONFIG_CNSS2_DEBUG
  269. static inline u32 cnss_get_host_build_type(void)
  270. {
  271. return QMI_HOST_BUILD_TYPE_PRIMARY_V01;
  272. }
  273. #else
  274. static inline u32 cnss_get_host_build_type(void)
  275. {
  276. return QMI_HOST_BUILD_TYPE_SECONDARY_V01;
  277. }
  278. #endif
  279. #endif /* _CNSS_QMI_H */