qmi.h 8.8 KB

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