[PATCH 3/8] wcn36xx: move pw_state to wcn36xx_vif struct
Eugene Krasnikov
k.eugene.e at gmail.com
Mon Sep 9 09:35:17 EDT 2013
Each vif can be in different power state.
Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
debug.c | 19 ++++++++++++++-----
dxe.c | 2 +-
main.c | 1 -
pmc.c | 15 ++++++---------
pmc.h | 1 -
wcn36xx.h | 7 ++++---
6 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/debug.c b/debug.c
index f23301e..a4c86fb 100644
--- a/debug.c
+++ b/debug.c
@@ -35,13 +35,22 @@ static ssize_t read_file_bool_bmps(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wcn36xx *wcn = file->private_data;
+ struct wcn36xx_vif *vif_priv = NULL;
+ struct ieee80211_vif *vif = NULL;
char buf[3];
- if (wcn->pw_state == WCN36XX_BMPS)
- buf[0] = '1';
- else
- buf[0] = '0';
-
+ list_for_each_entry(vif_priv, &wcn->vif_list, list) {
+ vif = container_of((void *)vif_priv,
+ struct ieee80211_vif,
+ drv_priv);
+ if (NL80211_IFTYPE_STATION == vif->type) {
+ if (vif_priv->pw_state == WCN36XX_BMPS)
+ buf[0] = '1';
+ else
+ buf[0] = '0';
+ break;
+ }
+ }
buf[1] = '\n';
buf[2] = 0x00;
diff --git a/dxe.c b/dxe.c
index db1f413..93ea934 100644
--- a/dxe.c
+++ b/dxe.c
@@ -655,7 +655,7 @@ int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
* mode and writing to the register will not wake up the chip. Instead
* notify chip about new frame through SMSM bus.
*/
- if (wcn->pw_state == WCN36XX_BMPS) {
+ if (is_low && wcn->current_vif->pw_state == WCN36XX_BMPS) {
wcn->ctrl_ops->smsm_change_state(
0,
WCN36XX_SMSM_WLAN_TX_ENABLE);
diff --git a/main.c b/main.c
index e13c7ff..814b101 100644
--- a/main.c
+++ b/main.c
@@ -230,7 +230,6 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
goto out_smd_stop;
}
- wcn36xx_pmc_init(wcn);
wcn36xx_debugfs_init(wcn);
if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
diff --git a/pmc.c b/pmc.c
index beffe8b..28b515c 100644
--- a/pmc.c
+++ b/pmc.c
@@ -18,21 +18,16 @@
#include "wcn36xx.h"
-int wcn36xx_pmc_init(struct wcn36xx *wcn)
-{
- wcn->pw_state = WCN36XX_FULL_POWER;
- return 0;
-}
-
int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
struct ieee80211_vif *vif)
{
int ret = 0;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
/* TODO: Make sure the TX chain clean */
ret = wcn36xx_smd_enter_bmps(wcn, vif);
if (!ret) {
wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
- wcn->pw_state = WCN36XX_BMPS;
+ vif_priv->pw_state = WCN36XX_BMPS;
} else {
/*
* One of the reasons why HW will not enter BMPS is because
@@ -47,12 +42,14 @@ int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
struct ieee80211_vif *vif)
{
- if (WCN36XX_BMPS != wcn->pw_state) {
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+
+ if (WCN36XX_BMPS != vif_priv->pw_state) {
wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n");
return -EINVAL;
}
wcn36xx_smd_exit_bmps(wcn, vif);
- wcn->pw_state = WCN36XX_FULL_POWER;
+ vif_priv->pw_state = WCN36XX_FULL_POWER;
return 0;
}
diff --git a/pmc.h b/pmc.h
index 1f743a9..f72ed68 100644
--- a/pmc.h
+++ b/pmc.h
@@ -24,7 +24,6 @@ enum wcn36xx_power_state {
WCN36XX_BMPS
};
-int wcn36xx_pmc_init(struct wcn36xx *wcn);
int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
struct ieee80211_vif *vif);
int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
diff --git a/wcn36xx.h b/wcn36xx.h
index 4cabfa8..1c8aaa7 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -119,6 +119,10 @@ struct wcn36xx_vif {
u8 dtim_period;
enum ani_ed_type encrypt_type;
bool is_joining;
+
+ /* Power management */
+ enum wcn36xx_power_state pw_state;
+
u8 bss_index;
u8 ucast_dpu_signature;
/* Returned from WCN36XX_HAL_ADD_STA_SELF_RSP */
@@ -214,9 +218,6 @@ struct wcn36xx {
struct sk_buff *tx_ack_skb;
- /* Power management */
- enum wcn36xx_power_state pw_state;
-
#ifdef CONFIG_WCN36XX_DEBUGFS
/* Debug file system entry */
struct wcn36xx_dfs_entry dfs;
--
1.8.2.2
More information about the wcn36xx
mailing list