smd.c (5b7fc772e657824455507fc97f6b92287075a237) smd.c (37de943d01539a0b36ab52cf73c1dfad140f697a)
1/*
2 * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 8 unchanged lines hidden (view full) ---

17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
19#include <linux/bitfield.h>
20#include <linux/etherdevice.h>
21#include <linux/firmware.h>
22#include <linux/bitops.h>
23#include <linux/rpmsg.h>
24#include "smd.h"
1/*
2 * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 8 unchanged lines hidden (view full) ---

17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
19#include <linux/bitfield.h>
20#include <linux/etherdevice.h>
21#include <linux/firmware.h>
22#include <linux/bitops.h>
23#include <linux/rpmsg.h>
24#include "smd.h"
25#include "firmware.h"
25
26struct wcn36xx_cfg_val {
27 u32 cfg_id;
28 u32 value;
29};
30
31#define WCN36XX_CFG_VAL(id, val) \
32{ \

--- 257 unchanged lines hidden (view full) ---

290 struct wcn36xx_hal_config_sta_params_v1 *sta_params)
291{
292 if (sta->deflink.vht_cap.vht_supported) {
293 unsigned long caps = sta->deflink.vht_cap.cap;
294
295 sta_params->vht_capable = sta->deflink.vht_cap.vht_supported;
296 sta_params->vht_ldpc_enabled =
297 is_cap_supported(caps, IEEE80211_VHT_CAP_RXLDPC);
26
27struct wcn36xx_cfg_val {
28 u32 cfg_id;
29 u32 value;
30};
31
32#define WCN36XX_CFG_VAL(id, val) \
33{ \

--- 257 unchanged lines hidden (view full) ---

291 struct wcn36xx_hal_config_sta_params_v1 *sta_params)
292{
293 if (sta->deflink.vht_cap.vht_supported) {
294 unsigned long caps = sta->deflink.vht_cap.cap;
295
296 sta_params->vht_capable = sta->deflink.vht_cap.vht_supported;
297 sta_params->vht_ldpc_enabled =
298 is_cap_supported(caps, IEEE80211_VHT_CAP_RXLDPC);
298 if (get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) {
299 if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) {
299 sta_params->vht_tx_mu_beamformee_capable =
300 is_cap_supported(caps, IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
301 if (sta_params->vht_tx_mu_beamformee_capable)
302 sta_params->vht_tx_bf_enabled = 1;
303 } else {
304 sta_params->vht_tx_mu_beamformee_capable = 0;
305 }
306 sta_params->vht_tx_channel_width_set = 0;

--- 2119 unchanged lines hidden (view full) ---

2426 wcn36xx_err("hal_dump_cmd response failed err=%d\n", ret);
2427 goto out;
2428 }
2429out:
2430 mutex_unlock(&wcn->hal_mutex);
2431 return ret;
2432}
2433
300 sta_params->vht_tx_mu_beamformee_capable =
301 is_cap_supported(caps, IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
302 if (sta_params->vht_tx_mu_beamformee_capable)
303 sta_params->vht_tx_bf_enabled = 1;
304 } else {
305 sta_params->vht_tx_mu_beamformee_capable = 0;
306 }
307 sta_params->vht_tx_channel_width_set = 0;

--- 2119 unchanged lines hidden (view full) ---

2427 wcn36xx_err("hal_dump_cmd response failed err=%d\n", ret);
2428 goto out;
2429 }
2430out:
2431 mutex_unlock(&wcn->hal_mutex);
2432 return ret;
2433}
2434
2434void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap)
2435{
2436 int arr_idx, bit_idx;
2437
2438 if (cap < 0 || cap > 127) {
2439 wcn36xx_warn("error cap idx %d\n", cap);
2440 return;
2441 }
2442
2443 arr_idx = cap / 32;
2444 bit_idx = cap % 32;
2445 bitmap[arr_idx] |= (1 << bit_idx);
2446}
2447
2448int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap)
2449{
2450 int arr_idx, bit_idx;
2451
2452 if (cap < 0 || cap > 127) {
2453 wcn36xx_warn("error cap idx %d\n", cap);
2454 return -EINVAL;
2455 }
2456
2457 arr_idx = cap / 32;
2458 bit_idx = cap % 32;
2459
2460 return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0;
2461}
2462
2463void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap)
2464{
2465 int arr_idx, bit_idx;
2466
2467 if (cap < 0 || cap > 127) {
2468 wcn36xx_warn("error cap idx %d\n", cap);
2469 return;
2470 }
2471
2472 arr_idx = cap / 32;
2473 bit_idx = cap % 32;
2474 bitmap[arr_idx] &= ~(1 << bit_idx);
2475}
2476
2477int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
2478{
2479 struct wcn36xx_hal_feat_caps_msg msg_body, *rsp;
2480 int ret, i;
2481
2482 mutex_lock(&wcn->hal_mutex);
2483 INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ);
2484
2435int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
2436{
2437 struct wcn36xx_hal_feat_caps_msg msg_body, *rsp;
2438 int ret, i;
2439
2440 mutex_lock(&wcn->hal_mutex);
2441 INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ);
2442
2485 set_feat_caps(msg_body.feat_caps, STA_POWERSAVE);
2443 wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, STA_POWERSAVE);
2486 if (wcn->rf_id == RF_IRIS_WCN3680) {
2444 if (wcn->rf_id == RF_IRIS_WCN3680) {
2487 set_feat_caps(msg_body.feat_caps, DOT11AC);
2488 set_feat_caps(msg_body.feat_caps, WLAN_CH144);
2489 set_feat_caps(msg_body.feat_caps, ANTENNA_DIVERSITY_SELECTION);
2445 wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, DOT11AC);
2446 wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, WLAN_CH144);
2447 wcn36xx_firmware_set_feat_caps(msg_body.feat_caps,
2448 ANTENNA_DIVERSITY_SELECTION);
2490 }
2491
2492 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2493
2494 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2495 if (ret) {
2496 wcn36xx_err("Sending hal_feature_caps_exchange failed\n");
2497 goto out;

--- 797 unchanged lines hidden (view full) ---

3295 struct ieee80211_vif *vif)
3296{
3297 struct wcn36xx_hal_add_bcn_filter_req_msg msg_body, *body;
3298 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
3299 u8 *payload;
3300 size_t payload_size;
3301 int ret;
3302
2449 }
2450
2451 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
2452
2453 ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
2454 if (ret) {
2455 wcn36xx_err("Sending hal_feature_caps_exchange failed\n");
2456 goto out;

--- 797 unchanged lines hidden (view full) ---

3254 struct ieee80211_vif *vif)
3255{
3256 struct wcn36xx_hal_add_bcn_filter_req_msg msg_body, *body;
3257 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
3258 u8 *payload;
3259 size_t payload_size;
3260 int ret;
3261
3303 if (!get_feat_caps(wcn->fw_feat_caps, BCN_FILTER))
3262 if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, BCN_FILTER))
3304 return -EOPNOTSUPP;
3305
3306 mutex_lock(&wcn->hal_mutex);
3307 INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BCN_FILTER_REQ);
3308
3309 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3310
3311 body = (struct wcn36xx_hal_add_bcn_filter_req_msg *)wcn->hal_buf;

--- 208 unchanged lines hidden ---
3263 return -EOPNOTSUPP;
3264
3265 mutex_lock(&wcn->hal_mutex);
3266 INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BCN_FILTER_REQ);
3267
3268 PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
3269
3270 body = (struct wcn36xx_hal_add_bcn_filter_req_msg *)wcn->hal_buf;

--- 208 unchanged lines hidden ---