qmi.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023 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_aux_dnld_send_sync(struct cnss_plat_data *plat_priv);
  40. int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
  41. enum cnss_driver_mode mode);
  42. int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
  43. struct cnss_wlan_enable_cfg *config,
  44. const char *host_version);
  45. int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv,
  46. u32 offset, u32 mem_type,
  47. u32 data_len, u8 *data);
  48. int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
  49. u32 offset, u32 mem_type,
  50. u32 data_len, u8 *data);
  51. int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
  52. u8 fw_log_mode);
  53. int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv);
  54. int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv);
  55. int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv);
  56. int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
  57. void *cmd, int cmd_len);
  58. int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
  59. void *data);
  60. int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
  61. void *data);
  62. int cnss_register_coex_service(struct cnss_plat_data *plat_priv);
  63. void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv);
  64. int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv);
  65. int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv);
  66. int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv);
  67. int cnss_register_ims_service(struct cnss_plat_data *plat_priv);
  68. void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv);
  69. int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv);
  70. void cnss_ignore_qmi_failure(bool ignore);
  71. int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv);
  72. int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
  73. u8 *mac, u32 mac_len);
  74. int cnss_dms_init(struct cnss_plat_data *plat_priv);
  75. void cnss_dms_deinit(struct cnss_plat_data *plat_priv);
  76. int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv);
  77. int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
  78. u32 total_size);
  79. int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv);
  80. int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option);
  81. int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
  82. u32 cal_file_download_size);
  83. int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv);
  84. int cnss_wlfw_ini_file_send_sync(struct cnss_plat_data *plat_priv,
  85. enum wlfw_ini_file_type_v01 file_type);
  86. int cnss_wlfw_send_host_wfc_call_status(struct cnss_plat_data *plat_priv,
  87. struct cnss_wfc_cfg cfg);
  88. void cnss_cancel_dms_work(void);
  89. #else
  90. #define QMI_WLFW_TIMEOUT_MS 10000
  91. static inline int cnss_qmi_init(struct cnss_plat_data *plat_priv)
  92. {
  93. return 0;
  94. }
  95. static inline void cnss_qmi_deinit(struct cnss_plat_data *plat_priv)
  96. {
  97. }
  98. static inline
  99. unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv)
  100. {
  101. return QMI_WLFW_TIMEOUT_MS;
  102. }
  103. static inline int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv,
  104. void *data)
  105. {
  106. return 0;
  107. }
  108. static inline int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv)
  109. {
  110. return 0;
  111. }
  112. static inline
  113. int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv)
  114. {
  115. return 0;
  116. }
  117. static inline int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv)
  118. {
  119. return 0;
  120. }
  121. static inline int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
  122. u32 bdf_type)
  123. {
  124. return 0;
  125. }
  126. static inline int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv)
  127. {
  128. return 0;
  129. }
  130. static inline int cnss_wlfw_aux_dnld_send_sync(struct cnss_plat_data *plat_priv)
  131. {
  132. return 0;
  133. }
  134. static inline
  135. int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv,
  136. enum cnss_driver_mode mode)
  137. {
  138. return 0;
  139. }
  140. static inline
  141. int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv,
  142. struct cnss_wlan_enable_cfg *config,
  143. const char *host_version)
  144. {
  145. return 0;
  146. }
  147. static inline
  148. int cnss_wlfw_athdiag_read_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_athdiag_write_send_sync(struct cnss_plat_data *plat_priv,
  156. u32 offset, u32 mem_type,
  157. u32 data_len, u8 *data)
  158. {
  159. return 0;
  160. }
  161. static inline
  162. int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv,
  163. u8 fw_log_mode)
  164. {
  165. return 0;
  166. }
  167. static inline
  168. int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv)
  169. {
  170. return 0;
  171. }
  172. static inline
  173. int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv)
  174. {
  175. return 0;
  176. }
  177. static inline
  178. int cnss_wlfw_dynamic_feature_mask_send_sync(struct cnss_plat_data *plat_priv)
  179. {
  180. return 0;
  181. }
  182. static inline
  183. int cnss_wlfw_get_info_send_sync(struct cnss_plat_data *plat_priv, int type,
  184. void *cmd, int cmd_len)
  185. {
  186. return 0;
  187. }
  188. static inline
  189. int cnss_process_wfc_call_ind_event(struct cnss_plat_data *plat_priv,
  190. void *data)
  191. {
  192. return 0;
  193. }
  194. static inline
  195. int cnss_process_twt_cfg_ind_event(struct cnss_plat_data *plat_priv,
  196. void *data)
  197. {
  198. return 0;
  199. }
  200. static inline
  201. int cnss_register_coex_service(struct cnss_plat_data *plat_priv)
  202. {
  203. return 0;
  204. }
  205. static inline
  206. void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv) {}
  207. static inline
  208. int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv)
  209. {
  210. return 0;
  211. }
  212. static inline
  213. int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv)
  214. {
  215. return 0;
  216. }
  217. static inline
  218. int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv)
  219. {
  220. return 0;
  221. }
  222. static inline
  223. int cnss_register_ims_service(struct cnss_plat_data *plat_priv)
  224. {
  225. return 0;
  226. }
  227. static inline
  228. void cnss_unregister_ims_service(struct cnss_plat_data *plat_priv) {}
  229. static inline
  230. int cnss_wlfw_send_pcie_gen_speed_sync(struct cnss_plat_data *plat_priv)
  231. {
  232. return 0;
  233. }
  234. void cnss_ignore_qmi_failure(bool ignore) {};
  235. static inline int cnss_qmi_get_dms_mac(struct cnss_plat_data *plat_priv)
  236. {
  237. return 0;
  238. }
  239. int cnss_wlfw_wlan_mac_req_send_sync(struct cnss_plat_data *plat_priv,
  240. u8 *mac, u32 mac_len)
  241. {
  242. return 0;
  243. }
  244. static inline int cnss_dms_init(struct cnss_plat_data *plat_priv)
  245. {
  246. return 0;
  247. }
  248. int cnss_wlfw_qdss_dnld_send_sync(struct cnss_plat_data *plat_priv)
  249. {
  250. return 0;
  251. }
  252. int cnss_wlfw_qdss_data_send_sync(struct cnss_plat_data *plat_priv, char *file_name,
  253. u32 total_size)
  254. {
  255. return 0;
  256. }
  257. static inline void cnss_dms_deinit(struct cnss_plat_data *plat_priv) {}
  258. int wlfw_qdss_trace_start(struct cnss_plat_data *plat_priv)
  259. {
  260. return 0;
  261. }
  262. int wlfw_qdss_trace_stop(struct cnss_plat_data *plat_priv, unsigned long long option)
  263. {
  264. return 0;
  265. }
  266. static inline
  267. int cnss_wlfw_cal_report_req_send_sync(struct cnss_plat_data *plat_priv,
  268. u32 cal_file_download_size)
  269. {
  270. return 0;
  271. }
  272. static inline
  273. int cnss_send_subsys_restart_level_msg(struct cnss_plat_data *plat_priv)
  274. {
  275. return 0;
  276. }
  277. int cnss_wlfw_ini_file_send_sync(struct cnss_plat_data *plat_priv,
  278. enum wlfw_ini_file_type_v01 file_type)
  279. {
  280. return 0;
  281. }
  282. static void cnss_cancel_dms_work(void)
  283. {
  284. }
  285. int cnss_wlfw_send_host_wfc_call_status(struct cnss_plat_data *plat_priv,
  286. struct cnss_wfc_cfg cfg)
  287. {
  288. return 0;
  289. }
  290. #endif /* CONFIG_CNSS2_QMI */
  291. #ifdef CONFIG_CNSS2_DEBUG
  292. static inline u32 cnss_get_host_build_type(void)
  293. {
  294. return QMI_HOST_BUILD_TYPE_PRIMARY_V01;
  295. }
  296. #else
  297. static inline u32 cnss_get_host_build_type(void)
  298. {
  299. return QMI_HOST_BUILD_TYPE_SECONDARY_V01;
  300. }
  301. #endif
  302. #endif /* _CNSS_QMI_H */