rtlwifi: btcoex: Add switch band notify for btc
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 19 Jan 2018 06:45:43 +0000 (14:45 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 Jan 2018 15:39:50 +0000 (17:39 +0200)
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 <pkshih@realtek.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
drivers/net/wireless/realtek/rtlwifi/wifi.h

index c335f06..b51189a 100644 (file)
@@ -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);
+}
index bc854ff..cd3925d 100644 (file)
@@ -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);
index 714c0de..bbc9517 100644 (file)
@@ -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;
index 8c50982..1d98741 100644 (file)
@@ -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);
index 531c86d..8ed0207 100644 (file)
@@ -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);