drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c- Extension
.c- Size
- 39618 bytes
- Lines
- 1487
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/relay.hmt7915.heeprom.hmcu.hmac.h
Detected Declarations
struct hw_queue_mapfunction mt7915_implicit_txbf_setfunction mt7915_implicit_txbf_getfunction mt7915_sys_recovery_setfunction mt7915_sys_recovery_getfunction mt7915_radar_triggerfunction mt7915_muru_debug_setfunction mt7915_muru_debug_getfunction mt7915_muru_stats_showfunction mt7915_rdd_monitorfunction mt7915_fw_debug_wm_setfunction mt7915_fw_debug_wm_getfunction mt7915_fw_debug_wa_setfunction mt7915_fw_debug_wa_getfunction create_buf_file_cbfunction remove_buf_file_cbfunction mt7915_fw_debug_bin_setfunction mt7915_fw_debug_bin_getfunction mt7915_fw_util_wm_showfunction mt7915_fw_util_wa_showfunction mt7915_ampdu_stat_read_phyfunction mt7915_txbf_stat_read_phyfunction mt7915_tx_stats_showfunction mt7915_hw_queue_readfunction mt7915_sta_hw_queue_readfunction mt7915_hw_queues_showfunction mt7915_xmit_queues_showfunction mt7915_rate_txpower_getfunction mt7915_rate_txpower_setfunction mt7915_path_txpower_showfunction mt7915_txpower_path_showfunction mt7915_twt_statsfunction mt7915_rf_regval_getfunction mt7915_rf_regval_setfunction mt7915_init_debugfsfunction mt7915_debugfs_write_fwlogfunction mt7915_debugfs_rx_fw_monitorfunction mt7915_debugfs_rx_logfunction mt7915_sta_fixed_rate_setfunction mt7915_queues_showfunction mt7915_sta_add_debugfs
Annotated Snippet
static const struct file_operations mt7915_sys_recovery_ops = {
.write = mt7915_sys_recovery_set,
.read = mt7915_sys_recovery_get,
.open = simple_open,
.llseek = default_llseek,
};
static int
mt7915_radar_trigger(void *data, u64 val)
{
#define RADAR_MAIN_CHAIN 1
#define RADAR_BACKGROUND 2
struct mt7915_phy *phy = data;
struct mt7915_dev *dev = phy->dev;
int rdd_idx;
if (!val || val > RADAR_BACKGROUND)
return -EINVAL;
if (val == RADAR_BACKGROUND && !dev->rdd2_phy) {
dev_err(dev->mt76.dev, "Background radar is not enabled\n");
return -EINVAL;
}
rdd_idx = mt7915_get_rdd_idx(phy, val == RADAR_BACKGROUND);
if (rdd_idx < 0) {
dev_err(dev->mt76.dev, "No RDD found\n");
return -EINVAL;
}
return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_RADAR_EMULATE,
rdd_idx, 0, 0);
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL,
mt7915_radar_trigger, "%lld\n");
static int
mt7915_muru_debug_set(void *data, u64 val)
{
struct mt7915_dev *dev = data;
dev->muru_debug = val;
mt7915_mcu_muru_debug_set(dev, dev->muru_debug);
return 0;
}
static int
mt7915_muru_debug_get(void *data, u64 *val)
{
struct mt7915_dev *dev = data;
*val = dev->muru_debug;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_debug, mt7915_muru_debug_get,
mt7915_muru_debug_set, "%lld\n");
static int mt7915_muru_stats_show(struct seq_file *file, void *data)
{
struct mt7915_phy *phy = file->private;
struct mt7915_dev *dev = phy->dev;
static const char * const dl_non_he_type[] = {
"CCK", "OFDM", "HT MIX", "HT GF",
"VHT SU", "VHT 2MU", "VHT 3MU", "VHT 4MU"
};
static const char * const dl_he_type[] = {
"HE SU", "HE EXT", "HE 2MU", "HE 3MU", "HE 4MU",
"HE 2RU", "HE 3RU", "HE 4RU", "HE 5-8RU", "HE 9-16RU",
"HE >16RU"
};
static const char * const ul_he_type[] = {
"HE 2MU", "HE 3MU", "HE 4MU", "HE SU", "HE 2RU",
"HE 3RU", "HE 4RU", "HE 5-8RU", "HE 9-16RU", "HE >16RU"
};
int ret, i;
u64 total_ppdu_cnt, sub_total_cnt;
if (!dev->muru_debug) {
seq_puts(file, "Please enable muru_debug first.\n");
return 0;
}
mutex_lock(&dev->mt76.mutex);
ret = mt7915_mcu_muru_debug_get(phy);
if (ret)
Annotation
- Immediate include surface: `linux/relay.h`, `mt7915.h`, `eeprom.h`, `mcu.h`, `mac.h`.
- Detected declarations: `struct hw_queue_map`, `function mt7915_implicit_txbf_set`, `function mt7915_implicit_txbf_get`, `function mt7915_sys_recovery_set`, `function mt7915_sys_recovery_get`, `function mt7915_radar_trigger`, `function mt7915_muru_debug_set`, `function mt7915_muru_debug_get`, `function mt7915_muru_stats_show`, `function mt7915_rdd_monitor`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.