Skip to content

Commit

Permalink
iwlagn: enable BT session 2 type UART for 2000 series
Browse files Browse the repository at this point in the history
For 2000 series device, use session 2 type of BT UART message

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
  • Loading branch information
Wey-Yi Guy committed Feb 26, 2011
1 parent 399f66f commit 6013270
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 35 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ static struct iwl_bt_params iwl2030_bt_params = {
.bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE,
.bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT,
.bt_sco_disable = true,
.bt_session_2 = true,
};

#define IWL_DEVICE_2000 \
Expand Down
68 changes: 46 additions & 22 deletions drivers/net/wireless/iwlwifi/iwl-agn-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1804,26 +1804,39 @@ static const __le32 iwlagn_concurrent_lookup[12] = {

void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
{
struct iwl6000_bt_cmd bt_cmd = {
struct iwl_basic_bt_cmd basic = {
.max_kill = IWLAGN_BT_MAX_KILL_DEFAULT,
.bt3_timer_t7_value = IWLAGN_BT3_T7_DEFAULT,
.bt3_prio_sample_time = IWLAGN_BT3_PRIO_SAMPLE_DEFAULT,
.bt3_timer_t2_value = IWLAGN_BT3_T2_DEFAULT,
};
struct iwl6000_bt_cmd bt_cmd_6000;
struct iwl2000_bt_cmd bt_cmd_2000;
int ret;

BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) !=
sizeof(bt_cmd.bt3_lookup_table));

if (priv->cfg->bt_params)
bt_cmd.prio_boost = priv->cfg->bt_params->bt_prio_boost;
else
bt_cmd.prio_boost = 0;
bt_cmd.kill_ack_mask = priv->kill_ack_mask;
bt_cmd.kill_cts_mask = priv->kill_cts_mask;
sizeof(basic.bt3_lookup_table));

if (priv->cfg->bt_params) {
if (priv->cfg->bt_params->bt_session_2) {
bt_cmd_2000.prio_boost = cpu_to_le32(
priv->cfg->bt_params->bt_prio_boost);
bt_cmd_2000.tx_prio_boost = 0;
bt_cmd_2000.rx_prio_boost = 0;
} else {
bt_cmd_6000.prio_boost =
priv->cfg->bt_params->bt_prio_boost;
bt_cmd_6000.tx_prio_boost = 0;
bt_cmd_6000.rx_prio_boost = 0;
}
} else {
IWL_ERR(priv, "failed to construct BT Coex Config\n");
return;
}

bt_cmd.valid = priv->bt_valid;
bt_cmd.tx_prio_boost = 0;
bt_cmd.rx_prio_boost = 0;
basic.kill_ack_mask = priv->kill_ack_mask;
basic.kill_cts_mask = priv->kill_cts_mask;
basic.valid = priv->bt_valid;

/*
* Configure BT coex mode to "no coexistence" when the
Expand All @@ -1832,32 +1845,43 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
* IBSS mode (no proper uCode support for coex then).
*/
if (!bt_coex_active || priv->iw_mode == NL80211_IFTYPE_ADHOC) {
bt_cmd.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED;
basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED;
} else {
bt_cmd.flags = IWLAGN_BT_FLAG_COEX_MODE_3W <<
basic.flags = IWLAGN_BT_FLAG_COEX_MODE_3W <<
IWLAGN_BT_FLAG_COEX_MODE_SHIFT;
if (priv->cfg->bt_params &&
priv->cfg->bt_params->bt_sco_disable)
bt_cmd.flags |= IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE;
basic.flags |= IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE;

if (priv->bt_ch_announce)
bt_cmd.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION;
IWL_DEBUG_INFO(priv, "BT coex flag: 0X%x\n", bt_cmd.flags);
basic.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION;
IWL_DEBUG_INFO(priv, "BT coex flag: 0X%x\n", basic.flags);
}
priv->bt_enable_flag = bt_cmd.flags;
priv->bt_enable_flag = basic.flags;
if (priv->bt_full_concurrent)
memcpy(bt_cmd.bt3_lookup_table, iwlagn_concurrent_lookup,
memcpy(basic.bt3_lookup_table, iwlagn_concurrent_lookup,
sizeof(iwlagn_concurrent_lookup));
else
memcpy(bt_cmd.bt3_lookup_table, iwlagn_def_3w_lookup,
memcpy(basic.bt3_lookup_table, iwlagn_def_3w_lookup,
sizeof(iwlagn_def_3w_lookup));

IWL_DEBUG_INFO(priv, "BT coex %s in %s mode\n",
bt_cmd.flags ? "active" : "disabled",
basic.flags ? "active" : "disabled",
priv->bt_full_concurrent ?
"full concurrency" : "3-wire");

if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, sizeof(bt_cmd), &bt_cmd))
if (priv->cfg->bt_params->bt_session_2) {
memcpy(&bt_cmd_2000.basic, &basic,
sizeof(basic));
ret = iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
sizeof(bt_cmd_2000), &bt_cmd_2000);
} else {
memcpy(&bt_cmd_6000.basic, &basic,
sizeof(basic));
ret = iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
sizeof(bt_cmd_6000), &bt_cmd_6000);
}
if (ret)
IWL_ERR(priv, "failed to send BT Coex Config\n");

}
Expand Down
22 changes: 9 additions & 13 deletions drivers/net/wireless/iwlwifi/iwl-commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -2477,7 +2477,7 @@ struct iwl_bt_cmd {
IWLAGN_BT_VALID_BT4_TIMES | \
IWLAGN_BT_VALID_3W_LUT)

struct iwl6000_bt_cmd {
struct iwl_basic_bt_cmd {
u8 flags;
u8 ledtime; /* unused */
u8 max_kill;
Expand All @@ -2490,6 +2490,10 @@ struct iwl6000_bt_cmd {
__le32 bt3_lookup_table[12];
__le16 bt4_decision_time; /* unused */
__le16 valid;
};

struct iwl6000_bt_cmd {
struct iwl_basic_bt_cmd basic;
u8 prio_boost;
/*
* set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask
Expand All @@ -2500,18 +2504,7 @@ struct iwl6000_bt_cmd {
};

struct iwl2000_bt_cmd {
u8 flags;
u8 ledtime; /* unused */
u8 max_kill;
u8 bt3_timer_t7_value;
__le32 kill_ack_mask;
__le32 kill_cts_mask;
u8 bt3_prio_sample_time;
u8 bt3_timer_t2_value;
__le16 bt4_reaction_time; /* unused */
__le32 bt3_lookup_table[12];
__le16 bt4_decision_time; /* unused */
__le16 valid;
struct iwl_basic_bt_cmd basic;
__le32 prio_boost;
/*
* set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask
Expand Down Expand Up @@ -4173,6 +4166,9 @@ enum iwl_bt_coex_profile_traffic_load {
*/
};

#define BT_SESSION_ACTIVITY_1_UART_MSG 0x1
#define BT_SESSION_ACTIVITY_2_UART_MSG 0x2

/* BT UART message - Share Part (BT -> WiFi) */
#define BT_UART_MSG_FRAME1MSGTYPE_POS (0)
#define BT_UART_MSG_FRAME1MSGTYPE_MSK \
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ struct iwl_bt_params {
u8 ampdu_factor;
u8 ampdu_density;
bool bt_sco_disable;
bool bt_session_2;
};
/*
* @use_rts_for_aggregation: use rts/cts protection for HT traffic
Expand Down

0 comments on commit 6013270

Please sign in to comment.