Lines Matching +full:rx +full:- +full:input +full:- +full:m

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2018-2019 Realtek Corporation
21 int (*cb_read)(struct seq_file *m, void *v);
107 static int rtw_debugfs_single_show(struct seq_file *m, void *v) in rtw_debugfs_single_show() argument
109 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_single_show()
111 return debugfs_priv->cb_read(m, v); in rtw_debugfs_single_show()
118 struct rtw_debugfs_priv *debugfs_priv = filp->private_data; in rtw_debugfs_common_write()
120 return debugfs_priv->cb_write(filp, buffer, count, loff); in rtw_debugfs_common_write()
127 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_single_write()
128 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_single_write()
130 return debugfs_priv->cb_write(filp, buffer, count, loff); in rtw_debugfs_single_write()
135 return single_open(filp, rtw_debugfs_single_show, inode->i_private); in rtw_debugfs_single_open_rw()
167 static int rtw_debugfs_get_read_reg(struct seq_file *m, void *v) in rtw_debugfs_get_read_reg() argument
169 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_read_reg()
170 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_read_reg()
173 len = debugfs_priv->read_reg.len; in rtw_debugfs_get_read_reg()
174 addr = debugfs_priv->read_reg.addr; in rtw_debugfs_get_read_reg()
178 seq_printf(m, "reg 0x%03x: 0x%02x\n", addr, val); in rtw_debugfs_get_read_reg()
182 seq_printf(m, "reg 0x%03x: 0x%04x\n", addr, val); in rtw_debugfs_get_read_reg()
186 seq_printf(m, "reg 0x%03x: 0x%08x\n", addr, val); in rtw_debugfs_get_read_reg()
192 static int rtw_debugfs_get_rf_read(struct seq_file *m, void *v) in rtw_debugfs_get_rf_read() argument
194 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_rf_read()
195 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_rf_read()
199 path = debugfs_priv->rf_path; in rtw_debugfs_get_rf_read()
200 addr = debugfs_priv->rf_addr; in rtw_debugfs_get_rf_read()
201 mask = debugfs_priv->rf_mask; in rtw_debugfs_get_rf_read()
203 mutex_lock(&rtwdev->mutex); in rtw_debugfs_get_rf_read()
205 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_get_rf_read()
207 seq_printf(m, "rf_read path:%d addr:0x%08x mask:0x%08x val=0x%08x\n", in rtw_debugfs_get_rf_read()
213 static int rtw_debugfs_get_fix_rate(struct seq_file *m, void *v) in rtw_debugfs_get_fix_rate() argument
215 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_fix_rate()
216 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_fix_rate()
217 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_get_fix_rate()
218 u8 fix_rate = dm_info->fix_rate; in rtw_debugfs_get_fix_rate()
221 seq_printf(m, "Fix rate disabled, fix_rate = %u\n", fix_rate); in rtw_debugfs_get_fix_rate()
225 seq_printf(m, "Data frames fixed at desc rate %u\n", fix_rate); in rtw_debugfs_get_fix_rate()
238 return -EFAULT; in rtw_debugfs_copy_from_user()
240 tmp_len = (count > size - 1 ? size - 1 : count); in rtw_debugfs_copy_from_user()
243 return -EFAULT; in rtw_debugfs_copy_from_user()
254 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_read_reg()
255 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_read_reg()
256 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_read_reg()
269 return -EINVAL; in rtw_debugfs_set_read_reg()
273 return -EINVAL; in rtw_debugfs_set_read_reg()
275 debugfs_priv->read_reg.addr = addr; in rtw_debugfs_set_read_reg()
276 debugfs_priv->read_reg.len = len; in rtw_debugfs_set_read_reg()
281 static int rtw_debugfs_get_dump_cam(struct seq_file *m, void *v) in rtw_debugfs_get_dump_cam() argument
283 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_dump_cam()
284 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_dump_cam()
286 u32 hw_key_idx = debugfs_priv->cb_data << RTW_SEC_CAM_ENTRY_SHIFT; in rtw_debugfs_get_dump_cam()
290 seq_printf(m, "cam entry%d\n", debugfs_priv->cb_data); in rtw_debugfs_get_dump_cam()
291 seq_puts(m, "0x0 0x1 0x2 0x3 "); in rtw_debugfs_get_dump_cam()
292 seq_puts(m, "0x4 0x5\n"); in rtw_debugfs_get_dump_cam()
293 mutex_lock(&rtwdev->mutex); in rtw_debugfs_get_dump_cam()
298 seq_printf(m, "%8.8x", val); in rtw_debugfs_get_dump_cam()
300 seq_puts(m, " "); in rtw_debugfs_get_dump_cam()
302 seq_puts(m, "\n"); in rtw_debugfs_get_dump_cam()
303 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_get_dump_cam()
307 static int rtw_debugfs_get_rsvd_page(struct seq_file *m, void *v) in rtw_debugfs_get_rsvd_page() argument
309 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_rsvd_page()
310 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_rsvd_page()
311 u16 page_size = rtwdev->chip->page_size; in rtw_debugfs_get_rsvd_page()
312 u32 buf_size = debugfs_priv->rsvd_page.page_num * page_size; in rtw_debugfs_get_rsvd_page()
313 u32 offset = debugfs_priv->rsvd_page.page_offset * page_size; in rtw_debugfs_get_rsvd_page()
320 return -ENOMEM; in rtw_debugfs_get_rsvd_page()
332 seq_printf(m, "PAGE %d\n", (i + offset) / page_size); in rtw_debugfs_get_rsvd_page()
333 seq_printf(m, "%8ph\n", buf + i); in rtw_debugfs_get_rsvd_page()
344 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_rsvd_page()
345 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_rsvd_page()
346 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_rsvd_page()
360 return -EINVAL; in rtw_debugfs_set_rsvd_page()
363 debugfs_priv->rsvd_page.page_offset = offset; in rtw_debugfs_set_rsvd_page()
364 debugfs_priv->rsvd_page.page_num = page_num; in rtw_debugfs_set_rsvd_page()
373 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_single_input()
374 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_single_input()
375 u32 input; in rtw_debugfs_set_single_input() local
378 ret = kstrtou32_from_user(buffer, count, 0, &input); in rtw_debugfs_set_single_input()
382 debugfs_priv->cb_data = input; in rtw_debugfs_set_single_input()
391 struct rtw_debugfs_priv *debugfs_priv = filp->private_data; in rtw_debugfs_set_write_reg()
392 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_write_reg()
406 return -EINVAL; in rtw_debugfs_set_write_reg()
437 struct rtw_debugfs_priv *debugfs_priv = filp->private_data; in rtw_debugfs_set_h2c()
438 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_h2c()
453 return -EINVAL; in rtw_debugfs_set_h2c()
456 mutex_lock(&rtwdev->mutex); in rtw_debugfs_set_h2c()
458 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_set_h2c()
467 struct rtw_debugfs_priv *debugfs_priv = filp->private_data; in rtw_debugfs_set_rf_write()
468 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_rf_write()
482 return -EINVAL; in rtw_debugfs_set_rf_write()
485 mutex_lock(&rtwdev->mutex); in rtw_debugfs_set_rf_write()
487 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_set_rf_write()
499 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_rf_read()
500 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_rf_read()
501 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_rf_read()
515 return -EINVAL; in rtw_debugfs_set_rf_read()
518 debugfs_priv->rf_path = path; in rtw_debugfs_set_rf_read()
519 debugfs_priv->rf_addr = addr; in rtw_debugfs_set_rf_read()
520 debugfs_priv->rf_mask = mask; in rtw_debugfs_set_rf_read()
529 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_fix_rate()
530 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_fix_rate()
531 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_fix_rate()
532 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_set_fix_rate()
540 dm_info->fix_rate = fix_rate; in rtw_debugfs_set_fix_rate()
545 static int rtw_debug_get_mac_page(struct seq_file *m, void *v) in rtw_debug_get_mac_page() argument
547 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debug_get_mac_page()
548 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debug_get_mac_page()
549 u32 page = debugfs_priv->cb_data; in rtw_debug_get_mac_page()
553 rtw_read32(rtwdev, debugfs_priv->cb_data); in rtw_debug_get_mac_page()
555 seq_printf(m, "\n%8.8x ", n + page); in rtw_debug_get_mac_page()
557 seq_printf(m, "%8.8x ", in rtw_debug_get_mac_page()
560 seq_puts(m, "\n"); in rtw_debug_get_mac_page()
564 static int rtw_debug_get_bb_page(struct seq_file *m, void *v) in rtw_debug_get_bb_page() argument
566 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debug_get_bb_page()
567 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debug_get_bb_page()
568 u32 page = debugfs_priv->cb_data; in rtw_debug_get_bb_page()
572 rtw_read32(rtwdev, debugfs_priv->cb_data); in rtw_debug_get_bb_page()
574 seq_printf(m, "\n%8.8x ", n + page); in rtw_debug_get_bb_page()
576 seq_printf(m, "%8.8x ", in rtw_debug_get_bb_page()
579 seq_puts(m, "\n"); in rtw_debug_get_bb_page()
583 static int rtw_debugfs_get_rf_dump(struct seq_file *m, void *v) in rtw_debugfs_get_rf_dump() argument
585 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_rf_dump()
586 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_rf_dump()
590 mutex_lock(&rtwdev->mutex); in rtw_debugfs_get_rf_dump()
592 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in rtw_debugfs_get_rf_dump()
593 seq_printf(m, "RF path:%d\n", path); in rtw_debugfs_get_rf_dump()
595 seq_printf(m, "%8.8x ", addr); in rtw_debugfs_get_rf_dump()
599 seq_printf(m, "%8.8x ", data); in rtw_debugfs_get_rf_dump()
601 seq_puts(m, "\n"); in rtw_debugfs_get_rf_dump()
603 seq_puts(m, "\n"); in rtw_debugfs_get_rf_dump()
606 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_get_rf_dump()
611 static void rtw_print_cck_rate_txt(struct seq_file *m, u8 rate) in rtw_print_cck_rate_txt() argument
614 cck_rate[] = {"1M", "2M", "5.5M", "11M"}; in rtw_print_cck_rate_txt()
615 u8 idx = rate - DESC_RATE1M; in rtw_print_cck_rate_txt()
617 seq_printf(m, " CCK_%-5s", cck_rate[idx]); in rtw_print_cck_rate_txt()
620 static void rtw_print_ofdm_rate_txt(struct seq_file *m, u8 rate) in rtw_print_ofdm_rate_txt() argument
623 ofdm_rate[] = {"6M", "9M", "12M", "18M", "24M", "36M", "48M", "54M"}; in rtw_print_ofdm_rate_txt()
624 u8 idx = rate - DESC_RATE6M; in rtw_print_ofdm_rate_txt()
626 seq_printf(m, " OFDM_%-4s", ofdm_rate[idx]); in rtw_print_ofdm_rate_txt()
629 static void rtw_print_ht_rate_txt(struct seq_file *m, u8 rate) in rtw_print_ht_rate_txt() argument
631 u8 mcs_n = rate - DESC_RATEMCS0; in rtw_print_ht_rate_txt()
633 seq_printf(m, " MCS%-6u", mcs_n); in rtw_print_ht_rate_txt()
636 static void rtw_print_vht_rate_txt(struct seq_file *m, u8 rate) in rtw_print_vht_rate_txt() argument
638 u8 idx = rate - DESC_RATEVHT1SS_MCS0; in rtw_print_vht_rate_txt()
645 seq_printf(m, " VHT%uSMCS%u", n_ss, mcs_n); in rtw_print_vht_rate_txt()
648 static void rtw_print_rate(struct seq_file *m, u8 rate) in rtw_print_rate() argument
652 rtw_print_cck_rate_txt(m, rate); in rtw_print_rate()
655 rtw_print_ofdm_rate_txt(m, rate); in rtw_print_rate()
658 rtw_print_ht_rate_txt(m, rate); in rtw_print_rate()
661 rtw_print_vht_rate_txt(m, rate); in rtw_print_rate()
664 seq_printf(m, " Unknown rate=0x%x\n", rate); in rtw_print_rate()
691 static int rtw_debugfs_get_tx_pwr_tbl(struct seq_file *m, void *v) in rtw_debugfs_get_tx_pwr_tbl() argument
693 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_tx_pwr_tbl()
694 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_tx_pwr_tbl()
695 struct rtw_hal *hal = &rtwdev->hal; in rtw_debugfs_get_tx_pwr_tbl()
699 mutex_lock(&rtwdev->mutex); in rtw_debugfs_get_tx_pwr_tbl()
700 bw = hal->current_band_width; in rtw_debugfs_get_tx_pwr_tbl()
701 ch = hal->current_channel; in rtw_debugfs_get_tx_pwr_tbl()
704 seq_printf(m, "channel: %u\n", ch); in rtw_debugfs_get_tx_pwr_tbl()
705 seq_printf(m, "bandwidth: %u\n", bw); in rtw_debugfs_get_tx_pwr_tbl()
706 seq_printf(m, "regulatory: %s\n", rtw_get_regd_string(regd)); in rtw_debugfs_get_tx_pwr_tbl()
707 seq_printf(m, "%-4s %-10s %-9s %-9s (%-4s %-4s %-4s) %-4s\n", in rtw_debugfs_get_tx_pwr_tbl()
710 mutex_lock(&hal->tx_power_mutex); in rtw_debugfs_get_tx_pwr_tbl()
713 if (hal->current_band_type == RTW_BAND_5G) in rtw_debugfs_get_tx_pwr_tbl()
728 seq_printf(m, "%4c ", path + 'A'); in rtw_debugfs_get_tx_pwr_tbl()
729 rtw_print_rate(m, rate); in rtw_debugfs_get_tx_pwr_tbl()
730 seq_printf(m, " %3u(0x%02x) %4u %4d (%4d %4d %4d) %4d\n", in rtw_debugfs_get_tx_pwr_tbl()
731 hal->tx_pwr_tbl[path][rate], in rtw_debugfs_get_tx_pwr_tbl()
732 hal->tx_pwr_tbl[path][rate], in rtw_debugfs_get_tx_pwr_tbl()
743 mutex_unlock(&hal->tx_power_mutex); in rtw_debugfs_get_tx_pwr_tbl()
744 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_get_tx_pwr_tbl()
749 void rtw_debugfs_get_simple_phy_info(struct seq_file *m) in rtw_debugfs_get_simple_phy_info() argument
751 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_simple_phy_info()
752 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_simple_phy_info()
753 struct rtw_hal *hal = &rtwdev->hal; in rtw_debugfs_get_simple_phy_info()
754 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_get_simple_phy_info()
755 struct rtw_traffic_stats *stats = &rtwdev->stats; in rtw_debugfs_get_simple_phy_info()
757 seq_printf(m, "%-40s = %ddBm/ %d\n", "RSSI/ STA Channel", in rtw_debugfs_get_simple_phy_info()
758 dm_info->rssi[RF_PATH_A] - 100, hal->current_channel); in rtw_debugfs_get_simple_phy_info()
760 seq_printf(m, "TP {Tx, Rx} = {%u, %u}Mbps\n", in rtw_debugfs_get_simple_phy_info()
761 stats->tx_throughput, stats->rx_throughput); in rtw_debugfs_get_simple_phy_info()
763 seq_puts(m, "[Tx Rate] = "); in rtw_debugfs_get_simple_phy_info()
764 rtw_print_rate(m, dm_info->tx_rate); in rtw_debugfs_get_simple_phy_info()
765 seq_printf(m, "(0x%x)\n", dm_info->tx_rate); in rtw_debugfs_get_simple_phy_info()
767 seq_puts(m, "[Rx Rate] = "); in rtw_debugfs_get_simple_phy_info()
768 rtw_print_rate(m, dm_info->curr_rx_rate); in rtw_debugfs_get_simple_phy_info()
769 seq_printf(m, "(0x%x)\n", dm_info->curr_rx_rate); in rtw_debugfs_get_simple_phy_info()
772 static int rtw_debugfs_get_phy_info(struct seq_file *m, void *v) in rtw_debugfs_get_phy_info() argument
774 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_phy_info()
775 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_phy_info()
776 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_get_phy_info()
777 struct rtw_traffic_stats *stats = &rtwdev->stats; in rtw_debugfs_get_phy_info()
778 struct rtw_pkt_count *last_cnt = &dm_info->last_pkt_count; in rtw_debugfs_get_phy_info()
779 struct rtw_efuse *efuse = &rtwdev->efuse; in rtw_debugfs_get_phy_info()
780 struct ewma_evm *ewma_evm = dm_info->ewma_evm; in rtw_debugfs_get_phy_info()
781 struct ewma_snr *ewma_snr = dm_info->ewma_snr; in rtw_debugfs_get_phy_info()
784 seq_puts(m, "==========[Common Info]========\n"); in rtw_debugfs_get_phy_info()
785 seq_printf(m, "Is link = %c\n", rtw_is_assoc(rtwdev) ? 'Y' : 'N'); in rtw_debugfs_get_phy_info()
786 seq_printf(m, "Current CH(fc) = %u\n", rtwdev->hal.current_channel); in rtw_debugfs_get_phy_info()
787 seq_printf(m, "Current BW = %u\n", rtwdev->hal.current_band_width); in rtw_debugfs_get_phy_info()
788 seq_printf(m, "Current IGI = 0x%x\n", dm_info->igi_history[0]); in rtw_debugfs_get_phy_info()
789 seq_printf(m, "TP {Tx, Rx} = {%u, %u}Mbps\n", in rtw_debugfs_get_phy_info()
790 stats->tx_throughput, stats->rx_throughput); in rtw_debugfs_get_phy_info()
791 seq_printf(m, "1SS for TX and RX = %c\n\n", rtwdev->hal.txrx_1ss ? in rtw_debugfs_get_phy_info()
794 seq_puts(m, "==========[Tx Phy Info]========\n"); in rtw_debugfs_get_phy_info()
795 seq_puts(m, "[Tx Rate] = "); in rtw_debugfs_get_phy_info()
796 rtw_print_rate(m, dm_info->tx_rate); in rtw_debugfs_get_phy_info()
797 seq_printf(m, "(0x%x)\n\n", dm_info->tx_rate); in rtw_debugfs_get_phy_info()
799 seq_puts(m, "==========[Rx Phy Info]========\n"); in rtw_debugfs_get_phy_info()
800 seq_printf(m, "[Rx Beacon Count] = %u\n", last_cnt->num_bcn_pkt); in rtw_debugfs_get_phy_info()
801 seq_puts(m, "[Rx Rate] = "); in rtw_debugfs_get_phy_info()
802 rtw_print_rate(m, dm_info->curr_rx_rate); in rtw_debugfs_get_phy_info()
803 seq_printf(m, "(0x%x)\n", dm_info->curr_rx_rate); in rtw_debugfs_get_phy_info()
805 seq_puts(m, "[Rx Rate Count]:\n"); in rtw_debugfs_get_phy_info()
806 seq_printf(m, " * CCK = {%u, %u, %u, %u}\n", in rtw_debugfs_get_phy_info()
807 last_cnt->num_qry_pkt[DESC_RATE1M], in rtw_debugfs_get_phy_info()
808 last_cnt->num_qry_pkt[DESC_RATE2M], in rtw_debugfs_get_phy_info()
809 last_cnt->num_qry_pkt[DESC_RATE5_5M], in rtw_debugfs_get_phy_info()
810 last_cnt->num_qry_pkt[DESC_RATE11M]); in rtw_debugfs_get_phy_info()
812 seq_printf(m, " * OFDM = {%u, %u, %u, %u, %u, %u, %u, %u}\n", in rtw_debugfs_get_phy_info()
813 last_cnt->num_qry_pkt[DESC_RATE6M], in rtw_debugfs_get_phy_info()
814 last_cnt->num_qry_pkt[DESC_RATE9M], in rtw_debugfs_get_phy_info()
815 last_cnt->num_qry_pkt[DESC_RATE12M], in rtw_debugfs_get_phy_info()
816 last_cnt->num_qry_pkt[DESC_RATE18M], in rtw_debugfs_get_phy_info()
817 last_cnt->num_qry_pkt[DESC_RATE24M], in rtw_debugfs_get_phy_info()
818 last_cnt->num_qry_pkt[DESC_RATE36M], in rtw_debugfs_get_phy_info()
819 last_cnt->num_qry_pkt[DESC_RATE48M], in rtw_debugfs_get_phy_info()
820 last_cnt->num_qry_pkt[DESC_RATE54M]); in rtw_debugfs_get_phy_info()
822 for (ss = 0; ss < efuse->hw_cap.nss; ss++) { in rtw_debugfs_get_phy_info()
824 seq_printf(m, " * HT_MCS[%u:%u] = {%u, %u, %u, %u, %u, %u, %u, %u}\n", in rtw_debugfs_get_phy_info()
826 last_cnt->num_qry_pkt[rate_id], in rtw_debugfs_get_phy_info()
827 last_cnt->num_qry_pkt[rate_id + 1], in rtw_debugfs_get_phy_info()
828 last_cnt->num_qry_pkt[rate_id + 2], in rtw_debugfs_get_phy_info()
829 last_cnt->num_qry_pkt[rate_id + 3], in rtw_debugfs_get_phy_info()
830 last_cnt->num_qry_pkt[rate_id + 4], in rtw_debugfs_get_phy_info()
831 last_cnt->num_qry_pkt[rate_id + 5], in rtw_debugfs_get_phy_info()
832 last_cnt->num_qry_pkt[rate_id + 6], in rtw_debugfs_get_phy_info()
833 last_cnt->num_qry_pkt[rate_id + 7]); in rtw_debugfs_get_phy_info()
836 for (ss = 0; ss < efuse->hw_cap.nss; ss++) { in rtw_debugfs_get_phy_info()
838 seq_printf(m, " * VHT_MCS-%uss MCS[0:9] = {%u, %u, %u, %u, %u, %u, %u, %u, %u, %u}\n", in rtw_debugfs_get_phy_info()
840 last_cnt->num_qry_pkt[rate_id], in rtw_debugfs_get_phy_info()
841 last_cnt->num_qry_pkt[rate_id + 1], in rtw_debugfs_get_phy_info()
842 last_cnt->num_qry_pkt[rate_id + 2], in rtw_debugfs_get_phy_info()
843 last_cnt->num_qry_pkt[rate_id + 3], in rtw_debugfs_get_phy_info()
844 last_cnt->num_qry_pkt[rate_id + 4], in rtw_debugfs_get_phy_info()
845 last_cnt->num_qry_pkt[rate_id + 5], in rtw_debugfs_get_phy_info()
846 last_cnt->num_qry_pkt[rate_id + 6], in rtw_debugfs_get_phy_info()
847 last_cnt->num_qry_pkt[rate_id + 7], in rtw_debugfs_get_phy_info()
848 last_cnt->num_qry_pkt[rate_id + 8], in rtw_debugfs_get_phy_info()
849 last_cnt->num_qry_pkt[rate_id + 9]); in rtw_debugfs_get_phy_info()
852 seq_printf(m, "[RSSI(dBm)] = {%d, %d}\n", in rtw_debugfs_get_phy_info()
853 dm_info->rssi[RF_PATH_A] - 100, in rtw_debugfs_get_phy_info()
854 dm_info->rssi[RF_PATH_B] - 100); in rtw_debugfs_get_phy_info()
855 seq_printf(m, "[Rx EVM(dB)] = {-%d, -%d}\n", in rtw_debugfs_get_phy_info()
856 dm_info->rx_evm_dbm[RF_PATH_A], in rtw_debugfs_get_phy_info()
857 dm_info->rx_evm_dbm[RF_PATH_B]); in rtw_debugfs_get_phy_info()
858 seq_printf(m, "[Rx SNR] = {%d, %d}\n", in rtw_debugfs_get_phy_info()
859 dm_info->rx_snr[RF_PATH_A], in rtw_debugfs_get_phy_info()
860 dm_info->rx_snr[RF_PATH_B]); in rtw_debugfs_get_phy_info()
861 seq_printf(m, "[CFO_tail(KHz)] = {%d, %d}\n", in rtw_debugfs_get_phy_info()
862 dm_info->cfo_tail[RF_PATH_A], in rtw_debugfs_get_phy_info()
863 dm_info->cfo_tail[RF_PATH_B]); in rtw_debugfs_get_phy_info()
865 if (dm_info->curr_rx_rate >= DESC_RATE11M) { in rtw_debugfs_get_phy_info()
866 seq_puts(m, "[Rx Average Status]:\n"); in rtw_debugfs_get_phy_info()
867 seq_printf(m, " * OFDM, EVM: {-%d}, SNR: {%d}\n", in rtw_debugfs_get_phy_info()
870 seq_printf(m, " * 1SS, EVM: {-%d}, SNR: {%d}\n", in rtw_debugfs_get_phy_info()
873 seq_printf(m, " * 2SS, EVM: {-%d, -%d}, SNR: {%d, %d}\n", in rtw_debugfs_get_phy_info()
880 seq_puts(m, "[Rx Counter]:\n"); in rtw_debugfs_get_phy_info()
881 seq_printf(m, " * CCA (CCK, OFDM, Total) = (%u, %u, %u)\n", in rtw_debugfs_get_phy_info()
882 dm_info->cck_cca_cnt, in rtw_debugfs_get_phy_info()
883 dm_info->ofdm_cca_cnt, in rtw_debugfs_get_phy_info()
884 dm_info->total_cca_cnt); in rtw_debugfs_get_phy_info()
885 seq_printf(m, " * False Alarm (CCK, OFDM, Total) = (%u, %u, %u)\n", in rtw_debugfs_get_phy_info()
886 dm_info->cck_fa_cnt, in rtw_debugfs_get_phy_info()
887 dm_info->ofdm_fa_cnt, in rtw_debugfs_get_phy_info()
888 dm_info->total_fa_cnt); in rtw_debugfs_get_phy_info()
889 seq_printf(m, " * CCK cnt (ok, err) = (%u, %u)\n", in rtw_debugfs_get_phy_info()
890 dm_info->cck_ok_cnt, dm_info->cck_err_cnt); in rtw_debugfs_get_phy_info()
891 seq_printf(m, " * OFDM cnt (ok, err) = (%u, %u)\n", in rtw_debugfs_get_phy_info()
892 dm_info->ofdm_ok_cnt, dm_info->ofdm_err_cnt); in rtw_debugfs_get_phy_info()
893 seq_printf(m, " * HT cnt (ok, err) = (%u, %u)\n", in rtw_debugfs_get_phy_info()
894 dm_info->ht_ok_cnt, dm_info->ht_err_cnt); in rtw_debugfs_get_phy_info()
895 seq_printf(m, " * VHT cnt (ok, err) = (%u, %u)\n", in rtw_debugfs_get_phy_info()
896 dm_info->vht_ok_cnt, dm_info->vht_err_cnt); in rtw_debugfs_get_phy_info()
901 static int rtw_debugfs_get_coex_info(struct seq_file *m, void *v) in rtw_debugfs_get_coex_info() argument
903 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_coex_info()
904 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_coex_info()
906 mutex_lock(&rtwdev->mutex); in rtw_debugfs_get_coex_info()
907 rtw_coex_display_coex_info(rtwdev, m); in rtw_debugfs_get_coex_info()
908 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_get_coex_info()
917 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_coex_enable()
918 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_coex_enable()
919 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_coex_enable()
920 struct rtw_coex *coex = &rtwdev->coex; in rtw_debugfs_set_coex_enable()
928 mutex_lock(&rtwdev->mutex); in rtw_debugfs_set_coex_enable()
929 coex->manual_control = !enable; in rtw_debugfs_set_coex_enable()
930 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_set_coex_enable()
935 static int rtw_debugfs_get_coex_enable(struct seq_file *m, void *v) in rtw_debugfs_get_coex_enable() argument
937 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_coex_enable()
938 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_coex_enable()
939 struct rtw_coex *coex = &rtwdev->coex; in rtw_debugfs_get_coex_enable()
941 seq_printf(m, "coex mechanism %s\n", in rtw_debugfs_get_coex_enable()
942 coex->manual_control ? "disabled" : "enabled"); in rtw_debugfs_get_coex_enable()
951 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_edcca_enable()
952 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_edcca_enable()
953 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_edcca_enable()
954 bool input; in rtw_debugfs_set_edcca_enable() local
957 err = kstrtobool_from_user(buffer, count, &input); in rtw_debugfs_set_edcca_enable()
961 rtw_edcca_enabled = input; in rtw_debugfs_set_edcca_enable()
967 static int rtw_debugfs_get_edcca_enable(struct seq_file *m, void *v) in rtw_debugfs_get_edcca_enable() argument
969 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_edcca_enable()
970 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_edcca_enable()
971 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_get_edcca_enable()
973 seq_printf(m, "EDCCA %s: EDCCA mode %d\n", in rtw_debugfs_get_edcca_enable()
975 dm_info->edcca_mode); in rtw_debugfs_get_edcca_enable()
983 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_fw_crash()
984 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_fw_crash()
985 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_fw_crash()
986 bool input; in rtw_debugfs_set_fw_crash() local
989 ret = kstrtobool_from_user(buffer, count, &input); in rtw_debugfs_set_fw_crash()
993 if (!input) in rtw_debugfs_set_fw_crash()
994 return -EINVAL; in rtw_debugfs_set_fw_crash()
996 if (test_bit(RTW_FLAG_RESTARTING, rtwdev->flags)) in rtw_debugfs_set_fw_crash()
997 return -EINPROGRESS; in rtw_debugfs_set_fw_crash()
999 mutex_lock(&rtwdev->mutex); in rtw_debugfs_set_fw_crash()
1001 set_bit(RTW_FLAG_RESTART_TRIGGERING, rtwdev->flags); in rtw_debugfs_set_fw_crash()
1003 mutex_unlock(&rtwdev->mutex); in rtw_debugfs_set_fw_crash()
1008 static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v) in rtw_debugfs_get_fw_crash() argument
1010 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_fw_crash()
1011 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_fw_crash()
1013 seq_printf(m, "%d\n", in rtw_debugfs_get_fw_crash()
1014 test_bit(RTW_FLAG_RESTART_TRIGGERING, rtwdev->flags) || in rtw_debugfs_get_fw_crash()
1015 test_bit(RTW_FLAG_RESTARTING, rtwdev->flags)); in rtw_debugfs_get_fw_crash()
1023 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_force_lowest_basic_rate()
1024 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_force_lowest_basic_rate()
1025 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_force_lowest_basic_rate()
1026 bool input; in rtw_debugfs_set_force_lowest_basic_rate() local
1029 err = kstrtobool_from_user(buffer, count, &input); in rtw_debugfs_set_force_lowest_basic_rate()
1033 if (input) in rtw_debugfs_set_force_lowest_basic_rate()
1034 set_bit(RTW_FLAG_FORCE_LOWEST_RATE, rtwdev->flags); in rtw_debugfs_set_force_lowest_basic_rate()
1036 clear_bit(RTW_FLAG_FORCE_LOWEST_RATE, rtwdev->flags); in rtw_debugfs_set_force_lowest_basic_rate()
1041 static int rtw_debugfs_get_force_lowest_basic_rate(struct seq_file *m, void *v) in rtw_debugfs_get_force_lowest_basic_rate() argument
1043 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_force_lowest_basic_rate()
1044 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_force_lowest_basic_rate()
1046 seq_printf(m, "force lowest basic rate: %d\n", in rtw_debugfs_get_force_lowest_basic_rate()
1047 test_bit(RTW_FLAG_FORCE_LOWEST_RATE, rtwdev->flags)); in rtw_debugfs_get_force_lowest_basic_rate()
1056 struct seq_file *seqpriv = (struct seq_file *)filp->private_data; in rtw_debugfs_set_dm_cap()
1057 struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; in rtw_debugfs_set_dm_cap()
1058 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_set_dm_cap()
1059 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_set_dm_cap()
1072 return -EINVAL; in rtw_debugfs_set_dm_cap()
1076 dm_info->dm_flags &= ~BIT(bit); in rtw_debugfs_set_dm_cap()
1078 dm_info->dm_flags |= BIT(bit); in rtw_debugfs_set_dm_cap()
1080 debugfs_priv->dm_cap.bit = bit; in rtw_debugfs_set_dm_cap()
1085 static void dump_gapk_status(struct rtw_dev *rtwdev, struct seq_file *m) in dump_gapk_status() argument
1087 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in dump_gapk_status()
1088 struct rtw_gapk_info *txgapk = &rtwdev->dm_info.gapk; in dump_gapk_status()
1092 seq_printf(m, "\n(%2d) %c%s\n\n", RTW_DM_CAP_TXGAPK, in dump_gapk_status()
1093 dm_info->dm_flags & BIT(RTW_DM_CAP_TXGAPK) ? '-' : '+', in dump_gapk_status()
1096 mutex_lock(&rtwdev->mutex); in dump_gapk_status()
1098 for (path = 0; path < rtwdev->hal.rf_path_num; path++) { in dump_gapk_status()
1100 seq_printf(m, "path %d:\n0x%x = 0x%x\n", path, RF_GAINTX, val); in dump_gapk_status()
1103 seq_printf(m, "[TXGAPK] offset %d %d\n", in dump_gapk_status()
1104 txgapk->rf3f_fs[path][i], i); in dump_gapk_status()
1105 seq_puts(m, "\n"); in dump_gapk_status()
1107 mutex_unlock(&rtwdev->mutex); in dump_gapk_status()
1110 static int rtw_debugfs_get_dm_cap(struct seq_file *m, void *v) in rtw_debugfs_get_dm_cap() argument
1112 struct rtw_debugfs_priv *debugfs_priv = m->private; in rtw_debugfs_get_dm_cap()
1113 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; in rtw_debugfs_get_dm_cap()
1114 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in rtw_debugfs_get_dm_cap()
1117 switch (debugfs_priv->dm_cap.bit) { in rtw_debugfs_get_dm_cap()
1119 dump_gapk_status(rtwdev, m); in rtw_debugfs_get_dm_cap()
1123 seq_printf(m, "(%2d) %c%s\n", i, in rtw_debugfs_get_dm_cap()
1124 dm_info->dm_flags & BIT(i) ? '-' : '+', in rtw_debugfs_get_dm_cap()
1129 debugfs_priv->dm_cap.bit = RTW_DM_CAP_NA; in rtw_debugfs_get_dm_cap()
1225 struct rtw_debugfs_priv *priv = &rtwdev->debugfs->name; \
1226 priv->rtwdev = rtwdev; \
1303 if (rtwdev->chip->id == RTW_CHIP_TYPE_8822C) { in rtw_debugfs_add_sec1()
1315 rtwdev->debugfs = kmemdup(&rtw_debugfs_templ, sizeof(rtw_debugfs_templ), in rtw_debugfs_init()
1317 if (!rtwdev->debugfs) in rtw_debugfs_init()
1321 rtwdev->hw->wiphy->debugfsdir); in rtw_debugfs_init()
1330 kfree(rtwdev->debugfs); in rtw_debugfs_deinit()
1348 dev_printk(KERN_DEBUG, rtwdev->dev, "%pV", &vaf); in rtw_dbg()