Skip to content

Commit

Permalink
Merge branch 'for-linville' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/luca/wl12xx
  • Loading branch information
John W. Linville committed May 5, 2011
2 parents eaef6a9 + 25eaea3 commit 890641b
Show file tree
Hide file tree
Showing 16 changed files with 852 additions and 280 deletions.
190 changes: 142 additions & 48 deletions drivers/net/wireless/wl12xx/acx.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,27 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl)
return ret;
}

int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold)
int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold)
{
struct acx_rts_threshold *rts;
int ret;

wl1271_debug(DEBUG_ACX, "acx rts threshold");
/*
* If the RTS threshold is not configured or out of range, use the
* default value.
*/
if (rts_threshold > IEEE80211_MAX_RTS_THRESHOLD)
rts_threshold = wl->conf.rx.rts_threshold;

wl1271_debug(DEBUG_ACX, "acx rts threshold: %d", rts_threshold);

rts = kzalloc(sizeof(*rts), GFP_KERNEL);
if (!rts) {
ret = -ENOMEM;
goto out;
}

rts->threshold = cpu_to_le16(rts_threshold);
rts->threshold = cpu_to_le16((u16)rts_threshold);

ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
if (ret < 0) {
Expand Down Expand Up @@ -540,13 +547,13 @@ int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable)
return ret;
}

int wl1271_acx_sg_cfg(struct wl1271 *wl)
int wl1271_acx_sta_sg_cfg(struct wl1271 *wl)
{
struct acx_bt_wlan_coex_param *param;
struct acx_sta_bt_wlan_coex_param *param;
struct conf_sg_settings *c = &wl->conf.sg;
int i, ret;

wl1271_debug(DEBUG_ACX, "acx sg cfg");
wl1271_debug(DEBUG_ACX, "acx sg sta cfg");

param = kzalloc(sizeof(*param), GFP_KERNEL);
if (!param) {
Expand All @@ -555,8 +562,38 @@ int wl1271_acx_sg_cfg(struct wl1271 *wl)
}

/* BT-WLAN coext parameters */
for (i = 0; i < CONF_SG_PARAMS_MAX; i++)
param->params[i] = cpu_to_le32(c->params[i]);
for (i = 0; i < CONF_SG_STA_PARAMS_MAX; i++)
param->params[i] = cpu_to_le32(c->sta_params[i]);
param->param_idx = CONF_SG_PARAMS_ALL;

ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
if (ret < 0) {
wl1271_warning("failed to set sg config: %d", ret);
goto out;
}

out:
kfree(param);
return ret;
}

int wl1271_acx_ap_sg_cfg(struct wl1271 *wl)
{
struct acx_ap_bt_wlan_coex_param *param;
struct conf_sg_settings *c = &wl->conf.sg;
int i, ret;

wl1271_debug(DEBUG_ACX, "acx sg ap cfg");

param = kzalloc(sizeof(*param), GFP_KERNEL);
if (!param) {
ret = -ENOMEM;
goto out;
}

/* BT-WLAN coext parameters */
for (i = 0; i < CONF_SG_AP_PARAMS_MAX; i++)
param->params[i] = cpu_to_le32(c->ap_params[i]);
param->param_idx = CONF_SG_PARAMS_ALL;

ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
Expand Down Expand Up @@ -804,7 +841,8 @@ int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
struct acx_ap_rate_policy *acx;
int ret = 0;

wl1271_debug(DEBUG_ACX, "acx ap rate policy");
wl1271_debug(DEBUG_ACX, "acx ap rate policy %d rates 0x%x",
idx, c->enabled_rates);

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx) {
Expand Down Expand Up @@ -898,12 +936,19 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type,
return ret;
}

int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold)
int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold)
{
struct acx_frag_threshold *acx;
int ret = 0;

wl1271_debug(DEBUG_ACX, "acx frag threshold");
/*
* If the fragmentation is not configured or out of range, use the
* default value.
*/
if (frag_threshold > IEEE80211_MAX_FRAG_THRESHOLD)
frag_threshold = wl->conf.tx.frag_threshold;

wl1271_debug(DEBUG_ACX, "acx frag threshold: %d", frag_threshold);

acx = kzalloc(sizeof(*acx), GFP_KERNEL);

Expand All @@ -912,7 +957,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold)
goto out;
}

