gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / net / wireless / ti / wlcore / hw_ops.h
blob0cd8723075269bce9dc36aa1e959e3a8382911c3
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * This file is part of wlcore
5 * Copyright (C) 2011 Texas Instruments Inc.
6 */
8 #ifndef __WLCORE_HW_OPS_H__
9 #define __WLCORE_HW_OPS_H__
11 #include "wlcore.h"
12 #include "rx.h"
14 static inline u32
15 wlcore_hw_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
17 if (!wl->ops->calc_tx_blocks)
18 BUG_ON(1);
20 return wl->ops->calc_tx_blocks(wl, len, spare_blks);
23 static inline void
24 wlcore_hw_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
25 u32 blks, u32 spare_blks)
27 if (!wl->ops->set_tx_desc_blocks)
28 BUG_ON(1);
30 return wl->ops->set_tx_desc_blocks(wl, desc, blks, spare_blks);
33 static inline void
34 wlcore_hw_set_tx_desc_data_len(struct wl1271 *wl,
35 struct wl1271_tx_hw_descr *desc,
36 struct sk_buff *skb)
38 if (!wl->ops->set_tx_desc_data_len)
39 BUG_ON(1);
41 wl->ops->set_tx_desc_data_len(wl, desc, skb);
44 static inline enum wl_rx_buf_align
45 wlcore_hw_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc)
48 if (!wl->ops->get_rx_buf_align)
49 BUG_ON(1);
51 return wl->ops->get_rx_buf_align(wl, rx_desc);
54 static inline int
55 wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len)
57 if (wl->ops->prepare_read)
58 return wl->ops->prepare_read(wl, rx_desc, len);
60 return 0;
63 static inline u32
64 wlcore_hw_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len)
66 if (!wl->ops->get_rx_packet_len)
67 BUG_ON(1);
69 return wl->ops->get_rx_packet_len(wl, rx_data, data_len);
72 static inline int wlcore_hw_tx_delayed_compl(struct wl1271 *wl)
74 if (wl->ops->tx_delayed_compl)
75 return wl->ops->tx_delayed_compl(wl);
77 return 0;
80 static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl)
82 if (wl->ops->tx_immediate_compl)
83 wl->ops->tx_immediate_compl(wl);
86 static inline int
87 wlcore_hw_init_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif)
89 if (wl->ops->init_vif)
90 return wl->ops->init_vif(wl, wlvif);
92 return 0;
95 static inline void
96 wlcore_hw_convert_fw_status(struct wl1271 *wl, void *raw_fw_status,
97 struct wl_fw_status *fw_status)
99 BUG_ON(!wl->ops->convert_fw_status);
101 wl->ops->convert_fw_status(wl, raw_fw_status, fw_status);
104 static inline u32
105 wlcore_hw_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif)
107 if (!wl->ops->sta_get_ap_rate_mask)
108 BUG_ON(1);
110 return wl->ops->sta_get_ap_rate_mask(wl, wlvif);
113 static inline int wlcore_identify_fw(struct wl1271 *wl)
115 if (wl->ops->identify_fw)
116 return wl->ops->identify_fw(wl);
118 return 0;
121 static inline void
122 wlcore_hw_set_tx_desc_csum(struct wl1271 *wl,
123 struct wl1271_tx_hw_descr *desc,
124 struct sk_buff *skb)
126 if (!wl->ops->set_tx_desc_csum)
127 BUG_ON(1);
129 wl->ops->set_tx_desc_csum(wl, desc, skb);
132 static inline void
133 wlcore_hw_set_rx_csum(struct wl1271 *wl,
134 struct wl1271_rx_descriptor *desc,
135 struct sk_buff *skb)
137 if (wl->ops->set_rx_csum)
138 wl->ops->set_rx_csum(wl, desc, skb);
141 static inline u32
142 wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
143 struct wl12xx_vif *wlvif)
145 if (wl->ops->ap_get_mimo_wide_rate_mask)
146 return wl->ops->ap_get_mimo_wide_rate_mask(wl, wlvif);
148 return 0;
151 static inline int
152 wlcore_debugfs_init(struct wl1271 *wl, struct dentry *rootdir)
154 if (wl->ops->debugfs_init)
155 return wl->ops->debugfs_init(wl, rootdir);
157 return 0;
160 static inline int
161 wlcore_handle_static_data(struct wl1271 *wl, void *static_data)
163 if (wl->ops->handle_static_data)
164 return wl->ops->handle_static_data(wl, static_data);
166 return 0;
169 static inline int
170 wlcore_hw_get_spare_blocks(struct wl1271 *wl, bool is_gem)
172 if (!wl->ops->get_spare_blocks)
173 BUG_ON(1);
175 return wl->ops->get_spare_blocks(wl, is_gem);
178 static inline int
179 wlcore_hw_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
180 struct ieee80211_vif *vif,
181 struct ieee80211_sta *sta,
182 struct ieee80211_key_conf *key_conf)
184 if (!wl->ops->set_key)
185 BUG_ON(1);
187 return wl->ops->set_key(wl, cmd, vif, sta, key_conf);
190 static inline u32
191 wlcore_hw_pre_pkt_send(struct wl1271 *wl, u32 buf_offset, u32 last_len)
193 if (wl->ops->pre_pkt_send)
194 return wl->ops->pre_pkt_send(wl, buf_offset, last_len);
196 return buf_offset;
199 static inline void
200 wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif)
202 if (wl->ops->sta_rc_update)
203 wl->ops->sta_rc_update(wl, wlvif);
206 static inline int
207 wlcore_hw_interrupt_notify(struct wl1271 *wl, bool action)
209 if (wl->ops->interrupt_notify)
210 return wl->ops->interrupt_notify(wl, action);
211 return 0;
214 static inline int
215 wlcore_hw_rx_ba_filter(struct wl1271 *wl, bool action)
217 if (wl->ops->rx_ba_filter)
218 return wl->ops->rx_ba_filter(wl, action);
219 return 0;
222 static inline int
223 wlcore_hw_ap_sleep(struct wl1271 *wl)
225 if (wl->ops->ap_sleep)
226 return wl->ops->ap_sleep(wl);
228 return 0;
231 static inline int
232 wlcore_hw_set_peer_cap(struct wl1271 *wl,
233 struct ieee80211_sta_ht_cap *ht_cap,
234 bool allow_ht_operation,
235 u32 rate_set, u8 hlid)
237 if (wl->ops->set_peer_cap)
238 return wl->ops->set_peer_cap(wl, ht_cap, allow_ht_operation,
239 rate_set, hlid);
241 return 0;
244 static inline u32
245 wlcore_hw_convert_hwaddr(struct wl1271 *wl, u32 hwaddr)
247 if (!wl->ops->convert_hwaddr)
248 BUG_ON(1);
250 return wl->ops->convert_hwaddr(wl, hwaddr);
253 static inline bool
254 wlcore_hw_lnk_high_prio(struct wl1271 *wl, u8 hlid,
255 struct wl1271_link *lnk)
257 if (!wl->ops->lnk_high_prio)
258 BUG_ON(1);
260 return wl->ops->lnk_high_prio(wl, hlid, lnk);
263 static inline bool
264 wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
265 struct wl1271_link *lnk)
267 if (!wl->ops->lnk_low_prio)
268 BUG_ON(1);
270 return wl->ops->lnk_low_prio(wl, hlid, lnk);
273 static inline int
274 wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
276 if (!wl->ops->smart_config_start)
277 return -EINVAL;
279 return wl->ops->smart_config_start(wl, group_bitmap);
282 static inline int
283 wlcore_smart_config_stop(struct wl1271 *wl)
285 if (!wl->ops->smart_config_stop)
286 return -EINVAL;
288 return wl->ops->smart_config_stop(wl);
291 static inline int
292 wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
293 u8 key_len, u8 *key)
295 if (!wl->ops->smart_config_set_group_key)
296 return -EINVAL;
298 return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
301 static inline int
302 wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
304 if (!wl->ops->set_cac)
305 return -EINVAL;
307 return wl->ops->set_cac(wl, wlvif, start);
310 static inline int
311 wlcore_hw_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
313 if (!wl->ops->dfs_master_restart)
314 return -EINVAL;
316 return wl->ops->dfs_master_restart(wl, wlvif);
318 #endif