xref: /wlan-driver/platform/cnss_utils/cnss_plat_ipc_qmi.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  */
5 
6 #ifndef _CNSS_PLAT_IPC_QMI_H
7 #define _CNSS_PLAT_IPC_QMI_H
8 
9 #include "cnss_plat_ipc_service_v01.h"
10 
11 /* As the value of CNSS_PLAT_IPC_MAX_QMI_CLIENTS will keep changing
12  * addition of new QMI client, it cannot be kept in IDL as change in
13  * existing value can cause backward compatibily issue. Keep it here
14  * and update its value with new QMI client ID added in enum in IDL.
15  */
16 #define CNSS_PLAT_IPC_MAX_QMI_CLIENTS CNSS_PLAT_IPC_DAEMON_QMI_CLIENT_V01
17 
18 /**
19  * cnss_plat_ipc_daemon_config: Config options provided by cnss-daemon
20  * @initialized: Set when daemon configs are initialized
21  * @dms_mac_addr_supported: DMS MAC address provisioning support
22  * @qdss_hw_trace_override: QDSS config for HW trace enable
23  * @cal_file_available_bitmask: Calibration file available
24  */
25 struct cnss_plat_ipc_daemon_config {
26 	u8 initialized;
27 	u8 dms_mac_addr_supported;
28 	u8 qdss_hw_trace_override;
29 	u32 cal_file_available_bitmask;
30 };
31 
32 typedef void (*cnss_plat_ipc_connection_update)(void *cb_ctx,
33 						bool connection_status);
34 
35 /**
36  * Persistent caldb file store which is a runtime FW param based feature will
37  * fail if CONFIG_CNSS_PLAT_IPC_QMI_SVC  is not enabled.
38  **/
39 #if IS_ENABLED(CONFIG_CNSS_PLAT_IPC_QMI_SVC)
40 int cnss_plat_ipc_register(enum cnss_plat_ipc_qmi_client_id_v01 client_id,
41 			   cnss_plat_ipc_connection_update
42 			   connection_update_cb, void *cb_ctx);
43 void cnss_plat_ipc_unregister(enum cnss_plat_ipc_qmi_client_id_v01 client_id,
44 			      void *cb_ctx);
45 int cnss_plat_ipc_qmi_file_download(enum cnss_plat_ipc_qmi_client_id_v01
46 				    client_id, char *file_name, char *buf,
47 				    u32 *size);
48 int cnss_plat_ipc_qmi_file_upload(enum cnss_plat_ipc_qmi_client_id_v01
49 				  client_id, char *file_name, u8 *file_buf,
50 				  u32 file_size);
51 struct cnss_plat_ipc_daemon_config *cnss_plat_ipc_qmi_daemon_config(void);
52 #else
53 static inline
cnss_plat_ipc_register(enum cnss_plat_ipc_qmi_client_id_v01 client_id,cnss_plat_ipc_connection_update connection_update_cb,void * cb_ctx)54 int cnss_plat_ipc_register(enum cnss_plat_ipc_qmi_client_id_v01 client_id,
55 			   cnss_plat_ipc_connection_update
56 			   connection_update_cb, void *cb_ctx)
57 {
58 	return 0;
59 }
60 
61 static inline
cnss_plat_ipc_unregister(enum cnss_plat_ipc_qmi_client_id_v01 client_id,void * cb_ctx)62 void cnss_plat_ipc_unregister(enum cnss_plat_ipc_qmi_client_id_v01 client_id,
63 			      void *cb_ctx)
64 {
65 }
66 
67 static inline
cnss_plat_ipc_qmi_file_download(enum cnss_plat_ipc_qmi_client_id_v01 client_id,char * file_name,char * buf,u32 * size)68 int cnss_plat_ipc_qmi_file_download(enum cnss_plat_ipc_qmi_client_id_v01
69 				    client_id, char *file_name, char *buf,
70 				    u32 *size)
71 {
72 	return -EOPNOTSUPP;
73 }
74 
75 static inline
cnss_plat_ipc_qmi_file_upload(enum cnss_plat_ipc_qmi_client_id_v01 client_id,char * file_name,u8 * file_buf,u32 file_size)76 int cnss_plat_ipc_qmi_file_upload(enum cnss_plat_ipc_qmi_client_id_v01
77 				  client_id, char *file_name, u8 *file_buf,
78 				  u32 file_size)
79 {
80 	return -EOPNOTSUPP;
81 }
82 
83 static inline
cnss_plat_ipc_qmi_daemon_config(void)84 struct cnss_plat_ipc_daemon_config *cnss_plat_ipc_qmi_daemon_config(void)
85 {
86 	return NULL;
87 }
88 
89 #endif
90 #endif
91