main.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _CNSS_MAIN_H
  7. #define _CNSS_MAIN_H
  8. #if IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64)
  9. #include <asm/arch_timer.h>
  10. #endif
  11. #if IS_ENABLED(CONFIG_ESOC)
  12. #include <linux/esoc_client.h>
  13. #endif
  14. #include <linux/etherdevice.h>
  15. #include <linux/firmware.h>
  16. #if IS_ENABLED(CONFIG_INTERCONNECT)
  17. #include <linux/interconnect.h>
  18. #endif
  19. #include <linux/mailbox_client.h>
  20. #include <linux/pm_qos.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/time64.h>
  23. #ifdef CONFIG_CNSS_OUT_OF_TREE
  24. #include "cnss2.h"
  25. #else
  26. #include <net/cnss2.h>
  27. #endif
  28. #if IS_ENABLED(CONFIG_QCOM_MEMORY_DUMP_V2) || IS_ENABLED(CONFIG_QCOM_MINIDUMP)
  29. #include <soc/qcom/memory_dump.h>
  30. #endif
  31. #if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART) || \
  32. IS_ENABLED(CONFIG_QCOM_RAMDUMP)
  33. #include <soc/qcom/qcom_ramdump.h>
  34. #endif
  35. #if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART)
  36. #include <soc/qcom/subsystem_notif.h>
  37. #include <soc/qcom/subsystem_restart.h>
  38. #endif
  39. #include "qmi.h"
  40. #define MAX_NO_OF_MAC_ADDR 4
  41. #define QMI_WLFW_MAX_TIMESTAMP_LEN 32
  42. #define QMI_WLFW_MAX_NUM_MEM_SEG 32
  43. #define QMI_WLFW_MAX_BUILD_ID_LEN 128
  44. #define CNSS_RDDM_TIMEOUT_MS 20000
  45. #define RECOVERY_TIMEOUT 60000
  46. #define WLAN_WD_TIMEOUT_MS 60000
  47. #define WLAN_COLD_BOOT_CAL_TIMEOUT 60000
  48. #define WLAN_MISSION_MODE_TIMEOUT 30000
  49. #define TIME_CLOCK_FREQ_HZ 19200000
  50. #define CNSS_RAMDUMP_MAGIC 0x574C414E
  51. #define CNSS_RAMDUMP_VERSION 0
  52. #define MAX_FIRMWARE_NAME_LEN 40
  53. #define FW_V2_NUMBER 2
  54. #define POWER_ON_RETRY_MAX_TIMES 4
  55. #define POWER_ON_RETRY_DELAY_MS 500
  56. #define WLFW_MAX_HANG_EVENT_DATA_SIZE 384
  57. #define CNSS_EVENT_SYNC BIT(0)
  58. #define CNSS_EVENT_UNINTERRUPTIBLE BIT(1)
  59. #define CNSS_EVENT_UNKILLABLE BIT(2)
  60. #define CNSS_EVENT_SYNC_UNINTERRUPTIBLE (CNSS_EVENT_SYNC | \
  61. CNSS_EVENT_UNINTERRUPTIBLE)
  62. #define CNSS_EVENT_SYNC_UNKILLABLE (CNSS_EVENT_SYNC | CNSS_EVENT_UNKILLABLE)
  63. enum cnss_dev_bus_type {
  64. CNSS_BUS_NONE = -1,
  65. CNSS_BUS_PCI,
  66. };
  67. struct cnss_vreg_cfg {
  68. const char *name;
  69. u32 min_uv;
  70. u32 max_uv;
  71. u32 load_ua;
  72. u32 delay_us;
  73. u32 need_unvote;
  74. };
  75. struct cnss_vreg_info {
  76. struct list_head list;
  77. struct regulator *reg;
  78. struct cnss_vreg_cfg cfg;
  79. u32 enabled;
  80. };
  81. enum cnss_vreg_type {
  82. CNSS_VREG_PRIM,
  83. };
  84. struct cnss_clk_cfg {
  85. const char *name;
  86. u32 freq;
  87. u32 required;
  88. };
  89. struct cnss_clk_info {
  90. struct list_head list;
  91. struct clk *clk;
  92. struct cnss_clk_cfg cfg;
  93. u32 enabled;
  94. };
  95. struct cnss_pinctrl_info {
  96. struct pinctrl *pinctrl;
  97. struct pinctrl_state *bootstrap_active;
  98. struct pinctrl_state *sol_default;
  99. struct pinctrl_state *wlan_en_active;
  100. struct pinctrl_state *wlan_en_sleep;
  101. int bt_en_gpio;
  102. int wlan_en_gpio;
  103. int xo_clk_gpio; /*qca6490 only */
  104. int sw_ctrl_gpio;
  105. int wlan_sw_ctrl_gpio;
  106. };
  107. #if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART)
  108. struct cnss_subsys_info {
  109. struct subsys_device *subsys_device;
  110. struct subsys_desc subsys_desc;
  111. void *subsys_handle;
  112. };
  113. #endif
  114. struct cnss_ramdump_info {
  115. void *ramdump_dev;
  116. unsigned long ramdump_size;
  117. void *ramdump_va;
  118. phys_addr_t ramdump_pa;
  119. #if IS_ENABLED(CONFIG_QCOM_MEMORY_DUMP_V2)
  120. struct msm_dump_data dump_data;
  121. #endif
  122. };
  123. struct cnss_dump_seg {
  124. unsigned long address;
  125. void *v_address;
  126. unsigned long size;
  127. u32 type;
  128. };
  129. struct cnss_dump_data {
  130. u32 version;
  131. u32 magic;
  132. char name[32];
  133. phys_addr_t paddr;
  134. int nentries;
  135. u32 seg_version;
  136. };
  137. struct cnss_ramdump_info_v2 {
  138. void *ramdump_dev;
  139. unsigned long ramdump_size;
  140. void *dump_data_vaddr;
  141. u8 dump_data_valid;
  142. struct cnss_dump_data dump_data;
  143. };
  144. #if IS_ENABLED(CONFIG_ESOC)
  145. struct cnss_esoc_info {
  146. struct esoc_desc *esoc_desc;
  147. u8 notify_modem_status;
  148. void *modem_notify_handler;
  149. int modem_current_status;
  150. };
  151. #endif
  152. #if IS_ENABLED(CONFIG_INTERCONNECT)
  153. /**
  154. * struct cnss_bus_bw_cfg - Interconnect vote data
  155. * @avg_bw: Vote for average bandwidth
  156. * @peak_bw: Vote for peak bandwidth
  157. */
  158. struct cnss_bus_bw_cfg {
  159. u32 avg_bw;
  160. u32 peak_bw;
  161. };
  162. /* Number of bw votes (avg, peak) entries that ICC requires */
  163. #define CNSS_ICC_VOTE_MAX 2
  164. /**
  165. * struct cnss_bus_bw_info - Bus bandwidth config for interconnect path
  166. * @list: Kernel linked list
  167. * @icc_name: Name of interconnect path as defined in Device tree
  168. * @icc_path: Interconnect path data structure
  169. * @cfg_table: Interconnect vote data for average and peak bandwidth
  170. */
  171. struct cnss_bus_bw_info {
  172. struct list_head list;
  173. const char *icc_name;
  174. struct icc_path *icc_path;
  175. struct cnss_bus_bw_cfg *cfg_table;
  176. };
  177. #endif
  178. /**
  179. * struct cnss_interconnect_cfg - CNSS platform interconnect config
  180. * @list_head: List of interconnect path bandwidth configs
  181. * @path_count: Count of interconnect path configured in device tree
  182. * @current_bw_vote: WLAN driver provided bandwidth vote
  183. * @bus_bw_cfg_count: Number of bandwidth configs for voting. It is the array
  184. * size of struct cnss_bus_bw_info.cfg_table
  185. */
  186. struct cnss_interconnect_cfg {
  187. struct list_head list_head;
  188. u32 path_count;
  189. int current_bw_vote;
  190. u32 bus_bw_cfg_count;
  191. };
  192. struct cnss_fw_mem {
  193. size_t size;
  194. void *va;
  195. phys_addr_t pa;
  196. u8 valid;
  197. u32 type;
  198. unsigned long attrs;
  199. };
  200. struct wlfw_rf_chip_info {
  201. u32 chip_id;
  202. u32 chip_family;
  203. };
  204. struct wlfw_rf_board_info {
  205. u32 board_id;
  206. };
  207. struct wlfw_soc_info {
  208. u32 soc_id;
  209. };
  210. struct wlfw_fw_version_info {
  211. u32 fw_version;
  212. char fw_build_timestamp[QMI_WLFW_MAX_TIMESTAMP_LEN + 1];
  213. };
  214. enum cnss_mem_type {
  215. CNSS_MEM_TYPE_MSA,
  216. CNSS_MEM_TYPE_DDR,
  217. CNSS_MEM_BDF,
  218. CNSS_MEM_M3,
  219. CNSS_MEM_CAL_V01,
  220. CNSS_MEM_DPD_V01,
  221. };
  222. enum cnss_fw_dump_type {
  223. CNSS_FW_IMAGE,
  224. CNSS_FW_RDDM,
  225. CNSS_FW_REMOTE_HEAP,
  226. CNSS_FW_DUMP_TYPE_MAX,
  227. };
  228. struct cnss_dump_entry {
  229. u32 type;
  230. u32 entry_start;
  231. u32 entry_num;
  232. };
  233. struct cnss_dump_meta_info {
  234. u32 magic;
  235. u32 version;
  236. u32 chipset;
  237. u32 total_entries;
  238. struct cnss_dump_entry entry[CNSS_FW_DUMP_TYPE_MAX];
  239. };
  240. enum cnss_driver_event_type {
  241. CNSS_DRIVER_EVENT_SERVER_ARRIVE,
  242. CNSS_DRIVER_EVENT_SERVER_EXIT,
  243. CNSS_DRIVER_EVENT_REQUEST_MEM,
  244. CNSS_DRIVER_EVENT_FW_MEM_READY,
  245. CNSS_DRIVER_EVENT_FW_READY,
  246. CNSS_DRIVER_EVENT_COLD_BOOT_CAL_START,
  247. CNSS_DRIVER_EVENT_COLD_BOOT_CAL_DONE,
  248. CNSS_DRIVER_EVENT_REGISTER_DRIVER,
  249. CNSS_DRIVER_EVENT_UNREGISTER_DRIVER,
  250. CNSS_DRIVER_EVENT_RECOVERY,
  251. CNSS_DRIVER_EVENT_FORCE_FW_ASSERT,
  252. CNSS_DRIVER_EVENT_POWER_UP,
  253. CNSS_DRIVER_EVENT_POWER_DOWN,
  254. CNSS_DRIVER_EVENT_IDLE_RESTART,
  255. CNSS_DRIVER_EVENT_IDLE_SHUTDOWN,
  256. CNSS_DRIVER_EVENT_IMS_WFC_CALL_IND,
  257. CNSS_DRIVER_EVENT_WLFW_TWT_CFG_IND,
  258. CNSS_DRIVER_EVENT_QDSS_TRACE_REQ_MEM,
  259. CNSS_DRIVER_EVENT_FW_MEM_FILE_SAVE,
  260. CNSS_DRIVER_EVENT_QDSS_TRACE_FREE,
  261. CNSS_DRIVER_EVENT_QDSS_TRACE_REQ_DATA,
  262. CNSS_DRIVER_EVENT_MAX,
  263. };
  264. enum cnss_driver_state {
  265. CNSS_QMI_WLFW_CONNECTED = 0,
  266. CNSS_FW_MEM_READY,
  267. CNSS_FW_READY,
  268. CNSS_IN_COLD_BOOT_CAL,
  269. CNSS_DRIVER_LOADING,
  270. CNSS_DRIVER_UNLOADING = 5,
  271. CNSS_DRIVER_IDLE_RESTART,
  272. CNSS_DRIVER_IDLE_SHUTDOWN,
  273. CNSS_DRIVER_PROBED,
  274. CNSS_DRIVER_RECOVERY,
  275. CNSS_FW_BOOT_RECOVERY = 10,
  276. CNSS_DEV_ERR_NOTIFY,
  277. CNSS_DRIVER_DEBUG,
  278. CNSS_COEX_CONNECTED,
  279. CNSS_IMS_CONNECTED,
  280. CNSS_IN_SUSPEND_RESUME = 15,
  281. CNSS_IN_REBOOT,
  282. CNSS_COLD_BOOT_CAL_DONE,
  283. CNSS_IN_PANIC,
  284. CNSS_QMI_DEL_SERVER,
  285. CNSS_QMI_DMS_CONNECTED = 20,
  286. CNSS_DAEMON_CONNECTED,
  287. CNSS_PCI_PROBE_DONE,
  288. CNSS_DRIVER_REGISTER,
  289. CNSS_WLAN_HW_DISABLED,
  290. CNSS_FS_READY = 25,
  291. CNSS_DRIVER_REGISTERED,
  292. };
  293. struct cnss_recovery_data {
  294. enum cnss_recovery_reason reason;
  295. };
  296. enum cnss_pins {
  297. CNSS_WLAN_EN,
  298. CNSS_PCIE_TXP,
  299. CNSS_PCIE_TXN,
  300. CNSS_PCIE_RXP,
  301. CNSS_PCIE_RXN,
  302. CNSS_PCIE_REFCLKP,
  303. CNSS_PCIE_REFCLKN,
  304. CNSS_PCIE_RST,
  305. CNSS_PCIE_WAKE,
  306. };
  307. struct cnss_pin_connect_result {
  308. u32 fw_pwr_pin_result;
  309. u32 fw_phy_io_pin_result;
  310. u32 fw_rf_pin_result;
  311. u32 host_pin_result;
  312. };
  313. enum cnss_debug_quirks {
  314. LINK_DOWN_SELF_RECOVERY,
  315. SKIP_DEVICE_BOOT,
  316. USE_CORE_ONLY_FW,
  317. SKIP_RECOVERY,
  318. QMI_BYPASS,
  319. ENABLE_WALTEST,
  320. ENABLE_PCI_LINK_DOWN_PANIC,
  321. FBC_BYPASS,
  322. ENABLE_DAEMON_SUPPORT,
  323. DISABLE_DRV,
  324. DISABLE_IO_COHERENCY,
  325. IGNORE_PCI_LINK_FAILURE,
  326. DISABLE_TIME_SYNC,
  327. QUIRK_MAX_VALUE
  328. };
  329. enum cnss_bdf_type {
  330. CNSS_BDF_BIN,
  331. CNSS_BDF_ELF,
  332. CNSS_BDF_REGDB = 4,
  333. CNSS_BDF_HDS = 6,
  334. };
  335. enum cnss_cal_status {
  336. CNSS_CAL_DONE,
  337. CNSS_CAL_TIMEOUT,
  338. CNSS_CAL_FAILURE,
  339. };
  340. struct cnss_cal_info {
  341. enum cnss_cal_status cal_status;
  342. };
  343. struct cnss_control_params {
  344. unsigned long quirks;
  345. unsigned int mhi_timeout;
  346. unsigned int mhi_m2_timeout;
  347. unsigned int qmi_timeout;
  348. unsigned int bdf_type;
  349. unsigned int time_sync_period;
  350. };
  351. struct cnss_tcs_info {
  352. resource_size_t cmd_base_addr;
  353. void __iomem *cmd_base_addr_io;
  354. };
  355. struct cnss_cpr_info {
  356. resource_size_t tcs_cmd_data_addr;
  357. void __iomem *tcs_cmd_data_addr_io;
  358. u32 cpr_pmic_addr;
  359. u32 voltage;
  360. };
  361. enum cnss_ce_index {
  362. CNSS_CE_00,
  363. CNSS_CE_01,
  364. CNSS_CE_02,
  365. CNSS_CE_03,
  366. CNSS_CE_04,
  367. CNSS_CE_05,
  368. CNSS_CE_06,
  369. CNSS_CE_07,
  370. CNSS_CE_08,
  371. CNSS_CE_09,
  372. CNSS_CE_10,
  373. CNSS_CE_11,
  374. CNSS_CE_COMMON,
  375. };
  376. struct cnss_dms_data {
  377. u32 mac_valid;
  378. u8 mac[QMI_WLFW_MAC_ADDR_SIZE_V01];
  379. };
  380. enum cnss_timeout_type {
  381. CNSS_TIMEOUT_QMI,
  382. CNSS_TIMEOUT_POWER_UP,
  383. CNSS_TIMEOUT_IDLE_RESTART,
  384. CNSS_TIMEOUT_CALIBRATION,
  385. CNSS_TIMEOUT_WLAN_WATCHDOG,
  386. CNSS_TIMEOUT_RDDM,
  387. CNSS_TIMEOUT_RECOVERY,
  388. CNSS_TIMEOUT_DAEMON_CONNECTION,
  389. };
  390. struct cnss_sol_gpio {
  391. int dev_sol_gpio;
  392. int dev_sol_irq;
  393. u32 dev_sol_counter;
  394. int host_sol_gpio;
  395. };
  396. struct cnss_plat_data {
  397. struct platform_device *plat_dev;
  398. void *bus_priv;
  399. enum cnss_dev_bus_type bus_type;
  400. struct list_head vreg_list;
  401. struct list_head clk_list;
  402. struct cnss_pinctrl_info pinctrl_info;
  403. struct cnss_sol_gpio sol_gpio;
  404. #if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART)
  405. struct cnss_subsys_info subsys_info;
  406. #endif
  407. struct cnss_ramdump_info ramdump_info;
  408. struct cnss_ramdump_info_v2 ramdump_info_v2;
  409. #if IS_ENABLED(CONFIG_ESOC)
  410. struct cnss_esoc_info esoc_info;
  411. #endif
  412. struct cnss_interconnect_cfg icc;
  413. struct notifier_block modem_nb;
  414. struct notifier_block reboot_nb;
  415. struct notifier_block panic_nb;
  416. struct cnss_platform_cap cap;
  417. struct pm_qos_request qos_request;
  418. struct cnss_device_version device_version;
  419. u32 rc_num;
  420. unsigned long device_id;
  421. enum cnss_driver_status driver_status;
  422. u32 recovery_count;
  423. u8 recovery_enabled;
  424. u8 recovery_pcss_enabled;
  425. u8 hds_enabled;
  426. unsigned long driver_state;
  427. struct list_head event_list;
  428. spinlock_t event_lock; /* spinlock for driver work event handling */
  429. struct work_struct event_work;
  430. struct workqueue_struct *event_wq;
  431. struct work_struct recovery_work;
  432. struct delayed_work wlan_reg_driver_work;
  433. struct qmi_handle qmi_wlfw;
  434. struct qmi_handle qmi_dms;
  435. struct wlfw_rf_chip_info chip_info;
  436. struct wlfw_rf_board_info board_info;
  437. struct wlfw_soc_info soc_info;
  438. struct wlfw_fw_version_info fw_version_info;
  439. struct cnss_dev_mem_info dev_mem_info[CNSS_MAX_DEV_MEM_NUM];
  440. char fw_build_id[QMI_WLFW_MAX_BUILD_ID_LEN + 1];
  441. u32 otp_version;
  442. u32 fw_mem_seg_len;
  443. struct cnss_fw_mem fw_mem[QMI_WLFW_MAX_NUM_MEM_SEG];
  444. struct cnss_fw_mem m3_mem;
  445. struct cnss_fw_mem *cal_mem;
  446. u64 cal_time;
  447. bool cbc_file_download;
  448. u32 cal_file_size;
  449. struct completion daemon_connected;
  450. u32 qdss_mem_seg_len;
  451. struct cnss_fw_mem qdss_mem[QMI_WLFW_MAX_NUM_MEM_SEG];
  452. u32 *qdss_reg;
  453. struct cnss_pin_connect_result pin_result;
  454. struct dentry *root_dentry;
  455. atomic_t pm_count;
  456. struct timer_list fw_boot_timer;
  457. struct completion power_up_complete;
  458. struct completion cal_complete;
  459. struct mutex dev_lock; /* mutex for register access through debugfs */
  460. struct mutex driver_ops_lock; /* mutex for external driver ops */
  461. struct cnss_wlan_driver *driver_ops;
  462. u32 device_freq_hz;
  463. u32 diag_reg_read_addr;
  464. u32 diag_reg_read_mem_type;
  465. u32 diag_reg_read_len;
  466. u8 *diag_reg_read_buf;
  467. u8 cal_done;
  468. u8 powered_on;
  469. u8 use_fw_path_with_prefix;
  470. char firmware_name[MAX_FIRMWARE_NAME_LEN];
  471. char fw_fallback_name[MAX_FIRMWARE_NAME_LEN];
  472. u8 *sram_dump;
  473. struct completion rddm_complete;
  474. struct completion recovery_complete;
  475. struct cnss_control_params ctrl_params;
  476. struct cnss_cpr_info cpr_info;
  477. u64 antenna;
  478. u64 grant;
  479. struct qmi_handle coex_qmi;
  480. struct qmi_handle ims_qmi;
  481. struct qmi_txn txn;
  482. struct wakeup_source *recovery_ws;
  483. u64 dynamic_feature;
  484. void *get_info_cb_ctx;
  485. int (*get_info_cb)(void *ctx, void *event, int event_len);
  486. bool cbc_enabled;
  487. u8 use_pm_domain;
  488. u8 use_nv_mac;
  489. u8 set_wlaon_pwr_ctrl;
  490. struct cnss_tcs_info tcs_info;
  491. bool fw_pcie_gen_switch;
  492. u8 pcie_gen_speed;
  493. struct cnss_dms_data dms;
  494. int power_up_error;
  495. u32 hw_trc_override;
  496. u8 charger_mode;
  497. struct mbox_client mbox_client_data;
  498. struct mbox_chan *mbox_chan;
  499. const char *vreg_ol_cpr, *vreg_ipa;
  500. const char **pdc_init_table, **vreg_pdc_map, **pmu_vreg_map;
  501. int pdc_init_table_len, vreg_pdc_map_len, pmu_vreg_map_len;
  502. bool adsp_pc_enabled;
  503. u64 feature_list;
  504. u32 is_converged_dt;
  505. u16 hang_event_data_len;
  506. u32 hang_data_addr_offset;
  507. /* bitmap to detect FEM combination */
  508. u8 hwid_bitmap;
  509. enum cnss_driver_mode driver_mode;
  510. uint32_t num_shadow_regs_v3;
  511. };
  512. #if IS_ENABLED(CONFIG_ARCH_QCOM)
  513. static inline u64 cnss_get_host_timestamp(struct cnss_plat_data *plat_priv)
  514. {
  515. u64 ticks = __arch_counter_get_cntvct();
  516. do_div(ticks, TIME_CLOCK_FREQ_HZ / 100000);
  517. return ticks * 10;
  518. }
  519. #else
  520. static inline u64 cnss_get_host_timestamp(struct cnss_plat_data *plat_priv)
  521. {
  522. struct timespec64 ts;
  523. ktime_get_ts64(&ts);
  524. return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
  525. }
  526. #endif
  527. int cnss_wlan_hw_disable_check(struct cnss_plat_data *plat_priv);
  528. int cnss_wlan_hw_enable(void);
  529. struct cnss_plat_data *cnss_get_plat_priv(struct platform_device *plat_dev);
  530. void cnss_pm_stay_awake(struct cnss_plat_data *plat_priv);
  531. void cnss_pm_relax(struct cnss_plat_data *plat_priv);
  532. int cnss_driver_event_post(struct cnss_plat_data *plat_priv,
  533. enum cnss_driver_event_type type,
  534. u32 flags, void *data);
  535. int cnss_get_vreg_type(struct cnss_plat_data *plat_priv,
  536. enum cnss_vreg_type type);
  537. void cnss_put_vreg_type(struct cnss_plat_data *plat_priv,
  538. enum cnss_vreg_type type);
  539. int cnss_vreg_on_type(struct cnss_plat_data *plat_priv,
  540. enum cnss_vreg_type type);
  541. int cnss_vreg_off_type(struct cnss_plat_data *plat_priv,
  542. enum cnss_vreg_type type);
  543. int cnss_get_clk(struct cnss_plat_data *plat_priv);
  544. void cnss_put_clk(struct cnss_plat_data *plat_priv);
  545. int cnss_vreg_unvote_type(struct cnss_plat_data *plat_priv,
  546. enum cnss_vreg_type type);
  547. int cnss_get_pinctrl(struct cnss_plat_data *plat_priv);
  548. int cnss_get_wlan_sw_ctrl(struct cnss_plat_data *plat_priv);
  549. int cnss_power_on_device(struct cnss_plat_data *plat_priv);
  550. void cnss_power_off_device(struct cnss_plat_data *plat_priv);
  551. bool cnss_is_device_powered_on(struct cnss_plat_data *plat_priv);
  552. int cnss_enable_dev_sol_irq(struct cnss_plat_data *plat_priv);
  553. int cnss_disable_dev_sol_irq(struct cnss_plat_data *plat_priv);
  554. int cnss_get_dev_sol_value(struct cnss_plat_data *plat_priv);
  555. int cnss_init_dev_sol_irq(struct cnss_plat_data *plat_priv);
  556. int cnss_deinit_dev_sol_irq(struct cnss_plat_data *plat_priv);
  557. int cnss_set_host_sol_value(struct cnss_plat_data *plat_priv, int value);
  558. int cnss_get_host_sol_value(struct cnss_plat_data *plat_priv);
  559. int cnss_register_subsys(struct cnss_plat_data *plat_priv);
  560. void cnss_unregister_subsys(struct cnss_plat_data *plat_priv);
  561. int cnss_register_ramdump(struct cnss_plat_data *plat_priv);
  562. void cnss_unregister_ramdump(struct cnss_plat_data *plat_priv);
  563. int cnss_do_ramdump(struct cnss_plat_data *plat_priv);
  564. int cnss_do_elf_ramdump(struct cnss_plat_data *plat_priv);
  565. void cnss_set_pin_connect_status(struct cnss_plat_data *plat_priv);
  566. int cnss_get_cpr_info(struct cnss_plat_data *plat_priv);
  567. int cnss_update_cpr_info(struct cnss_plat_data *plat_priv);
  568. int cnss_va_to_pa(struct device *dev, size_t size, void *va, dma_addr_t dma,
  569. phys_addr_t *pa, unsigned long attrs);
  570. int cnss_minidump_add_region(struct cnss_plat_data *plat_priv,
  571. enum cnss_fw_dump_type type, int seg_no,
  572. void *va, phys_addr_t pa, size_t size);
  573. int cnss_minidump_remove_region(struct cnss_plat_data *plat_priv,
  574. enum cnss_fw_dump_type type, int seg_no,
  575. void *va, phys_addr_t pa, size_t size);
  576. int cnss_enable_int_pow_amp_vreg(struct cnss_plat_data *plat_priv);
  577. int cnss_get_tcs_info(struct cnss_plat_data *plat_priv);
  578. unsigned int cnss_get_timeout(struct cnss_plat_data *plat_priv,
  579. enum cnss_timeout_type);
  580. int cnss_aop_mbox_init(struct cnss_plat_data *plat_priv);
  581. int cnss_aop_pdc_reconfig(struct cnss_plat_data *plat_priv);
  582. int cnss_aop_send_msg(struct cnss_plat_data *plat_priv, char *msg);
  583. void cnss_power_misc_params_init(struct cnss_plat_data *plat_priv);
  584. int cnss_aop_ol_cpr_cfg_setup(struct cnss_plat_data *plat_priv,
  585. struct wlfw_pmu_cfg_v01 *fw_pmu_cfg);
  586. int cnss_request_firmware_direct(struct cnss_plat_data *plat_priv,
  587. const struct firmware **fw_entry,
  588. const char *filename);
  589. int cnss_set_feature_list(struct cnss_plat_data *plat_priv,
  590. enum cnss_feature_v01 feature);
  591. int cnss_clear_feature_list(struct cnss_plat_data *plat_priv,
  592. enum cnss_feature_v01 feature);
  593. int cnss_get_feature_list(struct cnss_plat_data *plat_priv,
  594. u64 *feature_list);
  595. int cnss_get_input_gpio_value(struct cnss_plat_data *plat_priv, int gpio_num);
  596. bool cnss_check_driver_loading_allowed(void);
  597. #endif /* _CNSS_MAIN_H */