diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2012-04-19 12:48:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-08 20:56:08 -0400 |
commit | 354ce4a4ca613f31871b919e6a86f7fa4cea2582 (patch) | |
tree | 3d99643829b5c984282a971229be9d6b80474cc0 /drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |
parent | 9a00be04e66cc025ab4558d34620615d5c4de5b6 (diff) |
iwlwifi: add checking for the condition to reduce tx power
When bluetooth coex is active and certain condition matched,
driver need to decide should the tx power been reduce or not.
Adding the logic to manage it.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-lib.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 0642186a90fa..994a7daa852d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -541,9 +541,10 @@ static void iwlagn_print_uartmsg(struct iwl_priv *priv, | |||
541 | BT_UART_MSG_FRAME7CONNECTABLE_POS); | 541 | BT_UART_MSG_FRAME7CONNECTABLE_POS); |
542 | } | 542 | } |
543 | 543 | ||
544 | static void iwlagn_set_kill_msk(struct iwl_priv *priv, | 544 | static bool iwlagn_set_kill_msk(struct iwl_priv *priv, |
545 | struct iwl_bt_uart_msg *uart_msg) | 545 | struct iwl_bt_uart_msg *uart_msg) |
546 | { | 546 | { |
547 | bool need_update = false; | ||
547 | u8 kill_msk; | 548 | u8 kill_msk; |
548 | static const __le32 bt_kill_ack_msg[2] = { | 549 | static const __le32 bt_kill_ack_msg[2] = { |
549 | IWLAGN_BT_KILL_ACK_MASK_DEFAULT, | 550 | IWLAGN_BT_KILL_ACK_MASK_DEFAULT, |
@@ -560,10 +561,39 @@ static void iwlagn_set_kill_msk(struct iwl_priv *priv, | |||
560 | priv->kill_ack_mask = bt_kill_ack_msg[kill_msk]; | 561 | priv->kill_ack_mask = bt_kill_ack_msg[kill_msk]; |
561 | priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK; | 562 | priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK; |
562 | priv->kill_cts_mask = bt_kill_cts_msg[kill_msk]; | 563 | priv->kill_cts_mask = bt_kill_cts_msg[kill_msk]; |
564 | need_update = true; | ||
565 | } | ||
566 | return need_update; | ||
567 | } | ||
563 | 568 | ||
564 | /* schedule to send runtime bt_config */ | 569 | static bool iwlagn_fill_txpower_mode(struct iwl_priv *priv, |
565 | queue_work(priv->workqueue, &priv->bt_runtime_config); | 570 | struct iwl_bt_uart_msg *uart_msg) |
571 | { | ||
572 | bool need_update = false; | ||
573 | |||
574 | if (!priv->reduced_txpower && | ||
575 | !iwl_is_associated(priv, IWL_RXON_CTX_PAN) && | ||
576 | (uart_msg->frame3 & (BT_UART_MSG_FRAME3ACL_MSK | | ||
577 | BT_UART_MSG_FRAME3OBEX_MSK)) && | ||
578 | !(uart_msg->frame3 & (BT_UART_MSG_FRAME3SCOESCO_MSK | | ||
579 | BT_UART_MSG_FRAME3SNIFF_MSK | BT_UART_MSG_FRAME3A2DP_MSK))) { | ||
580 | /* enabling reduced tx power */ | ||
581 | priv->reduced_txpower = true; | ||
582 | priv->bt_valid |= IWLAGN_BT_VALID_REDUCED_TX_PWR; | ||
583 | need_update = true; | ||
584 | } else if (priv->reduced_txpower && | ||
585 | (iwl_is_associated(priv, IWL_RXON_CTX_PAN) || | ||
586 | (uart_msg->frame3 & (BT_UART_MSG_FRAME3SCOESCO_MSK | | ||
587 | BT_UART_MSG_FRAME3SNIFF_MSK | BT_UART_MSG_FRAME3A2DP_MSK)) || | ||
588 | !(uart_msg->frame3 & (BT_UART_MSG_FRAME3ACL_MSK | | ||
589 | BT_UART_MSG_FRAME3OBEX_MSK)))) { | ||
590 | /* disable reduced tx power */ | ||
591 | priv->reduced_txpower = false; | ||
592 | priv->bt_valid &= ~IWLAGN_BT_VALID_REDUCED_TX_PWR; | ||
593 | need_update = true; | ||
566 | } | 594 | } |
595 | |||
596 | return need_update; | ||
567 | } | 597 | } |
568 | 598 | ||
569 | int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, | 599 | int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, |
@@ -611,7 +641,11 @@ int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, | |||
611 | } | 641 | } |
612 | } | 642 | } |
613 | 643 | ||
614 | iwlagn_set_kill_msk(priv, uart_msg); | 644 | /* schedule to send runtime bt_config */ |
645 | if (iwlagn_set_kill_msk(priv, uart_msg) || | ||
646 | iwlagn_fill_txpower_mode(priv, uart_msg)) | ||
647 | queue_work(priv->workqueue, &priv->bt_runtime_config); | ||
648 | |||
615 | 649 | ||
616 | /* FIXME: based on notification, adjust the prio_boost */ | 650 | /* FIXME: based on notification, adjust the prio_boost */ |
617 | 651 | ||