diff options
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 23 |
3 files changed, 49 insertions, 1 deletions
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index f6b1402509f5..397c5fca0ff5 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -103,6 +103,7 @@ struct _wlan_private { | |||
103 | int open; | 103 | int open; |
104 | int mesh_open; | 104 | int mesh_open; |
105 | int infra_open; | 105 | int infra_open; |
106 | int mesh_autostart_enabled; | ||
106 | 107 | ||
107 | char name[DEV_NAME_LEN]; | 108 | char name[DEV_NAME_LEN]; |
108 | 109 | ||
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index 5efdeac6e208..670e1d23c043 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -990,6 +990,19 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) | |||
990 | if (priv->adapter->psstate != PS_STATE_FULL_POWER) | 990 | if (priv->adapter->psstate != PS_STATE_FULL_POWER) |
991 | return -1; | 991 | return -1; |
992 | 992 | ||
993 | if (priv->mesh_dev && !priv->mesh_autostart_enabled) { | ||
994 | /* Mesh autostart must be activated while sleeping | ||
995 | * On resume it will go back to the current state | ||
996 | */ | ||
997 | struct cmd_ds_mesh_access mesh_access; | ||
998 | memset(&mesh_access, 0, sizeof(mesh_access)); | ||
999 | mesh_access.data[0] = cpu_to_le32(1); | ||
1000 | libertas_prepare_and_send_command(priv, | ||
1001 | CMD_MESH_ACCESS, | ||
1002 | CMD_ACT_MESH_SET_AUTOSTART_ENABLED, | ||
1003 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); | ||
1004 | } | ||
1005 | |||
993 | netif_device_detach(cardp->eth_dev); | 1006 | netif_device_detach(cardp->eth_dev); |
994 | netif_device_detach(priv->mesh_dev); | 1007 | netif_device_detach(priv->mesh_dev); |
995 | 1008 | ||
@@ -1017,6 +1030,19 @@ static int if_usb_resume(struct usb_interface *intf) | |||
1017 | netif_device_attach(cardp->eth_dev); | 1030 | netif_device_attach(cardp->eth_dev); |
1018 | netif_device_attach(priv->mesh_dev); | 1031 | netif_device_attach(priv->mesh_dev); |
1019 | 1032 | ||
1033 | if (priv->mesh_dev && !priv->mesh_autostart_enabled) { | ||
1034 | /* Mesh autostart was activated while sleeping | ||
1035 | * Disable it if appropriate | ||
1036 | */ | ||
1037 | struct cmd_ds_mesh_access mesh_access; | ||
1038 | memset(&mesh_access, 0, sizeof(mesh_access)); | ||
1039 | mesh_access.data[0] = cpu_to_le32(0); | ||
1040 | libertas_prepare_and_send_command(priv, | ||
1041 | CMD_MESH_ACCESS, | ||
1042 | CMD_ACT_MESH_SET_AUTOSTART_ENABLED, | ||
1043 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); | ||
1044 | } | ||
1045 | |||
1020 | lbs_deb_leave(LBS_DEB_USB); | 1046 | lbs_deb_leave(LBS_DEB_USB); |
1021 | return 0; | 1047 | return 0; |
1022 | } | 1048 | } |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 9ccc9524153b..a3a17caae439 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -271,15 +271,20 @@ static ssize_t libertas_autostart_enabled_set(struct device * dev, | |||
271 | { | 271 | { |
272 | struct cmd_ds_mesh_access mesh_access; | 272 | struct cmd_ds_mesh_access mesh_access; |
273 | uint32_t datum; | 273 | uint32_t datum; |
274 | wlan_private * priv = (to_net_dev(dev))->priv; | ||
275 | int ret; | ||
274 | 276 | ||
275 | memset(&mesh_access, 0, sizeof(mesh_access)); | 277 | memset(&mesh_access, 0, sizeof(mesh_access)); |
276 | sscanf(buf, "%d", &datum); | 278 | sscanf(buf, "%d", &datum); |
277 | mesh_access.data[0] = cpu_to_le32(datum); | 279 | mesh_access.data[0] = cpu_to_le32(datum); |
278 | 280 | ||
279 | libertas_prepare_and_send_command((to_net_dev(dev))->priv, | 281 | ret = libertas_prepare_and_send_command(priv, |
280 | CMD_MESH_ACCESS, | 282 | CMD_MESH_ACCESS, |
281 | CMD_ACT_MESH_SET_AUTOSTART_ENABLED, | 283 | CMD_ACT_MESH_SET_AUTOSTART_ENABLED, |
282 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); | 284 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); |
285 | if (ret == 0) | ||
286 | priv->mesh_autostart_enabled = datum ? 1 : 0; | ||
287 | |||
283 | return strlen(buf); | 288 | return strlen(buf); |
284 | } | 289 | } |
285 | 290 | ||
@@ -853,6 +858,7 @@ static int wlan_setup_station_hw(wlan_private * priv) | |||
853 | { | 858 | { |
854 | int ret = -1; | 859 | int ret = -1; |
855 | wlan_adapter *adapter = priv->adapter; | 860 | wlan_adapter *adapter = priv->adapter; |
861 | struct cmd_ds_mesh_access mesh_access; | ||
856 | 862 | ||
857 | lbs_deb_enter(LBS_DEB_FW); | 863 | lbs_deb_enter(LBS_DEB_FW); |
858 | 864 | ||
@@ -889,6 +895,21 @@ static int wlan_setup_station_hw(wlan_private * priv) | |||
889 | goto done; | 895 | goto done; |
890 | } | 896 | } |
891 | 897 | ||
898 | /* Disable mesh autostart */ | ||
899 | if (priv->mesh_dev) { | ||
900 | memset(&mesh_access, 0, sizeof(mesh_access)); | ||
901 | mesh_access.data[0] = cpu_to_le32(0); | ||
902 | ret = libertas_prepare_and_send_command(priv, | ||
903 | CMD_MESH_ACCESS, | ||
904 | CMD_ACT_MESH_SET_AUTOSTART_ENABLED, | ||
905 | CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); | ||
906 | if (ret) { | ||
907 | ret = -1; | ||
908 | goto done; | ||
909 | } | ||
910 | priv->mesh_autostart_enabled = 0; | ||
911 | } | ||
912 | |||
892 | ret = 0; | 913 | ret = 0; |
893 | done: | 914 | done: |
894 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); | 915 | lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); |