summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2015-09-27 11:17:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-29 05:19:53 +0300
commit43c93d9bf5e2b195c38de99024d8d9e545a5aae5 (patch)
treece08d956515493d368f6513b3e62b4fb9c842343 /drivers/staging/vt6656
parentc15158797df6c36780bd07252eb079ff4c9d1706 (diff)
downloadlinux-43c93d9bf5e2b195c38de99024d8d9e545a5aae5.tar.xz
staging: vt6656: implement power saving code.
The device should ready to listen to next beacon so on count down of wake_up_count == 1. schedule command WLAN_CMD_TBTT_WAKEUP which calls vnt_next_tbtt_wakeup which wakes the device. This restores this back to vendors code with a slight difference the count down is in the interrupt handler. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/device.h2
-rw-r--r--drivers/staging/vt6656/int.c14
-rw-r--r--drivers/staging/vt6656/power.c2
3 files changed, 14 insertions, 4 deletions
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 635d931de409..dec36f296f3d 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -389,6 +389,8 @@ struct vnt_private {
u8 bb_pre_ed_rssi;
u8 bb_pre_ed_index;
+ u16 wake_up_count;
+
/* command timer */
struct delayed_work run_command_work;
diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index 2ef70e4701f6..14b8ebc6508d 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -149,10 +149,18 @@ void vnt_int_process_data(struct vnt_private *priv)
priv->op_mode == NL80211_IFTYPE_AP)
vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
- if (int_data->isr0 & ISR_TBTT) {
- if (priv->hw->conf.flags & IEEE80211_CONF_PS)
+ if (int_data->isr0 & ISR_TBTT &&
+ priv->hw->conf.flags & IEEE80211_CONF_PS) {
+ if (!priv->wake_up_count)
+ priv->wake_up_count =
+ priv->hw->conf.listen_interval;
+
+ --priv->wake_up_count;
+
+ /* Turn on wake up to listen next beacon */
+ if (priv->wake_up_count == 1)
vnt_schedule_command(priv,
- WLAN_CMD_TBTT_WAKEUP);
+ WLAN_CMD_TBTT_WAKEUP);
}
priv->current_tsf = le64_to_cpu(int_data->tsf);
diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
index 0ffbaed5d774..d5912d23aa0d 100644
--- a/drivers/staging/vt6656/power.c
+++ b/drivers/staging/vt6656/power.c
@@ -134,7 +134,7 @@ int vnt_next_tbtt_wakeup(struct vnt_private *priv)
struct ieee80211_conf *conf = &hw->conf;
int wake_up = false;
- if (conf->listen_interval == 1) {
+ if (conf->listen_interval > 1) {
/* Turn on wake up to listen next beacon */
vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
wake_up = true;