This source file includes following definitions.
- vnt_enable_power_saving
- vnt_disable_power_saving
- vnt_next_tbtt_wakeup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "mac.h"
24 #include "device.h"
25 #include "power.h"
26 #include "wcmd.h"
27 #include "rxtx.h"
28 #include "card.h"
29 #include "usbpipe.h"
30
31
32
33
34
35
36
37
38
39
40
41 void vnt_enable_power_saving(struct vnt_private *priv, u16 listen_interval)
42 {
43 u16 aid = priv->current_aid | BIT(14) | BIT(15);
44
45
46 vnt_mac_write_word(priv, MAC_REG_PWBT, C_PWBT);
47
48 if (priv->op_mode != NL80211_IFTYPE_ADHOC)
49
50 vnt_mac_write_word(priv, MAC_REG_AIDATIM, aid);
51
52
53
54
55
56 vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_PSEN);
57
58
59 vnt_mac_reg_bits_on(priv, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
60
61
62
63
64 vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_GO2DOZE);
65
66 if (listen_interval >= 2) {
67
68 vnt_mac_reg_bits_off(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
69
70
71 vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
72 } else {
73
74 vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
75 }
76
77 dev_dbg(&priv->usb->dev, "PS:Power Saving Mode Enable...\n");
78 }
79
80
81
82
83
84
85
86
87
88
89
90 void vnt_disable_power_saving(struct vnt_private *priv)
91 {
92
93 vnt_control_out(priv, MESSAGE_TYPE_DISABLE_PS, 0,
94 0, 0, NULL);
95
96
97 vnt_mac_reg_bits_off(priv, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
98
99
100 vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
101 }
102
103
104
105
106
107
108
109
110
111
112
113 int vnt_next_tbtt_wakeup(struct vnt_private *priv)
114 {
115 struct ieee80211_hw *hw = priv->hw;
116 struct ieee80211_conf *conf = &hw->conf;
117 int wake_up = false;
118
119 if (conf->listen_interval > 1) {
120
121 vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
122 wake_up = true;
123 }
124
125 return wake_up;
126 }