drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c- Extension
.c- Size
- 10478 bytes
- Lines
- 438
- 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
linux/slab.hlinux/string.hlinux/export.hiwl-drv.hiwl-phy-db.hiwl-debug.hiwl-op-mode.hiwl-trans.h
Detected Declarations
struct iwl_phy_db_entrystruct iwl_phy_dbstruct iwl_phy_db_chg_txpenum iwl_phy_db_section_typefunction iwl_phy_db_get_sectionfunction iwl_phy_db_free_sectionfunction iwl_phy_db_freefunction iwl_phy_db_set_sectionfunction is_valid_channelfunction ch_id_to_ch_indexfunction channel_id_to_papdfunction channel_id_to_txpfunction iwl_phy_db_get_section_datafunction iwl_send_phy_db_cmdfunction iwl_phy_db_send_all_channel_groupsfunction iwl_send_phy_db_data
Annotated Snippet
struct iwl_phy_db_entry {
u16 size;
u8 *data;
};
/**
* struct iwl_phy_db - stores phy configuration and calibration data.
*
* @cfg: phy configuration.
* @calib_nch: non channel specific calibration data.
* @n_group_papd: number of entries in papd channel group.
* @calib_ch_group_papd: calibration data related to papd channel group.
* @n_group_txp: number of entries in tx power channel group.
* @calib_ch_group_txp: calibration data related to tx power chanel group.
* @trans: transport layer
*/
struct iwl_phy_db {
struct iwl_phy_db_entry cfg;
struct iwl_phy_db_entry calib_nch;
int n_group_papd;
struct iwl_phy_db_entry *calib_ch_group_papd;
int n_group_txp;
struct iwl_phy_db_entry *calib_ch_group_txp;
struct iwl_trans *trans;
};
enum iwl_phy_db_section_type {
IWL_PHY_DB_CFG = 1,
IWL_PHY_DB_CALIB_NCH,
IWL_PHY_DB_UNUSED,
IWL_PHY_DB_CALIB_CHG_PAPD,
IWL_PHY_DB_CALIB_CHG_TXP,
IWL_PHY_DB_MAX
};
#define PHY_DB_CMD 0x6c
/* for parsing of tx power channel group data that comes from the firmware*/
struct iwl_phy_db_chg_txp {
__le32 space;
__le16 max_channel_idx;
} __packed;
struct iwl_phy_db *iwl_phy_db_init(struct iwl_trans *trans)
{
struct iwl_phy_db *phy_db = kzalloc_obj(struct iwl_phy_db);
if (!phy_db)
return phy_db;
phy_db->trans = trans;
phy_db->n_group_txp = -1;
phy_db->n_group_papd = -1;
/* TODO: add default values of the phy db. */
return phy_db;
}
IWL_EXPORT_SYMBOL(iwl_phy_db_init);
/*
* get phy db section: returns a pointer to a phy db section specified by
* type and channel group id.
*/
static struct iwl_phy_db_entry *
iwl_phy_db_get_section(struct iwl_phy_db *phy_db,
enum iwl_phy_db_section_type type,
u16 chg_id)
{
if (!phy_db || type >= IWL_PHY_DB_MAX)
return NULL;
switch (type) {
case IWL_PHY_DB_CFG:
return &phy_db->cfg;
case IWL_PHY_DB_CALIB_NCH:
return &phy_db->calib_nch;
case IWL_PHY_DB_CALIB_CHG_PAPD:
if (chg_id >= phy_db->n_group_papd)
return NULL;
return &phy_db->calib_ch_group_papd[chg_id];
case IWL_PHY_DB_CALIB_CHG_TXP:
if (chg_id >= phy_db->n_group_txp)
return NULL;
return &phy_db->calib_ch_group_txp[chg_id];
default:
return NULL;
}
return NULL;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/string.h`, `linux/export.h`, `iwl-drv.h`, `iwl-phy-db.h`, `iwl-debug.h`, `iwl-op-mode.h`, `iwl-trans.h`.
- Detected declarations: `struct iwl_phy_db_entry`, `struct iwl_phy_db`, `struct iwl_phy_db_chg_txp`, `enum iwl_phy_db_section_type`, `function iwl_phy_db_get_section`, `function iwl_phy_db_free_section`, `function iwl_phy_db_free`, `function iwl_phy_db_set_section`, `function is_valid_channel`, `function ch_id_to_ch_index`.
- 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.