1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
7 #ifndef ATH12K_DBRING_H
8 #define ATH12K_DBRING_H
10 #include <linux/types.h>
11 #include <linux/idr.h>
12 #include <linux/spinlock.h>
15 struct ath12k_dbring_element {
20 struct ath12k_dbring_data {
23 struct ath12k_wmi_dma_buf_release_meta_data_params meta;
26 struct ath12k_dbring_buf_release_event {
27 struct ath12k_wmi_dma_buf_release_fixed_params fixed;
28 const struct ath12k_wmi_dma_buf_release_entry_params *buf_entry;
29 const struct ath12k_wmi_dma_buf_release_meta_data_params *meta_data;
34 struct ath12k_dbring_cap {
36 enum wmi_direct_buffer_module id;
42 struct ath12k_dbring {
43 struct dp_srng refill_srng;
45 /* Protects bufs_idr */
53 u32 num_resp_per_event;
55 int (*handler)(struct ath12k *ar, struct ath12k_dbring_data *data);
58 int ath12k_dbring_set_cfg(struct ath12k *ar,
59 struct ath12k_dbring *ring,
60 u32 num_resp_per_event,
62 int (*handler)(struct ath12k *,
63 struct ath12k_dbring_data *));
64 int ath12k_dbring_wmi_cfg_setup(struct ath12k *ar,
65 struct ath12k_dbring *ring,
66 enum wmi_direct_buffer_module id);
67 int ath12k_dbring_buf_setup(struct ath12k *ar,
68 struct ath12k_dbring *ring,
69 struct ath12k_dbring_cap *db_cap);
70 int ath12k_dbring_srng_setup(struct ath12k *ar, struct ath12k_dbring *ring,
71 int ring_num, int num_entries);
72 int ath12k_dbring_buffer_release_event(struct ath12k_base *ab,
73 struct ath12k_dbring_buf_release_event *ev);
74 int ath12k_dbring_get_cap(struct ath12k_base *ab,
76 enum wmi_direct_buffer_module id,
77 struct ath12k_dbring_cap *db_cap);
78 void ath12k_dbring_srng_cleanup(struct ath12k *ar, struct ath12k_dbring *ring);
79 void ath12k_dbring_buf_cleanup(struct ath12k *ar, struct ath12k_dbring *ring);
80 #endif /* ATH12K_DBRING_H */