drivers/net/wireless/realtek/rtw89/sar.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/sar.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/sar.c- Extension
.c- Size
- 24305 bytes
- Lines
- 912
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
acpi.hdebug.hfw.hphy.hreg.hsar.hutil.h
Detected Declarations
function rtw89_sar_get_subbandfunction rtw89_query_sar_config_commonfunction rtw89_sar_cfg_acpi_get_entfunction rtw89_sar_cfg_acpi_get_minfunction rtw89_query_sar_config_acpifunction rtw89_txpwr_sar_to_macfunction rtw89_txpwr_tas_to_sarfunction rtw89_txpwr_sar_to_tasfunction rtw89_tas_is_activefunction rtw89_for_each_rtwviffunction rtw89_query_sarfunction rtw89_print_sarfunction rtw89_print_tasfunction rtw89_apply_sar_commonfunction rtw89_ops_set_sar_specsfunction rtw89_apply_sar_acpifunction rtw89_set_sar_from_acpifunction rtw89_tas_query_sar_configfunction __rtw89_tas_state_updatefunction rtw89_tas_state_updatefunction rtw89_tas_get_window_sizefunction rtw89_tas_window_updatefunction rtw89_tas_history_updatefunction rtw89_tas_rolling_averagefunction rtw89_tas_initfunction rtw89_tas_resetfunction rtw89_tas_trackfunction rtw89_tas_scanfunction rtw89_tas_chanctx_cbfunction rtw89_tas_fw_timer_enablefunction rtw89_sar_initfunction rtw89_sar_track_acpifunction rtw89_sar_trackexport rtw89_query_sarexport rtw89_tas_chanctx_cb
Annotated Snippet
if (sar_parm->force_path) {
switch (sar_parm->path) {
default:
case RF_PATH_A:
*cfg = cfg_a;
break;
case RF_PATH_B:
*cfg = cfg_b;
break;
}
} else {
*cfg = max(cfg_a, cfg_b);
}
} else {
*cfg = min(cfg_a, cfg_b);
}
if (sar_parm->ntx == RTW89_2TX)
*cfg -= rtwsar->downgrade_2tx;
return 0;
}
static const
struct rtw89_sar_handler rtw89_sar_handlers[RTW89_SAR_SOURCE_NR] = {
[RTW89_SAR_SOURCE_COMMON] = {
.descr_sar_source = "RTW89_SAR_SOURCE_COMMON",
.txpwr_factor_sar = 2,
.query_sar_config = rtw89_query_sar_config_common,
},
[RTW89_SAR_SOURCE_ACPI] = {
.descr_sar_source = "RTW89_SAR_SOURCE_ACPI",
.txpwr_factor_sar = TXPWR_FACTOR_OF_RTW89_ACPI_SAR,
.query_sar_config = rtw89_query_sar_config_acpi,
},
};
#define rtw89_sar_set_src(_dev, _src, _cfg_name, _cfg_data) \
do { \
typeof(_src) _s = (_src); \
typeof(_dev) _d = (_dev); \
BUILD_BUG_ON(!rtw89_sar_handlers[_s].descr_sar_source); \
BUILD_BUG_ON(!rtw89_sar_handlers[_s].query_sar_config); \
if (test_bit(RTW89_FLAG_PROBE_DONE, _d->flags)) \
lockdep_assert_wiphy(_d->hw->wiphy); \
_d->sar._cfg_name = *(_cfg_data); \
_d->sar.src = _s; \
} while (0)
static s8 rtw89_txpwr_sar_to_mac(struct rtw89_dev *rtwdev, u8 fct, s32 cfg)
{
const u8 fct_mac = rtwdev->chip->txpwr_factor_mac;
s32 cfg_mac;
cfg_mac = fct > fct_mac ?
cfg >> (fct - fct_mac) : cfg << (fct_mac - fct);
return (s8)clamp_t(s32, cfg_mac,
RTW89_SAR_TXPWR_MAC_MIN,
RTW89_SAR_TXPWR_MAC_MAX);
}
static s32 rtw89_txpwr_tas_to_sar(const struct rtw89_sar_handler *sar_hdl,
s32 cfg)
{
const u8 fct = sar_hdl->txpwr_factor_sar;
if (fct > RTW89_TAS_FACTOR)
return cfg << (fct - RTW89_TAS_FACTOR);
else
return cfg >> (RTW89_TAS_FACTOR - fct);
}
static s32 rtw89_txpwr_sar_to_tas(const struct rtw89_sar_handler *sar_hdl,
s32 cfg)
{
const u8 fct = sar_hdl->txpwr_factor_sar;
if (fct > RTW89_TAS_FACTOR)
return cfg >> (fct - RTW89_TAS_FACTOR);
else
return cfg << (RTW89_TAS_FACTOR - fct);
}
static bool rtw89_tas_is_active(struct rtw89_dev *rtwdev)
{
struct rtw89_tas_info *tas = &rtwdev->tas;
struct rtw89_vif *rtwvif;
if (!tas->enable)
Annotation
- Immediate include surface: `acpi.h`, `debug.h`, `fw.h`, `phy.h`, `reg.h`, `sar.h`, `util.h`.
- Detected declarations: `function rtw89_sar_get_subband`, `function rtw89_query_sar_config_common`, `function rtw89_sar_cfg_acpi_get_ent`, `function rtw89_sar_cfg_acpi_get_min`, `function rtw89_query_sar_config_acpi`, `function rtw89_txpwr_sar_to_mac`, `function rtw89_txpwr_tas_to_sar`, `function rtw89_txpwr_sar_to_tas`, `function rtw89_tas_is_active`, `function rtw89_for_each_rtwvif`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.