1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/wireless/realtek/rtw89/util.h
Ping-Ke Shih 1b00e9236a rtw89: 8852c: add set channel of BB part
BB does many settings during setting channel. First is to configure CCK
for 2G channels, and then basic channel and bandwidth settings with a
encoded channel index that will report to driver when we receive packets.
Configure spur elimination to avoid spur of CSI and NBI tones in certain
frequencies. Also, it initializes BT grant to arrange path sharing with
BT according to band. Finally, reset TSSI and BB hardware to ensure it
stays in initial state.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220414062027.62638-12-pkshih@realtek.com
2022-04-23 15:44:51 +03:00

47 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
* Copyright(c) 2019-2020 Realtek Corporation
*/
#ifndef __RTW89_UTIL_H__
#define __RTW89_UTIL_H__
#include "core.h"
#define rtw89_iterate_vifs_bh(rtwdev, iterator, data) \
ieee80211_iterate_active_interfaces_atomic((rtwdev)->hw, \
IEEE80211_IFACE_ITER_NORMAL, iterator, data)
/* call this function with rtwdev->mutex is held */
#define rtw89_for_each_rtwvif(rtwdev, rtwvif) \
list_for_each_entry(rtwvif, &(rtwdev)->rtwvifs_list, list)
/* The result of negative dividend and positive divisor is undefined, but it
* should be one case of round-down or round-up. So, make it round-down if the
* result is round-up.
* Note: the maximum value of divisor is 0x7FFF_FFFF, because we cast it to
* signed value to make compiler to use signed divide instruction.
*/
static inline s32 s32_div_u32_round_down(s32 dividend, u32 divisor, s32 *remainder)
{
s32 i_divisor = (s32)divisor;
s32 i_remainder;
s32 quotient;
quotient = dividend / i_divisor;
i_remainder = dividend % i_divisor;
if (i_remainder < 0) {
quotient--;
i_remainder += i_divisor;
}
if (remainder)
*remainder = i_remainder;
return quotient;
}
static inline s32 s32_div_u32_round_closest(s32 dividend, u32 divisor)
{
return s32_div_u32_round_down(dividend + divisor / 2, divisor, NULL);
}
#endif