diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-03-18 06:26:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-23 16:50:21 -0400 |
commit | 7fc3a8647d2eaa8bc2f7ac7e9baff55199da7be6 (patch) | |
tree | 983b195e3c084def8784af68d0aba69e33ccf940 /drivers/net/wireless | |
parent | a1dd8187d8d8f565976c9e55374dee520cdc2fa3 (diff) |
wl1271: Add sysfs file to control BT co-ex state
Add a sysfs file to control the state of the BT co-ex (enable or disable it.)
By default, the BT co-ex is enabled.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_acx.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_acx.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_init.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 72 |
5 files changed, 81 insertions, 4 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 7397999deb19..23a0c7e22939 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -484,6 +484,8 @@ struct wl1271 { | |||
484 | /* Current chipset configuration */ | 484 | /* Current chipset configuration */ |
485 | struct conf_drv_settings conf; | 485 | struct conf_drv_settings conf; |
486 | 486 | ||
487 | bool sg_enabled; | ||
488 | |||
487 | struct list_head list; | 489 | struct list_head list; |
488 | }; | 490 | }; |
489 | 491 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c index e7c22d3c75ac..7e337cea9905 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.c +++ b/drivers/net/wireless/wl12xx/wl1271_acx.c | |||
@@ -534,7 +534,7 @@ out: | |||
534 | } | 534 | } |
535 | 535 | ||
536 | 536 | ||
537 | int wl1271_acx_sg_enable(struct wl1271 *wl) | 537 | int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable) |
538 | { | 538 | { |
539 | struct acx_bt_wlan_coex *pta; | 539 | struct acx_bt_wlan_coex *pta; |
540 | int ret; | 540 | int ret; |
@@ -547,7 +547,10 @@ int wl1271_acx_sg_enable(struct wl1271 *wl) | |||
547 | goto out; | 547 | goto out; |
548 | } | 548 | } |
549 | 549 | ||
550 | pta->enable = wl->conf.sg.state; | 550 | if (enable) |
551 | pta->enable = wl->conf.sg.state; | ||
552 | else | ||
553 | pta->enable = CONF_SG_DISABLE; | ||
551 | 554 | ||
552 | ret = wl1271_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); | 555 | ret = wl1271_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); |
553 | if (ret < 0) { | 556 | if (ret < 0) { |
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h index dee3c06a717c..8e5870fa9609 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.h +++ b/drivers/net/wireless/wl12xx/wl1271_acx.h | |||
@@ -1005,7 +1005,7 @@ int wl1271_acx_dco_itrim_params(struct wl1271 *wl); | |||
1005 | int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter); | 1005 | int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter); |
1006 | int wl1271_acx_beacon_filter_table(struct wl1271 *wl); | 1006 | int wl1271_acx_beacon_filter_table(struct wl1271 *wl); |
1007 | int wl1271_acx_conn_monit_params(struct wl1271 *wl); | 1007 | int wl1271_acx_conn_monit_params(struct wl1271 *wl); |
1008 | int wl1271_acx_sg_enable(struct wl1271 *wl); | 1008 | int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable); |
1009 | int wl1271_acx_sg_cfg(struct wl1271 *wl); | 1009 | int wl1271_acx_sg_cfg(struct wl1271 *wl); |
1010 | int wl1271_acx_cca_threshold(struct wl1271 *wl); | 1010 | int wl1271_acx_cca_threshold(struct wl1271 *wl); |
1011 | int wl1271_acx_bcn_dtim_options(struct wl1271 *wl); | 1011 | int wl1271_acx_bcn_dtim_options(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c index d68445c9d333..d9335fc2a575 100644 --- a/drivers/net/wireless/wl12xx/wl1271_init.c +++ b/drivers/net/wireless/wl12xx/wl1271_init.c | |||
@@ -164,7 +164,7 @@ int wl1271_init_pta(struct wl1271 *wl) | |||
164 | if (ret < 0) | 164 | if (ret < 0) |
165 | return ret; | 165 | return ret; |
166 | 166 | ||
167 | ret = wl1271_acx_sg_enable(wl); | 167 | ret = wl1271_acx_sg_enable(wl, wl->sg_enabled); |
168 | if (ret < 0) | 168 | if (ret < 0) |
169 | return ret; | 169 | return ret; |
170 | 170 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index ad9c49111678..abf9f22ee968 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -1982,6 +1982,68 @@ static const struct ieee80211_ops wl1271_ops = { | |||
1982 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) | 1982 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) |
1983 | }; | 1983 | }; |
1984 | 1984 | ||
1985 | static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev, | ||
1986 | struct device_attribute *attr, | ||
1987 | char *buf) | ||
1988 | { | ||
1989 | struct wl1271 *wl = dev_get_drvdata(dev); | ||
1990 | ssize_t len; | ||
1991 | |||
1992 | /* FIXME: what's the maximum length of buf? page size?*/ | ||
1993 | len = 500; | ||
1994 | |||
1995 | mutex_lock(&wl->mutex); | ||
1996 | len = snprintf(buf, len, "%d\n\n0 - off\n1 - on\n", | ||
1997 | wl->sg_enabled); | ||
1998 | mutex_unlock(&wl->mutex); | ||
1999 | |||
2000 | return len; | ||
2001 | |||
2002 | } | ||
2003 | |||
2004 | static ssize_t wl1271_sysfs_store_bt_coex_state(struct device *dev, | ||
2005 | struct device_attribute *attr, | ||
2006 | const char *buf, size_t count) | ||
2007 | { | ||
2008 | struct wl1271 *wl = dev_get_drvdata(dev); | ||
2009 | unsigned long res; | ||
2010 | int ret; | ||
2011 | |||
2012 | ret = strict_strtoul(buf, 10, &res); | ||
2013 | |||
2014 | if (ret < 0) { | ||
2015 | wl1271_warning("incorrect value written to bt_coex_mode"); | ||
2016 | return count; | ||
2017 | } | ||
2018 | |||
2019 | mutex_lock(&wl->mutex); | ||
2020 | |||
2021 | res = !!res; | ||
2022 | |||
2023 | if (res == wl->sg_enabled) | ||
2024 | goto out; | ||
2025 | |||
2026 | wl->sg_enabled = res; | ||
2027 | |||
2028 | if (wl->state == WL1271_STATE_OFF) | ||
2029 | goto out; | ||
2030 | |||
2031 | ret = wl1271_ps_elp_wakeup(wl, false); | ||
2032 | if (ret < 0) | ||
2033 | goto out; | ||
2034 | |||
2035 | wl1271_acx_sg_enable(wl, wl->sg_enabled); | ||
2036 | wl1271_ps_elp_sleep(wl); | ||
2037 | |||
2038 | out: | ||
2039 | mutex_unlock(&wl->mutex); | ||
2040 | return count; | ||
2041 | } | ||
2042 | |||
2043 | static DEVICE_ATTR(bt_coex_state, S_IRUGO | S_IWUSR, | ||
2044 | wl1271_sysfs_show_bt_coex_state, | ||
2045 | wl1271_sysfs_store_bt_coex_state); | ||
2046 | |||
1985 | int wl1271_register_hw(struct wl1271 *wl) | 2047 | int wl1271_register_hw(struct wl1271 *wl) |
1986 | { | 2048 | { |
1987 | int ret; | 2049 | int ret; |
@@ -2073,6 +2135,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2073 | wl->band = IEEE80211_BAND_2GHZ; | 2135 | wl->band = IEEE80211_BAND_2GHZ; |
2074 | wl->vif = NULL; | 2136 | wl->vif = NULL; |
2075 | wl->flags = 0; | 2137 | wl->flags = 0; |
2138 | wl->sg_enabled = true; | ||
2076 | 2139 | ||
2077 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 2140 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |
2078 | wl->tx_frames[i] = NULL; | 2141 | wl->tx_frames[i] = NULL; |
@@ -2095,9 +2158,18 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2095 | } | 2158 | } |
2096 | dev_set_drvdata(&wl1271_device.dev, wl); | 2159 | dev_set_drvdata(&wl1271_device.dev, wl); |
2097 | 2160 | ||
2161 | /* Create sysfs file to control bt coex state */ | ||
2162 | ret = device_create_file(&wl1271_device.dev, &dev_attr_bt_coex_state); | ||
2163 | if (ret < 0) { | ||
2164 | wl1271_error("failed to create sysfs file bt_coex_state"); | ||
2165 | goto err_platform; | ||
2166 | } | ||
2098 | 2167 | ||
2099 | return hw; | 2168 | return hw; |
2100 | 2169 | ||
2170 | err_platform: | ||
2171 | platform_device_unregister(&wl1271_device); | ||
2172 | |||
2101 | err_hw: | 2173 | err_hw: |
2102 | ieee80211_unregister_hw(wl->hw); | 2174 | ieee80211_unregister_hw(wl->hw); |
2103 | 2175 | ||