ath9k: cleanup MCI indentation

Fix bad indentation & if nesting to lose about two levels
of unnecessary indentation.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Rajkumar Manoharan 2012-06-04 16:28:08 +05:30 committed by John W. Linville
parent 5d294a1680
commit 4f6bd1a8df
1 changed files with 215 additions and 220 deletions

View File

@ -35,31 +35,30 @@ static int ar9003_mci_wait_for_interrupt(struct ath_hw *ah, u32 address,
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
while (time_out) { while (time_out) {
if (REG_READ(ah, address) & bit_position) { if (!(REG_READ(ah, address) & bit_position)) {
REG_WRITE(ah, address, bit_position);
if (address == AR_MCI_INTERRUPT_RX_MSG_RAW) {
if (bit_position &
AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE)
ar9003_mci_reset_req_wakeup(ah);
if (bit_position &
(AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING |
AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING))
REG_WRITE(ah, AR_MCI_INTERRUPT_RAW,
AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE);
REG_WRITE(ah, AR_MCI_INTERRUPT_RAW,
AR_MCI_INTERRUPT_RX_MSG);
}
break;
}
udelay(10); udelay(10);
time_out -= 10; time_out -= 10;
if (time_out < 0) if (time_out < 0)
break; break;
else
continue;
}
REG_WRITE(ah, address, bit_position);
if (address != AR_MCI_INTERRUPT_RX_MSG_RAW)
break;
if (bit_position & AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE)
ar9003_mci_reset_req_wakeup(ah);
if (bit_position & (AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING |
AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING))
REG_WRITE(ah, AR_MCI_INTERRUPT_RAW,
AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE);
REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_RX_MSG);
break;
} }
if (time_out <= 0) { if (time_out <= 0) {
@ -127,14 +126,13 @@ static void ar9003_mci_send_coex_version_query(struct ath_hw *ah,
struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
u32 payload[4] = {0, 0, 0, 0}; u32 payload[4] = {0, 0, 0, 0};
if (!mci->bt_version_known && if (mci->bt_version_known ||
(mci->bt_state != MCI_BT_SLEEP)) { (mci->bt_state == MCI_BT_SLEEP))
MCI_GPM_SET_TYPE_OPCODE(payload, return;
MCI_GPM_COEX_AGENT,
MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT,
MCI_GPM_COEX_VERSION_QUERY); MCI_GPM_COEX_VERSION_QUERY);
ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true);
wait_done, true);
}
} }
static void ar9003_mci_send_coex_version_response(struct ath_hw *ah, static void ar9003_mci_send_coex_version_response(struct ath_hw *ah,
@ -158,15 +156,14 @@ static void ar9003_mci_send_coex_wlan_channels(struct ath_hw *ah,
struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
u32 *payload = &mci->wlan_channels[0]; u32 *payload = &mci->wlan_channels[0];
if ((mci->wlan_channels_update == true) && if (!mci->wlan_channels_update ||
(mci->bt_state != MCI_BT_SLEEP)) { (mci->bt_state == MCI_BT_SLEEP))
MCI_GPM_SET_TYPE_OPCODE(payload, return;
MCI_GPM_COEX_AGENT,
MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT,
MCI_GPM_COEX_WLAN_CHANNELS); MCI_GPM_COEX_WLAN_CHANNELS);
ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true);
wait_done, true);
MCI_GPM_SET_TYPE_OPCODE(payload, 0xff, 0xff); MCI_GPM_SET_TYPE_OPCODE(payload, 0xff, 0xff);
}
} }
static void ar9003_mci_send_coex_bt_status_query(struct ath_hw *ah, static void ar9003_mci_send_coex_bt_status_query(struct ath_hw *ah,
@ -174,11 +171,13 @@ static void ar9003_mci_send_coex_bt_status_query(struct ath_hw *ah,
{ {
struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
u32 payload[4] = {0, 0, 0, 0}; u32 payload[4] = {0, 0, 0, 0};
bool query_btinfo = !!(query_type & (MCI_GPM_COEX_QUERY_BT_ALL_INFO | bool query_btinfo;
if (mci->bt_state == MCI_BT_SLEEP)
return;
query_btinfo = !!(query_type & (MCI_GPM_COEX_QUERY_BT_ALL_INFO |
MCI_GPM_COEX_QUERY_BT_TOPOLOGY)); MCI_GPM_COEX_QUERY_BT_TOPOLOGY));
if (mci->bt_state != MCI_BT_SLEEP) {
MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT, MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT,
MCI_GPM_COEX_STATUS_QUERY); MCI_GPM_COEX_STATUS_QUERY);
@ -196,7 +195,6 @@ static void ar9003_mci_send_coex_bt_status_query(struct ath_hw *ah,
if (query_btinfo) if (query_btinfo)
mci->query_bt = false; mci->query_bt = false;
}
} }
static void ar9003_mci_send_coex_halt_bt_gpm(struct ath_hw *ah, bool halt, static void ar9003_mci_send_coex_halt_bt_gpm(struct ath_hw *ah, bool halt,
@ -241,8 +239,9 @@ static void ar9003_mci_prep_interface(struct ath_hw *ah)
ar9003_mci_remote_reset(ah, true); ar9003_mci_remote_reset(ah, true);
ar9003_mci_send_req_wake(ah, true); ar9003_mci_send_req_wake(ah, true);
if (ar9003_mci_wait_for_interrupt(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, if (!ar9003_mci_wait_for_interrupt(ah, AR_MCI_INTERRUPT_RX_MSG_RAW,
AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING, 500)) { AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING, 500))
goto clear_redunt;
mci->bt_state = MCI_BT_AWAKE; mci->bt_state = MCI_BT_AWAKE;
@ -283,8 +282,7 @@ static void ar9003_mci_prep_interface(struct ath_hw *ah)
REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW,
AR_MCI_INTERRUPT_RX_MSG_CONT_RST); AR_MCI_INTERRUPT_RX_MSG_CONT_RST);
REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_BT_PRI);
AR_MCI_INTERRUPT_BT_PRI);
if (mci->is_2g) { if (mci->is_2g) {
ar9003_mci_send_lna_transfer(ah, true); ar9003_mci_send_lna_transfer(ah, true);
@ -302,8 +300,8 @@ static void ar9003_mci_prep_interface(struct ath_hw *ah)
ath_dbg(common, MCI, ath_dbg(common, MCI,
"MCI BT didn't respond to LNA_TRANS\n"); "MCI BT didn't respond to LNA_TRANS\n");
} }
}
clear_redunt:
/* Clear the extra redundant SYS_WAKING from BT */ /* Clear the extra redundant SYS_WAKING from BT */
if ((mci->bt_state == MCI_BT_AWAKE) && if ((mci->bt_state == MCI_BT_AWAKE) &&
(REG_READ_FIELD(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, (REG_READ_FIELD(ah, AR_MCI_INTERRUPT_RX_MSG_RAW,
@ -614,9 +612,9 @@ static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 gpm_type,
} }
break; break;
} }
} else if ((recv_type == gpm_type) && (recv_opcode == gpm_opcode)) { } else if ((recv_type == gpm_type) &&
(recv_opcode == gpm_opcode))
break; break;
}
/* /*
* check if it's cal_grant * check if it's cal_grant
@ -730,8 +728,9 @@ int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan,
if (!IS_CHAN_2GHZ(chan) || (mci_hw->bt_state != MCI_BT_SLEEP)) if (!IS_CHAN_2GHZ(chan) || (mci_hw->bt_state != MCI_BT_SLEEP))
goto exit; goto exit;
if (ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET) || if (!ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET) &&
ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE)) { !ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE))
goto exit;
/* /*
* BT is sleeping. Check if BT wakes up during * BT is sleeping. Check if BT wakes up during
@ -740,8 +739,8 @@ int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan,
* message exchanges again and recal. * message exchanges again and recal.
*/ */
REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW,
AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET | (AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET |
AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE); AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE));
ar9003_mci_remote_reset(ah, true); ar9003_mci_remote_reset(ah, true);
ar9003_mci_send_sys_waking(ah, true); ar9003_mci_send_sys_waking(ah, true);
@ -761,7 +760,6 @@ int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan,
if (!ath9k_hw_init_cal(ah, chan)) if (!ath9k_hw_init_cal(ah, chan))
return -EIO; return -EIO;
}
exit: exit:
ar9003_mci_enable_interrupt(ah); ar9003_mci_enable_interrupt(ah);
return 0; return 0;
@ -797,9 +795,12 @@ static void ar9003_mci_osla_setup(struct ath_hw *ah, bool enable)
struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
u32 thresh; u32 thresh;
if (enable) { if (!enable) {
REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, REG_CLR_BIT(ah, AR_BTCOEX_CTRL,
AR_MCI_SCHD_TABLE_2_HW_BASED, 1); AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
return;
}
REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, AR_MCI_SCHD_TABLE_2_HW_BASED, 1);
REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2,
AR_MCI_SCHD_TABLE_2_MEM_BASED, 1); AR_MCI_SCHD_TABLE_2_MEM_BASED, 1);
@ -809,17 +810,12 @@ static void ar9003_mci_osla_setup(struct ath_hw *ah, bool enable)
AR_BTCOEX_CTRL_AGGR_THRESH, thresh); AR_BTCOEX_CTRL_AGGR_THRESH, thresh);
REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, REG_RMW_FIELD(ah, AR_BTCOEX_CTRL,
AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN, 1); AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN, 1);
} else { } else
REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, REG_RMW_FIELD(ah, AR_BTCOEX_CTRL,
AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN, 0); AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN, 0);
}
REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, REG_RMW_FIELD(ah, AR_BTCOEX_CTRL,
AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1); AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1);
} else {
REG_CLR_BIT(ah, AR_BTCOEX_CTRL,
AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
}
} }
void ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g, void ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
@ -942,7 +938,9 @@ static void ar9003_mci_send_2g5g_status(struct ath_hw *ah, bool wait_done)
struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
u32 new_flags, to_set, to_clear; u32 new_flags, to_set, to_clear;
if (mci->update_2g5g && (mci->bt_state != MCI_BT_SLEEP)) { if (!mci->update_2g5g || (mci->bt_state == MCI_BT_SLEEP))
return;
if (mci->is_2g) { if (mci->is_2g) {
new_flags = MCI_2G_FLAGS; new_flags = MCI_2G_FLAGS;
to_clear = MCI_2G_FLAGS_CLEAR_MASK; to_clear = MCI_2G_FLAGS_CLEAR_MASK;
@ -961,7 +959,6 @@ static void ar9003_mci_send_2g5g_status(struct ath_hw *ah, bool wait_done)
ar9003_mci_send_coex_bt_flags(ah, wait_done, ar9003_mci_send_coex_bt_flags(ah, wait_done,
MCI_GPM_COEX_BT_FLAGS_SET, MCI_GPM_COEX_BT_FLAGS_SET,
to_set); to_set);
}
} }
static void ar9003_mci_queue_unsent_gpm(struct ath_hw *ah, u8 header, static void ar9003_mci_queue_unsent_gpm(struct ath_hw *ah, u8 header,
@ -1017,7 +1014,9 @@ void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool wait_done)
{ {
struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
if (mci->update_2g5g) { if (!mci->update_2g5g)
return;
if (mci->is_2g) { if (mci->is_2g) {
ar9003_mci_send_2g5g_status(ah, true); ar9003_mci_send_2g5g_status(ah, true);
ar9003_mci_send_lna_transfer(ah, true); ar9003_mci_send_lna_transfer(ah, true);
@ -1028,10 +1027,9 @@ void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool wait_done)
REG_CLR_BIT(ah, AR_PHY_GLB_CONTROL, REG_CLR_BIT(ah, AR_PHY_GLB_CONTROL,
AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL);
if (!(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA)) { if (!(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA))
REG_SET_BIT(ah, AR_BTCOEX_CTRL, REG_SET_BIT(ah, AR_BTCOEX_CTRL,
AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN); AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
}
} else { } else {
ar9003_mci_send_lna_take(ah, true); ar9003_mci_send_lna_take(ah, true);
udelay(5); udelay(5);
@ -1045,7 +1043,6 @@ void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool wait_done)
ar9003_mci_send_2g5g_status(ah, true); ar9003_mci_send_2g5g_status(ah, true);
} }
}
} }
bool ar9003_mci_send_message(struct ath_hw *ah, u8 header, u32 flag, bool ar9003_mci_send_message(struct ath_hw *ah, u8 header, u32 flag,
@ -1370,11 +1367,9 @@ u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type, u32 *p_data)
* sure currently is in UNHALT-ed mode and BT can * sure currently is in UNHALT-ed mode and BT can
* respond to status query. * respond to status query.
*/ */
value = (!mci->unhalt_bt_gpm && value = (!mci->unhalt_bt_gpm && mci->need_flush_btinfo) ? 1 : 0;
mci->need_flush_btinfo) ? 1 : 0;
if (p_data) if (p_data)
mci->need_flush_btinfo = mci->need_flush_btinfo = (*p_data != 0) ? true : false;
(*p_data != 0) ? true : false;
break; break;
case MCI_STATE_RECOVER_RX: case MCI_STATE_RECOVER_RX:
ar9003_mci_prep_interface(ah); ar9003_mci_prep_interface(ah);