2 * Copyright (c) 2008-2011 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/slab.h>
18 #include <linux/vmalloc.h>
19 #include <linux/export.h>
20 #include <linux/relay.h>
21 #include <asm/unaligned.h>
25 #define REG_WRITE_D(_ah, _reg, _val) \
26 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
27 #define REG_READ_D(_ah, _reg) \
28 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
31 static ssize_t
ath9k_debugfs_read_buf(struct file
*file
, char __user
*user_buf
,
32 size_t count
, loff_t
*ppos
)
34 u8
*buf
= file
->private_data
;
35 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, strlen(buf
));
38 static int ath9k_debugfs_release_buf(struct inode
*inode
, struct file
*file
)
40 vfree(file
->private_data
);
44 #ifdef CONFIG_ATH_DEBUG
46 static ssize_t
read_file_debug(struct file
*file
, char __user
*user_buf
,
47 size_t count
, loff_t
*ppos
)
49 struct ath_softc
*sc
= file
->private_data
;
50 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
54 len
= sprintf(buf
, "0x%08x\n", common
->debug_mask
);
55 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
58 static ssize_t
write_file_debug(struct file
*file
, const char __user
*user_buf
,
59 size_t count
, loff_t
*ppos
)
61 struct ath_softc
*sc
= file
->private_data
;
62 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
67 len
= min(count
, sizeof(buf
) - 1);
68 if (copy_from_user(buf
, user_buf
, len
))
72 if (kstrtoul(buf
, 0, &mask
))
75 common
->debug_mask
= mask
;
79 static const struct file_operations fops_debug
= {
80 .read
= read_file_debug
,
81 .write
= write_file_debug
,
84 .llseek
= default_llseek
,
89 #define DMA_BUF_LEN 1024
92 static ssize_t
read_file_ani(struct file
*file
, char __user
*user_buf
,
93 size_t count
, loff_t
*ppos
)
95 struct ath_softc
*sc
= file
->private_data
;
96 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
97 struct ath_hw
*ah
= sc
->sc_ah
;
98 unsigned int len
= 0, size
= 1024;
102 buf
= kzalloc(size
, GFP_KERNEL
);
106 if (common
->disable_ani
) {
107 len
+= snprintf(buf
+ len
, size
- len
, "%s: %s\n",
112 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %s\n",
114 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
115 "ANI RESET", ah
->stats
.ast_ani_reset
);
116 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
117 "SPUR UP", ah
->stats
.ast_ani_spurup
);
118 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
119 "SPUR DOWN", ah
->stats
.ast_ani_spurup
);
120 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
121 "OFDM WS-DET ON", ah
->stats
.ast_ani_ofdmon
);
122 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
123 "OFDM WS-DET OFF", ah
->stats
.ast_ani_ofdmoff
);
124 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
125 "MRC-CCK ON", ah
->stats
.ast_ani_ccklow
);
126 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
127 "MRC-CCK OFF", ah
->stats
.ast_ani_cckhigh
);
128 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
129 "FIR-STEP UP", ah
->stats
.ast_ani_stepup
);
130 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
131 "FIR-STEP DOWN", ah
->stats
.ast_ani_stepdown
);
132 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
133 "INV LISTENTIME", ah
->stats
.ast_ani_lneg_or_lzero
);
134 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
135 "OFDM ERRORS", ah
->stats
.ast_ani_ofdmerrs
);
136 len
+= snprintf(buf
+ len
, size
- len
, "%15s: %u\n",
137 "CCK ERRORS", ah
->stats
.ast_ani_cckerrs
);
142 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
148 static ssize_t
write_file_ani(struct file
*file
,
149 const char __user
*user_buf
,
150 size_t count
, loff_t
*ppos
)
152 struct ath_softc
*sc
= file
->private_data
;
153 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
158 len
= min(count
, sizeof(buf
) - 1);
159 if (copy_from_user(buf
, user_buf
, len
))
163 if (kstrtoul(buf
, 0, &ani
))
166 if (ani
< 0 || ani
> 1)
169 common
->disable_ani
= !ani
;
171 if (common
->disable_ani
) {
172 clear_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
181 static const struct file_operations fops_ani
= {
182 .read
= read_file_ani
,
183 .write
= write_file_ani
,
185 .owner
= THIS_MODULE
,
186 .llseek
= default_llseek
,
189 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
191 static ssize_t
read_file_bt_ant_diversity(struct file
*file
,
192 char __user
*user_buf
,
193 size_t count
, loff_t
*ppos
)
195 struct ath_softc
*sc
= file
->private_data
;
196 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
200 len
= sprintf(buf
, "%d\n", common
->bt_ant_diversity
);
201 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
204 static ssize_t
write_file_bt_ant_diversity(struct file
*file
,
205 const char __user
*user_buf
,
206 size_t count
, loff_t
*ppos
)
208 struct ath_softc
*sc
= file
->private_data
;
209 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
210 struct ath9k_hw_capabilities
*pCap
= &sc
->sc_ah
->caps
;
211 unsigned long bt_ant_diversity
;
215 len
= min(count
, sizeof(buf
) - 1);
216 if (copy_from_user(buf
, user_buf
, len
))
219 if (!(pCap
->hw_caps
& ATH9K_HW_CAP_BT_ANT_DIV
))
223 if (kstrtoul(buf
, 0, &bt_ant_diversity
))
226 common
->bt_ant_diversity
= !!bt_ant_diversity
;
228 ath9k_hw_set_bt_ant_diversity(sc
->sc_ah
, common
->bt_ant_diversity
);
229 ath_dbg(common
, CONFIG
, "Enable WLAN/BT RX Antenna diversity: %d\n",
230 common
->bt_ant_diversity
);
231 ath9k_ps_restore(sc
);
236 static const struct file_operations fops_bt_ant_diversity
= {
237 .read
= read_file_bt_ant_diversity
,
238 .write
= write_file_bt_ant_diversity
,
240 .owner
= THIS_MODULE
,
241 .llseek
= default_llseek
,
246 void ath9k_debug_stat_ant(struct ath_softc
*sc
,
247 struct ath_hw_antcomb_conf
*div_ant_conf
,
248 int main_rssi_avg
, int alt_rssi_avg
)
250 struct ath_antenna_stats
*as_main
= &sc
->debug
.stats
.ant_stats
[ANT_MAIN
];
251 struct ath_antenna_stats
*as_alt
= &sc
->debug
.stats
.ant_stats
[ANT_ALT
];
253 as_main
->lna_attempt_cnt
[div_ant_conf
->main_lna_conf
]++;
254 as_alt
->lna_attempt_cnt
[div_ant_conf
->alt_lna_conf
]++;
256 as_main
->rssi_avg
= main_rssi_avg
;
257 as_alt
->rssi_avg
= alt_rssi_avg
;
260 static ssize_t
read_file_antenna_diversity(struct file
*file
,
261 char __user
*user_buf
,
262 size_t count
, loff_t
*ppos
)
264 struct ath_softc
*sc
= file
->private_data
;
265 struct ath_hw
*ah
= sc
->sc_ah
;
266 struct ath9k_hw_capabilities
*pCap
= &ah
->caps
;
267 struct ath_antenna_stats
*as_main
= &sc
->debug
.stats
.ant_stats
[ANT_MAIN
];
268 struct ath_antenna_stats
*as_alt
= &sc
->debug
.stats
.ant_stats
[ANT_ALT
];
269 struct ath_hw_antcomb_conf div_ant_conf
;
270 unsigned int len
= 0, size
= 1024;
273 char *lna_conf_str
[4] = {"LNA1_MINUS_LNA2",
278 buf
= kzalloc(size
, GFP_KERNEL
);
282 if (!(pCap
->hw_caps
& ATH9K_HW_CAP_ANT_DIV_COMB
)) {
283 len
+= snprintf(buf
+ len
, size
- len
, "%s\n",
284 "Antenna Diversity Combining is disabled");
289 ath9k_hw_antdiv_comb_conf_get(ah
, &div_ant_conf
);
290 len
+= snprintf(buf
+ len
, size
- len
, "Current MAIN config : %s\n",
291 lna_conf_str
[div_ant_conf
.main_lna_conf
]);
292 len
+= snprintf(buf
+ len
, size
- len
, "Current ALT config : %s\n",
293 lna_conf_str
[div_ant_conf
.alt_lna_conf
]);
294 len
+= snprintf(buf
+ len
, size
- len
, "Average MAIN RSSI : %d\n",
296 len
+= snprintf(buf
+ len
, size
- len
, "Average ALT RSSI : %d\n\n",
298 ath9k_ps_restore(sc
);
300 len
+= snprintf(buf
+ len
, size
- len
, "Packet Receive Cnt:\n");
301 len
+= snprintf(buf
+ len
, size
- len
, "-------------------\n");
303 len
+= snprintf(buf
+ len
, size
- len
, "%30s%15s\n",
305 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
309 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
311 as_main
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA1
],
312 as_alt
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA1
]);
313 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
315 as_main
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA2
],
316 as_alt
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA2
]);
317 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
319 as_main
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2
],
320 as_alt
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2
]);
321 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
323 as_main
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2
],
324 as_alt
->lna_recv_cnt
[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2
]);
326 len
+= snprintf(buf
+ len
, size
- len
, "\nLNA Config Attempts:\n");
327 len
+= snprintf(buf
+ len
, size
- len
, "--------------------\n");
329 len
+= snprintf(buf
+ len
, size
- len
, "%30s%15s\n",
331 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
333 as_main
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA1
],
334 as_alt
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA1
]);
335 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
337 as_main
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA2
],
338 as_alt
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA2
]);
339 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
341 as_main
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2
],
342 as_alt
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2
]);
343 len
+= snprintf(buf
+ len
, size
- len
, "%-14s:%15d%15d\n",
345 as_main
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2
],
346 as_alt
->lna_attempt_cnt
[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2
]);
352 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
358 static const struct file_operations fops_antenna_diversity
= {
359 .read
= read_file_antenna_diversity
,
361 .owner
= THIS_MODULE
,
362 .llseek
= default_llseek
,
365 static ssize_t
read_file_dma(struct file
*file
, char __user
*user_buf
,
366 size_t count
, loff_t
*ppos
)
368 struct ath_softc
*sc
= file
->private_data
;
369 struct ath_hw
*ah
= sc
->sc_ah
;
372 unsigned int len
= 0;
373 u32 val
[ATH9K_NUM_DMA_DEBUG_REGS
];
374 int i
, qcuOffset
= 0, dcuOffset
= 0;
375 u32
*qcuBase
= &val
[0], *dcuBase
= &val
[4];
377 buf
= kmalloc(DMA_BUF_LEN
, GFP_KERNEL
);
383 REG_WRITE_D(ah
, AR_MACMISC
,
384 ((AR_MACMISC_DMA_OBS_LINE_8
<< AR_MACMISC_DMA_OBS_S
) |
385 (AR_MACMISC_MISC_OBS_BUS_1
<<
386 AR_MACMISC_MISC_OBS_BUS_MSB_S
)));
388 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
389 "Raw DMA Debug values:\n");
391 for (i
= 0; i
< ATH9K_NUM_DMA_DEBUG_REGS
; i
++) {
393 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "\n");
395 val
[i
] = REG_READ_D(ah
, AR_DMADBG_0
+ (i
* sizeof(u32
)));
396 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "%d: %08x ",
400 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "\n\n");
401 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
402 "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
404 for (i
= 0; i
< ATH9K_NUM_QUEUES
; i
++, qcuOffset
+= 4, dcuOffset
+= 5) {
415 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
416 "%2d %2x %1x %2x %2x\n",
417 i
, (*qcuBase
& (0x7 << qcuOffset
)) >> qcuOffset
,
418 (*qcuBase
& (0x8 << qcuOffset
)) >> (qcuOffset
+ 3),
419 val
[2] & (0x7 << (i
* 3)) >> (i
* 3),
420 (*dcuBase
& (0x1f << dcuOffset
)) >> dcuOffset
);
423 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "\n");
425 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
426 "qcu_stitch state: %2x qcu_fetch state: %2x\n",
427 (val
[3] & 0x003c0000) >> 18, (val
[3] & 0x03c00000) >> 22);
428 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
429 "qcu_complete state: %2x dcu_complete state: %2x\n",
430 (val
[3] & 0x1c000000) >> 26, (val
[6] & 0x3));
431 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
432 "dcu_arb state: %2x dcu_fp state: %2x\n",
433 (val
[5] & 0x06000000) >> 25, (val
[5] & 0x38000000) >> 27);
434 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
435 "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n",
436 (val
[6] & 0x000003fc) >> 2, (val
[6] & 0x00000400) >> 10);
437 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
438 "txfifo_valid_0: %1d txfifo_valid_1: %1d\n",
439 (val
[6] & 0x00000800) >> 11, (val
[6] & 0x00001000) >> 12);
440 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
441 "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n",
442 (val
[6] & 0x0001e000) >> 13, (val
[6] & 0x001e0000) >> 17);
444 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "pcu observe: 0x%x\n",
445 REG_READ_D(ah
, AR_OBS_BUS_1
));
446 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
447 "AR_CR: 0x%x\n", REG_READ_D(ah
, AR_CR
));
449 ath9k_ps_restore(sc
);
451 if (len
> DMA_BUF_LEN
)
454 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
459 static const struct file_operations fops_dma
= {
460 .read
= read_file_dma
,
462 .owner
= THIS_MODULE
,
463 .llseek
= default_llseek
,
467 void ath_debug_stat_interrupt(struct ath_softc
*sc
, enum ath9k_int status
)
470 sc
->debug
.stats
.istats
.total
++;
471 if (sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
) {
472 if (status
& ATH9K_INT_RXLP
)
473 sc
->debug
.stats
.istats
.rxlp
++;
474 if (status
& ATH9K_INT_RXHP
)
475 sc
->debug
.stats
.istats
.rxhp
++;
476 if (status
& ATH9K_INT_BB_WATCHDOG
)
477 sc
->debug
.stats
.istats
.bb_watchdog
++;
479 if (status
& ATH9K_INT_RX
)
480 sc
->debug
.stats
.istats
.rxok
++;
482 if (status
& ATH9K_INT_RXEOL
)
483 sc
->debug
.stats
.istats
.rxeol
++;
484 if (status
& ATH9K_INT_RXORN
)
485 sc
->debug
.stats
.istats
.rxorn
++;
486 if (status
& ATH9K_INT_TX
)
487 sc
->debug
.stats
.istats
.txok
++;
488 if (status
& ATH9K_INT_TXURN
)
489 sc
->debug
.stats
.istats
.txurn
++;
490 if (status
& ATH9K_INT_RXPHY
)
491 sc
->debug
.stats
.istats
.rxphyerr
++;
492 if (status
& ATH9K_INT_RXKCM
)
493 sc
->debug
.stats
.istats
.rx_keycache_miss
++;
494 if (status
& ATH9K_INT_SWBA
)
495 sc
->debug
.stats
.istats
.swba
++;
496 if (status
& ATH9K_INT_BMISS
)
497 sc
->debug
.stats
.istats
.bmiss
++;
498 if (status
& ATH9K_INT_BNR
)
499 sc
->debug
.stats
.istats
.bnr
++;
500 if (status
& ATH9K_INT_CST
)
501 sc
->debug
.stats
.istats
.cst
++;
502 if (status
& ATH9K_INT_GTT
)
503 sc
->debug
.stats
.istats
.gtt
++;
504 if (status
& ATH9K_INT_TIM
)
505 sc
->debug
.stats
.istats
.tim
++;
506 if (status
& ATH9K_INT_CABEND
)
507 sc
->debug
.stats
.istats
.cabend
++;
508 if (status
& ATH9K_INT_DTIMSYNC
)
509 sc
->debug
.stats
.istats
.dtimsync
++;
510 if (status
& ATH9K_INT_DTIM
)
511 sc
->debug
.stats
.istats
.dtim
++;
512 if (status
& ATH9K_INT_TSFOOR
)
513 sc
->debug
.stats
.istats
.tsfoor
++;
514 if (status
& ATH9K_INT_MCI
)
515 sc
->debug
.stats
.istats
.mci
++;
516 if (status
& ATH9K_INT_GENTIMER
)
517 sc
->debug
.stats
.istats
.gen_timer
++;
520 static ssize_t
read_file_interrupt(struct file
*file
, char __user
*user_buf
,
521 size_t count
, loff_t
*ppos
)
523 struct ath_softc
*sc
= file
->private_data
;
524 unsigned int len
= 0;
527 char *buf
= kmalloc(mxlen
, GFP_KERNEL
);
531 #define PR_IS(a, s) \
533 len += snprintf(buf + len, mxlen - len, \
535 sc->debug.stats.istats.s); \
538 if (sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
) {
541 PR_IS("WATHDOG", bb_watchdog
);
545 PR_IS("RXEOL", rxeol
);
546 PR_IS("RXORN", rxorn
);
548 PR_IS("TXURN", txurn
);
550 PR_IS("RXPHY", rxphyerr
);
551 PR_IS("RXKCM", rx_keycache_miss
);
553 PR_IS("BMISS", bmiss
);
558 PR_IS("CABEND", cabend
);
559 PR_IS("DTIMSYNC", dtimsync
);
561 PR_IS("TSFOOR", tsfoor
);
563 PR_IS("GENTIMER", gen_timer
);
564 PR_IS("TOTAL", total
);
566 len
+= snprintf(buf
+ len
, mxlen
- len
,
567 "SYNC_CAUSE stats:\n");
569 PR_IS("Sync-All", sync_cause_all
);
570 PR_IS("RTC-IRQ", sync_rtc_irq
);
571 PR_IS("MAC-IRQ", sync_mac_irq
);
572 PR_IS("EEPROM-Illegal-Access", eeprom_illegal_access
);
573 PR_IS("APB-Timeout", apb_timeout
);
574 PR_IS("PCI-Mode-Conflict", pci_mode_conflict
);
575 PR_IS("HOST1-Fatal", host1_fatal
);
576 PR_IS("HOST1-Perr", host1_perr
);
577 PR_IS("TRCV-FIFO-Perr", trcv_fifo_perr
);
578 PR_IS("RADM-CPL-EP", radm_cpl_ep
);
579 PR_IS("RADM-CPL-DLLP-Abort", radm_cpl_dllp_abort
);
580 PR_IS("RADM-CPL-TLP-Abort", radm_cpl_tlp_abort
);
581 PR_IS("RADM-CPL-ECRC-Err", radm_cpl_ecrc_err
);
582 PR_IS("RADM-CPL-Timeout", radm_cpl_timeout
);
583 PR_IS("Local-Bus-Timeout", local_timeout
);
584 PR_IS("PM-Access", pm_access
);
585 PR_IS("MAC-Awake", mac_awake
);
586 PR_IS("MAC-Asleep", mac_asleep
);
587 PR_IS("MAC-Sleep-Access", mac_sleep_access
);
592 rv
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
597 static const struct file_operations fops_interrupt
= {
598 .read
= read_file_interrupt
,
600 .owner
= THIS_MODULE
,
601 .llseek
= default_llseek
,
604 static ssize_t
read_file_xmit(struct file
*file
, char __user
*user_buf
,
605 size_t count
, loff_t
*ppos
)
607 struct ath_softc
*sc
= file
->private_data
;
609 unsigned int len
= 0, size
= 2048;
612 buf
= kzalloc(size
, GFP_KERNEL
);
616 len
+= sprintf(buf
, "%30s %10s%10s%10s\n\n",
617 "BE", "BK", "VI", "VO");
619 PR("MPDUs Queued: ", queued
);
620 PR("MPDUs Completed: ", completed
);
621 PR("MPDUs XRetried: ", xretries
);
622 PR("Aggregates: ", a_aggr
);
623 PR("AMPDUs Queued HW:", a_queued_hw
);
624 PR("AMPDUs Queued SW:", a_queued_sw
);
625 PR("AMPDUs Completed:", a_completed
);
626 PR("AMPDUs Retried: ", a_retries
);
627 PR("AMPDUs XRetried: ", a_xretries
);
628 PR("TXERR Filtered: ", txerr_filtered
);
629 PR("FIFO Underrun: ", fifo_underrun
);
630 PR("TXOP Exceeded: ", xtxop
);
631 PR("TXTIMER Expiry: ", timer_exp
);
632 PR("DESC CFG Error: ", desc_cfg_err
);
633 PR("DATA Underrun: ", data_underrun
);
634 PR("DELIM Underrun: ", delim_underrun
);
635 PR("TX-Pkts-All: ", tx_pkts_all
);
636 PR("TX-Bytes-All: ", tx_bytes_all
);
637 PR("HW-put-tx-buf: ", puttxbuf
);
638 PR("HW-tx-start: ", txstart
);
639 PR("HW-tx-proc-desc: ", txprocdesc
);
640 PR("TX-Failed: ", txfailed
);
645 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
651 static ssize_t
print_queue(struct ath_softc
*sc
, struct ath_txq
*txq
,
652 char *buf
, ssize_t size
)
656 ath_txq_lock(sc
, txq
);
658 len
+= snprintf(buf
+ len
, size
- len
, "%s: %d ",
659 "qnum", txq
->axq_qnum
);
660 len
+= snprintf(buf
+ len
, size
- len
, "%s: %2d ",
661 "qdepth", txq
->axq_depth
);
662 len
+= snprintf(buf
+ len
, size
- len
, "%s: %2d ",
663 "ampdu-depth", txq
->axq_ampdu_depth
);
664 len
+= snprintf(buf
+ len
, size
- len
, "%s: %3d ",
665 "pending", txq
->pending_frames
);
666 len
+= snprintf(buf
+ len
, size
- len
, "%s: %d\n",
667 "stopped", txq
->stopped
);
669 ath_txq_unlock(sc
, txq
);
673 static ssize_t
read_file_queues(struct file
*file
, char __user
*user_buf
,
674 size_t count
, loff_t
*ppos
)
676 struct ath_softc
*sc
= file
->private_data
;
679 unsigned int len
= 0, size
= 1024;
682 char *qname
[4] = {"VO", "VI", "BE", "BK"};
684 buf
= kzalloc(size
, GFP_KERNEL
);
688 for (i
= 0; i
< IEEE80211_NUM_ACS
; i
++) {
689 txq
= sc
->tx
.txq_map
[i
];
690 len
+= snprintf(buf
+ len
, size
- len
, "(%s): ", qname
[i
]);
691 len
+= print_queue(sc
, txq
, buf
+ len
, size
- len
);
694 len
+= snprintf(buf
+ len
, size
- len
, "(CAB): ");
695 len
+= print_queue(sc
, sc
->beacon
.cabq
, buf
+ len
, size
- len
);
700 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
706 static ssize_t
read_file_misc(struct file
*file
, char __user
*user_buf
,
707 size_t count
, loff_t
*ppos
)
709 struct ath_softc
*sc
= file
->private_data
;
710 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
711 struct ieee80211_hw
*hw
= sc
->hw
;
712 struct ath9k_vif_iter_data iter_data
;
714 unsigned int len
= 0;
719 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
720 "BSSID: %pM\n", common
->curbssid
);
721 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
722 "BSSID-MASK: %pM\n", common
->bssidmask
);
723 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
724 "OPMODE: %s\n", ath_opmode_to_string(sc
->sc_ah
->opmode
));
727 rxfilter
= ath9k_hw_getrxfilter(sc
->sc_ah
);
728 ath9k_ps_restore(sc
);
730 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
731 "RXFILTER: 0x%x", rxfilter
);
733 if (rxfilter
& ATH9K_RX_FILTER_UCAST
)
734 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " UCAST");
735 if (rxfilter
& ATH9K_RX_FILTER_MCAST
)
736 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " MCAST");
737 if (rxfilter
& ATH9K_RX_FILTER_BCAST
)
738 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BCAST");
739 if (rxfilter
& ATH9K_RX_FILTER_CONTROL
)
740 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " CONTROL");
741 if (rxfilter
& ATH9K_RX_FILTER_BEACON
)
742 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BEACON");
743 if (rxfilter
& ATH9K_RX_FILTER_PROM
)
744 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PROM");
745 if (rxfilter
& ATH9K_RX_FILTER_PROBEREQ
)
746 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PROBEREQ");
747 if (rxfilter
& ATH9K_RX_FILTER_PHYERR
)
748 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PHYERR");
749 if (rxfilter
& ATH9K_RX_FILTER_MYBEACON
)
750 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " MYBEACON");
751 if (rxfilter
& ATH9K_RX_FILTER_COMP_BAR
)
752 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " COMP_BAR");
753 if (rxfilter
& ATH9K_RX_FILTER_PSPOLL
)
754 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PSPOLL");
755 if (rxfilter
& ATH9K_RX_FILTER_PHYRADAR
)
756 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PHYRADAR");
757 if (rxfilter
& ATH9K_RX_FILTER_MCAST_BCAST_ALL
)
758 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " MCAST_BCAST_ALL");
759 if (rxfilter
& ATH9K_RX_FILTER_CONTROL_WRAPPER
)
760 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " CONTROL_WRAPPER");
762 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n");
764 reg
= sc
->sc_ah
->imask
;
766 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "INTERRUPT-MASK: 0x%x", reg
);
768 if (reg
& ATH9K_INT_SWBA
)
769 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " SWBA");
770 if (reg
& ATH9K_INT_BMISS
)
771 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BMISS");
772 if (reg
& ATH9K_INT_CST
)
773 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " CST");
774 if (reg
& ATH9K_INT_RX
)
775 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " RX");
776 if (reg
& ATH9K_INT_RXHP
)
777 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " RXHP");
778 if (reg
& ATH9K_INT_RXLP
)
779 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " RXLP");
780 if (reg
& ATH9K_INT_BB_WATCHDOG
)
781 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BB_WATCHDOG");
783 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n");
785 ath9k_calculate_iter_data(hw
, NULL
, &iter_data
);
787 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
788 "VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i"
789 " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n",
790 iter_data
.naps
, iter_data
.nstations
, iter_data
.nmeshes
,
791 iter_data
.nwds
, iter_data
.nadhocs
,
792 sc
->nvifs
, sc
->nbcnvifs
);
794 if (len
> sizeof(buf
))
797 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
801 static ssize_t
read_file_reset(struct file
*file
, char __user
*user_buf
,
802 size_t count
, loff_t
*ppos
)
804 struct ath_softc
*sc
= file
->private_data
;
806 unsigned int len
= 0;
808 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
809 "%17s: %2d\n", "Baseband Hang",
810 sc
->debug
.stats
.reset
[RESET_TYPE_BB_HANG
]);
811 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
812 "%17s: %2d\n", "Baseband Watchdog",
813 sc
->debug
.stats
.reset
[RESET_TYPE_BB_WATCHDOG
]);
814 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
815 "%17s: %2d\n", "Fatal HW Error",
816 sc
->debug
.stats
.reset
[RESET_TYPE_FATAL_INT
]);
817 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
818 "%17s: %2d\n", "TX HW error",
819 sc
->debug
.stats
.reset
[RESET_TYPE_TX_ERROR
]);
820 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
821 "%17s: %2d\n", "TX Path Hang",
822 sc
->debug
.stats
.reset
[RESET_TYPE_TX_HANG
]);
823 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
824 "%17s: %2d\n", "PLL RX Hang",
825 sc
->debug
.stats
.reset
[RESET_TYPE_PLL_HANG
]);
826 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
827 "%17s: %2d\n", "MCI Reset",
828 sc
->debug
.stats
.reset
[RESET_TYPE_MCI
]);
830 if (len
> sizeof(buf
))
833 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
836 void ath_debug_stat_tx(struct ath_softc
*sc
, struct ath_buf
*bf
,
837 struct ath_tx_status
*ts
, struct ath_txq
*txq
,
840 int qnum
= txq
->axq_qnum
;
842 TX_STAT_INC(qnum
, tx_pkts_all
);
843 sc
->debug
.stats
.txstats
[qnum
].tx_bytes_all
+= bf
->bf_mpdu
->len
;
845 if (bf_isampdu(bf
)) {
846 if (flags
& ATH_TX_ERROR
)
847 TX_STAT_INC(qnum
, a_xretries
);
849 TX_STAT_INC(qnum
, a_completed
);
851 if (ts
->ts_status
& ATH9K_TXERR_XRETRY
)
852 TX_STAT_INC(qnum
, xretries
);
854 TX_STAT_INC(qnum
, completed
);
857 if (ts
->ts_status
& ATH9K_TXERR_FILT
)
858 TX_STAT_INC(qnum
, txerr_filtered
);
859 if (ts
->ts_status
& ATH9K_TXERR_FIFO
)
860 TX_STAT_INC(qnum
, fifo_underrun
);
861 if (ts
->ts_status
& ATH9K_TXERR_XTXOP
)
862 TX_STAT_INC(qnum
, xtxop
);
863 if (ts
->ts_status
& ATH9K_TXERR_TIMER_EXPIRED
)
864 TX_STAT_INC(qnum
, timer_exp
);
865 if (ts
->ts_flags
& ATH9K_TX_DESC_CFG_ERR
)
866 TX_STAT_INC(qnum
, desc_cfg_err
);
867 if (ts
->ts_flags
& ATH9K_TX_DATA_UNDERRUN
)
868 TX_STAT_INC(qnum
, data_underrun
);
869 if (ts
->ts_flags
& ATH9K_TX_DELIM_UNDERRUN
)
870 TX_STAT_INC(qnum
, delim_underrun
);
873 static const struct file_operations fops_xmit
= {
874 .read
= read_file_xmit
,
876 .owner
= THIS_MODULE
,
877 .llseek
= default_llseek
,
880 static const struct file_operations fops_queues
= {
881 .read
= read_file_queues
,
883 .owner
= THIS_MODULE
,
884 .llseek
= default_llseek
,
887 static const struct file_operations fops_misc
= {
888 .read
= read_file_misc
,
890 .owner
= THIS_MODULE
,
891 .llseek
= default_llseek
,
894 static const struct file_operations fops_reset
= {
895 .read
= read_file_reset
,
897 .owner
= THIS_MODULE
,
898 .llseek
= default_llseek
,
901 static ssize_t
read_file_recv(struct file
*file
, char __user
*user_buf
,
902 size_t count
, loff_t
*ppos
)
904 #define PHY_ERR(s, p) \
905 len += snprintf(buf + len, size - len, "%22s : %10u\n", s, \
906 sc->debug.stats.rxstats.phy_err_stats[p]);
908 #define RXS_ERR(s, e) \
910 len += snprintf(buf + len, size - len, \
911 "%22s : %10u\n", s, \
912 sc->debug.stats.rxstats.e); \
915 struct ath_softc
*sc
= file
->private_data
;
917 unsigned int len
= 0, size
= 1600;
920 buf
= kzalloc(size
, GFP_KERNEL
);
924 RXS_ERR("CRC ERR", crc_err
);
925 RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err
);
926 RXS_ERR("PHY ERR", phy_err
);
927 RXS_ERR("MIC ERR", mic_err
);
928 RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err
);
929 RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err
);
930 RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err
);
931 RXS_ERR("RX-LENGTH-ERR", rx_len_err
);
932 RXS_ERR("RX-OOM-ERR", rx_oom_err
);
933 RXS_ERR("RX-RATE-ERR", rx_rate_err
);
934 RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err
);
936 PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN
);
937 PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING
);
938 PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY
);
939 PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE
);
940 PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH
);
941 PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR
);
942 PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE
);
943 PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR
);
944 PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING
);
945 PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY
);
946 PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL
);
947 PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL
);
948 PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP
);
949 PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE
);
950 PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART
);
951 PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT
);
952 PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING
);
953 PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC
);
954 PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL
);
955 PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE
);
956 PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART
);
957 PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL
);
958 PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP
);
959 PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR
);
960 PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL
);
961 PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL
);
963 RXS_ERR("RX-Pkts-All", rx_pkts_all
);
964 RXS_ERR("RX-Bytes-All", rx_bytes_all
);
965 RXS_ERR("RX-Beacons", rx_beacons
);
966 RXS_ERR("RX-Frags", rx_frags
);
967 RXS_ERR("RX-Spectral", rx_spectral
);
972 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
981 void ath_debug_stat_rx(struct ath_softc
*sc
, struct ath_rx_status
*rs
)
983 #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++
985 RX_STAT_INC(rx_pkts_all
);
986 sc
->debug
.stats
.rxstats
.rx_bytes_all
+= rs
->rs_datalen
;
988 if (rs
->rs_status
& ATH9K_RXERR_CRC
)
989 RX_STAT_INC(crc_err
);
990 if (rs
->rs_status
& ATH9K_RXERR_DECRYPT
)
991 RX_STAT_INC(decrypt_crc_err
);
992 if (rs
->rs_status
& ATH9K_RXERR_MIC
)
993 RX_STAT_INC(mic_err
);
994 if (rs
->rs_status
& ATH9K_RX_DELIM_CRC_PRE
)
995 RX_STAT_INC(pre_delim_crc_err
);
996 if (rs
->rs_status
& ATH9K_RX_DELIM_CRC_POST
)
997 RX_STAT_INC(post_delim_crc_err
);
998 if (rs
->rs_status
& ATH9K_RX_DECRYPT_BUSY
)
999 RX_STAT_INC(decrypt_busy_err
);
1001 if (rs
->rs_status
& ATH9K_RXERR_PHY
) {
1002 RX_STAT_INC(phy_err
);
1003 if (rs
->rs_phyerr
< ATH9K_PHYERR_MAX
)
1004 RX_PHY_ERR_INC(rs
->rs_phyerr
);
1007 #undef RX_PHY_ERR_INC
1010 static const struct file_operations fops_recv
= {
1011 .read
= read_file_recv
,
1012 .open
= simple_open
,
1013 .owner
= THIS_MODULE
,
1014 .llseek
= default_llseek
,
1017 static ssize_t
read_file_spec_scan_ctl(struct file
*file
, char __user
*user_buf
,
1018 size_t count
, loff_t
*ppos
)
1020 struct ath_softc
*sc
= file
->private_data
;
1024 switch (sc
->spectral_mode
) {
1025 case SPECTRAL_DISABLED
:
1028 case SPECTRAL_BACKGROUND
:
1029 mode
= "background";
1031 case SPECTRAL_CHANSCAN
:
1034 case SPECTRAL_MANUAL
:
1039 return simple_read_from_buffer(user_buf
, count
, ppos
, mode
, len
);
1042 static ssize_t
write_file_spec_scan_ctl(struct file
*file
,
1043 const char __user
*user_buf
,
1044 size_t count
, loff_t
*ppos
)
1046 struct ath_softc
*sc
= file
->private_data
;
1047 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
1051 len
= min(count
, sizeof(buf
) - 1);
1052 if (copy_from_user(buf
, user_buf
, len
))
1057 if (strncmp("trigger", buf
, 7) == 0) {
1058 ath9k_spectral_scan_trigger(sc
->hw
);
1059 } else if (strncmp("background", buf
, 9) == 0) {
1060 ath9k_spectral_scan_config(sc
->hw
, SPECTRAL_BACKGROUND
);
1061 ath_dbg(common
, CONFIG
, "spectral scan: background mode enabled\n");
1062 } else if (strncmp("chanscan", buf
, 8) == 0) {
1063 ath9k_spectral_scan_config(sc
->hw
, SPECTRAL_CHANSCAN
);
1064 ath_dbg(common
, CONFIG
, "spectral scan: channel scan mode enabled\n");
1065 } else if (strncmp("manual", buf
, 6) == 0) {
1066 ath9k_spectral_scan_config(sc
->hw
, SPECTRAL_MANUAL
);
1067 ath_dbg(common
, CONFIG
, "spectral scan: manual mode enabled\n");
1068 } else if (strncmp("disable", buf
, 7) == 0) {
1069 ath9k_spectral_scan_config(sc
->hw
, SPECTRAL_DISABLED
);
1070 ath_dbg(common
, CONFIG
, "spectral scan: disabled\n");
1078 static const struct file_operations fops_spec_scan_ctl
= {
1079 .read
= read_file_spec_scan_ctl
,
1080 .write
= write_file_spec_scan_ctl
,
1081 .open
= simple_open
,
1082 .owner
= THIS_MODULE
,
1083 .llseek
= default_llseek
,
1086 static ssize_t
read_file_spectral_short_repeat(struct file
*file
,
1087 char __user
*user_buf
,
1088 size_t count
, loff_t
*ppos
)
1090 struct ath_softc
*sc
= file
->private_data
;
1094 len
= sprintf(buf
, "%d\n", sc
->spec_config
.short_repeat
);
1095 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1098 static ssize_t
write_file_spectral_short_repeat(struct file
*file
,
1099 const char __user
*user_buf
,
1100 size_t count
, loff_t
*ppos
)
1102 struct ath_softc
*sc
= file
->private_data
;
1107 len
= min(count
, sizeof(buf
) - 1);
1108 if (copy_from_user(buf
, user_buf
, len
))
1112 if (kstrtoul(buf
, 0, &val
))
1115 if (val
< 0 || val
> 1)
1118 sc
->spec_config
.short_repeat
= val
;
1122 static const struct file_operations fops_spectral_short_repeat
= {
1123 .read
= read_file_spectral_short_repeat
,
1124 .write
= write_file_spectral_short_repeat
,
1125 .open
= simple_open
,
1126 .owner
= THIS_MODULE
,
1127 .llseek
= default_llseek
,
1130 static ssize_t
read_file_spectral_count(struct file
*file
,
1131 char __user
*user_buf
,
1132 size_t count
, loff_t
*ppos
)
1134 struct ath_softc
*sc
= file
->private_data
;
1138 len
= sprintf(buf
, "%d\n", sc
->spec_config
.count
);
1139 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1142 static ssize_t
write_file_spectral_count(struct file
*file
,
1143 const char __user
*user_buf
,
1144 size_t count
, loff_t
*ppos
)
1146 struct ath_softc
*sc
= file
->private_data
;
1151 len
= min(count
, sizeof(buf
) - 1);
1152 if (copy_from_user(buf
, user_buf
, len
))
1156 if (kstrtoul(buf
, 0, &val
))
1159 if (val
< 0 || val
> 255)
1162 sc
->spec_config
.count
= val
;
1166 static const struct file_operations fops_spectral_count
= {
1167 .read
= read_file_spectral_count
,
1168 .write
= write_file_spectral_count
,
1169 .open
= simple_open
,
1170 .owner
= THIS_MODULE
,
1171 .llseek
= default_llseek
,
1174 static ssize_t
read_file_spectral_period(struct file
*file
,
1175 char __user
*user_buf
,
1176 size_t count
, loff_t
*ppos
)
1178 struct ath_softc
*sc
= file
->private_data
;
1182 len
= sprintf(buf
, "%d\n", sc
->spec_config
.period
);
1183 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1186 static ssize_t
write_file_spectral_period(struct file
*file
,
1187 const char __user
*user_buf
,
1188 size_t count
, loff_t
*ppos
)
1190 struct ath_softc
*sc
= file
->private_data
;
1195 len
= min(count
, sizeof(buf
) - 1);
1196 if (copy_from_user(buf
, user_buf
, len
))
1200 if (kstrtoul(buf
, 0, &val
))
1203 if (val
< 0 || val
> 255)
1206 sc
->spec_config
.period
= val
;
1210 static const struct file_operations fops_spectral_period
= {
1211 .read
= read_file_spectral_period
,
1212 .write
= write_file_spectral_period
,
1213 .open
= simple_open
,
1214 .owner
= THIS_MODULE
,
1215 .llseek
= default_llseek
,
1218 static ssize_t
read_file_spectral_fft_period(struct file
*file
,
1219 char __user
*user_buf
,
1220 size_t count
, loff_t
*ppos
)
1222 struct ath_softc
*sc
= file
->private_data
;
1226 len
= sprintf(buf
, "%d\n", sc
->spec_config
.fft_period
);
1227 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1230 static ssize_t
write_file_spectral_fft_period(struct file
*file
,
1231 const char __user
*user_buf
,
1232 size_t count
, loff_t
*ppos
)
1234 struct ath_softc
*sc
= file
->private_data
;
1239 len
= min(count
, sizeof(buf
) - 1);
1240 if (copy_from_user(buf
, user_buf
, len
))
1244 if (kstrtoul(buf
, 0, &val
))
1247 if (val
< 0 || val
> 15)
1250 sc
->spec_config
.fft_period
= val
;
1254 static const struct file_operations fops_spectral_fft_period
= {
1255 .read
= read_file_spectral_fft_period
,
1256 .write
= write_file_spectral_fft_period
,
1257 .open
= simple_open
,
1258 .owner
= THIS_MODULE
,
1259 .llseek
= default_llseek
,
1262 static struct dentry
*create_buf_file_handler(const char *filename
,
1263 struct dentry
*parent
,
1265 struct rchan_buf
*buf
,
1268 struct dentry
*buf_file
;
1270 buf_file
= debugfs_create_file(filename
, mode
, parent
, buf
,
1271 &relay_file_operations
);
1276 static int remove_buf_file_handler(struct dentry
*dentry
)
1278 debugfs_remove(dentry
);
1283 void ath_debug_send_fft_sample(struct ath_softc
*sc
,
1284 struct fft_sample_tlv
*fft_sample_tlv
)
1287 if (!sc
->rfs_chan_spec_scan
)
1290 length
= __be16_to_cpu(fft_sample_tlv
->length
) +
1291 sizeof(*fft_sample_tlv
);
1292 relay_write(sc
->rfs_chan_spec_scan
, fft_sample_tlv
, length
);
1295 static struct rchan_callbacks rfs_spec_scan_cb
= {
1296 .create_buf_file
= create_buf_file_handler
,
1297 .remove_buf_file
= remove_buf_file_handler
,
1301 static ssize_t
read_file_regidx(struct file
*file
, char __user
*user_buf
,
1302 size_t count
, loff_t
*ppos
)
1304 struct ath_softc
*sc
= file
->private_data
;
1308 len
= sprintf(buf
, "0x%08x\n", sc
->debug
.regidx
);
1309 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1312 static ssize_t
write_file_regidx(struct file
*file
, const char __user
*user_buf
,
1313 size_t count
, loff_t
*ppos
)
1315 struct ath_softc
*sc
= file
->private_data
;
1316 unsigned long regidx
;
1320 len
= min(count
, sizeof(buf
) - 1);
1321 if (copy_from_user(buf
, user_buf
, len
))
1325 if (kstrtoul(buf
, 0, ®idx
))
1328 sc
->debug
.regidx
= regidx
;
1332 static const struct file_operations fops_regidx
= {
1333 .read
= read_file_regidx
,
1334 .write
= write_file_regidx
,
1335 .open
= simple_open
,
1336 .owner
= THIS_MODULE
,
1337 .llseek
= default_llseek
,
1340 static ssize_t
read_file_regval(struct file
*file
, char __user
*user_buf
,
1341 size_t count
, loff_t
*ppos
)
1343 struct ath_softc
*sc
= file
->private_data
;
1344 struct ath_hw
*ah
= sc
->sc_ah
;
1349 ath9k_ps_wakeup(sc
);
1350 regval
= REG_READ_D(ah
, sc
->debug
.regidx
);
1351 ath9k_ps_restore(sc
);
1352 len
= sprintf(buf
, "0x%08x\n", regval
);
1353 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1356 static ssize_t
write_file_regval(struct file
*file
, const char __user
*user_buf
,
1357 size_t count
, loff_t
*ppos
)
1359 struct ath_softc
*sc
= file
->private_data
;
1360 struct ath_hw
*ah
= sc
->sc_ah
;
1361 unsigned long regval
;
1365 len
= min(count
, sizeof(buf
) - 1);
1366 if (copy_from_user(buf
, user_buf
, len
))
1370 if (kstrtoul(buf
, 0, ®val
))
1373 ath9k_ps_wakeup(sc
);
1374 REG_WRITE_D(ah
, sc
->debug
.regidx
, regval
);
1375 ath9k_ps_restore(sc
);
1379 static const struct file_operations fops_regval
= {
1380 .read
= read_file_regval
,
1381 .write
= write_file_regval
,
1382 .open
= simple_open
,
1383 .owner
= THIS_MODULE
,
1384 .llseek
= default_llseek
,
1387 #define REGDUMP_LINE_SIZE 20
1389 static int open_file_regdump(struct inode
*inode
, struct file
*file
)
1391 struct ath_softc
*sc
= inode
->i_private
;
1392 unsigned int len
= 0;
1395 unsigned long num_regs
, regdump_len
, max_reg_offset
;
1397 max_reg_offset
= AR_SREV_9300_20_OR_LATER(sc
->sc_ah
) ? 0x16bd4 : 0xb500;
1398 num_regs
= max_reg_offset
/ 4 + 1;
1399 regdump_len
= num_regs
* REGDUMP_LINE_SIZE
+ 1;
1400 buf
= vmalloc(regdump_len
);
1404 ath9k_ps_wakeup(sc
);
1405 for (i
= 0; i
< num_regs
; i
++)
1406 len
+= scnprintf(buf
+ len
, regdump_len
- len
,
1407 "0x%06x 0x%08x\n", i
<< 2, REG_READ(sc
->sc_ah
, i
<< 2));
1408 ath9k_ps_restore(sc
);
1410 file
->private_data
= buf
;
1415 static const struct file_operations fops_regdump
= {
1416 .open
= open_file_regdump
,
1417 .read
= ath9k_debugfs_read_buf
,
1418 .release
= ath9k_debugfs_release_buf
,
1419 .owner
= THIS_MODULE
,
1420 .llseek
= default_llseek
,/* read accesses f_pos */
1423 static ssize_t
read_file_dump_nfcal(struct file
*file
, char __user
*user_buf
,
1424 size_t count
, loff_t
*ppos
)
1426 struct ath_softc
*sc
= file
->private_data
;
1427 struct ath_hw
*ah
= sc
->sc_ah
;
1428 struct ath9k_nfcal_hist
*h
= sc
->caldata
.nfCalHist
;
1429 struct ath_common
*common
= ath9k_hw_common(ah
);
1430 struct ieee80211_conf
*conf
= &common
->hw
->conf
;
1431 u32 len
= 0, size
= 1500;
1435 u8 chainmask
= (ah
->rxchainmask
<< 3) | ah
->rxchainmask
;
1438 buf
= kzalloc(size
, GFP_KERNEL
);
1442 len
+= snprintf(buf
+ len
, size
- len
,
1443 "Channel Noise Floor : %d\n", ah
->noise
);
1444 len
+= snprintf(buf
+ len
, size
- len
,
1445 "Chain | privNF | # Readings | NF Readings\n");
1446 for (i
= 0; i
< NUM_NF_READINGS
; i
++) {
1447 if (!(chainmask
& (1 << i
)) ||
1448 ((i
>= AR5416_MAX_CHAINS
) && !conf_is_ht40(conf
)))
1451 nread
= AR_PHY_CCA_FILTERWINDOW_LENGTH
- h
[i
].invalidNFcount
;
1452 len
+= snprintf(buf
+ len
, size
- len
, " %d\t %d\t %d\t\t",
1453 i
, h
[i
].privNF
, nread
);
1454 for (j
= 0; j
< nread
; j
++)
1455 len
+= snprintf(buf
+ len
, size
- len
,
1456 " %d", h
[i
].nfCalBuffer
[j
]);
1457 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1463 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1469 static const struct file_operations fops_dump_nfcal
= {
1470 .read
= read_file_dump_nfcal
,
1471 .open
= simple_open
,
1472 .owner
= THIS_MODULE
,
1473 .llseek
= default_llseek
,
1476 static ssize_t
read_file_base_eeprom(struct file
*file
, char __user
*user_buf
,
1477 size_t count
, loff_t
*ppos
)
1479 struct ath_softc
*sc
= file
->private_data
;
1480 struct ath_hw
*ah
= sc
->sc_ah
;
1481 u32 len
= 0, size
= 1500;
1485 buf
= kzalloc(size
, GFP_KERNEL
);
1489 len
= ah
->eep_ops
->dump_eeprom(ah
, true, buf
, len
, size
);
1491 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1497 static const struct file_operations fops_base_eeprom
= {
1498 .read
= read_file_base_eeprom
,
1499 .open
= simple_open
,
1500 .owner
= THIS_MODULE
,
1501 .llseek
= default_llseek
,
1504 static ssize_t
read_file_modal_eeprom(struct file
*file
, char __user
*user_buf
,
1505 size_t count
, loff_t
*ppos
)
1507 struct ath_softc
*sc
= file
->private_data
;
1508 struct ath_hw
*ah
= sc
->sc_ah
;
1509 u32 len
= 0, size
= 6000;
1513 buf
= kzalloc(size
, GFP_KERNEL
);
1517 len
= ah
->eep_ops
->dump_eeprom(ah
, false, buf
, len
, size
);
1519 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1525 static const struct file_operations fops_modal_eeprom
= {
1526 .read
= read_file_modal_eeprom
,
1527 .open
= simple_open
,
1528 .owner
= THIS_MODULE
,
1529 .llseek
= default_llseek
,
1532 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1533 static ssize_t
read_file_btcoex(struct file
*file
, char __user
*user_buf
,
1534 size_t count
, loff_t
*ppos
)
1536 struct ath_softc
*sc
= file
->private_data
;
1537 u32 len
= 0, size
= 1500;
1541 buf
= kzalloc(size
, GFP_KERNEL
);
1545 if (!sc
->sc_ah
->common
.btcoex_enabled
) {
1546 len
= snprintf(buf
, size
, "%s\n",
1547 "BTCOEX is disabled");
1551 len
= ath9k_dump_btcoex(sc
, buf
, size
);
1553 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1559 static const struct file_operations fops_btcoex
= {
1560 .read
= read_file_btcoex
,
1561 .open
= simple_open
,
1562 .owner
= THIS_MODULE
,
1563 .llseek
= default_llseek
,
1567 static ssize_t
read_file_node_stat(struct file
*file
, char __user
*user_buf
,
1568 size_t count
, loff_t
*ppos
)
1570 struct ath_node
*an
= file
->private_data
;
1571 struct ath_softc
*sc
= an
->sc
;
1572 struct ath_atx_tid
*tid
;
1573 struct ath_atx_ac
*ac
;
1574 struct ath_txq
*txq
;
1575 u32 len
= 0, size
= 4096;
1580 buf
= kzalloc(size
, GFP_KERNEL
);
1584 if (!an
->sta
->ht_cap
.ht_supported
) {
1585 len
= snprintf(buf
, size
, "%s\n",
1586 "HT not supported");
1590 len
= snprintf(buf
, size
, "Max-AMPDU: %d\n",
1592 len
+= snprintf(buf
+ len
, size
- len
, "MPDU Density: %d\n\n",
1595 len
+= snprintf(buf
+ len
, size
- len
,
1596 "%2s%7s\n", "AC", "SCHED");
1598 for (acno
= 0, ac
= &an
->ac
[acno
];
1599 acno
< IEEE80211_NUM_ACS
; acno
++, ac
++) {
1601 ath_txq_lock(sc
, txq
);
1602 len
+= snprintf(buf
+ len
, size
- len
,
1605 ath_txq_unlock(sc
, txq
);
1608 len
+= snprintf(buf
+ len
, size
- len
,
1609 "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n",
1610 "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
1611 "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
1613 for (tidno
= 0, tid
= &an
->tid
[tidno
];
1614 tidno
< IEEE80211_NUM_TIDS
; tidno
++, tid
++) {
1616 ath_txq_lock(sc
, txq
);
1617 len
+= snprintf(buf
+ len
, size
- len
,
1618 "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n",
1619 tid
->tidno
, tid
->seq_start
, tid
->seq_next
,
1620 tid
->baw_size
, tid
->baw_head
, tid
->baw_tail
,
1621 tid
->bar_index
, tid
->sched
, tid
->paused
);
1622 ath_txq_unlock(sc
, txq
);
1625 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1631 static const struct file_operations fops_node_stat
= {
1632 .read
= read_file_node_stat
,
1633 .open
= simple_open
,
1634 .owner
= THIS_MODULE
,
1635 .llseek
= default_llseek
,
1638 void ath9k_sta_add_debugfs(struct ieee80211_hw
*hw
,
1639 struct ieee80211_vif
*vif
,
1640 struct ieee80211_sta
*sta
,
1643 struct ath_node
*an
= (struct ath_node
*)sta
->drv_priv
;
1644 debugfs_create_file("node_stat", S_IRUGO
, dir
, an
, &fops_node_stat
);
1647 /* Ethtool support for get-stats */
1649 #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
1650 static const char ath9k_gstrings_stats
[][ETH_GSTRING_LEN
] = {
1657 AMKSTR(d_tx_mpdus_queued
),
1658 AMKSTR(d_tx_mpdus_completed
),
1659 AMKSTR(d_tx_mpdu_xretries
),
1660 AMKSTR(d_tx_aggregates
),
1661 AMKSTR(d_tx_ampdus_queued_hw
),
1662 AMKSTR(d_tx_ampdus_queued_sw
),
1663 AMKSTR(d_tx_ampdus_completed
),
1664 AMKSTR(d_tx_ampdu_retries
),
1665 AMKSTR(d_tx_ampdu_xretries
),
1666 AMKSTR(d_tx_fifo_underrun
),
1667 AMKSTR(d_tx_op_exceeded
),
1668 AMKSTR(d_tx_timer_expiry
),
1669 AMKSTR(d_tx_desc_cfg_err
),
1670 AMKSTR(d_tx_data_underrun
),
1671 AMKSTR(d_tx_delim_underrun
),
1673 "d_rx_decrypt_crc_err",
1676 "d_rx_pre_delim_crc_err",
1677 "d_rx_post_delim_crc_err",
1678 "d_rx_decrypt_busy_err",
1680 "d_rx_phyerr_radar",
1681 "d_rx_phyerr_ofdm_timing",
1682 "d_rx_phyerr_cck_timing",
1685 #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats)
1687 void ath9k_get_et_strings(struct ieee80211_hw
*hw
,
1688 struct ieee80211_vif
*vif
,
1691 if (sset
== ETH_SS_STATS
)
1692 memcpy(data
, *ath9k_gstrings_stats
,
1693 sizeof(ath9k_gstrings_stats
));
1696 int ath9k_get_et_sset_count(struct ieee80211_hw
*hw
,
1697 struct ieee80211_vif
*vif
, int sset
)
1699 if (sset
== ETH_SS_STATS
)
1700 return ATH9K_SSTATS_LEN
;
1704 #define AWDATA(elem) \
1706 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \
1707 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \
1708 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \
1709 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \
1712 #define AWDATA_RX(elem) \
1714 data[i++] = sc->debug.stats.rxstats.elem; \
1717 void ath9k_get_et_stats(struct ieee80211_hw
*hw
,
1718 struct ieee80211_vif
*vif
,
1719 struct ethtool_stats
*stats
, u64
*data
)
1721 struct ath_softc
*sc
= hw
->priv
;
1724 data
[i
++] = (sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BE
)].tx_pkts_all
+
1725 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BK
)].tx_pkts_all
+
1726 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VI
)].tx_pkts_all
+
1727 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VO
)].tx_pkts_all
);
1728 data
[i
++] = (sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BE
)].tx_bytes_all
+
1729 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BK
)].tx_bytes_all
+
1730 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VI
)].tx_bytes_all
+
1731 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VO
)].tx_bytes_all
);
1732 AWDATA_RX(rx_pkts_all
);
1733 AWDATA_RX(rx_bytes_all
);
1735 AWDATA(tx_pkts_all
);
1736 AWDATA(tx_bytes_all
);
1741 AWDATA(a_queued_hw
);
1742 AWDATA(a_queued_sw
);
1743 AWDATA(a_completed
);
1746 AWDATA(fifo_underrun
);
1749 AWDATA(desc_cfg_err
);
1750 AWDATA(data_underrun
);
1751 AWDATA(delim_underrun
);
1754 AWDATA_RX(decrypt_crc_err
);
1757 AWDATA_RX(pre_delim_crc_err
);
1758 AWDATA_RX(post_delim_crc_err
);
1759 AWDATA_RX(decrypt_busy_err
);
1761 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_RADAR
]);
1762 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_OFDM_TIMING
]);
1763 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_CCK_TIMING
]);
1765 WARN_ON(i
!= ATH9K_SSTATS_LEN
);
1768 void ath9k_deinit_debug(struct ath_softc
*sc
)
1770 if (config_enabled(CONFIG_ATH9K_DEBUGFS
) && sc
->rfs_chan_spec_scan
) {
1771 relay_close(sc
->rfs_chan_spec_scan
);
1772 sc
->rfs_chan_spec_scan
= NULL
;
1776 int ath9k_init_debug(struct ath_hw
*ah
)
1778 struct ath_common
*common
= ath9k_hw_common(ah
);
1779 struct ath_softc
*sc
= (struct ath_softc
*) common
->priv
;
1781 sc
->debug
.debugfs_phy
= debugfs_create_dir("ath9k",
1782 sc
->hw
->wiphy
->debugfsdir
);
1783 if (!sc
->debug
.debugfs_phy
)
1786 #ifdef CONFIG_ATH_DEBUG
1787 debugfs_create_file("debug", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1791 ath9k_dfs_init_debug(sc
);
1793 debugfs_create_file("dma", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1795 debugfs_create_file("interrupt", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1797 debugfs_create_file("xmit", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1799 debugfs_create_file("queues", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1801 debugfs_create_u32("qlen_bk", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1802 &sc
->tx
.txq_max_pending
[IEEE80211_AC_BK
]);
1803 debugfs_create_u32("qlen_be", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1804 &sc
->tx
.txq_max_pending
[IEEE80211_AC_BE
]);
1805 debugfs_create_u32("qlen_vi", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1806 &sc
->tx
.txq_max_pending
[IEEE80211_AC_VI
]);
1807 debugfs_create_u32("qlen_vo", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1808 &sc
->tx
.txq_max_pending
[IEEE80211_AC_VO
]);
1809 debugfs_create_file("misc", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1811 debugfs_create_file("reset", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1813 debugfs_create_file("recv", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1815 debugfs_create_u8("rx_chainmask", S_IRUSR
, sc
->debug
.debugfs_phy
,
1817 debugfs_create_u8("tx_chainmask", S_IRUSR
, sc
->debug
.debugfs_phy
,
1819 debugfs_create_file("ani", S_IRUSR
| S_IWUSR
,
1820 sc
->debug
.debugfs_phy
, sc
, &fops_ani
);
1821 debugfs_create_bool("paprd", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1822 &sc
->sc_ah
->config
.enable_paprd
);
1823 debugfs_create_file("regidx", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1825 debugfs_create_file("regval", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1827 debugfs_create_bool("ignore_extcca", S_IRUSR
| S_IWUSR
,
1828 sc
->debug
.debugfs_phy
,
1829 &ah
->config
.cwm_ignore_extcca
);
1830 debugfs_create_file("regdump", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1832 debugfs_create_file("dump_nfcal", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1834 debugfs_create_file("base_eeprom", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1836 debugfs_create_file("modal_eeprom", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1837 &fops_modal_eeprom
);
1838 sc
->rfs_chan_spec_scan
= relay_open("spectral_scan",
1839 sc
->debug
.debugfs_phy
,
1840 1024, 256, &rfs_spec_scan_cb
,
1842 debugfs_create_file("spectral_scan_ctl", S_IRUSR
| S_IWUSR
,
1843 sc
->debug
.debugfs_phy
, sc
,
1844 &fops_spec_scan_ctl
);
1845 debugfs_create_file("spectral_short_repeat", S_IRUSR
| S_IWUSR
,
1846 sc
->debug
.debugfs_phy
, sc
,
1847 &fops_spectral_short_repeat
);
1848 debugfs_create_file("spectral_count", S_IRUSR
| S_IWUSR
,
1849 sc
->debug
.debugfs_phy
, sc
, &fops_spectral_count
);
1850 debugfs_create_file("spectral_period", S_IRUSR
| S_IWUSR
,
1851 sc
->debug
.debugfs_phy
, sc
, &fops_spectral_period
);
1852 debugfs_create_file("spectral_fft_period", S_IRUSR
| S_IWUSR
,
1853 sc
->debug
.debugfs_phy
, sc
,
1854 &fops_spectral_fft_period
);
1855 debugfs_create_u32("gpio_mask", S_IRUSR
| S_IWUSR
,
1856 sc
->debug
.debugfs_phy
, &sc
->sc_ah
->gpio_mask
);
1857 debugfs_create_u32("gpio_val", S_IRUSR
| S_IWUSR
,
1858 sc
->debug
.debugfs_phy
, &sc
->sc_ah
->gpio_val
);
1859 debugfs_create_file("antenna_diversity", S_IRUSR
,
1860 sc
->debug
.debugfs_phy
, sc
, &fops_antenna_diversity
);
1861 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1862 debugfs_create_file("bt_ant_diversity", S_IRUSR
| S_IWUSR
,
1863 sc
->debug
.debugfs_phy
, sc
, &fops_bt_ant_diversity
);
1864 debugfs_create_file("btcoex", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,