diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-05-07 04:38:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-07 14:57:18 -0400 |
commit | d717fd6188b2ea63cf9dc0a870fd312c312841cd (patch) | |
tree | 428410070c7ce5aa36f699939344bb3267ad9eed /drivers/net/wireless/wl12xx/wl1271_main.c | |
parent | 2ff6575b1e497f88acf2c7de7e1ba015267b689d (diff) |
wl1271: Add sysfs file to retrieve HW PG-version and ROM-version
This patch reads the HW PG version (along with a ROM-version, embedded in the
same value) from the wl1271 hardware and publishes the value in a sysfs -file.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@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/wl12xx/wl1271_main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index b0837255de6f..36dfdee5fbfe 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -2232,6 +2232,29 @@ static DEVICE_ATTR(bt_coex_state, S_IRUGO | S_IWUSR, | |||
2232 | wl1271_sysfs_show_bt_coex_state, | 2232 | wl1271_sysfs_show_bt_coex_state, |
2233 | wl1271_sysfs_store_bt_coex_state); | 2233 | wl1271_sysfs_store_bt_coex_state); |
2234 | 2234 | ||
2235 | static ssize_t wl1271_sysfs_show_hw_pg_ver(struct device *dev, | ||
2236 | struct device_attribute *attr, | ||
2237 | char *buf) | ||
2238 | { | ||
2239 | struct wl1271 *wl = dev_get_drvdata(dev); | ||
2240 | ssize_t len; | ||
2241 | |||
2242 | /* FIXME: what's the maximum length of buf? page size?*/ | ||
2243 | len = 500; | ||
2244 | |||
2245 | mutex_lock(&wl->mutex); | ||
2246 | if (wl->hw_pg_ver >= 0) | ||
2247 | len = snprintf(buf, len, "%d\n", wl->hw_pg_ver); | ||
2248 | else | ||
2249 | len = snprintf(buf, len, "n/a\n"); | ||
2250 | mutex_unlock(&wl->mutex); | ||
2251 | |||
2252 | return len; | ||
2253 | } | ||
2254 | |||
2255 | static DEVICE_ATTR(hw_pg_ver, S_IRUGO | S_IWUSR, | ||
2256 | wl1271_sysfs_show_hw_pg_ver, NULL); | ||
2257 | |||
2235 | int wl1271_register_hw(struct wl1271 *wl) | 2258 | int wl1271_register_hw(struct wl1271 *wl) |
2236 | { | 2259 | { |
2237 | int ret; | 2260 | int ret; |
@@ -2351,6 +2374,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2351 | wl->vif = NULL; | 2374 | wl->vif = NULL; |
2352 | wl->flags = 0; | 2375 | wl->flags = 0; |
2353 | wl->sg_enabled = true; | 2376 | wl->sg_enabled = true; |
2377 | wl->hw_pg_ver = -1; | ||
2354 | 2378 | ||
2355 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 2379 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |
2356 | wl->tx_frames[i] = NULL; | 2380 | wl->tx_frames[i] = NULL; |
@@ -2380,8 +2404,18 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2380 | goto err_platform; | 2404 | goto err_platform; |
2381 | } | 2405 | } |
2382 | 2406 | ||
2407 | /* Create sysfs file to get HW PG version */ | ||
2408 | ret = device_create_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver); | ||
2409 | if (ret < 0) { | ||
2410 | wl1271_error("failed to create sysfs file hw_pg_ver"); | ||
2411 | goto err_bt_coex_state; | ||
2412 | } | ||
2413 | |||
2383 | return hw; | 2414 | return hw; |
2384 | 2415 | ||
2416 | err_bt_coex_state: | ||
2417 | device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state); | ||
2418 | |||
2385 | err_platform: | 2419 | err_platform: |
2386 | platform_device_unregister(wl->plat_dev); | 2420 | platform_device_unregister(wl->plat_dev); |
2387 | 2421 | ||