aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti/wlcore/testmode.c
diff options
context:
space:
mode:
authorYair Shapira <yair.shapira@ti.com>2012-07-11 18:48:06 +0300
committerLuciano Coelho <coelho@ti.com>2012-07-18 15:08:22 +0300
commitff324317e6133ed4a88380eb675a93c76a9e0d5e (patch)
treedaa468cc7c7a8e9e0295ace2e6c2a35fe2b209f9 /drivers/net/wireless/ti/wlcore/testmode.c
parentwl18xx: disable calibrator based fem detect (diff)
downloadlinux-dev-ff324317e6133ed4a88380eb675a93c76a9e0d5e.tar.xz
linux-dev-ff324317e6133ed4a88380eb675a93c76a9e0d5e.zip
wlcore/wl12xx: calibrator fem detect implementation
this completes the calibrator based fem detect logic in driver: driver starts (by calibrator) in plt_mode PLT_FEM_DETECT wlcore inits and starts plt on wl12xx wl12xx fetches fem number from firmware and stores it in wl->fem_manuf wl12xx immediatly returns (doesn't start radio, etc...) wlcore returns the fem_manuf to calibrator using WL1271_TM_ATTR_DATA plt_mode is stopped Signed-off-by: Yair Shapira <yair.shapira@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti/wlcore/testmode.c')
-rw-r--r--drivers/net/wireless/ti/wlcore/testmode.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c
index a204c938c79e..081f1750cb88 100644
--- a/drivers/net/wireless/ti/wlcore/testmode.c
+++ b/drivers/net/wireless/ti/wlcore/testmode.c
@@ -245,6 +245,43 @@ static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[])
return 0;
}
+static int wl1271_tm_detect_fem(struct wl1271 *wl, struct nlattr *tb[])
+{
+ /* return FEM type */
+ int ret, len;
+ struct sk_buff *skb;
+
+ ret = wl1271_plt_start(wl, PLT_FEM_DETECT);
+ if (ret < 0)
+ goto out;
+
+ mutex_lock(&wl->mutex);
+
+ len = nla_total_size(sizeof(wl->fem_manuf));
+ skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len);
+ if (!skb) {
+ ret = -ENOMEM;
+ goto out_mutex;
+ }
+
+ if (nla_put(skb, WL1271_TM_ATTR_DATA, sizeof(wl->fem_manuf),
+ &wl->fem_manuf)) {
+ kfree_skb(skb);
+ ret = -EMSGSIZE;
+ goto out_mutex;
+ }
+
+ ret = cfg80211_testmode_reply(skb);
+
+out_mutex:
+ mutex_unlock(&wl->mutex);
+
+ /* We always stop plt after DETECT mode */
+ wl1271_plt_stop(wl);
+out:
+ return ret;
+}
+
static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[])
{
u32 val;
@@ -262,8 +299,10 @@ static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[])
ret = wl1271_plt_stop(wl);
break;
case PLT_ON:
+ ret = wl1271_plt_start(wl, PLT_ON);
+ break;
case PLT_FEM_DETECT:
- ret = wl1271_plt_start(wl, val);
+ ret = wl1271_tm_detect_fem(wl, tb);
break;
default:
ret = -EINVAL;