qmi.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. int cnss_wlfw_ini_file_send_sync(struct cnss_plat_data *plat_priv,
  84. enum wlfw_ini_file_type_v01 file_type);
  85. void cnss_cancel_dms_work(void);
  86. #else
  87. #define QMI_WLFW_TIMEOUT_MS 10000
  88. static inline int cnss_qmi_init(struct cnss_plat_data *plat_priv)
  89. {
  90. return 0;
  91. }
  92. static inline void cnss_qmi_deinit(struct cnss_plat_data *plat_priv)
  93. {
  94. }
  95. static inline
  96. unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv)
  97. {
  98. return QMI_WLFW_TIMEOUT_MS;
  99. }
  100. static inline int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv,
  101. void *data)
  102. {
  103. return 0;
  104. }
  105. static inline int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv)
  106. {
  107. return 0;
  108. }
  109. static inline
  110. int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv)
  111. {
  112. return 0;
  113. }
  114. static inline int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
  115. {
  116. return 0;
  117. }
  118. static inline int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
  119. u32 bdf_type)
  120. {
  121. return 0;
  122. }
  123. static inline int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv)
  124. {
  125. return 0;
  126. }
  127. static inline
  128. int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
  129. enum cnss_driver_mode mode)
  130. {
  131. return 0;
  132. }
  133. static inline
  134. int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
  135. struct cnss_wlan_enable_cfg *config,
  136. const char *host_version)
  137. {
  138. return 0;
  139. }
  140. static inline
  141. int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv,
  142. u32 offset, u32 mem_type,
  143. u32 data_len, u8 *data)
  144. {
  145. return 0;
  146. }
  147. static inline
  148. int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
  149. u32 offset, u32 mem_type,
  150. u32 data_len, u8 *data)
  151. {
  152. return 0;
  153. }
  154. static inline
  155. int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
  156. u8 fw_log_mode)
  157. {
  158. return 0;
  159. }
  160. static inline
  161. int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv)
  162. {
  163. return 0;
  164. }
  165. static inline
  166. int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv)
  167. {
  168. return 0;
  169. }
  170. static inline
  171. int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv)
  172. {
  173. return 0;
  174. }
  175. static inline
  176. int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
  177. void *cmd, int cmd_len)
  178. {
  179. return 0;
  180. }
  181. static inline
  182. int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
  183. void *data)
  184. {
  185. return 0;
  186. }
  187. static inline
  188. int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
  189. void *data)
  190. {
  191. return 0;
  192. }
  193. static inline
  194. int cnss_register_coex_service(struct cnss_plat_data *plat_priv)
  195. {
  196. return 0;
  197. }
  198. static inline
  199. void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv) {}
  200. static inline
  201. int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv)
  202. {
  203. return 0;
  204. }
  205. static inline
  206. int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv)
  207. {
  208. return 0;
  209. }
  210. static inline
  211. int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv)
  212. {
  213. return 0;
  214. }
  215. static inline
  216. int cnss_register_ims_service(struct cnss_plat_data *plat_priv)
  217. {
  218. return 0;
  219. }
  220. static inline
  221. void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv) {}
  222. static inline
  223. int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv)
  224. {
  225. return 0;
  226. }
  227. void cnss_ignore_qmi_failure(bool ignore) {};
  228. static inline int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv)
  229. {
  230. return 0;
  231. }
  232. int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
  233. u8 *mac, u32 mac_len)
  234. {
  235. return 0;
  236. }
  237. static inline int cnss_dms_init(struct cnss_plat_data *plat_priv)
  238. {
  239. return 0;
  240. }
  241. int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv)
  242. {
  243. return 0;
  244. }
  245. int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
  246. u32 total_size)
  247. {
  248. return 0;
  249. }
  250. static inline void cnss_dms_deinit(struct cnss_plat_data *plat_priv) {}
  251. int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv)
  252. {
  253. return 0;
  254. }
  255. int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option)
  256. {
  257. return 0;
  258. }
  259. static inline
  260. int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
  261. u32 cal_file_download_size)
  262. {
  263. return 0;
  264. }
  265. static inline
  266. int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv)
  267. {
  268. return 0;
  269. }
  270. int cnss_wlfw_ini_file_send_sync(struct cnss_plat_data *plat_priv,
  271. enum wlfw_ini_file_type_v01 file_type)
  272. {
  273. return 0;
  274. }
  275. static void cnss_cancel_dms_work(void)
  276. {
  277. }
  278. #endif /* CONFIG_CNSS2_QMI */
  279. #ifdef CONFIG_CNSS2_DEBUG
  280. static inline u32 cnss_get_host_build_type(void)
  281. {
  282. return QMI_HOST_BUILD_TYPE_PRIMARY_V01;
  283. }
  284. #else
  285. static inline u32 cnss_get_host_build_type(void)
  286. {
  287. return QMI_HOST_BUILD_TYPE_SECONDARY_V01;
  288. }
  289. #endif
  290. #endif /* _CNSS_QMI_H */