Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. */ |
| 3 | |
| 4 | #ifndef _CNSS_QMI_H |
| 5 | #define _CNSS_QMI_H |
| 6 | |
| 7 | #include <linux/soc/qcom/qmi.h> |
| 8 | |
| 9 | struct cnss_plat_data; |
| 10 | |
Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 11 | struct cnss_qmi_event_server_arrive_data { |
| 12 | unsigned int node; |
| 13 | unsigned int port; |
| 14 | }; |
| 15 | |
Yuanyuan Liu | 36d1fba | 2019-01-02 14:13:15 -0800 | [diff] [blame] | 16 | #define QDSS_TRACE_SEG_LEN_MAX 32 |
| 17 | #define QDSS_TRACE_FILE_NAME_MAX 16 |
| 18 | |
| 19 | struct cnss_mem_seg { |
| 20 | u64 addr; |
| 21 | u32 size; |
| 22 | }; |
| 23 | |
| 24 | struct cnss_qmi_event_qdss_trace_save_data { |
| 25 | u32 total_size; |
| 26 | u32 mem_seg_len; |
| 27 | struct cnss_mem_seg mem_seg[QDSS_TRACE_SEG_LEN_MAX]; |
| 28 | char file_name[QDSS_TRACE_FILE_NAME_MAX + 1]; |
| 29 | }; |
| 30 | |
| 31 | #ifdef CONFIG_CNSS2_QMI |
| 32 | #include "wlan_firmware_service_v01.h" |
| 33 | #include "coexistence_service_v01.h" |
| 34 | |
Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 35 | int cnss_qmi_init(struct cnss_plat_data *plat_priv); |
| 36 | void cnss_qmi_deinit(struct cnss_plat_data *plat_priv); |
| 37 | unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv); |
| 38 | int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv, void *data); |
| 39 | int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv); |
| 40 | int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv); |
| 41 | int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv); |
Yue Ma | d3534c4 | 2019-02-25 15:18:41 -0800 | [diff] [blame] | 42 | int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv, |
| 43 | u32 bdf_type); |
Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 44 | int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv); |
| 45 | int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv, |
| 46 | enum cnss_driver_mode mode); |
| 47 | int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv, |
| 48 | struct cnss_wlan_enable_cfg *config, |
| 49 | const char *host_version); |
| 50 | int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv, |
| 51 | u32 offset, u32 mem_type, |
| 52 | u32 data_len, u8 *data); |
| 53 | int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv, |
| 54 | u32 offset, u32 mem_type, |
| 55 | u32 data_len, u8 *data); |
| 56 | int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv, |
| 57 | u8 fw_log_mode); |
Yuanyuan Liu | a168383 | 2019-01-29 11:01:29 -0800 | [diff] [blame] | 58 | int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv); |
| 59 | int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv); |
Yuanyuan Liu | 659d5f3 | 2019-01-25 14:29:22 -0800 | [diff] [blame] | 60 | int cnss_register_coex_service(struct cnss_plat_data *plat_priv); |
| 61 | void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv); |
| 62 | int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv); |
| 63 | int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv); |
Yuanyuan Liu | 36d1fba | 2019-01-02 14:13:15 -0800 | [diff] [blame] | 64 | int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv); |
Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 65 | #else |
| 66 | #define QMI_WLFW_TIMEOUT_MS 10000 |
| 67 | |
| 68 | static inline int cnss_qmi_init(struct cnss_plat_data *plat_priv) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | static inline void cnss_qmi_deinit(struct cnss_plat_data *plat_priv) |
| 74 | { |
| 75 | } |
| 76 | |
| 77 | static inline |
| 78 | unsigned int cnss_get_qmi_timeout(struct cnss_plat_data *plat_priv) |
| 79 | { |
| 80 | return QMI_WLFW_TIMEOUT_MS; |
| 81 | } |
| 82 | |
| 83 | static inline int cnss_wlfw_server_arrive(struct cnss_plat_data *plat_priv, |
| 84 | void *data) |
| 85 | { |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | static inline int cnss_wlfw_server_exit(struct cnss_plat_data *plat_priv) |
| 90 | { |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | static inline |
| 95 | int cnss_wlfw_respond_mem_send_sync(struct cnss_plat_data *plat_priv) |
| 96 | { |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | static inline int cnss_wlfw_tgt_cap_send_sync(struct cnss_plat_data *plat_priv) |
| 101 | { |
| 102 | return 0; |
| 103 | } |
| 104 | |
Yue Ma | d3534c4 | 2019-02-25 15:18:41 -0800 | [diff] [blame] | 105 | static inline int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv, |
| 106 | u32 bdf_type) |
Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 107 | { |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | static inline int cnss_wlfw_m3_dnld_send_sync(struct cnss_plat_data *plat_priv) |
| 112 | { |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | static inline |
| 117 | int cnss_wlfw_wlan_mode_send_sync(struct cnss_plat_data *plat_priv, |
| 118 | enum cnss_driver_mode mode) |
| 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | static inline |
| 124 | int cnss_wlfw_wlan_cfg_send_sync(struct cnss_plat_data *plat_priv, |
| 125 | struct cnss_wlan_enable_cfg *config, |
| 126 | const char *host_version) |
| 127 | { |
| 128 | return 0; |
| 129 | } |
| 130 | |
| 131 | static inline |
| 132 | int cnss_wlfw_athdiag_read_send_sync(struct cnss_plat_data *plat_priv, |
| 133 | u32 offset, u32 mem_type, |
| 134 | u32 data_len, u8 *data) |
| 135 | { |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | static inline |
| 140 | int cnss_wlfw_athdiag_write_send_sync(struct cnss_plat_data *plat_priv, |
| 141 | u32 offset, u32 mem_type, |
| 142 | u32 data_len, u8 *data) |
| 143 | { |
| 144 | return 0; |
| 145 | } |
| 146 | |
| 147 | static inline |
| 148 | int cnss_wlfw_ini_send_sync(struct cnss_plat_data *plat_priv, |
| 149 | u8 fw_log_mode) |
| 150 | { |
| 151 | return 0; |
| 152 | } |
Yuanyuan Liu | a168383 | 2019-01-29 11:01:29 -0800 | [diff] [blame] | 153 | |
| 154 | static inline |
| 155 | int cnss_wlfw_antenna_switch_send_sync(struct cnss_plat_data *plat_priv) |
| 156 | { |
| 157 | return 0; |
| 158 | } |
| 159 | |
| 160 | static inline |
| 161 | int cnss_wlfw_antenna_grant_send_sync(struct cnss_plat_data *plat_priv) |
| 162 | { |
| 163 | return 0; |
| 164 | } |
Yuanyuan Liu | 659d5f3 | 2019-01-25 14:29:22 -0800 | [diff] [blame] | 165 | |
| 166 | static inline |
| 167 | int cnss_register_coex_service(struct cnss_plat_data *plat_priv) |
| 168 | { |
| 169 | return 0; |
| 170 | } |
| 171 | |
| 172 | static inline |
| 173 | void cnss_unregister_coex_service(struct cnss_plat_data *plat_priv) {} |
| 174 | |
| 175 | static inline |
| 176 | int coex_antenna_switch_to_wlan_send_sync_msg(struct cnss_plat_data *plat_priv) |
| 177 | { |
| 178 | return 0; |
| 179 | } |
| 180 | |
| 181 | static inline |
| 182 | int coex_antenna_switch_to_mdm_send_sync_msg(struct cnss_plat_data *plat_priv) |
Yuanyuan Liu | 36d1fba | 2019-01-02 14:13:15 -0800 | [diff] [blame] | 183 | |
| 184 | static inline |
| 185 | int cnss_wlfw_qdss_trace_mem_info_send_sync(struct cnss_plat_data *plat_priv) |
Yuanyuan Liu | 659d5f3 | 2019-01-25 14:29:22 -0800 | [diff] [blame] | 186 | { |
| 187 | return 0; |
| 188 | } |
Yuanyuan Liu | d5ec14c | 2019-01-03 11:25:40 -0800 | [diff] [blame] | 189 | #endif /* CONFIG_CNSS2_QMI */ |
| 190 | |
| 191 | #endif /* _CNSS_QMI_H */ |