Lines Matching refs:wdev
19 static int wfx_hif_generic_confirm(struct wfx_dev *wdev, in wfx_hif_generic_confirm() argument
27 WARN(!mutex_is_locked(&wdev->hif_cmd.lock), "data locking error"); in wfx_hif_generic_confirm()
29 if (!wdev->hif_cmd.buf_send) { in wfx_hif_generic_confirm()
30 dev_warn(wdev->dev, "unexpected confirmation: 0x%.2x\n", cmd); in wfx_hif_generic_confirm()
34 if (cmd != wdev->hif_cmd.buf_send->id) { in wfx_hif_generic_confirm()
35 dev_warn(wdev->dev, "chip response mismatch request: 0x%.2x vs 0x%.2x\n", in wfx_hif_generic_confirm()
36 cmd, wdev->hif_cmd.buf_send->id); in wfx_hif_generic_confirm()
40 if (wdev->hif_cmd.buf_recv) { in wfx_hif_generic_confirm()
41 if (wdev->hif_cmd.len_recv >= len && len > 0) in wfx_hif_generic_confirm()
42 memcpy(wdev->hif_cmd.buf_recv, buf, len); in wfx_hif_generic_confirm()
46 wdev->hif_cmd.ret = status; in wfx_hif_generic_confirm()
48 complete(&wdev->hif_cmd.done); in wfx_hif_generic_confirm()
52 static int wfx_hif_tx_confirm(struct wfx_dev *wdev, in wfx_hif_tx_confirm() argument
57 wfx_tx_confirm_cb(wdev, body); in wfx_hif_tx_confirm()
61 static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev, in wfx_hif_multi_tx_confirm() argument
69 wfx_tx_confirm_cb(wdev, &body->tx_conf_payload[i]); in wfx_hif_multi_tx_confirm()
73 static int wfx_hif_startup_indication(struct wfx_dev *wdev, in wfx_hif_startup_indication() argument
79 dev_err(wdev->dev, "received invalid startup indication"); in wfx_hif_startup_indication()
82 memcpy(&wdev->hw_caps, body, sizeof(struct wfx_hif_ind_startup)); in wfx_hif_startup_indication()
83 complete(&wdev->firmware_ready); in wfx_hif_startup_indication()
87 static int wfx_hif_wakeup_indication(struct wfx_dev *wdev, in wfx_hif_wakeup_indication() argument
90 if (!wdev->pdata.gpio_wakeup || gpiod_get_value(wdev->pdata.gpio_wakeup) == 0) { in wfx_hif_wakeup_indication()
91 dev_warn(wdev->dev, "unexpected wake-up indication\n"); in wfx_hif_wakeup_indication()
97 static int wfx_hif_receive_indication(struct wfx_dev *wdev, const struct wfx_hif_msg *hif, in wfx_hif_receive_indication() argument
100 struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); in wfx_hif_receive_indication()
104 dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); in wfx_hif_receive_indication()
113 static int wfx_hif_event_indication(struct wfx_dev *wdev, in wfx_hif_event_indication() argument
116 struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); in wfx_hif_event_indication()
121 dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); in wfx_hif_event_indication()
134 dev_dbg(wdev->dev, "ignore BSSREGAINED indication\n"); in wfx_hif_event_indication()
137 dev_warn(wdev->dev, "error while processing power save request: %d\n", in wfx_hif_event_indication()
141 dev_warn(wdev->dev, "unhandled event indication: %.2x\n", type); in wfx_hif_event_indication()
147 static int wfx_hif_pm_mode_complete_indication(struct wfx_dev *wdev, in wfx_hif_pm_mode_complete_indication() argument
150 struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); in wfx_hif_pm_mode_complete_indication()
153 dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); in wfx_hif_pm_mode_complete_indication()
161 static int wfx_hif_scan_complete_indication(struct wfx_dev *wdev, in wfx_hif_scan_complete_indication() argument
164 struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); in wfx_hif_scan_complete_indication()
168 dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); in wfx_hif_scan_complete_indication()
177 static int wfx_hif_join_complete_indication(struct wfx_dev *wdev, in wfx_hif_join_complete_indication() argument
180 struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); in wfx_hif_join_complete_indication()
183 dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); in wfx_hif_join_complete_indication()
186 dev_warn(wdev->dev, "unattended JoinCompleteInd\n"); in wfx_hif_join_complete_indication()
191 static int wfx_hif_suspend_resume_indication(struct wfx_dev *wdev, in wfx_hif_suspend_resume_indication() argument
198 wvif = wdev_to_wvif(wdev, hif->interface); in wfx_hif_suspend_resume_indication()
200 dev_warn(wdev->dev, "%s: received event for non-existent vif\n", __func__); in wfx_hif_suspend_resume_indication()
211 wfx_suspend_hot_dev(wdev, STA_NOTIFY_AWAKE); in wfx_hif_suspend_resume_indication()
213 wfx_suspend_hot_dev(wdev, STA_NOTIFY_SLEEP); in wfx_hif_suspend_resume_indication()
219 static int wfx_hif_generic_indication(struct wfx_dev *wdev, in wfx_hif_generic_indication() argument
229 dev_info(wdev->dev, "firmware says: %s\n", (char *)&body->data); in wfx_hif_generic_indication()
232 mutex_lock(&wdev->rx_stats_lock); in wfx_hif_generic_indication()
234 if (!wfx_api_older_than(wdev, 1, 4)) in wfx_hif_generic_indication()
235 dev_info(wdev->dev, "Rx test ongoing. Temperature: %d degrees C\n", in wfx_hif_generic_indication()
237 memcpy(&wdev->rx_stats, &body->data.rx_stats, sizeof(wdev->rx_stats)); in wfx_hif_generic_indication()
238 mutex_unlock(&wdev->rx_stats_lock); in wfx_hif_generic_indication()
241 mutex_lock(&wdev->tx_power_loop_info_lock); in wfx_hif_generic_indication()
242 memcpy(&wdev->tx_power_loop_info, &body->data.tx_power_loop_info, in wfx_hif_generic_indication()
243 sizeof(wdev->tx_power_loop_info)); in wfx_hif_generic_indication()
244 mutex_unlock(&wdev->tx_power_loop_info_lock); in wfx_hif_generic_indication()
247 dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", type); in wfx_hif_generic_indication()
296 static int wfx_hif_error_indication(struct wfx_dev *wdev, in wfx_hif_error_indication() argument
309 dev_err(wdev->dev, "asynchronous error: %s: %d\n", in wfx_hif_error_indication()
312 dev_err(wdev->dev, "asynchronous error: %s\n", hif_errors[i].str); in wfx_hif_error_indication()
314 dev_err(wdev->dev, "asynchronous error: unknown: %08x\n", type); in wfx_hif_error_indication()
317 wdev->chip_frozen = true; in wfx_hif_error_indication()
322 static int wfx_hif_exception_indication(struct wfx_dev *wdev, in wfx_hif_exception_indication() argument
329 dev_err(wdev->dev, "firmware assert %d\n", le32_to_cpup((__le32 *)body->data)); in wfx_hif_exception_indication()
331 dev_err(wdev->dev, "firmware exception\n"); in wfx_hif_exception_indication()
334 wdev->chip_frozen = true; in wfx_hif_exception_indication()
341 int (*handler)(struct wfx_dev *wdev, const struct wfx_hif_msg *hif, const void *buf);
361 void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb) in wfx_handle_rx() argument
369 wfx_hif_receive_indication(wdev, hif, hif->body, skb); in wfx_handle_rx()
373 if (mutex_is_locked(&wdev->hif_cmd.lock) && in wfx_handle_rx()
374 wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) { in wfx_handle_rx()
375 wfx_hif_generic_confirm(wdev, hif, hif->body); in wfx_handle_rx()
381 hif_handlers[i].handler(wdev, hif, hif->body); in wfx_handle_rx()
386 dev_err(wdev->dev, "unsupported HIF indication: ID %02x\n", hif_id); in wfx_handle_rx()
388 dev_err(wdev->dev, "unexpected HIF confirmation: ID %02x\n", hif_id); in wfx_handle_rx()