1 // SPDX-License-Identifier: ISC
6 mt7603_reset_read(struct seq_file
*s
, void *data
)
8 struct mt7603_dev
*dev
= dev_get_drvdata(s
->private);
9 static const char * const reset_cause_str
[] = {
10 [RESET_CAUSE_TX_HANG
] = "TX hang",
11 [RESET_CAUSE_TX_BUSY
] = "TX DMA busy stuck",
12 [RESET_CAUSE_RX_BUSY
] = "RX DMA busy stuck",
13 [RESET_CAUSE_RX_PSE_BUSY
] = "RX PSE busy stuck",
14 [RESET_CAUSE_BEACON_STUCK
] = "Beacon stuck",
15 [RESET_CAUSE_MCU_HANG
] = "MCU hang",
16 [RESET_CAUSE_RESET_FAILED
] = "PSE reset failed",
20 for (i
= 0; i
< ARRAY_SIZE(reset_cause_str
); i
++) {
21 if (!reset_cause_str
[i
])
24 seq_printf(s
, "%20s: %u\n", reset_cause_str
[i
],
32 mt7603_radio_read(struct seq_file
*s
, void *data
)
34 struct mt7603_dev
*dev
= dev_get_drvdata(s
->private);
36 seq_printf(s
, "Sensitivity: %d\n", dev
->sensitivity
);
37 seq_printf(s
, "False CCA: ofdm=%d cck=%d\n",
38 dev
->false_cca_ofdm
, dev
->false_cca_cck
);
44 mt7603_edcca_set(void *data
, u64 val
)
46 struct mt7603_dev
*dev
= data
;
48 mutex_lock(&dev
->mt76
.mutex
);
50 dev
->ed_monitor_enabled
= !!val
;
51 dev
->ed_monitor
= dev
->ed_monitor_enabled
&&
52 dev
->mt76
.region
== NL80211_DFS_ETSI
;
53 mt7603_init_edcca(dev
);
55 mutex_unlock(&dev
->mt76
.mutex
);
61 mt7603_edcca_get(void *data
, u64
*val
)
63 struct mt7603_dev
*dev
= data
;
65 *val
= dev
->ed_monitor_enabled
;
69 DEFINE_DEBUGFS_ATTRIBUTE(fops_edcca
, mt7603_edcca_get
,
70 mt7603_edcca_set
, "%lld\n");
73 mt7603_ampdu_stat_read(struct seq_file
*file
, void *data
)
75 struct mt7603_dev
*dev
= file
->private;
76 int bound
[3], i
, range
;
78 range
= mt76_rr(dev
, MT_AGG_ASRCR
);
79 for (i
= 0; i
< ARRAY_SIZE(bound
); i
++)
80 bound
[i
] = MT_AGG_ASRCR_RANGE(range
, i
) + 1;
82 seq_printf(file
, "Length: %8d | ", bound
[0]);
83 for (i
= 0; i
< ARRAY_SIZE(bound
) - 1; i
++)
84 seq_printf(file
, "%3d -%3d | ",
85 bound
[i
], bound
[i
+ 1]);
86 seq_puts(file
, "\nCount: ");
87 for (i
= 0; i
< ARRAY_SIZE(bound
); i
++)
88 seq_printf(file
, "%8d | ", dev
->mt76
.aggr_stats
[i
]);
95 mt7603_ampdu_stat_open(struct inode
*inode
, struct file
*f
)
97 return single_open(f
, mt7603_ampdu_stat_read
, inode
->i_private
);
100 static const struct file_operations fops_ampdu_stat
= {
101 .open
= mt7603_ampdu_stat_open
,
104 .release
= single_release
,
107 void mt7603_init_debugfs(struct mt7603_dev
*dev
)
111 dir
= mt76_register_debugfs(&dev
->mt76
);
115 debugfs_create_file("ampdu_stat", 0400, dir
, dev
, &fops_ampdu_stat
);
116 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "queues", dir
,
118 debugfs_create_file("edcca", 0600, dir
, dev
, &fops_edcca
);
119 debugfs_create_u32("reset_test", 0600, dir
, &dev
->reset_test
);
120 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "reset", dir
,
122 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "radio", dir
,