drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c- Extension
.c- Size
- 28279 bytes
- Lines
- 1079
- 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.hmt7996.heeprom.hmcu.hmac.h
Detected Declarations
struct hw_queue_mapfunction mt7996_implicit_txbf_setfunction mt7996_implicit_txbf_getfunction mt7996_sys_recovery_setfunction mt7996_sys_recovery_getfunction mt7996_radar_triggerfunction mt7996_rdd_monitorfunction mt7996_fw_debug_wm_setfunction mt7996_fw_debug_wm_getfunction mt7996_fw_debug_wa_setfunction mt7996_fw_debug_wa_getfunction create_buf_file_cbfunction remove_buf_file_cbfunction mt7996_fw_debug_bin_setfunction mt7996_fw_debug_bin_getfunction mt7996_fw_util_wa_showfunction mt7996_ampdu_stat_read_phyfunction mt7996_txbf_stat_read_phyfunction mt7996_tx_stats_show_phyfunction mt7996_tx_stats_showfunction mt7996_hw_queue_readfunction mt7996_sta_hw_queue_readfunction for_each_sta_active_linkfunction mt7996_hw_queues_showfunction mt7996_xmit_queues_showfunction mt7996_twt_statsfunction mt7996_rf_regval_getfunction mt7996_rf_regval_setfunction mt7996_init_debugfsfunction mt7996_debugfs_write_fwlogfunction mt7996_debugfs_rx_fw_monitorfunction mt7996_debugfs_rx_logfunction mt7996_queues_showfunction mt7996_sta_add_debugfsfunction mt7996_link_sta_fixed_rate_setfunction mt7996_link_sta_add_debugfs
Annotated Snippet
static const struct file_operations mt7996_sys_recovery_ops = {
.write = mt7996_sys_recovery_set,
.read = mt7996_sys_recovery_get,
.open = simple_open,
.llseek = default_llseek,
};
static int
mt7996_radar_trigger(void *data, u64 val)
{
#define RADAR_MAIN_CHAIN 1
#define RADAR_BACKGROUND 2
struct mt7996_dev *dev = data;
struct mt7996_phy *phy = mt7996_band_phy(dev, NL80211_BAND_5GHZ);
struct cfg80211_chan_def *chandef;
int rdd_idx, ret;
if (!phy || !val || val > RADAR_BACKGROUND)
return -EINVAL;
if (test_bit(MT76_SCANNING, &phy->mt76->state))
return -EBUSY;
if (val == RADAR_BACKGROUND) {
if (!dev->rdd2_phy || !cfg80211_chandef_valid(&dev->rdd2_chandef)) {
dev_err(dev->mt76.dev, "Background radar is not enabled\n");
return -EINVAL;
}
chandef = &dev->rdd2_chandef;
} else {
chandef = &phy->mt76->chandef;
}
rdd_idx = mt7996_get_rdd_idx(phy, val == RADAR_BACKGROUND);
if (rdd_idx < 0) {
dev_err(dev->mt76.dev, "No RDD found\n");
return -EINVAL;
}
ret = cfg80211_chandef_dfs_required(dev->mt76.hw->wiphy, chandef,
NL80211_IFTYPE_AP);
if (ret <= 0)
return ret;
return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE, rdd_idx, 0);
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL,
mt7996_radar_trigger, "%lld\n");
static int
mt7996_rdd_monitor(struct seq_file *s, void *data)
{
struct mt7996_dev *dev = dev_get_drvdata(s->private);
struct cfg80211_chan_def *chandef = &dev->rdd2_chandef;
const char *bw;
int ret = 0;
mutex_lock(&dev->mt76.mutex);
if (!cfg80211_chandef_valid(chandef)) {
ret = -EINVAL;
goto out;
}
if (!dev->rdd2_phy) {
seq_puts(s, "not running\n");
goto out;
}
switch (chandef->width) {
case NL80211_CHAN_WIDTH_40:
bw = "40";
break;
case NL80211_CHAN_WIDTH_80:
bw = "80";
break;
case NL80211_CHAN_WIDTH_160:
bw = "160";
break;
case NL80211_CHAN_WIDTH_80P80:
bw = "80P80";
break;
default:
bw = "20";
break;
}
seq_printf(s, "channel %d (%d MHz) width %s MHz center1: %d MHz\n",
chandef->chan->hw_value, chandef->chan->center_freq,
Annotation
- Immediate include surface: `linux/relay.h`, `mt7996.h`, `eeprom.h`, `mcu.h`, `mac.h`.
- Detected declarations: `struct hw_queue_map`, `function mt7996_implicit_txbf_set`, `function mt7996_implicit_txbf_get`, `function mt7996_sys_recovery_set`, `function mt7996_sys_recovery_get`, `function mt7996_radar_trigger`, `function mt7996_rdd_monitor`, `function mt7996_fw_debug_wm_set`, `function mt7996_fw_debug_wm_get`, `function mt7996_fw_debug_wa_set`.
- 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.