Commit 7fe1fe75 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtlwifi: rtl8723be: btcoex: add package_type function to btcoex

The new code handles the package-type of the chip.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 0de9b5db
...@@ -163,6 +163,13 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv) ...@@ -163,6 +163,13 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
return num; return num;
} }
u8 rtl_get_hwpg_package_type(struct rtl_priv *rtlpriv)
{
struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
return rtlhal->package_type;
}
static void halbtc_leave_lps(struct btc_coexist *btcoexist) static void halbtc_leave_lps(struct btc_coexist *btcoexist)
{ {
struct rtl_priv *rtlpriv; struct rtl_priv *rtlpriv;
......
...@@ -50,6 +50,8 @@ u8 rtl_get_hwpg_bt_exist(struct rtl_priv *rtlpriv); ...@@ -50,6 +50,8 @@ u8 rtl_get_hwpg_bt_exist(struct rtl_priv *rtlpriv);
u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv); u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv);
u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv); u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv);
u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv); u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv);
u8 rtl_get_hwpg_package_type(struct rtl_priv *rtlpriv);
enum rt_media_status mgnt_link_status_query(struct ieee80211_hw *hw); enum rt_media_status mgnt_link_status_query(struct ieee80211_hw *hw);
#endif #endif
...@@ -73,8 +73,6 @@ static void efuse_word_enable_data_read(u8 word_en, u8 *sourdata, ...@@ -73,8 +73,6 @@ static void efuse_word_enable_data_read(u8 word_en, u8 *sourdata,
u8 *targetdata); u8 *targetdata);
static u8 enable_efuse_data_write(struct ieee80211_hw *hw, static u8 enable_efuse_data_write(struct ieee80211_hw *hw,
u16 efuse_addr, u8 word_en, u8 *data); u16 efuse_addr, u8 word_en, u8 *data);
static void efuse_power_switch(struct ieee80211_hw *hw, u8 write,
u8 pwrstate);
static u16 efuse_get_current_size(struct ieee80211_hw *hw); static u16 efuse_get_current_size(struct ieee80211_hw *hw);
static u8 efuse_calculate_word_cnts(u8 word_en); static u8 efuse_calculate_word_cnts(u8 word_en);
...@@ -1124,7 +1122,7 @@ static u8 enable_efuse_data_write(struct ieee80211_hw *hw, ...@@ -1124,7 +1122,7 @@ static u8 enable_efuse_data_write(struct ieee80211_hw *hw,
return badworden; return badworden;
} }
static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate) void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
...@@ -1210,6 +1208,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate) ...@@ -1210,6 +1208,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
} }
} }
} }
EXPORT_SYMBOL(efuse_power_switch);
static u16 efuse_get_current_size(struct ieee80211_hw *hw) static u16 efuse_get_current_size(struct ieee80211_hw *hw)
{ {
......
...@@ -109,6 +109,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw); ...@@ -109,6 +109,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); void efuse_force_write_vendor_Id(struct ieee80211_hw *hw);
void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate);
int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv, int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv,
int max_size, u8 *hwinfo, int *params); int max_size, u8 *hwinfo, int *params);
void rtl_fill_dummy(u8 *pfwbuf, u32 *pfwlen); void rtl_fill_dummy(u8 *pfwbuf, u32 *pfwlen);
......
...@@ -2020,6 +2020,37 @@ static void _rtl8723be_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, ...@@ -2020,6 +2020,37 @@ static void _rtl8723be_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
"eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory);
} }
static u8 _rtl8723be_read_package_type(struct ieee80211_hw *hw)
{
u8 package_type;
u8 value;
efuse_power_switch(hw, false, true);
if (!efuse_one_byte_read(hw, 0x1FB, &value))
value = 0;
efuse_power_switch(hw, false, false);
switch (value & 0x7) {
case 0x4:
package_type = PACKAGE_TFBGA79;
break;
case 0x5:
package_type = PACKAGE_TFBGA90;
break;
case 0x6:
package_type = PACKAGE_QFN68;
break;
case 0x7:
package_type = PACKAGE_TFBGA80;
break;
default:
package_type = PACKAGE_DEFAULT;
break;
}
return package_type;
}
static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw,
bool pseudo_test) bool pseudo_test)
{ {
...@@ -2078,6 +2109,8 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, ...@@ -2078,6 +2109,8 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw,
rtlefuse->autoload_failflag, rtlefuse->autoload_failflag,
hwinfo); hwinfo);
rtlhal->package_type = _rtl8723be_read_package_type(hw);
/* set channel plan from efuse */ /* set channel plan from efuse */
rtlefuse->channel_plan = rtlefuse->eeprom_channelplan; rtlefuse->channel_plan = rtlefuse->eeprom_channelplan;
......
...@@ -925,6 +925,14 @@ enum wolpattern_type { ...@@ -925,6 +925,14 @@ enum wolpattern_type {
UNKNOWN_TYPE = 4, UNKNOWN_TYPE = 4,
}; };
enum package_type {
PACKAGE_DEFAULT,
PACKAGE_QFN68,
PACKAGE_TFBGA90,
PACKAGE_TFBGA80,
PACKAGE_TFBGA79
};
struct octet_string { struct octet_string {
u8 *octet; u8 *octet;
u16 length; u16 length;
...@@ -1509,6 +1517,7 @@ struct rtl_hal { ...@@ -1509,6 +1517,7 @@ struct rtl_hal {
u32 version; /*version of chip */ u32 version; /*version of chip */
u8 state; /*stop 0, start 1 */ u8 state; /*stop 0, start 1 */
u8 board_type; u8 board_type;
u8 package_type;
u8 external_pa; u8 external_pa;
u8 pa_mode; u8 pa_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment