drm: bridge: adv7511: remove s32 format from i2s capabilities
[drm/drm-misc.git] / drivers / net / wireless / ath / ath12k / hif.h
blobe8840fab6061c7e5372bff8de438ec9f0c46f07b
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3 * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
7 #ifndef ATH12K_HIF_H
8 #define ATH12K_HIF_H
10 #include "core.h"
12 struct ath12k_hif_ops {
13 u32 (*read32)(struct ath12k_base *ab, u32 address);
14 void (*write32)(struct ath12k_base *ab, u32 address, u32 data);
15 void (*irq_enable)(struct ath12k_base *ab);
16 void (*irq_disable)(struct ath12k_base *ab);
17 int (*start)(struct ath12k_base *ab);
18 void (*stop)(struct ath12k_base *ab);
19 int (*power_up)(struct ath12k_base *ab);
20 void (*power_down)(struct ath12k_base *ab, bool is_suspend);
21 int (*suspend)(struct ath12k_base *ab);
22 int (*resume)(struct ath12k_base *ab);
23 int (*map_service_to_pipe)(struct ath12k_base *ab, u16 service_id,
24 u8 *ul_pipe, u8 *dl_pipe);
25 int (*get_user_msi_vector)(struct ath12k_base *ab, char *user_name,
26 int *num_vectors, u32 *user_base_data,
27 u32 *base_vector);
28 void (*get_msi_address)(struct ath12k_base *ab, u32 *msi_addr_lo,
29 u32 *msi_addr_hi);
30 void (*ce_irq_enable)(struct ath12k_base *ab);
31 void (*ce_irq_disable)(struct ath12k_base *ab);
32 void (*get_ce_msi_idx)(struct ath12k_base *ab, u32 ce_id, u32 *msi_idx);
33 int (*panic_handler)(struct ath12k_base *ab);
34 void (*coredump_download)(struct ath12k_base *ab);
37 static inline int ath12k_hif_map_service_to_pipe(struct ath12k_base *ab, u16 service_id,
38 u8 *ul_pipe, u8 *dl_pipe)
40 return ab->hif.ops->map_service_to_pipe(ab, service_id,
41 ul_pipe, dl_pipe);
44 static inline int ath12k_hif_get_user_msi_vector(struct ath12k_base *ab,
45 char *user_name,
46 int *num_vectors,
47 u32 *user_base_data,
48 u32 *base_vector)
50 if (!ab->hif.ops->get_user_msi_vector)
51 return -EOPNOTSUPP;
53 return ab->hif.ops->get_user_msi_vector(ab, user_name, num_vectors,
54 user_base_data,
55 base_vector);
58 static inline void ath12k_hif_get_msi_address(struct ath12k_base *ab,
59 u32 *msi_addr_lo,
60 u32 *msi_addr_hi)
62 if (!ab->hif.ops->get_msi_address)
63 return;
65 ab->hif.ops->get_msi_address(ab, msi_addr_lo, msi_addr_hi);
68 static inline void ath12k_hif_get_ce_msi_idx(struct ath12k_base *ab, u32 ce_id,
69 u32 *msi_data_idx)
71 if (ab->hif.ops->get_ce_msi_idx)
72 ab->hif.ops->get_ce_msi_idx(ab, ce_id, msi_data_idx);
73 else
74 *msi_data_idx = ce_id;
77 static inline void ath12k_hif_ce_irq_enable(struct ath12k_base *ab)
79 if (ab->hif.ops->ce_irq_enable)
80 ab->hif.ops->ce_irq_enable(ab);
83 static inline void ath12k_hif_ce_irq_disable(struct ath12k_base *ab)
85 if (ab->hif.ops->ce_irq_disable)
86 ab->hif.ops->ce_irq_disable(ab);
89 static inline void ath12k_hif_irq_enable(struct ath12k_base *ab)
91 ab->hif.ops->irq_enable(ab);
94 static inline void ath12k_hif_irq_disable(struct ath12k_base *ab)
96 ab->hif.ops->irq_disable(ab);
99 static inline int ath12k_hif_suspend(struct ath12k_base *ab)
101 if (ab->hif.ops->suspend)
102 return ab->hif.ops->suspend(ab);
104 return 0;
107 static inline int ath12k_hif_resume(struct ath12k_base *ab)
109 if (ab->hif.ops->resume)
110 return ab->hif.ops->resume(ab);
112 return 0;
115 static inline int ath12k_hif_start(struct ath12k_base *ab)
117 return ab->hif.ops->start(ab);
120 static inline void ath12k_hif_stop(struct ath12k_base *ab)
122 ab->hif.ops->stop(ab);
125 static inline u32 ath12k_hif_read32(struct ath12k_base *ab, u32 address)
127 return ab->hif.ops->read32(ab, address);
130 static inline void ath12k_hif_write32(struct ath12k_base *ab, u32 address,
131 u32 data)
133 ab->hif.ops->write32(ab, address, data);
136 static inline int ath12k_hif_power_up(struct ath12k_base *ab)
138 if (!ab->hif.ops->power_up)
139 return -EOPNOTSUPP;
141 return ab->hif.ops->power_up(ab);
144 static inline void ath12k_hif_power_down(struct ath12k_base *ab, bool is_suspend)
146 if (!ab->hif.ops->power_down)
147 return;
149 ab->hif.ops->power_down(ab, is_suspend);
152 static inline int ath12k_hif_panic_handler(struct ath12k_base *ab)
154 if (!ab->hif.ops->panic_handler)
155 return NOTIFY_DONE;
157 return ab->hif.ops->panic_handler(ab);
160 static inline void ath12k_hif_coredump_download(struct ath12k_base *ab)
162 if (ab->hif.ops->coredump_download)
163 ab->hif.ops->coredump_download(ab);
165 #endif /* ATH12K_HIF_H */