Path: blob/main/sys/contrib/dev/athk/ath12k/dbring.h
48378 views
/* SPDX-License-Identifier: BSD-3-Clause-Clear */1/*2* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.3* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.4*/56#ifndef ATH12K_DBRING_H7#define ATH12K_DBRING_H89#include <linux/types.h>10#include <linux/idr.h>11#include <linux/spinlock.h>12#include "dp.h"1314struct ath12k_dbring_element {15dma_addr_t paddr;16u8 payload[];17};1819struct ath12k_dbring_data {20void *data;21u32 data_sz;22struct ath12k_wmi_dma_buf_release_meta_data_params meta;23};2425struct ath12k_dbring_buf_release_event {26struct ath12k_wmi_dma_buf_release_fixed_params fixed;27const struct ath12k_wmi_dma_buf_release_entry_params *buf_entry;28const struct ath12k_wmi_dma_buf_release_meta_data_params *meta_data;29u32 num_buf_entry;30u32 num_meta;31};3233struct ath12k_dbring_cap {34u32 pdev_id;35enum wmi_direct_buffer_module id;36u32 min_elem;37u32 min_buf_sz;38u32 min_buf_align;39};4041struct ath12k_dbring {42struct dp_srng refill_srng;43struct idr bufs_idr;44/* Protects bufs_idr */45spinlock_t idr_lock;46dma_addr_t tp_addr;47dma_addr_t hp_addr;48int bufs_max;49u32 pdev_id;50u32 buf_sz;51u32 buf_align;52u32 num_resp_per_event;53u32 event_timeout_ms;54int (*handler)(struct ath12k *ar, struct ath12k_dbring_data *data);55};5657int ath12k_dbring_set_cfg(struct ath12k *ar,58struct ath12k_dbring *ring,59u32 num_resp_per_event,60u32 event_timeout_ms,61int (*handler)(struct ath12k *,62struct ath12k_dbring_data *));63int ath12k_dbring_wmi_cfg_setup(struct ath12k *ar,64struct ath12k_dbring *ring,65enum wmi_direct_buffer_module id);66int ath12k_dbring_buf_setup(struct ath12k *ar,67struct ath12k_dbring *ring,68struct ath12k_dbring_cap *db_cap);69int ath12k_dbring_srng_setup(struct ath12k *ar, struct ath12k_dbring *ring,70int ring_num, int num_entries);71int ath12k_dbring_buffer_release_event(struct ath12k_base *ab,72struct ath12k_dbring_buf_release_event *ev);73int ath12k_dbring_get_cap(struct ath12k_base *ab,74u8 pdev_idx,75enum wmi_direct_buffer_module id,76struct ath12k_dbring_cap *db_cap);77void ath12k_dbring_srng_cleanup(struct ath12k *ar, struct ath12k_dbring *ring);78void ath12k_dbring_buf_cleanup(struct ath12k *ar, struct ath12k_dbring *ring);79#endif /* ATH12K_DBRING_H */808182