aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/wmi.c
diff options
context:
space:
mode:
authorBartosz Markowski <bartosz.markowski@tieto.com>2013-09-26 11:47:09 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2013-09-27 07:58:14 -0400
commit6f97d256b7c0c624f7cd5881beeabb5c7a3678b8 (patch)
tree5b29fadb94ec6542bf87445752b2ff6a98a49cc4 /drivers/net/wireless/ath/ath10k/wmi.c
parent8a6618b00f280a35cef36f6156cb7f80b35553c3 (diff)
ath10k: split ath10k_wmi_service_ready_event_rx
Since the both firmwares we are going to support, have significantly different APIs (WMI and shared structures), it's easier to actually split the whole event handling functions, instead cutting them inside. The fork starts now on ath10k_wmi_process_rx(). Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/wmi.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index ef80291737b4..ed79d325b610 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1301,6 +1301,69 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
1301 complete(&ar->wmi.service_ready); 1301 complete(&ar->wmi.service_ready);
1302} 1302}
1303 1303
1304static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
1305 struct sk_buff *skb)
1306{
1307 struct wmi_service_ready_event_10x *ev = (void *)skb->data;
1308
1309 if (skb->len < sizeof(*ev)) {
1310 ath10k_warn("Service ready event was %d B but expected %zu B. Wrong firmware version?\n",
1311 skb->len, sizeof(*ev));
1312 return;
1313 }
1314
1315 ar->hw_min_tx_power = __le32_to_cpu(ev->hw_min_tx_power);
1316 ar->hw_max_tx_power = __le32_to_cpu(ev->hw_max_tx_power);
1317 ar->ht_cap_info = __le32_to_cpu(ev->ht_cap_info);
1318 ar->vht_cap_info = __le32_to_cpu(ev->vht_cap_info);
1319 ar->fw_version_major =
1320 (__le32_to_cpu(ev->sw_version) & 0xff000000) >> 24;
1321 ar->fw_version_minor = (__le32_to_cpu(ev->sw_version) & 0x00ffffff);
1322 ar->phy_capability = __le32_to_cpu(ev->phy_capability);
1323 ar->num_rf_chains = __le32_to_cpu(ev->num_rf_chains);
1324
1325 if (ar->num_rf_chains > WMI_MAX_SPATIAL_STREAM) {
1326 ath10k_warn("hardware advertises support for more spatial streams than it should (%d > %d)\n",
1327 ar->num_rf_chains, WMI_MAX_SPATIAL_STREAM);
1328 ar->num_rf_chains = WMI_MAX_SPATIAL_STREAM;
1329 }
1330
1331 ar->ath_common.regulatory.current_rd =
1332 __le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd);
1333
1334 ath10k_debug_read_service_map(ar, ev->wmi_service_bitmap,
1335 sizeof(ev->wmi_service_bitmap));
1336
1337 if (strlen(ar->hw->wiphy->fw_version) == 0) {
1338 snprintf(ar->hw->wiphy->fw_version,
1339 sizeof(ar->hw->wiphy->fw_version),
1340 "%u.%u",
1341 ar->fw_version_major,
1342 ar->fw_version_minor);
1343 }
1344
1345 /* FIXME: it probably should be better to support this.
1346 TODO: Next patch introduce memory chunks. It's a must for 10.x FW */
1347 if (__le32_to_cpu(ev->num_mem_reqs) > 0) {
1348 ath10k_warn("target requested %d memory chunks; ignoring\n",
1349 __le32_to_cpu(ev->num_mem_reqs));
1350 }
1351
1352 ath10k_dbg(ATH10K_DBG_WMI,
1353 "wmi event service ready sw_ver 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u num_rf_chains %u\n",
1354 __le32_to_cpu(ev->sw_version),
1355 __le32_to_cpu(ev->abi_version),
1356 __le32_to_cpu(ev->phy_capability),
1357 __le32_to_cpu(ev->ht_cap_info),
1358 __le32_to_cpu(ev->vht_cap_info),
1359 __le32_to_cpu(ev->vht_supp_mcs),
1360 __le32_to_cpu(ev->sys_cap_info),
1361 __le32_to_cpu(ev->num_mem_reqs),
1362 __le32_to_cpu(ev->num_rf_chains));
1363
1364 complete(&ar->wmi.service_ready);
1365}
1366
1304static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb) 1367static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
1305{ 1368{
1306 struct wmi_ready_event *ev = (struct wmi_ready_event *)skb->data; 1369 struct wmi_ready_event *ev = (struct wmi_ready_event *)skb->data;
@@ -1537,7 +1600,7 @@ static void ath10k_wmi_10x_process_rx(struct ath10k *ar, struct sk_buff *skb)
1537 ath10k_wmi_event_vdev_resume_req(ar, skb); 1600 ath10k_wmi_event_vdev_resume_req(ar, skb);
1538 break; 1601 break;
1539 case WMI_10X_SERVICE_READY_EVENTID: 1602 case WMI_10X_SERVICE_READY_EVENTID:
1540 ath10k_wmi_service_ready_event_rx(ar, skb); 1603 ath10k_wmi_10x_service_ready_event_rx(ar, skb);
1541 break; 1604 break;
1542 case WMI_10X_READY_EVENTID: 1605 case WMI_10X_READY_EVENTID:
1543 ath10k_wmi_ready_event_rx(ar, skb); 1606 ath10k_wmi_ready_event_rx(ar, skb);