acx->frag_threshold = cpu_to_le16(frag_threshold);
acx->frag_threshold = cpu_to_le16((u16)frag_threshold);
ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx));
if (ret < 0) {
wl1271_warning("Setting of frag threshold failed: %d", ret);
Expand Down Expand Up @@ -954,6 +999,7 @@ int wl1271_acx_tx_config_options(struct wl1271 *wl)
int wl1271_acx_ap_mem_cfg(struct wl1271 *wl)
{
struct wl1271_acx_ap_config_memory *mem_conf;
struct conf_memory_settings *mem;
int ret;

wl1271_debug(DEBUG_ACX, "wl1271 mem cfg");
Expand All @@ -964,14 +1010,21 @@ int wl1271_acx_ap_mem_cfg(struct wl1271 *wl)
goto out;
}

if (wl->chip.id == CHIP_ID_1283_PG20)
/*
* FIXME: The 128x AP FW does not yet support dynamic memory.
* Use the base memory configuration for 128x for now. This
* should be fine tuned in the future.
*/
mem = &wl->conf.mem_wl128x;
else
mem = &wl->conf.mem_wl127x;

/* memory config */
/* FIXME: for now we always use mem_wl127x for AP, because it
* doesn't support dynamic memory and we don't have the
* optimal values for wl128x without dynamic memory yet */
mem_conf->num_stations = wl->conf.mem_wl127x.num_stations;
mem_conf->rx_mem_block_num = wl->conf.mem_wl127x.rx_block_num;
mem_conf->tx_min_mem_block_num = wl->conf.mem_wl127x.tx_min_block_num;
mem_conf->num_ssid_profiles = wl->conf.mem_wl127x.ssid_profiles;
mem_conf->num_stations = mem->num_stations;
mem_conf->rx_mem_block_num = mem->rx_block_num;
mem_conf->tx_min_mem_block_num = mem->tx_min_block_num;
mem_conf->num_ssid_profiles = mem->ssid_profiles;
mem_conf->total_tx_descriptors = cpu_to_le32(ACX_TX_DESCRIPTORS);

ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
Expand Down Expand Up @@ -1524,46 +1577,22 @@ int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime)
return ret;
}

int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl)
int wl1271_acx_max_tx_retry(struct wl1271 *wl)
{
struct wl1271_acx_ap_max_tx_retry *acx = NULL;
struct wl1271_acx_max_tx_retry *acx = NULL;
int ret;

wl1271_debug(DEBUG_ACX, "acx ap max tx retry");
wl1271_debug(DEBUG_ACX, "acx max tx retry");

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx)
return -ENOMEM;

acx->max_tx_retry = cpu_to_le16(wl->conf.tx.max_tx_retries);
acx->max_tx_retry = cpu_to_le16(wl->conf.tx.ap_max_tx_retries);

ret = wl1271_cmd_configure(wl, ACX_MAX_TX_FAILURE, acx, sizeof(*acx));
if (ret < 0) {
wl1271_warning("acx ap max tx retry failed: %d", ret);
goto out;
}

out:
kfree(acx);
return ret;
}

int wl1271_acx_sta_max_tx_retry(struct wl1271 *wl)
{
struct wl1271_acx_sta_max_tx_retry *acx = NULL;
int ret;

wl1271_debug(DEBUG_ACX, "acx sta max tx retry");

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx)
return -ENOMEM;

acx->max_tx_retry = wl->conf.tx.max_tx_retries;

ret = wl1271_cmd_configure(wl, ACX_CONS_TX_FAILURE, acx, sizeof(*acx));
if (ret < 0) {
wl1271_warning("acx sta max tx retry failed: %d", ret);
wl1271_warning("acx max tx retry failed: %d", ret);
goto out;
}

Expand Down Expand Up @@ -1626,3 +1655,68 @@ int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr)
kfree(acx);
return ret;
}

int wl1271_acx_set_ap_beacon_filter(struct wl1271 *wl, bool enable)
{
struct acx_ap_beacon_filter *acx = NULL;
int ret;

wl1271_debug(DEBUG_ACX, "acx set ap beacon filter: %d", enable);

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx)
return -ENOMEM;

acx->enable = enable ? 1 : 0;

ret = wl1271_cmd_configure(wl, ACX_AP_BEACON_FILTER_OPT,
acx, sizeof(*acx));
if (ret < 0) {
wl1271_warning("acx set ap beacon filter failed: %d", ret);
goto out;
}

out:
kfree(acx);
return ret;
}

int wl1271_acx_fm_coex(struct wl1271 *wl)
{
struct wl1271_acx_fm_coex *acx;
int ret;

wl1271_debug(DEBUG_ACX, "acx fm coex setting");

acx = kzalloc(sizeof(*acx), GFP_KERNEL);
if (!acx) {
ret = -ENOMEM;
goto out;
}

acx->enable = wl->conf.fm_coex.enable;
acx->swallow_period = wl->conf.fm_coex.swallow_period;
acx->n_divider_fref_set_1 = wl->conf.fm_coex.n_divider_fref_set_1;
acx->n_divider_fref_set_2 = wl->conf.fm_coex.n_divider_fref_set_2;
acx->m_divider_fref_set_1 =
cpu_to_le16(wl->conf.fm_coex.m_divider_fref_set_1);
acx->m_divider_fref_set_2 =
cpu_to_le16(wl->conf.fm_coex.m_divider_fref_set_2);
acx->coex_pll_stabilization_time =
cpu_to_le32(wl->conf.fm_coex.coex_pll_stabilization_time);
acx->ldo_stabilization_time =
cpu_to_le16(wl->conf.fm_coex.ldo_stabilization_time);
acx->fm_disturbed_band_margin =
wl->conf.fm_coex.fm_disturbed_band_margin;
acx->swallow_clk_diff = wl->conf.fm_coex.swallow_clk_diff;

ret = wl1271_cmd_configure(wl, ACX_FM_COEX_CFG, acx, sizeof(*acx));
if (ret < 0) {
wl1271_warning("acx fm coex setting failed: %d", ret);
goto out;
}

out:
kfree(acx);
return ret;
}
Loading

0 comments on commit 890641b

Please sign in to comment.