rtlwifi: add btcoex materials for 8822be
[email protected]
maintainerPATCH 1/10 rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
The rtlwifi newer ICs support 80M bandwidth in 5G band, so extend get_wifi_bw() to know bandwidth 80M that helps btcoex to make correct decisions.
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 37 +++++++++------------- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 1 + 2 files changed, 16 insertions(+), 22 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +15 -22
@@ -95,21 +95,6 @@ static bool is_any_client_connect_to_ap(struct btc_coexist *btcoexist)return false; } -static bool halbtc_is_bt40 (struct rtl_priv *adapter) -{ -struct rtl_priv *rtlpriv = adapter; -struct rtl_phy *rtlphy = &(rtlpriv->phy); -bool is_ht40 = true; -enum ht_channel_width bw = rtlphy->current_chan_bw; - -if (bw ==HT_CHANNEL_WIDTH_20 ) - is_ht40 = false; -else if (bw ==HT_CHANNEL_WIDTH_20_40 ) - is_ht40 = true; - -return is_ht40; -} -static bool halbtc_legacy (struct rtl_priv *adapter) {struct rtl_priv *rtlpriv = adapter;
@@ -135,18 +120,26 @@ bool halbtc_is_wifi_uplink(struct rtl_priv *adapter)static u32 halbtc_get_wifi_bw (struct btc_coexist *btcoexist) { -struct rtl_priv *rtlpriv = - (struct rtl_priv *)btcoexist->adapter; +struct rtl_priv *rtlpriv = btcoexist->adapter; +struct rtl_phy *rtlphy = &rtlpriv->phy;u32 wifi_bw =BTC_WIFI_BW_HT20 ; -if (halbtc_is_bt40 (rtlpriv)) { - wifi_bw =BTC_WIFI_BW_HT40 ; +if (halbtc_legacy (rtlpriv)) { + wifi_bw =BTC_WIFI_BW_LEGACY ; }else { -if (halbtc_legacy (rtlpriv)) - wifi_bw =BTC_WIFI_BW_LEGACY ; -else +switch (rtlphy->current_chan_bw) { +case HT_CHANNEL_WIDTH_20 : wifi_bw =BTC_WIFI_BW_HT20 ; +break ; +case HT_CHANNEL_WIDTH_20_40 : + wifi_bw =BTC_WIFI_BW_HT40 ; +break ; +case HT_CHANNEL_WIDTH_80 : + wifi_bw =BTC_WIFI_BW_HT80 ; +break ; + } } +return wifi_bw; }
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1 -0
@@ -190,6 +190,7 @@ enum btc_wifi_bw_mode {BTC_WIFI_BW_LEGACY =0x0 ,BTC_WIFI_BW_HT20 =0x1 ,BTC_WIFI_BW_HT40 =0x2 , +BTC_WIFI_BW_HT80 =0x3 , BTC_WIFI_BW_MAX };
Signature · 1 line
2.15.1
[email protected]
maintainercover rtlwifi: add btcoex materials for 8822be
From: Ping-Ke Shih <[email protected]>
In order to support rtl8822be, btcoex needs more information to control rtl8822be, and common code needs to add more materials as well.
Ping-Ke Shih (10):
rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M
rtlwifi: btcoex: Add switch band notify for btc
rtlwifi: btcoex: Add variable ant_div_cfg to support antenna diversity
rtlwifi: btcoex: add scan_notify within ips_notify if RFON
rtlwifi: btcoex: Add wifi_only series ops to control solo card
rtlwifi: btcoex: add boolean variables dbg_mode
rtlwifi: btcoex: Fix some static warnings from Sparse
rtlwifi: 8822be has to report vht capability to mac80211
rtlwifi: Add ratr_table for newer IC
rtlwifi: Add spec_ver to check whether use new rate-id or not
drivers/net/wireless/realtek/rtlwifi/base.c | 129 ++++++++++++++++++-- drivers/net/wireless/realtek/rtlwifi/base.h | 2 + .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 135 ++++++++++++++------- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 64 ++++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 89 +++++++++++++- .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 7 ++ drivers/net/wireless/realtek/rtlwifi/core.c | 6 + drivers/net/wireless/realtek/rtlwifi/pci.c | 8 +- drivers/net/wireless/realtek/rtlwifi/wifi.h | 32 +++++ 9 files changed, 409 insertions(+), 63 deletions(-)
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 2/10 rtlwifi: btcoex: Add switch band notify for btc
From: Ping-Ke Shih <[email protected]>
BT shares 2.4G band but not 5G band, so inform current band to btcoex to setup antenna properly.
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 13 +++++++++++ .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 9 ++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 27 ++++++++++++++++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 2 ++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 ++ 5 files changed, 53 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +13 -0
@@ -1910,3 +1910,16 @@ void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,halbtc_normal_low_power (btcoexist); } + +void exhalbtc_switch_band_notify (struct btc_coexist *btcoexist,u8 type) +{ +if (!halbtc_is_bt_coexist_available (btcoexist)) +return ; + +if (btcoexist->manual_control) +return ; + +halbtc_leave_low_power (btcoexist); + +halbtc_normal_low_power (btcoexist); +}
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +9 -0
@@ -385,6 +385,14 @@ enum btc_notify_type_scan {BTC_SCAN_MAX }; +enum btc_notify_type_switchband { +BTC_NOT_SWITCH =0x0 , +BTC_SWITCH_TO_24G =0x1 , +BTC_SWITCH_TO_5G =0x2 , +BTC_SWITCH_TO_24G_NOFORSCAN =0x3 , +BTC_SWITCH_MAX +}; +enum btc_notify_type_associate {BTC_ASSOCIATE_FINISH =0x0 ,BTC_ASSOCIATE_START =0x1 ,
@@ -659,6 +667,7 @@ void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, 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,struct seq_file *m); +void exhalbtc_switch_band_notify (struct btc_coexist *btcoexist,u8 type);void exhalbtc_signal_compensation (struct btc_coexist *btcoexist,u8 *rssi_wifi,u8 *rssi_bt);void exhalbtc_lps_leave (struct btc_coexist *btcoexist);
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +27 -0
@@ -48,6 +48,7 @@ static struct rtl_btc_ops rtl_btc_operation = { .btc_is_disable_edca_turbo = rtl_btc_is_disable_edca_turbo, .btc_is_bt_disabled = rtl_btc_is_bt_disabled, .btc_special_packet_notify = rtl_btc_special_packet_notify, + .btc_switch_band_notify = rtl_btc_switch_band_notify, .btc_record_pwr_mode = rtl_btc_record_pwr_mode, .btc_get_lps_val = rtl_btc_get_lps_val, .btc_get_rpwm_val = rtl_btc_get_rpwm_val,
@@ -423,6 +424,32 @@ void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type)return exhalbtc_special_packet_notify (btcoexist, pkt_type); } +void rtl_btc_switch_band_notify (struct rtl_priv *rtlpriv,u8 band_type, +bool scanning) +{ +struct btc_coexist *btcoexist =rtl_btc_coexist (rtlpriv); +u8 type =BTC_NOT_SWITCH ; + +if (!btcoexist) +return ; + +switch (band_type) { +case BAND_ON_2_4G : +if (scanning) + type =BTC_SWITCH_TO_24G ; +else + type =BTC_SWITCH_TO_24G_NOFORSCAN ; +break ; + +case BAND_ON_5G : + type =BTC_SWITCH_TO_5G ; +break ; + } + +if (type !=BTC_NOT_SWITCH ) +exhalbtc_switch_band_notify (btcoexist, type); +} +struct rtl_btc_ops *rtl_btc_get_ops_pointer (void ) {return &rtl_btc_operation;
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +2 -0
@@ -46,6 +46,8 @@ 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_switch_band_notify (struct rtl_priv *rtlpriv,u8 band_type, +bool scanning);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);
drivers/net/wireless/realtek/rtlwifi/wifi.h +2 -0
@@ -2579,6 +2579,8 @@ struct rtl_btc_ops {bool (*btc_is_bt_disabled) (struct rtl_priv *rtlpriv);void (*btc_special_packet_notify)(struct rtl_priv *rtlpriv,u8 pkt_type); +void (*btc_switch_band_notify)(struct rtl_priv *rtlpriv,u8 type, +bool scanning);void (*btc_display_bt_coex_info)(struct rtl_priv *rtlpriv,struct seq_file *m);void (*btc_record_pwr_mode)(struct rtl_priv *rtlpriv,u8 *buf,u8 len);
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 3/10 rtlwifi: btcoex: Add variable ant_div_cfg to support antenna diversity
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
The variable will be used by btcoex of 8822be, so we prepare this variable in advance.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 1 + drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +1 -0
@@ -1310,6 +1310,7 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter) "[BTCoex], Package Type = Non-TFBGA\n"); btcoexist->board_info.rfe_type =rtl_get_hwpg_rfe_type (rtlpriv); + btcoexist->board_info.ant_div_cfg =0 ;return true; }
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1 -0
@@ -153,6 +153,7 @@ struct btc_board_info {bool tfbga_package;u8 rfe_type; +u8 ant_div_cfg; };enum btc_dbg_opcode {
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 4/10 rtlwifi: btcoex: add scan_notify within ips_notify if RFON
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
Three steps of connection procedure are scan, enter/leave IPS, auth. There is no scan between leaving IPS and sending auth, but btcoex use scan as an important clue that indicates user is going to connect. So add scan notifications in ips_notify to correct btcoex's state.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +8 -0
@@ -212,6 +212,14 @@ void rtl_btc_ips_notify(struct rtl_priv *rtlpriv, u8 type)return ;exhalbtc_ips_notify (btcoexist, type); + +if (type ==ERFON ) { +/* In some situation, it doesn't scan after leaving IPS, and +* this will cause btcoex in wrong state. +*/ +exhalbtc_scan_notify (btcoexist,1 ); +exhalbtc_scan_notify (btcoexist,0 ); + } }void rtl_btc_lps_notify (struct rtl_priv *rtlpriv,u8 type)
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 5/10 rtlwifi: btcoex: Add wifi_only series ops to control solo card
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
Originally, btcoex controls the antenna of combo card, but solo card is also needed to setup properly. The new ops are named with suffix '_wifi_only' opposited to original btc_ops, and new structures and definitions are also introduced. The wifi_only oly contains four ops that are initial variable, hw config, scan notify, and switch band notify.
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 48 +++++++++++++++++++ .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 47 +++++++++++++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 54 +++++++++++++++++++++- .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 5 ++ drivers/net/wireless/realtek/rtlwifi/core.c | 6 +++ drivers/net/wireless/realtek/rtlwifi/pci.c | 8 +++- drivers/net/wireless/realtek/rtlwifi/wifi.h | 7 +++ 7 files changed, 172 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +48 -0
@@ -1247,6 +1247,40 @@ bool exhalbtc_initlize_variables(struct rtl_priv *rtlpriv)return true; } +bool exhalbtc_initlize_variables_wifi_only (struct rtl_priv *rtlpriv) +{ +struct wifi_only_cfg *wifionly_cfg =rtl_btc_wifi_only (rtlpriv); +struct wifi_only_haldata *wifionly_haldata; + +if (!wifionly_cfg) +return false; + + wifionly_cfg->adapter = rtlpriv; + +switch (rtlpriv->rtlhal.interface) { +case INTF_PCI : + wifionly_cfg->chip_interface =BTC_INTF_PCI ; +break ; +case INTF_USB : + wifionly_cfg->chip_interface =BTC_INTF_USB ; +break ; +default : + wifionly_cfg->chip_interface =BTC_INTF_UNKNOWN ; +break ; + } + + wifionly_haldata = &wifionly_cfg->haldata_info; + + wifionly_haldata->customer_id =CUSTOMER_NORMAL ; + wifionly_haldata->efuse_pg_antnum =rtl_get_hwpg_ant_num (rtlpriv); + wifionly_haldata->efuse_pg_antpath = +rtl_get_hwpg_single_ant_path (rtlpriv); + wifionly_haldata->rfe_type =rtl_get_hwpg_rfe_type (rtlpriv); + wifionly_haldata->ant_div_cfg =0 ; + +return true; +} +bool exhalbtc_bind_bt_coex_withadapter (void *adapter) {struct rtl_priv *rtlpriv = adapter;
@@ -1368,6 +1402,10 @@ void exhalbtc_init_hw_config(struct btc_coexist *btcoexist, bool wifi_only) } } +void exhalbtc_init_hw_config_wifi_only (struct wifi_only_cfg *wifionly_cfg) +{ +} +void exhalbtc_init_coex_dm (struct btc_coexist *btcoexist) {if (!halbtc_is_bt_coexist_available (btcoexist))
@@ -1494,6 +1532,11 @@ void exhalbtc_scan_notify(struct btc_coexist *btcoexist, u8 type)halbtc_normal_low_power (btcoexist); } +void exhalbtc_scan_notify_wifi_only (struct wifi_only_cfg *wifionly_cfg, +u8 is_5g) +{ +} +void exhalbtc_connect_notify (struct btc_coexist *btcoexist,u8 action) {u8 asso_type;
@@ -1924,3 +1967,8 @@ void exhalbtc_switch_band_notify(struct btc_coexist *btcoexist, u8 type)halbtc_normal_low_power (btcoexist); } + +void exhalbtc_switch_band_notify_wifi_only (struct wifi_only_cfg *wifionly_cfg, +u8 is_5g) +{ +}
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +47 -0
72 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +53 -1
109 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +5 -0
@@ -28,13 +28,16 @@#include "halbt_precomp.h" void rtl_btc_init_variables (struct rtl_priv *rtlpriv); +void rtl_btc_init_variables_wifi_only (struct rtl_priv *rtlpriv);void rtl_btc_deinit_variables (struct rtl_priv *rtlpriv);void rtl_btc_init_hal_vars (struct rtl_priv *rtlpriv);void rtl_btc_power_on_setting (struct rtl_priv *rtlpriv);void rtl_btc_init_hw_config (struct rtl_priv *rtlpriv); +void rtl_btc_init_hw_config_wifi_only (struct rtl_priv *rtlpriv);void rtl_btc_ips_notify (struct rtl_priv *rtlpriv,u8 type);void rtl_btc_lps_notify (struct rtl_priv *rtlpriv,u8 type);void rtl_btc_scan_notify (struct rtl_priv *rtlpriv,u8 scantype); +void rtl_btc_scan_notify_wifi_only (struct rtl_priv *rtlpriv,u8 scantype);void rtl_btc_connect_notify (struct rtl_priv *rtlpriv,u8 action);void rtl_btc_mediastatus_notify (struct rtl_priv *rtlpriv,enum rt_media_status mstatus);
@@ -48,6 +51,8 @@ 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_switch_band_notify (struct rtl_priv *rtlpriv,u8 band_type,bool scanning); +void rtl_btc_switch_band_notify_wifionly (struct rtl_priv *rtlpriv,u8 band_type, +bool scanning);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);
drivers/net/wireless/realtek/rtlwifi/core.c +6 -0
@@ -1453,6 +1453,9 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw,if (rtlpriv->cfg->ops->get_btc_status ()) rtlpriv->btcoexist.btc_ops->btc_scan_notify (rtlpriv,1 ); +else if (rtlpriv->btcoexist.btc_ops) + rtlpriv->btcoexist.btc_ops->btc_scan_notify_wifi_only (rtlpriv, +1 );if (rtlpriv->dm.supp_phymode_switch) {if (rtlpriv->cfg->ops->chk_switch_dmdp)
@@ -1508,6 +1511,9 @@ static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw, rtlpriv->cfg->ops->scan_operation_backup (hw,SCAN_OPT_RESTORE );if (rtlpriv->cfg->ops->get_btc_status ()) rtlpriv->btcoexist.btc_ops->btc_scan_notify (rtlpriv,0 ); +else if (rtlpriv->btcoexist.btc_ops) + rtlpriv->btcoexist.btc_ops->btc_scan_notify_wifi_only (rtlpriv, +0 ); } static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
drivers/net/wireless/realtek/rtlwifi/pci.c +6 -2
@@ -1794,6 +1794,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));struct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw));struct rtl_mac *rtlmac =rtl_mac (rtl_priv (hw)); +struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;int err;
@@ -1803,9 +1804,12 @@ static int rtl_pci_start(struct ieee80211_hw *hw)if (rtlpriv->cfg->ops->get_btc_status && rtlpriv->cfg->ops->get_btc_status ()) { rtlpriv->btcoexist.btc_info.ap_num =36 ; - rtlpriv->btcoexist.btc_ops->btc_init_variables (rtlpriv); - rtlpriv->btcoexist.btc_ops->btc_init_hal_vars (rtlpriv); + btc_ops->btc_init_variables (rtlpriv); + btc_ops->btc_init_hal_vars (rtlpriv); + }else if (btc_ops) { + btc_ops->btc_init_variables_wifi_only (rtlpriv); } + err = rtlpriv->cfg->ops->hw_init (hw);if (err) { RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
drivers/net/wireless/realtek/rtlwifi/wifi.h +7 -0
@@ -2502,6 +2502,7 @@ struct bt_coexist_info {struct rtl_btc_info btc_info;/* btc context */ void *btc_context; +void *wifi_only_context;/* EEPROM BT info. */ u8 eeprom_bt_coexist;u8 eeprom_bt_type;
@@ -2558,13 +2559,17 @@ struct bt_coexist_info {struct rtl_btc_ops {void (*btc_init_variables) (struct rtl_priv *rtlpriv); +void (*btc_init_variables_wifi_only)(struct rtl_priv *rtlpriv);void (*btc_deinit_variables)(struct rtl_priv *rtlpriv);void (*btc_init_hal_vars) (struct rtl_priv *rtlpriv);void (*btc_power_on_setting)(struct rtl_priv *rtlpriv);void (*btc_init_hw_config) (struct rtl_priv *rtlpriv); +void (*btc_init_hw_config_wifi_only)(struct rtl_priv *rtlpriv);void (*btc_ips_notify) (struct rtl_priv *rtlpriv,u8 type);void (*btc_lps_notify)(struct rtl_priv *rtlpriv,u8 type);void (*btc_scan_notify) (struct rtl_priv *rtlpriv,u8 scantype); +void (*btc_scan_notify_wifi_only)(struct rtl_priv *rtlpriv, +u8 scantype);void (*btc_connect_notify) (struct rtl_priv *rtlpriv,u8 action);void (*btc_mediastatus_notify) (struct rtl_priv *rtlpriv,enum rt_media_status mstatus);
@@ -2581,6 +2586,8 @@ struct rtl_btc_ops { u8 pkt_type);void (*btc_switch_band_notify)(struct rtl_priv *rtlpriv,u8 type,bool scanning); +void (*btc_switch_band_notify_wifi_only)(struct rtl_priv *rtlpriv, +u8 type,bool scanning);void (*btc_display_bt_coex_info)(struct rtl_priv *rtlpriv,struct seq_file *m);void (*btc_record_pwr_mode)(struct rtl_priv *rtlpriv,u8 *buf,u8 len);
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 6/10 rtlwifi: btcoex: add boolean variables dbg_mode
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
In files halbtc8822b1ant.c and halbtc8822b2ant.c that I will submit later, two undesired directives named BT_8822B_1ANT_COEX_DBG and BT_8822B_2ANT_COEX_DBG will be replaced by boolean variables.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +2 -0
@@ -583,6 +583,8 @@ struct btc_coexist {*/ bool auto_report_1ant;bool auto_report_2ant; +bool dbg_mode_1ant; +bool dbg_mode_2ant;bool initilized;bool stop_coex_dm;bool manual_control;
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 7/10 rtlwifi: btcoex: Fix some static warnings from Sparse
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
Add 'static' or declaration to resolve the warnings.
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 36 +++++++--------------- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 4 +++ 2 files changed, 15 insertions(+), 25 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +11 -25
@@ -29,7 +29,7 @@* Debug related function ***************************************************/ -const char *const gl_btc_wifi_bw_string[] = { +static const char *const gl_btc_wifi_bw_string[] = {"11bg" ,"HT20" ,"HT40" ,
@@ -37,7 +37,7 @@ const char *const gl_btc_wifi_bw_string[] = { "HT160" }; -const char *const gl_btc_wifi_freq_string[] = { +static const char *const gl_btc_wifi_freq_string[] = {"2.4G" ,"5G" };
@@ -156,7 +156,7 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)return chnl; } -u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv) {struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
@@ -171,12 +171,12 @@ u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)return rtlpriv->btcoexist.btc_info.single_ant_path; } -u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv) {return rtlpriv->btcoexist.btc_info.bt_type; } -u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) {struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;u8 num;
@@ -193,7 +193,7 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)return num; } -u8 rtl_get_hwpg_package_type (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_package_type (struct rtl_priv *rtlpriv) {struct rtl_hal *rtlhal =rtl_hal (rtlpriv);
@@ -504,7 +504,7 @@ static u32 halbtc_get_bt_forbidden_slot_val(void *btc_context)return btcoexist->bt_info.bt_forb_slot_val; } -u32 halbtc_get_wifi_link_status (struct btc_coexist *btcoexist) +static u32 halbtc_get_wifi_link_status (struct btc_coexist *btcoexist) {/* return value: * [31:16] => connected port number
@@ -980,7 +980,8 @@ static void halbtc_write_4byte(void *bt_context, u32 reg_addr, u32 data)rtl_write_dword (rtlpriv, reg_addr, data); } -void halbtc_write_local_reg_1byte (void *btc_context,u32 reg_addr,u8 data) +static void halbtc_write_local_reg_1byte (void *btc_context,u32 reg_addr, +u8 data) {struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;struct rtl_priv *rtlpriv = btcoexist->adapter;
@@ -993,22 +994,6 @@ void halbtc_write_local_reg_1byte(void *btc_context, u32 reg_addr, u8 data)rtl_write_byte (rtlpriv, reg_addr, data); } -void halbtc_set_macreg (void *btc_context,u32 reg_addr,u32 bit_mask,u32 data) -{ -struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context; -struct rtl_priv *rtlpriv = btcoexist->adapter; - -rtl_set_bbreg (rtlpriv->mac80211.hw, reg_addr, bit_mask, data); -} - -u32 halbtc_get_macreg (void *btc_context,u32 reg_addr,u32 bit_mask) -{ -struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context; -struct rtl_priv *rtlpriv = btcoexist->adapter; - -return rtl_get_bbreg (rtlpriv->mac80211.hw, reg_addr, bit_mask); -} -static void halbtc_set_bbreg (void *bt_context,u32 reg_addr,u32 bit_mask,u32 data) {
@@ -1054,6 +1039,7 @@ static void halbtc_fill_h2c_cmd(void *bt_context, u8 element_id, cmd_len, cmd_buf); } +static void halbtc_set_bt_reg (void *btc_context,u8 reg_type,u32 offset,u32 set_val) {struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
@@ -1093,7 +1079,7 @@ static void halbtc_display_dbg_msg(void *bt_context, u8 disp_type, } } -bool halbtc_under_ips (struct btc_coexist *btcoexist) +static bool halbtc_under_ips (struct btc_coexist *btcoexist) {struct rtl_priv *rtlpriv = btcoexist->adapter;struct rtl_ps_ctl *ppsc =rtl_psc (rtlpriv);
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +4 -0
@@ -647,6 +647,7 @@ bool exhalbtc_initlize_variables(struct rtl_priv *rtlpriv);bool exhalbtc_initlize_variables_wifi_only (struct rtl_priv *rtlpriv);bool exhalbtc_bind_bt_coex_withadapter (void *adapter);void exhalbtc_power_on_setting (struct btc_coexist *btcoexist); +void exhalbtc_pre_load_firmware (struct btc_coexist *btcoexist);void exhalbtc_init_hw_config (struct btc_coexist *btcoexist,bool wifi_only);void exhalbtc_init_hw_config_wifi_only (struct wifi_only_cfg *wifionly_cfg);void exhalbtc_init_coex_dm (struct btc_coexist *btcoexist);
@@ -661,6 +662,7 @@ void exhalbtc_mediastatus_notify(struct btc_coexist *btcoexist,void exhalbtc_special_packet_notify (struct btc_coexist *btcoexist,u8 pkt_type);void exhalbtc_bt_info_notify (struct btc_coexist *btcoexist,u8 *tmp_buf,u8 length); +void exhalbtc_rf_status_notify (struct btc_coexist *btcoexist,u8 type);void exhalbtc_stack_operation_notify (struct btc_coexist *btcoexist,u8 type);void exhalbtc_halt_notify (struct btc_coexist *btcoexist);void exhalbtc_pnp_notify (struct btc_coexist *btcoexist,u8 pnp_state);
@@ -668,6 +670,8 @@ void exhalbtc_coex_dm_switch(struct btc_coexist *btcoexist);void exhalbtc_periodical (struct btc_coexist *btcoexist);void exhalbtc_dbg_control (struct btc_coexist *btcoexist,u8 code,u8 len,u8 *data); +void exhalbtc_antenna_detection (struct btc_coexist *btcoexist,u32 cent_freq, +u32 offset,u32 span,u32 seconds);void exhalbtc_stack_update_profile_info (void );void exhalbtc_set_hci_version (struct btc_coexist *btcoexist,u16 hci_version); void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 8/10 rtlwifi: 8822be has to report vht capability to mac80211
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
8822be is 2x2 11ac wifi chip, so report VHT capability to mac80211.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/base.c +2 -1
@@ -244,7 +244,8 @@ static void _rtl_init_hw_vht_capab(struct ieee80211_hw *hw,struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_hal *rtlhal =rtl_hal (rtlpriv); -if (rtlhal->hw_type ==HARDWARE_TYPE_RTL8812AE ) { +if (rtlhal->hw_type ==HARDWARE_TYPE_RTL8812AE || + rtlhal->hw_type ==HARDWARE_TYPE_RTL8822BE ) {u16 mcs_map; vht_cap->vht_supported = true;
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 9/10 rtlwifi: Add ratr_table for newer IC
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
New generation ICs will support 11ac, 5G, n-NSS, etc, so we define a set of rate ID.
--- drivers/net/wireless/realtek/rtlwifi/wifi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/wireless/realtek/rtlwifi/wifi.h +18 -0
@@ -873,6 +873,24 @@ enum ratr_table_mode { RATR_INX_WIRELESS_AC_24N = 9, }; +enum ratr_table_mode_new { +RATEID_IDX_BGN_40M_2SS =0 , +RATEID_IDX_BGN_40M_1SS =1 , +RATEID_IDX_BGN_20M_2SS_BN =2 , +RATEID_IDX_BGN_20M_1SS_BN =3 , +RATEID_IDX_GN_N2SS =4 , +RATEID_IDX_GN_N1SS =5 , +RATEID_IDX_BG =6 , +RATEID_IDX_G =7 , +RATEID_IDX_B =8 , +RATEID_IDX_VHT_2SS =9 , +RATEID_IDX_VHT_1SS =10 , +RATEID_IDX_MIX1 =11 , +RATEID_IDX_MIX2 =12 , +RATEID_IDX_VHT_3SS =13 , +RATEID_IDX_BGN_3SS =14 , +}; +enum rtl_link_state {MAC80211_NOLINK =0 ,MAC80211_LINKING =1 ,
Signature · 1 line
2.15.1
[email protected]
maintainerPATCH 10/10 rtlwifi: Add spec_ver to check whether use new rate-id or not
In reply to [email protected]From: Ping-Ke Shih <[email protected]>
The field spec_ver is IC's specification mask for common code to do proper process to specified IC. This commit add a field new rate ID for new generation IC.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 126 +++++++++++++++++++++++++--- drivers/net/wireless/realtek/rtlwifi/base.h | 2 + drivers/net/wireless/realtek/rtlwifi/wifi.h | 5 ++ 3 files changed, 121 insertions(+), 12 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +114 -12
@@ -698,14 +698,94 @@ static void _rtl_query_protection_mode(struct ieee80211_hw *hw, } } +u8 rtl_mrate_idx_to_arfr_id (struct ieee80211_hw *hw,u8 rate_index, +enum wireless_mode wirelessmode) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +struct rtl_phy *rtlphy = &rtlpriv->phy; +u8 ret =0 ; + +switch (rate_index) { +case RATR_INX_WIRELESS_NGB : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_BGN_40M_1SS ; +else + ret =RATEID_IDX_BGN_40M_2SS ; + ;break ; +case RATR_INX_WIRELESS_N : +case RATR_INX_WIRELESS_NG : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_GN_N1SS ; +else + ret =RATEID_IDX_GN_N2SS ; + ;break ; +case RATR_INX_WIRELESS_NB : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_BGN_20M_1SS_BN ; +else + ret =RATEID_IDX_BGN_20M_2SS_BN ; + ;break ; +case RATR_INX_WIRELESS_GB : + ret =RATEID_IDX_BG ; +break ; +case RATR_INX_WIRELESS_G : + ret =RATEID_IDX_G ; +break ; +case RATR_INX_WIRELESS_B : + ret =RATEID_IDX_B ; +break ; +case RATR_INX_WIRELESS_MC : +if (wirelessmode ==WIRELESS_MODE_B || + wirelessmode ==WIRELESS_MODE_G || + wirelessmode ==WIRELESS_MODE_N_24G || + wirelessmode ==WIRELESS_MODE_AC_24G ) + ret =RATEID_IDX_BG ; +else + ret =RATEID_IDX_G ; +break ; +case RATR_INX_WIRELESS_AC_5N : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_VHT_1SS ; +else + ret =RATEID_IDX_VHT_2SS ; +break ; +case RATR_INX_WIRELESS_AC_24N : +if (rtlphy->current_chan_bw ==HT_CHANNEL_WIDTH_80 ) { +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_VHT_1SS ; +else + ret =RATEID_IDX_VHT_2SS ; + }else { +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_MIX1 ; +else + ret =RATEID_IDX_MIX2 ; + } +break ; +default : + ret =RATEID_IDX_BGN_40M_2SS ; +break ; + } +return ret; +} +EXPORT_SYMBOL (rtl_mrate_idx_to_arfr_id); +static void _rtl_txrate_selectmode (struct ieee80211_hw *hw,struct ieee80211_sta *sta,struct rtl_tcb_desc *tcb_desc) { +#define SET_RATE_ID (rate_id) \ + ({typeof(rate_id) _id = rate_id; \ + ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \ + rtl_mrate_idx_to_arfr_id(hw, _id, \ + (sta_entry ? sta_entry->wireless_mode : \ + WIRELESS_MODE_G)) : \ + _id); }) +struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_mac *mac =rtl_mac (rtl_priv (hw));struct rtl_sta_info *sta_entry =NULL ; -u8 ratr_index =7 ; +u8 ratr_index =SET_RATE_ID (RATR_INX_WIRELESS_MC );if (sta) { sta_entry = (struct rtl_sta_info *) sta->drv_priv;
@@ -720,7 +800,8 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, tcb_desc->hw_rate = rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M ]; tcb_desc->use_driver_rate =1 ; - tcb_desc->ratr_index =RATR_INX_WIRELESS_MC ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_MC ); }else { tcb_desc->ratr_index = ratr_index; }
@@ -736,22 +817,30 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, mac->opmode == NL80211_IFTYPE_MESH_POINT) { tcb_desc->mac_id =0 ; -if (mac->mode ==WIRELESS_MODE_AC_5G ) +if (sta && + (rtlpriv->cfg->spec_ver &RTL_SPEC_NEW_RATEID )) + ;/* use sta_entry->ratr_index */ +else if (mac->mode ==WIRELESS_MODE_AC_5G ) tcb_desc->ratr_index = -RATR_INX_WIRELESS_AC_5N ; +SET_RATE_ID (RATR_INX_WIRELESS_AC_5N );else if (mac->mode ==WIRELESS_MODE_AC_24G ) tcb_desc->ratr_index = -RATR_INX_WIRELESS_AC_24N ; +SET_RATE_ID (RATR_INX_WIRELESS_AC_24N );else if (mac->mode ==WIRELESS_MODE_N_24G ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_NGB ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_NGB );else if (mac->mode ==WIRELESS_MODE_N_5G ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_NG ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_NG );else if (mac->mode &WIRELESS_MODE_G ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_GB ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_GB );else if (mac->mode &WIRELESS_MODE_B ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_B ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_B );else if (mac->mode &WIRELESS_MODE_A ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_G ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_G ); } else if (mac->opmode == NL80211_IFTYPE_AP || mac->opmode == NL80211_IFTYPE_ADHOC) {
@@ -765,6 +854,7 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, } } } +#undef SET_RATE_ID } static void _rtl_query_bandwidth_mode(struct ieee80211_hw *hw,
@@ -1141,9 +1231,19 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,struct ieee80211_sta *sta, struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc) { +#define SET_RATE_ID(rate_id) \ + ({typeof(rate_id) _id = rate_id; \ + ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \ + rtl_mrate_idx_to_arfr_id(hw, _id, \ + (sta_entry ? sta_entry->wireless_mode : \ + WIRELESS_MODE_G)) : \ + _id); }) + struct rtl_priv *rtlpriv = rtl_priv(hw);struct rtl_mac *rtlmac =rtl_mac (rtl_priv (hw));struct ieee80211_hdr *hdr =rtl_get_hdr (skb); +struct rtl_sta_info *sta_entry = + (sta ? (struct rtl_sta_info *)sta->drv_priv :NULL );__le16 fc =rtl_get_fc (skb);
@@ -1166,7 +1266,8 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,if (info->control.rates[0 ].idx ==0 ||ieee80211_is_nullfunc (fc)) { tcb_desc->use_driver_rate = true; - tcb_desc->ratr_index =RATR_INX_WIRELESS_MC ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_MC ); tcb_desc->disable_ratefallback =1 ; }else {
@@ -1208,11 +1309,12 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,_rtl_query_protection_mode (hw, tcb_desc, info); }else { tcb_desc->use_driver_rate = true; - tcb_desc->ratr_index =RATR_INX_WIRELESS_MC ; + tcb_desc->ratr_index =SET_RATE_ID (RATR_INX_WIRELESS_MC ); tcb_desc->disable_ratefallback =1 ; tcb_desc->mac_id =0 ; tcb_desc->packet_bw = false; } +#undef SET_RATE_ID }EXPORT_SYMBOL (rtl_get_tcb_desc);
drivers/net/wireless/realtek/rtlwifi/base.h +2 -0
@@ -162,6 +162,8 @@ void rtl_c2hcmd_wq_callback(void *data);void rtl_c2hcmd_launcher (struct ieee80211_hw *hw,int exec);void rtl_c2hcmd_enqueue (struct ieee80211_hw *hw,u8 tag,u8 len,u8 *val); +u8 rtl_mrate_idx_to_arfr_id (struct ieee80211_hw *hw,u8 rate_index, +enum wireless_mode wirelessmode); void rtl_get_tcb_desc(struct ieee80211_hw *hw, struct ieee80211_tx_info *info, struct ieee80211_sta *sta,
drivers/net/wireless/realtek/rtlwifi/wifi.h +5 -0
@@ -949,6 +949,10 @@ enum package_type {PACKAGE_TFBGA79 }; +enum rtl_spec_ver { +RTL_SPEC_NEW_RATEID =BIT (0 ),/* use ratr_table_mode_new */ +}; +struct octet_string {u8 *octet;u16 length;
@@ -2333,6 +2337,7 @@ struct rtl_hal_cfg {struct rtl_hal_ops *ops;struct rtl_mod_params *mod_params;struct rtl_hal_usbint_cfg *usb_interface_cfg; +enum rtl_spec_ver spec_ver;/*this map used for some registers or vars defined int HAL but used in MAIN */
Signature · 1 line
2.15.1
Re: [PATCH 08/10] rtlwifi: 8822be has to report vht capability to mac80211
In reply to [email protected]Quoted 8 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
8822be is 2x2 11ac wifi chip, so report VHT capability to mac80211.
Signed-off-by Ping-Ke Shih <[email protected]>--- drivers/net/wireless/realtek/rtlwifi/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines
drivers/net/wireless/realtek/rtlwifi/base.c +2
-1@@ -244,7 +244,8 @@ static void _rtl_init_hw_vht_capab(struct ieee80211_hw *hw,struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_hal *rtlhal =rtl_hal (rtlpriv); -if (rtlhal->hw_type ==HARDWARE_TYPE_RTL8812AE ) { +if (rtlhal->hw_type ==HARDWARE_TYPE_RTL8812AE || + rtlhal->hw_type ==HARDWARE_TYPE_RTL8822BE ) {u16 mcs_map; vht_cap->vht_supported = true;
Re: [PATCH 07/10] rtlwifi: btcoex: Fix some static warnings from Sparse
In reply to [email protected]Quoted 94 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
Add 'static' or declaration to resolve the warnings.
Signed-off-by Ping-Ke Shih <[email protected]>--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 36 +++++++--------------- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 4 +++ 2 files changed, 15 insertions(+), 25 deletions(-)drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +9
-14@@ -29,7 +29,7 @@* Debug related function ***************************************************/ -const char *const gl_btc_wifi_bw_string[] = { +static const char *const gl_btc_wifi_bw_string[] = {"11bg" ,"HT20" ,"HT40" ,@@ -37,7 +37,7 @@ const char *const gl_btc_wifi_bw_string[] = { "HT160" }; -const char *const gl_btc_wifi_freq_string[] = { +static const char *const gl_btc_wifi_freq_string[] = {"2.4G" ,"5G" };@@ -156,7 +156,7 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)return chnl; } -u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv) {struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;@@ -171,12 +171,12 @@ u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)return rtlpriv->btcoexist.btc_info.single_ant_path; } -u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv) {return rtlpriv->btcoexist.btc_info.bt_type; } -u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) {struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;u8 num;@@ -193,7 +193,7 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)return num; } -u8 rtl_get_hwpg_package_type (struct rtl_priv *rtlpriv) +static u8 rtl_get_hwpg_package_type (struct rtl_priv *rtlpriv) {struct rtl_hal *rtlhal =rtl_hal (rtlpriv);@@ -504,7 +504,7 @@ static u32 halbtc_get_bt_forbidden_slot_val(void *btc_context)return btcoexist->bt_info.bt_forb_slot_val; } -u32 halbtc_get_wifi_link_status (struct btc_coexist *btcoexist) +static u32 halbtc_get_wifi_link_status (struct btc_coexist *btcoexist) {/* return value: * [31:16] => connected port number @@ -980,7 +980,8 @@ static void halbtc_write_4byte(void *bt_context, u32 reg_addr, u32 data)rtl_write_dword (rtlpriv, reg_addr, data); } -void halbtc_write_local_reg_1byte (void *btc_context,u32 reg_addr,u8 data) +static void halbtc_write_local_reg_1byte (void *btc_context,u32 reg_addr, +u8 data) {struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;struct rtl_priv *rtlpriv = btcoexist->adapter;@@ -993,22 +994,6 @@ void halbtc_write_local_reg_1byte(void *btc_context, u32 reg_addr, u8 data)rtl_write_byte (rtlpriv, reg_addr, data); } -void halbtc_set_macreg (void *btc_context,u32 reg_addr,u32 bit_mask,u32 data) -{ -struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context; -struct rtl_priv *rtlpriv = btcoexist->adapter; - -rtl_set_bbreg (rtlpriv->mac80211.hw, reg_addr, bit_mask, data);
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c void halbtc_write_local_reg_1byte(void *btc_context, u32 reg_addr, u8 data) · line 1011
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +0
-10-} - -u32 halbtc_get_macreg (void *btc_context,u32 reg_addr,u32 bit_mask) -{ -struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context; -struct rtl_priv *rtlpriv = btcoexist->adapter; - -return rtl_get_bbreg (rtlpriv->mac80211.hw, reg_addr, bit_mask); -} -
Should we conclude that the two routines above are not used, and that fact was exposed when they were made static? If so, please note that they were deleted in the commit message.
Larry
Re: [PATCH 06/10] rtlwifi: btcoex: add boolean variables dbg_mode
In reply to [email protected]Quoted 16 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
In files
halbtc8822b1ant.candhalbtc8822b2ant.cthat I will submit later, two undesired directives namedBT_8822B_1ANT_COEX_DBGandBT_8822B_2ANT_COEX_DBGwill be replaced by boolean variables.Signed-off-by Ping-Ke Shih <[email protected]>--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 2 ++ 1 file changed, 2 insertions(+)drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +0
-0
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h struct btc_coexist { · line 590
Quoted 8 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +2
-0@@ -583,6 +583,8 @@ struct btc_coexist {*/ bool auto_report_1ant;bool auto_report_2ant; +bool dbg_mode_1ant; +bool dbg_mode_2ant;bool initilized;bool stop_coex_dm;bool manual_control;
Re: [PATCH 01/10] rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M
In reply to [email protected]Quoted 11 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
The rtlwifi newer ICs support 80M bandwidth in 5G band, so extend
get_wifi_bw()to know bandwidth 80M that helps btcoex to make correct decisions.Signed-off-by Ping-Ke Shih <[email protected]>--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 37 +++++++++------------- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 1 + 2 files changed, 16 insertions(+), 22 deletions(-)
Quoted 74 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +15
-22@@ -95,21 +95,6 @@ static bool is_any_client_connect_to_ap(struct btc_coexist *btcoexist)return false; } -static bool halbtc_is_bt40 (struct rtl_priv *adapter) -{ -struct rtl_priv *rtlpriv = adapter; -struct rtl_phy *rtlphy = &(rtlpriv->phy); -bool is_ht40 = true; -enum ht_channel_width bw = rtlphy->current_chan_bw; - -if (bw ==HT_CHANNEL_WIDTH_20 ) - is_ht40 = false; -else if (bw ==HT_CHANNEL_WIDTH_20_40 ) - is_ht40 = true; - -return is_ht40; -} -static bool halbtc_legacy (struct rtl_priv *adapter) {struct rtl_priv *rtlpriv = adapter;@@ -135,18 +120,26 @@ bool halbtc_is_wifi_uplink(struct rtl_priv *adapter)static u32 halbtc_get_wifi_bw (struct btc_coexist *btcoexist) { -struct rtl_priv *rtlpriv = - (struct rtl_priv *)btcoexist->adapter; +struct rtl_priv *rtlpriv = btcoexist->adapter; +struct rtl_phy *rtlphy = &rtlpriv->phy;u32 wifi_bw =BTC_WIFI_BW_HT20 ; -if (halbtc_is_bt40 (rtlpriv)) { - wifi_bw =BTC_WIFI_BW_HT40 ; +if (halbtc_legacy (rtlpriv)) { + wifi_bw =BTC_WIFI_BW_LEGACY ; }else { -if (halbtc_legacy (rtlpriv)) - wifi_bw =BTC_WIFI_BW_LEGACY ; -else +switch (rtlphy->current_chan_bw) { +case HT_CHANNEL_WIDTH_20 : wifi_bw =BTC_WIFI_BW_HT20 ; +break ; +case HT_CHANNEL_WIDTH_20_40 : + wifi_bw =BTC_WIFI_BW_HT40 ; +break ; +case HT_CHANNEL_WIDTH_80 : + wifi_bw =BTC_WIFI_BW_HT80 ; +break ; + } } +return wifi_bw; }drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1
-0@@ -190,6 +190,7 @@ enum btc_wifi_bw_mode {BTC_WIFI_BW_LEGACY =0x0 ,BTC_WIFI_BW_HT20 =0x1 ,BTC_WIFI_BW_HT40 =0x2 , +BTC_WIFI_BW_HT80 =0x3 , BTC_WIFI_BW_MAX };
Pkshih
maintainerRE: [PATCH 07/10] rtlwifi: btcoex: Fix some static warnings from Sparse
In reply to Larry FingerDQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogbGludXgtd2lyZWxlc3Mt b3duZXJAdmdlci5rZXJuZWwub3JnIFttYWlsdG86bGludXgtd2lyZWxlc3Mtb3duZXJAdmdlci5r ZXJuZWwub3JnXSBPbiBCZWhhbGYNCj4gT2YgTGFycnkgRmluZ2VyDQo+IFNlbnQ6IFNhdHVyZGF5 LCBKYW51YXJ5IDIwLCAyMDE4IDY6NDYgQU0NCj4gVG86IFBrc2hpaDsga3ZhbG9AY29kZWF1cm9y YS5vcmcNCj4gQ2M6IGxpbnV4LXdpcmVsZXNzQHZnZXIua2VybmVsLm9yZw0KPiBTdWJqZWN0OiBS ZTogW1BBVENIIDA3LzEwXSBydGx3aWZpOiBidGNvZXg6IEZpeCBzb21lIHN0YXRpYyB3YXJuaW5n cyBmcm9tIFNwYXJzZQ0KPiANCj4gT24gMDEvMTkvMjAxOCAxMjo0NSBBTSwgcGtzaGloQHJlYWx0 ZWsuY29tIHdyb3RlOg0KPiA+IEZyb206IFBpbmctS2UgU2hpaCA8cGtzaGloQHJlYWx0ZWsuY29t Pg0KPiA+DQo+ID4gQWRkICdzdGF0aWMnIG9yIGRlY2xhcmF0aW9uIHRvIHJlc29sdmUgdGhlIHdh cm5pbmdzLg0KPiA+DQo+ID4gU2lnbmVkLW9mZi1ieTogUGluZy1LZSBTaGloIDxwa3NoaWhAcmVh bHRlay5jb20+DQo+ID4gLS0tDQo+ID4gICAuLi4vcmVhbHRlay9ydGx3aWZpL2J0Y29leGlzdC9o YWxidGNvdXRzcmMuYyAgICAgICB8IDM2ICsrKysrKystLS0tLS0tLS0tLS0tLS0NCj4gPiAgIC4u Li9yZWFsdGVrL3J0bHdpZmkvYnRjb2V4aXN0L2hhbGJ0Y291dHNyYy5oICAgICAgIHwgIDQgKysr DQo+ID4gICAyIGZpbGVzIGNoYW5nZWQsIDE1IGluc2VydGlvbnMoKyksIDI1IGRlbGV0aW9ucygt KQ0KPiA+DQo+ID4gZGlmZiAtLWdpdCBhL2RyaXZlcnMvbmV0L3dpcmVsZXNzL3JlYWx0ZWsvcnRs d2lmaS9idGNvZXhpc3QvaGFsYnRjb3V0c3JjLmMNCj4gYi9kcml2ZXJzL25ldC93aXJlbGVzcy9y ZWFsdGVrL3J0bHdpZmkvYnRjb2V4aXN0L2hhbGJ0Y291dHNyYy5jDQo+ID4gaW5kZXggNzNlZjVi MjcxZjNiLi4xNDA0NzI5NDQxYTIgMTAwNjQ0DQo+ID4gLS0tIGEvZHJpdmVycy9uZXQvd2lyZWxl c3MvcmVhbHRlay9ydGx3aWZpL2J0Y29leGlzdC9oYWxidGNvdXRzcmMuYw0KPiA+ICsrKyBiL2Ry aXZlcnMvbmV0L3dpcmVsZXNzL3JlYWx0ZWsvcnRsd2lmaS9idGNvZXhpc3QvaGFsYnRjb3V0c3Jj LmMNCj4gPiBAQCAtOTkzLDIyICs5OTQsNiBAQCB2b2lkIGhhbGJ0Y193cml0ZV9sb2NhbF9yZWdf MWJ5dGUodm9pZCAqYnRjX2NvbnRleHQsIHUzMiByZWdfYWRkciwgdTggZGF0YSkNCj4gPiAgIAkJ cnRsX3dyaXRlX2J5dGUocnRscHJpdiwgcmVnX2FkZHIsIGRhdGEpOw0KPiA+ICAgfQ0KPiA+DQo+ ID4gLXZvaWQgaGFsYnRjX3NldF9tYWNyZWcodm9pZCAqYnRjX2NvbnRleHQsIHUzMiByZWdfYWRk ciwgdTMyIGJpdF9tYXNrLCB1MzIgZGF0YSkNCj4gPiAtew0KPiA+IC0Jc3RydWN0IGJ0Y19jb2V4 aXN0ICpidGNvZXhpc3QgPSAoc3RydWN0IGJ0Y19jb2V4aXN0ICopYnRjX2NvbnRleHQ7DQo+ID4g LQlzdHJ1Y3QgcnRsX3ByaXYgKnJ0bHByaXYgPSBidGNvZXhpc3QtPmFkYXB0ZXI7DQo+ID4gLQ0K PiA+IC0JcnRsX3NldF9iYnJlZyhydGxwcml2LT5tYWM4MDIxMS5odywgcmVnX2FkZHIsIGJpdF9t YXNrLCBkYXRhKTsNCj4gPiAtfQ0KPiA+IC0NCj4gPiAtdTMyIGhhbGJ0Y19nZXRfbWFjcmVnKHZv aWQgKmJ0Y19jb250ZXh0LCB1MzIgcmVnX2FkZHIsIHUzMiBiaXRfbWFzaykNCj4gPiAtew0KPiA+ IC0Jc3RydWN0IGJ0Y19jb2V4aXN0ICpidGNvZXhpc3QgPSAoc3RydWN0IGJ0Y19jb2V4aXN0ICop YnRjX2NvbnRleHQ7DQo+ID4gLQlzdHJ1Y3QgcnRsX3ByaXYgKnJ0bHByaXYgPSBidGNvZXhpc3Qt PmFkYXB0ZXI7DQo+ID4gLQ0KPiA+IC0JcmV0dXJuIHJ0bF9nZXRfYmJyZWcocnRscHJpdi0+bWFj ODAyMTEuaHcsIHJlZ19hZGRyLCBiaXRfbWFzayk7DQo+ID4gLX0NCj4gPiAtDQo+IA0KPiBTaG91 bGQgd2UgY29uY2x1ZGUgdGhhdCB0aGUgdHdvIHJvdXRpbmVzIGFib3ZlIGFyZSBub3QgdXNlZCwg YW5kIHRoYXQgZmFjdCB3YXMNCj4gZXhwb3NlZCB3aGVuIHRoZXkgd2VyZSBtYWRlIHN0YXRpYz8g SWYgc28sIHBsZWFzZSBub3RlIHRoYXQgdGhleSB3ZXJlIGRlbGV0ZWQgaW4NCj4gdGhlIGNvbW1p dCBtZXNzYWdlLg0KPiANCg0KSSdsbCBhZGQgdG8gY29tbWl0IGxvZyBpbiB2Mi4NCg0KUEsNCg0K
Re: [PATCH 03/10] rtlwifi: btcoex: Add variable ant_div_cfg to support antenna diversity
In reply to [email protected]Quoted 10 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
The variable will be used by btcoex of 8822be, so we prepare this variable in advance.
Signed-off-by Ping-Ke Shih <[email protected]>--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 1 + drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 1 + 2 files changed, 2 insertions(+)
Quoted 26 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +1
-0@@ -1310,6 +1310,7 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter) "[BTCoex], Package Type = Non-TFBGA\n"); btcoexist->board_info.rfe_type =rtl_get_hwpg_rfe_type (rtlpriv); + btcoexist->board_info.ant_div_cfg =0 ;return true; }drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1
-0@@ -153,6 +153,7 @@ struct btc_board_info {bool tfbga_package;u8 rfe_type; +u8 ant_div_cfg; };enum btc_dbg_opcode {
Re: [PATCH 04/10] rtlwifi: btcoex: add scan_notify within ips_notify if RFON
In reply to [email protected]Quoted 8 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
Three steps of connection procedure are scan, enter/leave IPS, auth. There is no scan between leaving IPS and sending auth, but btcoex use scan as an important clue that indicates user is going to connect. So add scan notifications in
ips_notifyto correct btcoex's state.Signed-off-by Ping-Ke Shih <[email protected]>
Quoted 24 lines
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +8
-0@@ -212,6 +212,14 @@ void rtl_btc_ips_notify(struct rtl_priv *rtlpriv, u8 type)return ;exhalbtc_ips_notify (btcoexist, type); + +if (type ==ERFON ) { +/* In some situation, it doesn't scan after leaving IPS, and +* this will cause btcoex in wrong state. +*/ +exhalbtc_scan_notify (btcoexist,1 ); +exhalbtc_scan_notify (btcoexist,0 ); + } }void rtl_btc_lps_notify (struct rtl_priv *rtlpriv,u8 type)
Re: [PATCH 09/10] rtlwifi: Add ratr_table for newer IC
In reply to [email protected]Quoted 9 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
New generation ICs will support 11ac, 5G, n-NSS, etc, so we define a set of rate ID.
Signed-off-by Ping-Ke Shih <[email protected]>--- drivers/net/wireless/realtek/rtlwifi/wifi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Quoted 31 lines
drivers/net/wireless/realtek/rtlwifi/wifi.h +18
-0@@ -873,6 +873,24 @@ enum ratr_table_mode { RATR_INX_WIRELESS_AC_24N = 9, }; +enum ratr_table_mode_new { +RATEID_IDX_BGN_40M_2SS =0 , +RATEID_IDX_BGN_40M_1SS =1 , +RATEID_IDX_BGN_20M_2SS_BN =2 , +RATEID_IDX_BGN_20M_1SS_BN =3 , +RATEID_IDX_GN_N2SS =4 , +RATEID_IDX_GN_N1SS =5 , +RATEID_IDX_BG =6 , +RATEID_IDX_G =7 , +RATEID_IDX_B =8 , +RATEID_IDX_VHT_2SS =9 , +RATEID_IDX_VHT_1SS =10 , +RATEID_IDX_MIX1 =11 , +RATEID_IDX_MIX2 =12 , +RATEID_IDX_VHT_3SS =13 , +RATEID_IDX_BGN_3SS =14 , +}; +enum rtl_link_state {MAC80211_NOLINK =0 ,MAC80211_LINKING =1 ,
Re: [PATCH 10/10] rtlwifi: Add spec_ver to check whether use new rate-id or not
In reply to [email protected]Quoted 7 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
The field
spec_veris IC's specification mask for common code to do proper process to specified IC. This commit add a field new rate ID for new generation IC.Signed-off-by Ping-Ke Shih <[email protected]>
Quoted 244 lines
--- drivers/net/wireless/realtek/rtlwifi/base.c | 126 +++++++++++++++++++++++++--- drivers/net/wireless/realtek/rtlwifi/base.h | 2 + drivers/net/wireless/realtek/rtlwifi/wifi.h | 5 ++ 3 files changed, 121 insertions(+), 12 deletions(-)drivers/net/wireless/realtek/rtlwifi/base.c +114
-12@@ -698,14 +698,94 @@ static void _rtl_query_protection_mode(struct ieee80211_hw *hw, } } +u8 rtl_mrate_idx_to_arfr_id (struct ieee80211_hw *hw,u8 rate_index, +enum wireless_mode wirelessmode) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +struct rtl_phy *rtlphy = &rtlpriv->phy; +u8 ret =0 ; + +switch (rate_index) { +case RATR_INX_WIRELESS_NGB : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_BGN_40M_1SS ; +else + ret =RATEID_IDX_BGN_40M_2SS ; + ;break ; +case RATR_INX_WIRELESS_N : +case RATR_INX_WIRELESS_NG : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_GN_N1SS ; +else + ret =RATEID_IDX_GN_N2SS ; + ;break ; +case RATR_INX_WIRELESS_NB : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_BGN_20M_1SS_BN ; +else + ret =RATEID_IDX_BGN_20M_2SS_BN ; + ;break ; +case RATR_INX_WIRELESS_GB : + ret =RATEID_IDX_BG ; +break ; +case RATR_INX_WIRELESS_G : + ret =RATEID_IDX_G ; +break ; +case RATR_INX_WIRELESS_B : + ret =RATEID_IDX_B ; +break ; +case RATR_INX_WIRELESS_MC : +if (wirelessmode ==WIRELESS_MODE_B || + wirelessmode ==WIRELESS_MODE_G || + wirelessmode ==WIRELESS_MODE_N_24G || + wirelessmode ==WIRELESS_MODE_AC_24G ) + ret =RATEID_IDX_BG ; +else + ret =RATEID_IDX_G ; +break ; +case RATR_INX_WIRELESS_AC_5N : +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_VHT_1SS ; +else + ret =RATEID_IDX_VHT_2SS ; +break ; +case RATR_INX_WIRELESS_AC_24N : +if (rtlphy->current_chan_bw ==HT_CHANNEL_WIDTH_80 ) { +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_VHT_1SS ; +else + ret =RATEID_IDX_VHT_2SS ; + }else { +if (rtlphy->rf_type ==RF_1T1R ) + ret =RATEID_IDX_MIX1 ; +else + ret =RATEID_IDX_MIX2 ; + } +break ; +default : + ret =RATEID_IDX_BGN_40M_2SS ; +break ; + } +return ret; +} +EXPORT_SYMBOL (rtl_mrate_idx_to_arfr_id); +static void _rtl_txrate_selectmode (struct ieee80211_hw *hw,struct ieee80211_sta *sta,struct rtl_tcb_desc *tcb_desc) { +#define SET_RATE_ID (rate_id) \ + ({typeof(rate_id) _id = rate_id; \ + ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \ + rtl_mrate_idx_to_arfr_id(hw, _id, \ + (sta_entry ? sta_entry->wireless_mode : \ + WIRELESS_MODE_G)) : \ + _id); }) +struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_mac *mac =rtl_mac (rtl_priv (hw));struct rtl_sta_info *sta_entry =NULL ; -u8 ratr_index =7 ; +u8 ratr_index =SET_RATE_ID (RATR_INX_WIRELESS_MC );if (sta) { sta_entry = (struct rtl_sta_info *) sta->drv_priv;@@ -720,7 +800,8 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, tcb_desc->hw_rate = rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M ]; tcb_desc->use_driver_rate =1 ; - tcb_desc->ratr_index =RATR_INX_WIRELESS_MC ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_MC ); }else { tcb_desc->ratr_index = ratr_index; }@@ -736,22 +817,30 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, mac->opmode == NL80211_IFTYPE_MESH_POINT) { tcb_desc->mac_id =0 ; -if (mac->mode ==WIRELESS_MODE_AC_5G ) +if (sta && + (rtlpriv->cfg->spec_ver &RTL_SPEC_NEW_RATEID )) + ;/* use sta_entry->ratr_index */ +else if (mac->mode ==WIRELESS_MODE_AC_5G ) tcb_desc->ratr_index = -RATR_INX_WIRELESS_AC_5N ; +SET_RATE_ID (RATR_INX_WIRELESS_AC_5N );else if (mac->mode ==WIRELESS_MODE_AC_24G ) tcb_desc->ratr_index = -RATR_INX_WIRELESS_AC_24N ; +SET_RATE_ID (RATR_INX_WIRELESS_AC_24N );else if (mac->mode ==WIRELESS_MODE_N_24G ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_NGB ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_NGB );else if (mac->mode ==WIRELESS_MODE_N_5G ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_NG ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_NG );else if (mac->mode &WIRELESS_MODE_G ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_GB ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_GB );else if (mac->mode &WIRELESS_MODE_B ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_B ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_B );else if (mac->mode &WIRELESS_MODE_A ) - tcb_desc->ratr_index =RATR_INX_WIRELESS_G ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_G ); } else if (mac->opmode == NL80211_IFTYPE_AP || mac->opmode == NL80211_IFTYPE_ADHOC) {@@ -765,6 +854,7 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, } } } +#undef SET_RATE_ID } static void _rtl_query_bandwidth_mode(struct ieee80211_hw *hw,@@ -1141,9 +1231,19 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,struct ieee80211_sta *sta, struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc) { +#define SET_RATE_ID(rate_id) \ + ({typeof (rate_id) _id = rate_id; \ + ((rtlpriv->cfg->spec_ver &RTL_SPEC_NEW_RATEID ) ? \ +rtl_mrate_idx_to_arfr_id (hw, _id, \ + (sta_entry ? sta_entry->wireless_mode : \ +WIRELESS_MODE_G )) : \ + _id); }) + struct rtl_priv *rtlpriv = rtl_priv(hw);struct rtl_mac *rtlmac =rtl_mac (rtl_priv (hw));struct ieee80211_hdr *hdr =rtl_get_hdr (skb); +struct rtl_sta_info *sta_entry = + (sta ? (struct rtl_sta_info *)sta->drv_priv :NULL );__le16 fc =rtl_get_fc (skb);@@ -1166,7 +1266,8 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,if (info->control.rates[0 ].idx ==0 ||ieee80211_is_nullfunc (fc)) { tcb_desc->use_driver_rate = true; - tcb_desc->ratr_index =RATR_INX_WIRELESS_MC ; + tcb_desc->ratr_index = +SET_RATE_ID (RATR_INX_WIRELESS_MC ); tcb_desc->disable_ratefallback =1 ; }else {@@ -1208,11 +1309,12 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,_rtl_query_protection_mode (hw, tcb_desc, info); }else { tcb_desc->use_driver_rate = true; - tcb_desc->ratr_index =RATR_INX_WIRELESS_MC ; + tcb_desc->ratr_index =SET_RATE_ID (RATR_INX_WIRELESS_MC ); tcb_desc->disable_ratefallback =1 ; tcb_desc->mac_id =0 ; tcb_desc->packet_bw = false; } +#undef SET_RATE_ID }EXPORT_SYMBOL (rtl_get_tcb_desc);drivers/net/wireless/realtek/rtlwifi/base.h +2
-0@@ -162,6 +162,8 @@ void rtl_c2hcmd_wq_callback(void *data);void rtl_c2hcmd_launcher (struct ieee80211_hw *hw,int exec);void rtl_c2hcmd_enqueue (struct ieee80211_hw *hw,u8 tag,u8 len,u8 *val); +u8 rtl_mrate_idx_to_arfr_id (struct ieee80211_hw *hw,u8 rate_index, +enum wireless_mode wirelessmode); void rtl_get_tcb_desc(struct ieee80211_hw *hw, struct ieee80211_tx_info *info, struct ieee80211_sta *sta,drivers/net/wireless/realtek/rtlwifi/wifi.h +5
-0@@ -949,6 +949,10 @@ enum package_type {PACKAGE_TFBGA79 }; +enum rtl_spec_ver { +RTL_SPEC_NEW_RATEID =BIT (0 ),/* use ratr_table_mode_new */ +}; +struct octet_string {u8 *octet;u16 length;@@ -2333,6 +2337,7 @@ struct rtl_hal_cfg {struct rtl_hal_ops *ops;struct rtl_mod_params *mod_params;struct rtl_hal_usbint_cfg *usb_interface_cfg; +enum rtl_spec_ver spec_ver;/*this map used for some registers or vars defined int HAL but used in MAIN */
Re: [PATCH 05/10] rtlwifi: btcoex: Add wifi_only series ops to control solo card
In reply to [email protected]Quoted 9 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
Originally, btcoex controls the antenna of combo card, but solo card is also needed to setup properly. The new ops are named with suffix '
_wifi_only' opposited to originalbtc_ops, and new structures and definitions are also introduced. Thewifi_onlyoly contains four ops that are initial variable, hw config, scan notify, and switch band notify.Signed-off-by Ping-Ke Shih <[email protected]>
Quoted 9 lines
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 48 +++++++++++++++++++ .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 47 +++++++++++++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 54 +++++++++++++++++++++- .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 5 ++ drivers/net/wireless/realtek/rtlwifi/core.c | 6 +++ drivers/net/wireless/realtek/rtlwifi/pci.c | 8 +++- drivers/net/wireless/realtek/rtlwifi/wifi.h | 7 +++ 7 files changed, 172 insertions(+), 3 deletions(-)
Re: [PATCH 02/10] rtlwifi: btcoex: Add switch band notify for btc
In reply to [email protected]Quoted 6 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
From: Ping-Ke Shih <[email protected]>
BT shares 2.4G band but not 5G band, so inform current band to btcoex to setup antenna properly.
Signed-off-by Ping-Ke Shih <[email protected]>
Quoted 128 lines
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 13 +++++++++++ .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 9 ++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 27 ++++++++++++++++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 2 ++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 ++ 5 files changed, 53 insertions(+)drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +13
-0@@ -1910,3 +1910,16 @@ void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,halbtc_normal_low_power (btcoexist); } + +void exhalbtc_switch_band_notify (struct btc_coexist *btcoexist,u8 type) +{ +if (!halbtc_is_bt_coexist_available (btcoexist)) +return ; + +if (btcoexist->manual_control) +return ; + +halbtc_leave_low_power (btcoexist); + +halbtc_normal_low_power (btcoexist); +}drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +9
-0@@ -385,6 +385,14 @@ enum btc_notify_type_scan {BTC_SCAN_MAX }; +enum btc_notify_type_switchband { +BTC_NOT_SWITCH =0x0 , +BTC_SWITCH_TO_24G =0x1 , +BTC_SWITCH_TO_5G =0x2 , +BTC_SWITCH_TO_24G_NOFORSCAN =0x3 , +BTC_SWITCH_MAX +}; +enum btc_notify_type_associate {BTC_ASSOCIATE_FINISH =0x0 ,BTC_ASSOCIATE_START =0x1 ,@@ -659,6 +667,7 @@ void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, 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,struct seq_file *m); +void exhalbtc_switch_band_notify (struct btc_coexist *btcoexist,u8 type);void exhalbtc_signal_compensation (struct btc_coexist *btcoexist,u8 *rssi_wifi,u8 *rssi_bt);void exhalbtc_lps_leave (struct btc_coexist *btcoexist);drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +27
-0@@ -48,6 +48,7 @@ static struct rtl_btc_ops rtl_btc_operation = { .btc_is_disable_edca_turbo = rtl_btc_is_disable_edca_turbo, .btc_is_bt_disabled = rtl_btc_is_bt_disabled, .btc_special_packet_notify = rtl_btc_special_packet_notify, + .btc_switch_band_notify = rtl_btc_switch_band_notify, .btc_record_pwr_mode = rtl_btc_record_pwr_mode, .btc_get_lps_val = rtl_btc_get_lps_val, .btc_get_rpwm_val = rtl_btc_get_rpwm_val,@@ -423,6 +424,32 @@ void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type)return exhalbtc_special_packet_notify (btcoexist, pkt_type); } +void rtl_btc_switch_band_notify (struct rtl_priv *rtlpriv,u8 band_type, +bool scanning) +{ +struct btc_coexist *btcoexist =rtl_btc_coexist (rtlpriv); +u8 type =BTC_NOT_SWITCH ; + +if (!btcoexist) +return ; + +switch (band_type) { +case BAND_ON_2_4G : +if (scanning) + type =BTC_SWITCH_TO_24G ; +else + type =BTC_SWITCH_TO_24G_NOFORSCAN ; +break ; + +case BAND_ON_5G : + type =BTC_SWITCH_TO_5G ; +break ; + } + +if (type !=BTC_NOT_SWITCH ) +exhalbtc_switch_band_notify (btcoexist, type); +} +struct rtl_btc_ops *rtl_btc_get_ops_pointer (void ) {return &rtl_btc_operation;drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +2
-0@@ -46,6 +46,8 @@ 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_switch_band_notify (struct rtl_priv *rtlpriv,u8 band_type, +bool scanning);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);drivers/net/wireless/realtek/rtlwifi/wifi.h +2
-0@@ -2579,6 +2579,8 @@ struct rtl_btc_ops {bool (*btc_is_bt_disabled) (struct rtl_priv *rtlpriv);void (*btc_special_packet_notify)(struct rtl_priv *rtlpriv,u8 pkt_type); +void (*btc_switch_band_notify)(struct rtl_priv *rtlpriv,u8 type, +bool scanning);void (*btc_display_bt_coex_info)(struct rtl_priv *rtlpriv,struct seq_file *m);void (*btc_record_pwr_mode)(struct rtl_priv *rtlpriv,u8 *buf,u8 len);
Pkshih
maintainerRe: [PATCH 10/10] rtlwifi: Add spec_ver to check whether use new rate-id or not
In reply to Larry FingerT24gTW9uLCAyMDE4LTAxLTIyIGF0IDEzOjEwIC0wNjAwLCBMYXJyeSBGaW5nZXIgd3JvdGU6DQo+ IE9uIDAxLzE5LzIwMTggMTI6NDUgQU0sIHBrc2hpaEByZWFsdGVrLmNvbSB3cm90ZToNCj4gPsKg DQo+ID4gRnJvbTogUGluZy1LZSBTaGloIDxwa3NoaWhAcmVhbHRlay5jb20+DQo+ID7CoA0KPiA+ IFRoZSBmaWVsZCBzcGVjX3ZlciBpcyBJQydzIHNwZWNpZmljYXRpb24gbWFzayBmb3IgY29tbW9u IGNvZGUgdG8gZG8gcHJvcGVyDQo+ID4gcHJvY2VzcyB0byBzcGVjaWZpZWQgSUMuIFRoaXMgY29t bWl0IGFkZCBhIGZpZWxkIG5ldyByYXRlIElEIGZvciBuZXcNCj4gPiBnZW5lcmF0aW9uIElDLg0K PiA+wqANCj4gPiBTaWduZWQtb2ZmLWJ5OiBQaW5nLUtlIFNoaWggPHBrc2hpaEByZWFsdGVrLmNv bT4NCj4gQWNrZWQtYnk6IExhcnJ5IEZpbmdlciA8TGFycnkuRmluZ2VyQGx3ZmluZ2VyLm5ldD4N Cj7CoA0KDQpTaGFsbCBJIGFwcGVuZCAiQWNrZWQtYnkiIGluIHYyPw0KDQo=
Re: [07/10] rtlwifi: btcoex: Fix some static warnings from Sparse
In reply to [email protected]Quoted 5 lines · Ping-Ke Shih
From: Ping-Ke Shih <[email protected]>
Add 'static' or declaration to resolve the warnings.
Signed-off-by Ping-Ke Shih <[email protected]>
Dropping this patch 7 per comments, but I'll try to take the rest (if they apply).
Patch set to Changes Requested.
Signature · 3 lines
https://patchwork.kernel.org/patch/10174655/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [01/10] rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M
In reply to [email protected]Quoted 8 lines · Ping-Ke Shih
From: Ping-Ke Shih <[email protected]>
The rtlwifi newer ICs support 80M bandwidth in 5G band, so extend
get_wifi_bw()to know bandwidth 80M that helps btcoex to make correct decisions.Signed-off-by Ping-Ke Shih <[email protected]>Acked-by Larry Finger <[email protected]>
9 patches applied to wireless-drivers-next.git, thanks.
66d0f9deba36 rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M 17bf85101181 rtlwifi: btcoex: Add switch band notify for btc f243bca13893 rtlwifi: btcoex: Add variable ant_div_cfg to support antenna diversity ee373844849c rtlwifi: btcoex: add scan_notify within ips_notify if RFON 9177c3363994 rtlwifi: btcoex: Add wifi_only series ops to control solo card 8d73e53e8a87 rtlwifi: btcoex: add boolean variables dbg_mode ba3cca4d0c3e rtlwifi: 8822be has to report vht capability to mac80211 be98db155646 rtlwifi: Add ratr_table for newer ICa75f3eebfa3d rtlwifi: Add spec_ver to check whether use new rate-id or not
Signature · 3 lines
https://patchwork.kernel.org/patch/10174643/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH 10/10] rtlwifi: Add spec_ver to check whether use new rate-id or not
In reply to PkshihQuoted 6 lines · Pkshih
Quoted 5 lines · Larry Finger
Quoted 4 lines · On 01/19/2018 12:45 AM, [email protected] wrote:
=C2=A0
From: Ping-Ke Shih <[email protected]>
=C2=A0
The fieldspec_veris IC's specification mask for common code to do pr=
oper
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
process to specified IC. This commit add a field new rate ID for new generation IC.
=C2=A0Signed-off-by Ping-Ke Shih <[email protected]>Acked-by Larry Finger <[email protected]>=C2=A0
Shall I append "Acked-by" in v2?
Yes, you can add Acked-by in the next version (if the patch in question is not modified after the ack).
But do note that patchwork can automatically take Acked-by from the mailing list, for example that happened in the 9 patches I just applied from this series. So you no need to resend the rtlwifi patches for just to add the Acked-by line.
--=20
Kalle Valo