1 // SPDX-License-Identifier: ISC
6 mt7615_radar_pattern_set(void *data
, u64 val
)
8 struct mt7615_dev
*dev
= data
;
10 return mt7615_mcu_rdd_send_pattern(dev
);
13 DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_pattern
, NULL
,
14 mt7615_radar_pattern_set
, "%lld\n");
17 mt7615_scs_set(void *data
, u64 val
)
19 struct mt7615_dev
*dev
= data
;
21 mt7615_mac_set_scs(dev
, val
);
27 mt7615_scs_get(void *data
, u64
*val
)
29 struct mt7615_dev
*dev
= data
;
36 DEFINE_DEBUGFS_ATTRIBUTE(fops_scs
, mt7615_scs_get
,
37 mt7615_scs_set
, "%lld\n");
40 mt7615_ampdu_stat_read(struct seq_file
*file
, void *data
)
42 struct mt7615_dev
*dev
= file
->private;
43 int bound
[7], i
, range
;
45 range
= mt76_rr(dev
, MT_AGG_ASRCR0
);
46 for (i
= 0; i
< 4; i
++)
47 bound
[i
] = MT_AGG_ASRCR_RANGE(range
, i
) + 1;
48 range
= mt76_rr(dev
, MT_AGG_ASRCR1
);
49 for (i
= 0; i
< 3; i
++)
50 bound
[i
+ 4] = MT_AGG_ASRCR_RANGE(range
, i
) + 1;
52 seq_printf(file
, "Length: %8d | ", bound
[0]);
53 for (i
= 0; i
< ARRAY_SIZE(bound
) - 1; i
++)
54 seq_printf(file
, "%3d -%3d | ",
55 bound
[i
], bound
[i
+ 1]);
56 seq_puts(file
, "\nCount: ");
57 for (i
= 0; i
< ARRAY_SIZE(bound
); i
++)
58 seq_printf(file
, "%8d | ", dev
->mt76
.aggr_stats
[i
]);
65 mt7615_ampdu_stat_open(struct inode
*inode
, struct file
*f
)
67 return single_open(f
, mt7615_ampdu_stat_read
, inode
->i_private
);
70 static const struct file_operations fops_ampdu_stat
= {
71 .open
= mt7615_ampdu_stat_open
,
74 .release
= single_release
,
78 mt7615_radio_read(struct seq_file
*s
, void *data
)
80 struct mt7615_dev
*dev
= dev_get_drvdata(s
->private);
82 seq_printf(s
, "Sensitivity: ofdm=%d cck=%d\n",
83 dev
->ofdm_sensitivity
, dev
->cck_sensitivity
);
84 seq_printf(s
, "False CCA: ofdm=%d cck=%d\n",
85 dev
->false_cca_ofdm
, dev
->false_cca_cck
);
90 static int mt7615_read_temperature(struct seq_file
*s
, void *data
)
92 struct mt7615_dev
*dev
= dev_get_drvdata(s
->private);
96 temp
= mt7615_mcu_get_temperature(dev
, 0);
97 seq_printf(s
, "Temperature: %d\n", temp
);
103 mt7615_queues_acq(struct seq_file
*s
, void *data
)
105 struct mt7615_dev
*dev
= dev_get_drvdata(s
->private);
108 for (i
= 0; i
< 16; i
++) {
109 int j
, acs
= i
/ 4, index
= i
% 4;
110 u32 ctrl
, val
, qlen
= 0;
112 val
= mt76_rr(dev
, MT_PLE_AC_QEMPTY(acs
, index
));
113 ctrl
= BIT(31) | BIT(15) | (acs
<< 8);
115 for (j
= 0; j
< 32; j
++) {
119 mt76_wr(dev
, MT_PLE_FL_Q0_CTRL
,
120 ctrl
| (j
+ (index
<< 5)));
121 qlen
+= mt76_get_field(dev
, MT_PLE_FL_Q3_CTRL
,
124 seq_printf(s
, "AC%d%d: queued=%d\n", acs
, index
, qlen
);
131 mt7615_queues_read(struct seq_file
*s
, void *data
)
133 struct mt7615_dev
*dev
= dev_get_drvdata(s
->private);
134 static const struct {
138 { "PDMA0", MT_TXQ_BE
},
139 { "MCUQ", MT_TXQ_MCU
},
140 { "MCUFWQ", MT_TXQ_FWDL
},
144 for (i
= 0; i
< ARRAY_SIZE(queue_map
); i
++) {
145 struct mt76_sw_queue
*q
= &dev
->mt76
.q_tx
[queue_map
[i
].id
];
151 "%s: queued=%d head=%d tail=%d\n",
152 queue_map
[i
].queue
, q
->q
->queued
, q
->q
->head
,
159 int mt7615_init_debugfs(struct mt7615_dev
*dev
)
163 dir
= mt76_register_debugfs(&dev
->mt76
);
167 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "queues", dir
,
169 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "acq", dir
,
171 debugfs_create_file("ampdu_stat", 0400, dir
, dev
, &fops_ampdu_stat
);
172 debugfs_create_file("scs", 0600, dir
, dev
, &fops_scs
);
173 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "radio", dir
,
175 debugfs_create_u32("dfs_hw_pattern", 0400, dir
, &dev
->hw_pattern
);
176 /* test pattern knobs */
177 debugfs_create_u8("pattern_len", 0600, dir
,
178 &dev
->radar_pattern
.n_pulses
);
179 debugfs_create_u32("pulse_period", 0600, dir
,
180 &dev
->radar_pattern
.period
);
181 debugfs_create_u16("pulse_width", 0600, dir
,
182 &dev
->radar_pattern
.width
);
183 debugfs_create_u16("pulse_power", 0600, dir
,
184 &dev
->radar_pattern
.power
);
185 debugfs_create_file("radar_trigger", 0200, dir
, dev
,
186 &fops_radar_pattern
);
187 debugfs_create_devm_seqfile(dev
->mt76
.dev
, "temperature", dir
,
188 mt7615_read_temperature
);