Lines Matching refs:priv

29 static void vnt_cmd_timer_wait(struct vnt_private *priv, unsigned long msecs)
31 schedule_delayed_work(&priv->run_command_work, msecs_to_jiffies(msecs));
43 static int vnt_cmd_complete(struct vnt_private *priv)
45 priv->command_state = WLAN_CMD_IDLE;
46 if (priv->free_cmd_queue == CMD_Q_SIZE) {
48 priv->cmd_running = false;
52 priv->command = priv->cmd_queue[priv->cmd_dequeue_idx];
54 priv->cmd_dequeue_idx = add_one_with_wrap_around(priv->cmd_dequeue_idx, CMD_Q_SIZE);
55 priv->free_cmd_queue++;
56 priv->cmd_running = true;
58 switch (priv->command) {
60 priv->command_state = WLAN_CMD_INIT_MAC80211_START;
64 priv->command_state = WLAN_CMD_TBTT_WAKEUP_START;
68 priv->command_state = WLAN_CMD_BECON_SEND_START;
72 priv->command_state = WLAN_CMD_SETPOWER_START;
76 priv->command_state = WLAN_CMD_CHANGE_ANTENNA_START;
83 vnt_cmd_timer_wait(priv, 0);
90 struct vnt_private *priv =
93 if (test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags))
96 if (!priv->cmd_running)
99 switch (priv->command_state) {
101 if (priv->mac_hw)
104 dev_info(&priv->usb->dev, "Starting mac80211\n");
106 if (vnt_init(priv)) {
108 dev_err(&priv->usb->dev, "failed to start\n");
109 usb_set_intfdata(priv->intf, NULL);
110 ieee80211_free_hw(priv->hw);
117 vnt_next_tbtt_wakeup(priv);
121 if (!priv->vif)
124 vnt_beacon_make(priv, priv->vif);
126 vnt_mac_reg_bits_on(priv, MAC_REG_TCR, TCR_AUTOBCNTX);
132 vnt_rf_setpower(priv, priv->hw->conf.chandef.chan);
137 dev_dbg(&priv->usb->dev, "Change from Antenna%d to",
138 priv->rx_antenna_sel);
140 if (priv->rx_antenna_sel == 0) {
141 priv->rx_antenna_sel = 1;
142 if (priv->tx_rx_ant_inv)
143 vnt_set_antenna_mode(priv, ANT_RXA);
145 vnt_set_antenna_mode(priv, ANT_RXB);
147 priv->rx_antenna_sel = 0;
148 if (priv->tx_rx_ant_inv)
149 vnt_set_antenna_mode(priv, ANT_RXB);
151 vnt_set_antenna_mode(priv, ANT_RXA);
159 vnt_cmd_complete(priv);
162 int vnt_schedule_command(struct vnt_private *priv, enum vnt_cmd command)
164 if (priv->free_cmd_queue == 0)
167 priv->cmd_queue[priv->cmd_enqueue_idx] = command;
169 priv->cmd_enqueue_idx = add_one_with_wrap_around(priv->cmd_enqueue_idx, CMD_Q_SIZE);
170 priv->free_cmd_queue--;
172 if (!priv->cmd_running)
173 vnt_cmd_complete(priv);
178 void vnt_reset_command_timer(struct vnt_private *priv)
180 priv->free_cmd_queue = CMD_Q_SIZE;
181 priv->cmd_dequeue_idx = 0;
182 priv->cmd_enqueue_idx = 0;
183 priv->command_state = WLAN_CMD_IDLE;
184 priv->cmd_running = false;