Commit 3d391c06 authored by Yan-Hsuan Chuang's avatar Yan-Hsuan Chuang Committed by Kalle Valo

rtw88: not to control LPS by each vif

The original design of LPS enter/leave routines allows
to control the LPS state by each interface. But the
hardware cannot actually handle it that way. This means
the hardware can only enter LPS once with an associated
port, so there is no need to keep tracking the state of
each vif.

Hence the logic of enter/leave LPS state can be simple,
just to check the state of the device's flag. And for
leaving LPS state, it will get the same port id to send
to inform the hardware.
Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 61d73095
...@@ -810,8 +810,6 @@ static void rtw_coex_ignore_wlan_act(struct rtw_dev *rtwdev, bool enable) ...@@ -810,8 +810,6 @@ static void rtw_coex_ignore_wlan_act(struct rtw_dev *rtwdev, bool enable)
static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type, static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type,
u8 lps_val, u8 rpwm_val) u8 lps_val, u8 rpwm_val)
{ {
struct rtw_lps_conf *lps_conf = &rtwdev->lps_conf;
struct rtw_vif *rtwvif;
struct rtw_coex *coex = &rtwdev->coex; struct rtw_coex *coex = &rtwdev->coex;
struct rtw_coex_stat *coex_stat = &coex->stat; struct rtw_coex_stat *coex_stat = &coex->stat;
u8 lps_mode = 0x0; u8 lps_mode = 0x0;
...@@ -823,18 +821,14 @@ static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type, ...@@ -823,18 +821,14 @@ static void rtw_coex_power_save_state(struct rtw_dev *rtwdev, u8 ps_type,
/* recover to original 32k low power setting */ /* recover to original 32k low power setting */
coex_stat->wl_force_lps_ctrl = false; coex_stat->wl_force_lps_ctrl = false;
rtwvif = lps_conf->rtwvif; rtw_leave_lps(rtwdev);
if (rtwvif && rtw_in_lps(rtwdev))
rtw_leave_lps(rtwdev, rtwvif);
break; break;
case COEX_PS_LPS_OFF: case COEX_PS_LPS_OFF:
coex_stat->wl_force_lps_ctrl = true; coex_stat->wl_force_lps_ctrl = true;
if (lps_mode) if (lps_mode)
rtw_fw_coex_tdma_type(rtwdev, 0x8, 0, 0, 0, 0); rtw_fw_coex_tdma_type(rtwdev, 0x8, 0, 0, 0, 0);
rtwvif = lps_conf->rtwvif; rtw_leave_lps(rtwdev);
if (rtwvif && rtw_in_lps(rtwdev))
rtw_leave_lps(rtwdev, rtwvif);
break; break;
default: default:
break; break;
......
...@@ -464,7 +464,7 @@ static void rtw_ops_sw_scan_start(struct ieee80211_hw *hw, ...@@ -464,7 +464,7 @@ static void rtw_ops_sw_scan_start(struct ieee80211_hw *hw,
struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
u32 config = 0; u32 config = 0;
rtw_leave_lps(rtwdev, rtwvif); rtw_leave_lps(rtwdev);
mutex_lock(&rtwdev->mutex); mutex_lock(&rtwdev->mutex);
......
...@@ -181,9 +181,9 @@ static void rtw_watch_dog_work(struct work_struct *work) ...@@ -181,9 +181,9 @@ static void rtw_watch_dog_work(struct work_struct *work)
*/ */
if (rtw_fw_support_lps && if (rtw_fw_support_lps &&
data.rtwvif && !data.active && data.assoc_cnt == 1) data.rtwvif && !data.active && data.assoc_cnt == 1)
rtw_enter_lps(rtwdev, data.rtwvif); rtw_enter_lps(rtwdev, data.rtwvif->port);
else else
rtw_leave_lps(rtwdev, rtwdev->lps_conf.rtwvif); rtw_leave_lps(rtwdev);
if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags))
return; return;
......
...@@ -533,8 +533,6 @@ enum rtw_pwr_state { ...@@ -533,8 +533,6 @@ enum rtw_pwr_state {
}; };
struct rtw_lps_conf { struct rtw_lps_conf {
/* the interface to enter lps */
struct rtw_vif *rtwvif;
enum rtw_lps_mode mode; enum rtw_lps_mode mode;
enum rtw_pwr_state state; enum rtw_pwr_state state;
u8 awake_interval; u8 awake_interval;
......
...@@ -96,36 +96,27 @@ bool rtw_in_lps(struct rtw_dev *rtwdev) ...@@ -96,36 +96,27 @@ bool rtw_in_lps(struct rtw_dev *rtwdev)
return test_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags); return test_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags);
} }
void rtw_enter_lps(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif) void rtw_enter_lps(struct rtw_dev *rtwdev, u8 port_id)
{ {
struct rtw_lps_conf *conf = &rtwdev->lps_conf; struct rtw_lps_conf *conf = &rtwdev->lps_conf;
if (WARN_ON(!rtwvif)) if (test_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags))
return;
if (rtwvif->in_lps)
return; return;
conf->mode = RTW_MODE_LPS; conf->mode = RTW_MODE_LPS;
conf->rtwvif = rtwvif; conf->port_id = port_id;
rtwvif->in_lps = true;
rtw_enter_lps_core(rtwdev); rtw_enter_lps_core(rtwdev);
} }
void rtw_leave_lps(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif) void rtw_leave_lps(struct rtw_dev *rtwdev)
{ {
struct rtw_lps_conf *conf = &rtwdev->lps_conf; struct rtw_lps_conf *conf = &rtwdev->lps_conf;
if (WARN_ON(!rtwvif)) if (!test_bit(RTW_FLAG_LEISURE_PS, rtwdev->flags))
return;
if (!rtwvif->in_lps)
return; return;
conf->mode = RTW_MODE_ACTIVE; conf->mode = RTW_MODE_ACTIVE;
conf->rtwvif = rtwvif;
rtwvif->in_lps = false;
rtw_leave_lps_core(rtwdev); rtw_leave_lps_core(rtwdev);
} }
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
int rtw_enter_ips(struct rtw_dev *rtwdev); int rtw_enter_ips(struct rtw_dev *rtwdev);
int rtw_leave_ips(struct rtw_dev *rtwdev); int rtw_leave_ips(struct rtw_dev *rtwdev);
void rtw_enter_lps(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif); void rtw_enter_lps(struct rtw_dev *rtwdev, u8 port_id);
void rtw_leave_lps(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif); void rtw_leave_lps(struct rtw_dev *rtwdev);
bool rtw_in_lps(struct rtw_dev *rtwdev); bool rtw_in_lps(struct rtw_dev *rtwdev);
#endif #endif
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