1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
6 #ifndef ATH11K_DBRING_H
7 #define ATH11K_DBRING_H
9 #include <linux/types.h>
10 #include <linux/idr.h>
11 #include <linux/spinlock.h>
14 struct ath11k_dbring_element
{
19 struct ath11k_dbring_data
{
22 struct wmi_dma_buf_release_meta_data meta
;
25 struct ath11k_dbring_buf_release_event
{
26 struct ath11k_wmi_dma_buf_release_fixed_param fixed
;
27 struct wmi_dma_buf_release_entry
*buf_entry
;
28 struct wmi_dma_buf_release_meta_data
*meta_data
;
33 struct ath11k_dbring_cap
{
35 enum wmi_direct_buffer_module id
;
41 struct ath11k_dbring
{
42 struct dp_srng refill_srng
;
44 /* Protects bufs_idr */
52 u32 num_resp_per_event
;
54 int (*handler
)(struct ath11k
*, struct ath11k_dbring_data
*);
57 int ath11k_dbring_set_cfg(struct ath11k
*ar
,
58 struct ath11k_dbring
*ring
,
59 u32 num_resp_per_event
,
61 int (*handler
)(struct ath11k
*,
62 struct ath11k_dbring_data
*));
63 int ath11k_dbring_wmi_cfg_setup(struct ath11k
*ar
,
64 struct ath11k_dbring
*ring
,
65 enum wmi_direct_buffer_module id
);
66 int ath11k_dbring_buf_setup(struct ath11k
*ar
,
67 struct ath11k_dbring
*ring
,
68 struct ath11k_dbring_cap
*db_cap
);
69 int ath11k_dbring_srng_setup(struct ath11k
*ar
, struct ath11k_dbring
*ring
,
70 int ring_num
, int num_entries
);
71 int ath11k_dbring_buffer_release_event(struct ath11k_base
*ab
,
72 struct ath11k_dbring_buf_release_event
*ev
);
73 int ath11k_dbring_get_cap(struct ath11k_base
*ab
,
75 enum wmi_direct_buffer_module id
,
76 struct ath11k_dbring_cap
*db_cap
);
77 void ath11k_dbring_srng_cleanup(struct ath11k
*ar
, struct ath11k_dbring
*ring
);
78 void ath11k_dbring_buf_cleanup(struct ath11k
*ar
, struct ath11k_dbring
*ring
);
79 #endif /* ATH11K_DBRING_H */