Skip to content

Commit

Permalink
rtlwifi: Improve debugging by using debugfs
Browse files Browse the repository at this point in the history
Use debugfs to dump register and btcoex status, and also write registers
and h2c.

We create topdir in /sys/kernel/debug/rtlwifi/, and use the MAC address
as subdirectory with several entries to dump mac_reg, bb_reg, rf_reg etc.
An example is
    /sys/kernel/debug/rtlwifi/00-11-22-33-44-55-66/mac_0

This change permits examination of device registers in a dynamic manner,
a feature not available with the current debug mechanism.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Ping-Ke Shih authored and Kalle Valo committed Jan 8, 2018
1 parent 981a2b6 commit 610247f
Show file tree
Hide file tree
Showing 9 changed files with 523 additions and 2 deletions.
6 changes: 6 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,9 @@ static int __init rtl_core_module_init(void)
if (rtl_rate_control_register())
pr_err("rtl: Unable to register rtl_rc, use default RC !!\n");

/* add debugfs */
rtl_debugfs_add_topdir();

/* init some global vars */
INIT_LIST_HEAD(&rtl_global_var.glb_priv_list);
spin_lock_init(&rtl_global_var.glb_list_lock);
Expand All @@ -2541,6 +2544,9 @@ static void __exit rtl_core_module_exit(void)
{
/*RC*/
rtl_rate_control_unregister();

/* remove debugfs */
rtl_debugfs_remove_topdir();
}

module_init(rtl_core_module_init);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,8 @@ void exhalbtc_set_single_ant_path(u8 single_ant_path)
gl_bt_coexist.board_info.single_ant_path = single_ant_path;
}

void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist)
void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
struct seq_file *m)
{
if (!halbtc_is_bt_coexist_available(btcoexist))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ void exhalbtc_update_min_bt_rssi(s8 bt_rssi);
void exhalbtc_set_bt_exist(bool bt_exist);
void exhalbtc_set_chip_type(u8 chip_type);
void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num);
void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist);
void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
struct seq_file *m);
void exhalbtc_signal_compensation(struct btc_coexist *btcoexist,
u8 *rssi_wifi, u8 *rssi_bt);
void exhalbtc_lps_leave(struct btc_coexist *btcoexist);
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ static struct rtl_btc_ops rtl_btc_operation = {
.btc_is_bt_ctrl_lps = rtl_btc_is_bt_ctrl_lps,
.btc_is_bt_lps_on = rtl_btc_is_bt_lps_on,
.btc_get_ampdu_cfg = rtl_btc_get_ampdu_cfg,
.btc_display_bt_coex_info = rtl_btc_display_bt_coex_info,
};

void rtl_btc_display_bt_coex_info(struct rtl_priv *rtlpriv, struct seq_file *m)
{
exhalbtc_display_bt_coex_info(&gl_bt_coexist, m);
}

void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len)
{
u8 safe_len;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ bool rtl_btc_is_limited_dig(struct rtl_priv *rtlpriv);
bool rtl_btc_is_disable_edca_turbo(struct rtl_priv *rtlpriv);
bool rtl_btc_is_bt_disabled(struct rtl_priv *rtlpriv);
void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type);
void rtl_btc_display_bt_coex_info(struct rtl_priv *rtlpriv, struct seq_file *m);
void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len);
u8 rtl_btc_get_lps_val(struct rtl_priv *rtlpriv);
u8 rtl_btc_get_rpwm_val(struct rtl_priv *rtlpriv);
Expand Down
Loading

0 comments on commit 610247f

Please sign in to comment.