2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
#define _HCI_INTF_C_
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
#include <recv_osdep.h>
|
|
|
|
#include <xmit_osdep.h>
|
|
|
|
#include <hal_intf.h>
|
|
|
|
#include <rtw_version.h>
|
|
|
|
|
|
|
|
#include <usb_vendor_req.h>
|
|
|
|
#include <usb_ops.h>
|
|
|
|
#include <usb_osintf.h>
|
|
|
|
#include <usb_hal.h>
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_PLATFORM_RTK_DMP
|
|
|
|
#include <asm/io.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_GLOBAL_UI_PID
|
2013-05-08 21:45:39 +00:00
|
|
|
int ui_pid[3] = {0, 0, 0};
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
static int rtw_suspend(struct usb_interface *intf, pm_message_t message);
|
|
|
|
static int rtw_resume(struct usb_interface *intf);
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_resume_process(struct adapter *padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
static int rtw_drv_init(struct usb_interface *pusb_intf,const struct usb_device_id *pdid);
|
2013-05-08 21:45:39 +00:00
|
|
|
static void rtw_dev_remove(struct usb_interface *pusb_intf);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
static void rtw_dev_shutdown(struct device *dev)
|
|
|
|
{
|
|
|
|
struct usb_interface *usb_intf = container_of(dev, struct usb_interface, dev);
|
|
|
|
struct dvobj_priv *dvobj = usb_get_intfdata(usb_intf);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *adapter = dvobj->if1;
|
2014-12-17 01:03:30 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
DBG_871X("%s\n", __func__);
|
|
|
|
|
|
|
|
for (i = 0; i<dvobj->iface_nums; i++) {
|
|
|
|
adapter = dvobj->padapters[i];
|
2014-12-29 02:13:24 +00:00
|
|
|
adapter->bSurpriseRemoved = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ATOMIC_SET(&dvobj->continual_io_error, MAX_CONTINUAL_IO_ERR+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,23))
|
|
|
|
/* Some useful macros to use to create struct usb_device_id */
|
2014-12-19 06:59:46 +00:00
|
|
|
#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
|
2014-12-17 01:03:30 +00:00
|
|
|
#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
|
2014-12-19 06:59:46 +00:00
|
|
|
#define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
|
|
|
|
#define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
|
2014-12-17 01:03:30 +00:00
|
|
|
#define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
|
|
|
|
#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
|
|
|
|
#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
|
|
|
|
#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
|
|
|
|
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
|
|
|
|
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
|
2014-12-19 06:59:46 +00:00
|
|
|
#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define USB_DEVICE_ID_MATCH_INT_INFO \
|
|
|
|
(USB_DEVICE_ID_MATCH_INT_CLASS | \
|
|
|
|
USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
|
|
|
|
USB_DEVICE_ID_MATCH_INT_PROTOCOL)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
|
|
|
|
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
|
|
|
|
| USB_DEVICE_ID_MATCH_DEVICE, \
|
|
|
|
.idVendor = (vend), \
|
|
|
|
.idProduct = (prod), \
|
|
|
|
.bInterfaceClass = (cl), \
|
|
|
|
.bInterfaceSubClass = (sc), \
|
|
|
|
.bInterfaceProtocol = (pr)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
/**
|
|
|
|
* USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
|
|
|
|
* @vend: the 16 bit USB Vendor ID
|
|
|
|
* @cl: bInterfaceClass value
|
|
|
|
* @sc: bInterfaceSubClass value
|
|
|
|
* @pr: bInterfaceProtocol value
|
|
|
|
*
|
|
|
|
* This macro is used to create a struct usb_device_id that matches a
|
|
|
|
* specific vendor with a specific class of interfaces.
|
|
|
|
*
|
|
|
|
* This is especially useful when explicitly matching devices that have
|
|
|
|
* vendor specific bDeviceClass values, but standards-compliant interfaces.
|
|
|
|
*/
|
|
|
|
#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
|
|
|
|
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
|
|
|
|
| USB_DEVICE_ID_MATCH_VENDOR, \
|
|
|
|
.idVendor = (vend), \
|
|
|
|
.bInterfaceClass = (cl), \
|
|
|
|
.bInterfaceSubClass = (sc), \
|
|
|
|
.bInterfaceProtocol = (pr)
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
/* ----------------------------------------------------------------------- */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define USB_VENDER_ID_REALTEK 0x0BDA
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#define RTL8188E_USB_IDS \
|
|
|
|
/*=== Realtek demoboard ===*/ \
|
|
|
|
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179)}, /* 8188EUS */ \
|
|
|
|
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ \
|
|
|
|
/*=== Customer ID ===*/ \
|
|
|
|
/****** 8188EUS ********/ \
|
2014-02-03 04:05:48 +00:00
|
|
|
{USB_DEVICE(0x07B8, 0x8179)}, /* Abocom - Abocom */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
static struct usb_device_id rtw_usb_id_tbl[] ={
|
|
|
|
RTL8188E_USB_IDS
|
2013-05-08 21:45:39 +00:00
|
|
|
{} /* Terminating entry */
|
|
|
|
};
|
2013-08-12 01:59:28 +00:00
|
|
|
MODULE_DEVICE_TABLE(usb, rtw_usb_id_tbl);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
static struct specific_device_id specific_device_id_tbl[] = {
|
2015-02-20 04:11:26 +00:00
|
|
|
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x8177, .flags=SPEC_DEV_ID_DISABLE_HT},/* 8188cu 1*1 dongole, (b/g mode only) */
|
|
|
|
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x817E, .flags=SPEC_DEV_ID_DISABLE_HT},/* 8188CE-VAU USB minCard (b/g mode only) */
|
2014-12-17 01:03:30 +00:00
|
|
|
{.idVendor=0x0b05, .idProduct=0x1791, .flags=SPEC_DEV_ID_DISABLE_HT},
|
|
|
|
{.idVendor=0x13D3, .idProduct=0x3311, .flags=SPEC_DEV_ID_DISABLE_HT},
|
2015-02-20 04:11:26 +00:00
|
|
|
{.idVendor=0x13D3, .idProduct=0x3359, .flags=SPEC_DEV_ID_DISABLE_HT},/* Russian customer -Azwave (8188CE-VAU g mode) */
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef RTK_DMP_PLATFORM
|
2015-02-20 04:11:26 +00:00
|
|
|
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x8111, .flags=SPEC_DEV_ID_ASSIGN_IFNAME}, /* Realtek 5G dongle for WiFi Display */
|
|
|
|
{.idVendor=0x2019, .idProduct=0xAB2D, .flags=SPEC_DEV_ID_ASSIGN_IFNAME}, /* PCI-Abocom 5G dongle for WiFi Display */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif /* RTK_DMP_PLATFORM */
|
|
|
|
{}
|
2013-05-08 21:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rtw_usb_drv {
|
|
|
|
struct usb_driver usbdrv;
|
|
|
|
int drv_registered;
|
|
|
|
};
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
static struct usb_device_id rtl8188e_usb_id_tbl[] ={
|
|
|
|
RTL8188E_USB_IDS
|
|
|
|
{} /* Terminating entry */
|
|
|
|
};
|
|
|
|
|
2014-12-19 04:28:04 +00:00
|
|
|
static struct rtw_usb_drv rtl8188e_usb_drv = {
|
2014-12-17 01:03:30 +00:00
|
|
|
.usbdrv.name = (char*)"rtl8188eu",
|
2013-05-08 21:45:39 +00:00
|
|
|
.usbdrv.probe = rtw_drv_init,
|
|
|
|
.usbdrv.disconnect = rtw_dev_remove,
|
2014-12-17 01:03:30 +00:00
|
|
|
.usbdrv.id_table = rtl8188e_usb_id_tbl,
|
2013-05-08 21:45:39 +00:00
|
|
|
.usbdrv.suspend = rtw_suspend,
|
|
|
|
.usbdrv.resume = rtw_resume,
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
|
2014-12-19 06:59:46 +00:00
|
|
|
.usbdrv.reset_resume = rtw_resume,
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
|
|
|
.usbdrv.supports_autosuspend = 1,
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
|
|
|
|
.usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
|
|
|
|
#else
|
|
|
|
.usbdrv.driver.shutdown = rtw_dev_shutdown,
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct rtw_usb_drv *usb_drv = &rtl8188e_usb_drv;
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return (RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_in(epd));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return (RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_out(epd));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
static inline int RT_usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
return (RT_usb_endpoint_xfer_int(epd) && RT_usb_endpoint_dir_in(epd));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
|
|
|
|
{
|
|
|
|
return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 rst = _SUCCESS;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_rtw_mutex_init(&dvobj->usb_vendor_req_mutex);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
|
2013-05-08 21:45:39 +00:00
|
|
|
dvobj->usb_alloc_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE);
|
|
|
|
if (dvobj->usb_alloc_vendor_req_buf == NULL) {
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("alloc usb_vendor_req_buf failed... /n");
|
2013-05-08 21:45:39 +00:00
|
|
|
rst = _FAIL;
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
dvobj->usb_vendor_req_buf =
|
2014-12-17 01:03:30 +00:00
|
|
|
(u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(dvobj->usb_alloc_vendor_req_buf ), ALIGNMENT_UNIT);
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return rst;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
u8 rst = _SUCCESS;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC
|
|
|
|
if(dvobj->usb_vendor_req_buf)
|
|
|
|
rtw_mfree(dvobj->usb_alloc_vendor_req_buf, MAX_USB_IO_CTL_SIZE);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_rtw_mutex_free(&dvobj->usb_vendor_req_mutex);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return rst;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
|
|
|
|
{
|
|
|
|
int i;
|
2014-12-17 01:03:30 +00:00
|
|
|
u8 val8;
|
2013-05-08 21:45:39 +00:00
|
|
|
int status = _FAIL;
|
|
|
|
struct dvobj_priv *pdvobjpriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct usb_device_descriptor *pdev_desc;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct usb_host_config *phost_conf;
|
|
|
|
struct usb_config_descriptor *pconf_desc;
|
|
|
|
struct usb_host_interface *phost_iface;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct usb_interface_descriptor *piface_desc;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct usb_host_endpoint *phost_endp;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct usb_endpoint_descriptor *pendp_desc;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct usb_device *pusbd;
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if ((pdvobjpriv = (struct dvobj_priv*)rtw_zmalloc(sizeof(*pdvobjpriv))) == NULL) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
_rtw_mutex_init(&pdvobjpriv->hw_init_mutex);
|
|
|
|
_rtw_mutex_init(&pdvobjpriv->h2c_fwcmd_mutex);
|
|
|
|
_rtw_mutex_init(&pdvobjpriv->setch_mutex);
|
|
|
|
_rtw_mutex_init(&pdvobjpriv->setbw_mutex);
|
2014-12-29 02:13:24 +00:00
|
|
|
pdvobjpriv->processing_dev_remove = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
pdvobjpriv->pusbintf = usb_intf ;
|
|
|
|
pusbd = pdvobjpriv->pusbdev = interface_to_usbdev(usb_intf);
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_set_intfdata(usb_intf, pdvobjpriv);
|
|
|
|
|
|
|
|
pdvobjpriv->RtNumInPipes = 0;
|
|
|
|
pdvobjpriv->RtNumOutPipes = 0;
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* padapter->EepromAddressSize = 6; */
|
|
|
|
/* pdvobjpriv->nr_endpoint = 6; */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
pdev_desc = &pusbd->descriptor;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
phost_conf = pusbd->actconfig;
|
|
|
|
pconf_desc = &phost_conf->desc;
|
|
|
|
|
|
|
|
phost_iface = &usb_intf->altsetting[0];
|
|
|
|
piface_desc = &phost_iface->desc;
|
|
|
|
|
|
|
|
pdvobjpriv->NumInterfaces = pconf_desc->bNumInterfaces;
|
|
|
|
pdvobjpriv->InterfaceNumber = piface_desc->bInterfaceNumber;
|
|
|
|
pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints;
|
|
|
|
|
2014-12-29 02:00:11 +00:00
|
|
|
for (i = 0; i < pdvobjpriv->nr_endpoint; i++) {
|
2014-12-17 01:03:30 +00:00
|
|
|
phost_endp = phost_iface->endpoint + i;
|
2014-12-29 02:00:11 +00:00
|
|
|
if (phost_endp) {
|
2014-12-17 01:03:30 +00:00
|
|
|
pendp_desc = &phost_endp->desc;
|
|
|
|
|
|
|
|
DBG_871X("\nusb_endpoint_descriptor(%d):\n", i);
|
|
|
|
DBG_871X("bLength=%x\n",pendp_desc->bLength);
|
|
|
|
DBG_871X("bDescriptorType=%x\n",pendp_desc->bDescriptorType);
|
|
|
|
DBG_871X("bEndpointAddress=%x\n",pendp_desc->bEndpointAddress);
|
|
|
|
DBG_871X("wMaxPacketSize=%d\n",le16_to_cpu(pendp_desc->wMaxPacketSize));
|
|
|
|
DBG_871X("bInterval=%x\n",pendp_desc->bInterval);
|
|
|
|
|
2014-12-29 02:00:11 +00:00
|
|
|
if (RT_usb_endpoint_is_bulk_in(pendp_desc)) {
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("RT_usb_endpoint_is_bulk_in = %x\n", RT_usb_endpoint_num(pendp_desc));
|
|
|
|
pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = RT_usb_endpoint_num(pendp_desc);
|
|
|
|
pdvobjpriv->RtNumInPipes++;
|
2014-12-29 02:00:11 +00:00
|
|
|
} else if (RT_usb_endpoint_is_int_in(pendp_desc)) {
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("RT_usb_endpoint_is_int_in = %x, Interval = %x\n", RT_usb_endpoint_num(pendp_desc),pendp_desc->bInterval);
|
|
|
|
pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = RT_usb_endpoint_num(pendp_desc);
|
|
|
|
pdvobjpriv->RtNumInPipes++;
|
|
|
|
}
|
|
|
|
else if (RT_usb_endpoint_is_bulk_out(pendp_desc))
|
|
|
|
{
|
|
|
|
DBG_871X("RT_usb_endpoint_is_bulk_out = %x\n", RT_usb_endpoint_num(pendp_desc));
|
|
|
|
pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = RT_usb_endpoint_num(pendp_desc);
|
|
|
|
pdvobjpriv->RtNumOutPipes++;
|
|
|
|
}
|
|
|
|
pdvobjpriv->ep_num[i] = RT_usb_endpoint_num(pendp_desc);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("nr_endpoint=%d, in_num=%d, out_num=%d\n\n", pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes, pdvobjpriv->RtNumOutPipes);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (pusbd->speed == USB_SPEED_HIGH) {
|
2014-12-29 02:13:24 +00:00
|
|
|
pdvobjpriv->ishighspeed = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("USB_SPEED_HIGH\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
2014-12-29 02:13:24 +00:00
|
|
|
pdvobjpriv->ishighspeed = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("NON USB_SPEED_HIGH\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
if (rtw_init_intf_priv(pdvobjpriv) == _FAIL) {
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't INIT rtw_init_intf_priv\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto free_dvobj;
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* 3 misc */
|
2014-12-19 06:59:46 +00:00
|
|
|
_rtw_init_sema(&(pdvobjpriv->usb_suspend_sema), 0);
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_reset_continual_io_error(pdvobjpriv);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
usb_get_dev(pusbd);
|
|
|
|
|
|
|
|
status = _SUCCESS;
|
|
|
|
|
|
|
|
free_dvobj:
|
|
|
|
if (status != _SUCCESS && pdvobjpriv) {
|
|
|
|
usb_set_intfdata(usb_intf, NULL);
|
2014-12-17 01:03:30 +00:00
|
|
|
_rtw_mutex_free(&pdvobjpriv->hw_init_mutex);
|
|
|
|
_rtw_mutex_free(&pdvobjpriv->h2c_fwcmd_mutex);
|
|
|
|
_rtw_mutex_free(&pdvobjpriv->setch_mutex);
|
|
|
|
_rtw_mutex_free(&pdvobjpriv->setbw_mutex);
|
|
|
|
rtw_mfree((u8*)pdvobjpriv, sizeof(*pdvobjpriv));
|
2013-05-08 21:45:39 +00:00
|
|
|
pdvobjpriv = NULL;
|
|
|
|
}
|
|
|
|
exit:
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
return pdvobjpriv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void usb_dvobj_deinit(struct usb_interface *usb_intf)
|
|
|
|
{
|
|
|
|
struct dvobj_priv *dvobj = usb_get_intfdata(usb_intf);
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_set_intfdata(usb_intf, NULL);
|
|
|
|
if (dvobj) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* Modify condition for 92DU DMDP 2010.11.18, by Thomas */
|
2014-12-17 01:03:30 +00:00
|
|
|
if ((dvobj->NumInterfaces != 2 && dvobj->NumInterfaces != 3)
|
|
|
|
|| (dvobj->InterfaceNumber == 1)) {
|
|
|
|
if (interface_to_usbdev(usb_intf)->state != USB_STATE_NOTATTACHED) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* If we didn't unplug usb dongle and remove/insert modlue, driver fails on sitesurvey for the first time when device is up . */
|
|
|
|
/* Reset usb port for sitesurvey fail issue. 2009.8.13, by Thomas */
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("usb attached..., try to reset usb device\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_reset_device(interface_to_usbdev(usb_intf));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rtw_deinit_intf_priv(dvobj);
|
2014-12-17 01:03:30 +00:00
|
|
|
_rtw_mutex_free(&dvobj->hw_init_mutex);
|
|
|
|
_rtw_mutex_free(&dvobj->h2c_fwcmd_mutex);
|
|
|
|
_rtw_mutex_free(&dvobj->setch_mutex);
|
|
|
|
_rtw_mutex_free(&dvobj->setbw_mutex);
|
|
|
|
rtw_mfree((u8*)dvobj, sizeof(*dvobj));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("%s %d\n", __func__, ATOMIC_READ(&usb_intf->dev.kobj.kref.refcount)); */
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_put_dev(interface_to_usbdev(usb_intf));
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void decide_chip_type_by_usb_device_id(struct adapter *padapter, const struct usb_device_id *pdid)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
padapter->chip_type = NULL_CHIP_TYPE;
|
|
|
|
hal_set_hw_type(padapter);
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void usb_intf_start(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+usb_intf_start\n"));
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_inirp_init(padapter);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-usb_intf_start\n"));
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void usb_intf_stop(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-12 01:59:28 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+usb_intf_stop\n"));
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* disabel_hw_interrupt */
|
2014-12-29 02:13:24 +00:00
|
|
|
if(padapter->bSurpriseRemoved == false)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* device still exists, so driver can do i/o operation */
|
|
|
|
/* TODO: */
|
2014-12-29 02:13:24 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("SurpriseRemoved==false\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* cancel in irp */
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_hal_inirp_deinit(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* cancel out irp */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_write_port_cancel(padapter);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* todo:cancel other irps */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-usb_intf_stop\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_dev_unload(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
struct net_device *pnetdev= (struct net_device*)padapter->pnetdev;
|
|
|
|
u8 val8;
|
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+rtw_dev_unload\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(padapter->bup == true)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
DBG_871X("===> rtw_dev_unload\n");
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
padapter->bDriverStopped = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
if (padapter->xmitpriv.ack_tx)
|
|
|
|
rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s3. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(padapter->intf_stop)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
padapter->intf_stop(padapter);
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s4. */
|
2014-12-19 06:59:46 +00:00
|
|
|
if(!adapter_to_pwrctl(padapter)->bInternalAutoSuspend )
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_stop_drv_threads(padapter);
|
|
|
|
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s5. */
|
2014-12-29 02:13:24 +00:00
|
|
|
if(padapter->bSurpriseRemoved == false)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("r871x_dev_unload()->rtl871x_hal_deinit()\n"); */
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_WOWLAN
|
2014-12-29 02:13:24 +00:00
|
|
|
if((adapter_to_pwrctl(padapter)->bSupportRemoteWakeup==true)&&(adapter_to_pwrctl(padapter)->wowlan_mode==true)){
|
|
|
|
DBG_871X("%s bSupportWakeOnWlan==true do not run rtw_hal_deinit()\n",__FUNCTION__);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
else
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_WOWLAN */
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
rtw_hal_deinit(padapter);
|
|
|
|
}
|
2014-12-29 02:13:24 +00:00
|
|
|
padapter->bSurpriseRemoved = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
padapter->bup = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_WOWLAN
|
2014-12-29 02:13:24 +00:00
|
|
|
padapter->hw_init_completed=false;
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_WOWLAN */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
else
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("r871x_dev_unload():padapter->bup == false\n" ));
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DBG_871X("<=== rtw_dev_unload\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-rtw_dev_unload\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void process_spec_devid(const struct usb_device_id *pdid)
|
|
|
|
{
|
|
|
|
u16 vid, pid;
|
|
|
|
u32 flags;
|
|
|
|
int i;
|
2014-12-17 01:03:30 +00:00
|
|
|
int num = sizeof(specific_device_id_tbl)/sizeof(struct specific_device_id);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
for(i=0; i<num; i++)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
vid = specific_device_id_tbl[i].idVendor;
|
|
|
|
pid = specific_device_id_tbl[i].idProduct;
|
|
|
|
flags = specific_device_id_tbl[i].flags;
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_DISABLE_HT))
|
|
|
|
{
|
|
|
|
rtw_ht_enable = 0;
|
|
|
|
rtw_cbw40_enable = 0;
|
|
|
|
rtw_ampdu_enable = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RTK_DMP_PLATFORM
|
2015-02-20 04:11:26 +00:00
|
|
|
/* Change the ifname to wlan10 when PC side WFD dongle plugin on DMP platform. */
|
|
|
|
/* It is used to distinguish between normal and PC-side wifi dongle/module. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_ASSIGN_IFNAME))
|
|
|
|
{
|
|
|
|
extern char* ifname;
|
2014-12-19 06:59:46 +00:00
|
|
|
strncpy(ifname, "wlan10", 6);
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("%s()-%d: ifname=%s, vid=%04X, pid=%04X\n", __FUNCTION__, __LINE__, ifname, vid, pid); */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif /* RTK_DMP_PLATFORM */
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_hw_suspend(struct adapter *padapter )
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct net_device *pnetdev = padapter->pnetdev;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved))
|
|
|
|
{
|
|
|
|
DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
|
2014-12-19 06:59:46 +00:00
|
|
|
padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto error_exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
if(padapter)/* system suspend */
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
LeaveAllPowerSaveMode(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
DBG_871X("==> rtw_hw_suspend\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
_enter_pwrlock(&pwrpriv->lock);
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bips_processing = true;
|
2015-02-20 04:11:26 +00:00
|
|
|
/* padapter->net_closed = true; */
|
|
|
|
/* s1. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pnetdev)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
netif_carrier_off(pnetdev);
|
|
|
|
rtw_netif_stop_queue(pnetdev);
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2. */
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_disassoc_cmd(padapter, 500, false);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2-2. indicate disconnect to os */
|
|
|
|
/* rtw_indicate_disconnect(padapter); */
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(check_fwstate(pmlmepriv, _FW_LINKED))
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
_clr_fwstate_(pmlmepriv, _FW_LINKED);
|
|
|
|
|
|
|
|
rtw_led_control(padapter, LED_CTL_NO_LINK);
|
|
|
|
|
|
|
|
rtw_os_indicate_disconnect(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* donnot enqueue cmd */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
|
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2-3. */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_assoc_resources(padapter, 1);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2-4. */
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_free_network_queue(padapter,true);
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_ips_dev_unload(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrpriv->rf_pwrstate = rf_off;
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bips_processing = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_exit_pwrlock(&pwrpriv->lock);
|
2013-08-12 01:59:28 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
else
|
|
|
|
goto error_exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
return 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
error_exit:
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("%s, failed \n",__FUNCTION__);
|
|
|
|
return (-1);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_hw_resume(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
|
|
|
struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct net_device *pnetdev = padapter->pnetdev;
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
if(padapter)/* system resume */
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("==> rtw_hw_resume\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
_enter_pwrlock(&pwrpriv->lock);
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bips_processing = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_reset_drv_sw(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(pm_netdev_open(pnetdev,false) != 0)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
_exit_pwrlock(&pwrpriv->lock);
|
|
|
|
goto error_exit;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
netif_device_attach(pnetdev);
|
2013-05-08 21:45:39 +00:00
|
|
|
netif_carrier_on(pnetdev);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(!rtw_netif_queue_stopped(pnetdev))
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_netif_start_queue(pnetdev);
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_netif_wake_queue(pnetdev);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bkeepfwalive = false;
|
|
|
|
pwrpriv->brfoffbyhw = false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
pwrpriv->rf_pwrstate = rf_on;
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bips_processing = false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
_exit_pwrlock(&pwrpriv->lock);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
goto error_exit;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return 0;
|
|
|
|
error_exit:
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("%s, Open net dev failed \n",__FUNCTION__);
|
|
|
|
return (-1);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_WOWLAN
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtw_suspend_wow(struct adapter *padapter)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
struct net_device *pnetdev = padapter->pnetdev;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
|
|
|
struct wifidirect_info* pwdinfo = &padapter->wdinfo;
|
|
|
|
struct wowlan_ioctl_param poidparam;
|
|
|
|
|
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->wowlan_mode = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
else
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->wowlan_mode = false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
rtw_cancel_all_timer(padapter);
|
2014-12-17 01:03:30 +00:00
|
|
|
LeaveAllPowerSaveMode(padapter);
|
|
|
|
|
|
|
|
rtw_stop_cmd_thread(padapter);
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* padapter->net_closed = true; */
|
|
|
|
/* s1. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pnetdev)
|
|
|
|
{
|
|
|
|
netif_carrier_off(pnetdev);
|
|
|
|
rtw_netif_stop_queue(pnetdev);
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(pwrpriv->bSupportRemoteWakeup==true && pwrpriv->wowlan_mode==true){
|
2015-02-20 04:11:26 +00:00
|
|
|
/* set H2C command */
|
2014-12-17 01:03:30 +00:00
|
|
|
poidparam.subcode=WOWLAN_ENABLE;
|
|
|
|
padapter->HalFunc.SetHwRegHandler(padapter,HW_VAR_WOWLAN,(u8 *)&poidparam);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2. */
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_disassoc_cmd(padapter, 0, false);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_LAYER2_ROAMING_RESUME
|
|
|
|
if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)&& rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
|
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("%s:%d assoc_ssid:%s\n", __FUNCTION__, __LINE__, pmlmepriv->assoc_ssid.Ssid); */
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("%s:%d %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, __LINE__,
|
|
|
|
pmlmepriv->cur_network.network.Ssid.Ssid,
|
|
|
|
MAC_ARG(pmlmepriv->cur_network.network.MacAddress),
|
|
|
|
pmlmepriv->cur_network.network.Ssid.SsidLength,
|
|
|
|
pmlmepriv->assoc_ssid.SsidLength);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_set_roaming(padapter, 1);
|
|
|
|
}
|
|
|
|
#endif
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2-2. indicate disconnect to os */
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_indicate_disconnect(padapter);
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2-3. */
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_free_assoc_resources(padapter, 1);
|
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
|
|
|
if(!pwrpriv->bInternalAutoSuspend )
|
|
|
|
#endif
|
2015-02-20 04:11:26 +00:00
|
|
|
/* s2-4. */
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_free_network_queue(padapter, true);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
rtw_dev_unload(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
|
|
|
|
rtw_indicate_scan_done(padapter, 1);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) */
|
|
|
|
/* rtw_indicate_disconnect(padapter); */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
|
|
|
|
{
|
|
|
|
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = dvobj->if1;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct net_device *pnetdev = padapter->pnetdev;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
|
|
|
|
struct usb_device *usb_dev = interface_to_usbdev(pusb_intf);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
int ret = 0;
|
|
|
|
u32 start_time = rtw_get_current_time();
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_IOL_READ_EFUSE_MAP
|
|
|
|
if(!padapter->bup){
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bMacPwrCtrlOn = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
|
|
|
|
if(bMacPwrCtrlOn)
|
|
|
|
rtw_hal_power_off(padapter);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved))
|
|
|
|
{
|
|
|
|
DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
|
|
|
|
padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pwrpriv->bInternalAutoSuspend )
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
2015-02-20 04:11:26 +00:00
|
|
|
/* The FW command register update must after MAC and FW init ready. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable ))
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bOpen = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bInSuspend = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
_enter_pwrlock(&pwrpriv->lock);
|
|
|
|
#ifdef CONFIG_WOWLAN
|
|
|
|
rtw_suspend_wow(padapter);
|
|
|
|
#else
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_suspend_common(padapter);
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
|
|
|
pwrpriv->rf_pwrstate = rf_off;
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bips_processing = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
_exit_pwrlock(&pwrpriv->lock);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
exit:
|
|
|
|
DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__
|
|
|
|
, ret, rtw_get_passing_time_ms(start_time));
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
static int rtw_resume(struct usb_interface *pusb_intf)
|
|
|
|
{
|
|
|
|
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = dvobj->if1;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct net_device *pnetdev = padapter->pnetdev;
|
|
|
|
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj);
|
2013-05-08 21:45:39 +00:00
|
|
|
int ret = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(pwrpriv->bInternalAutoSuspend ){
|
2014-12-19 06:59:46 +00:00
|
|
|
ret = rtw_resume_process(padapter);
|
2014-12-17 01:03:30 +00:00
|
|
|
} else {
|
|
|
|
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
|
|
|
rtw_resume_in_workqueue(pwrpriv);
|
|
|
|
#else
|
|
|
|
if (rtw_is_earlysuspend_registered(pwrpriv)
|
|
|
|
#ifdef CONFIG_WOWLAN
|
|
|
|
&& !pwrpriv->wowlan_mode
|
|
|
|
#endif /* CONFIG_WOWLAN */
|
|
|
|
) {
|
|
|
|
/* jeff: bypass resume here, do in late_resume */
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_set_do_late_resume(pwrpriv, true);
|
2014-12-17 01:03:30 +00:00
|
|
|
} else {
|
|
|
|
ret = rtw_resume_process(padapter);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_RESUME_IN_WORKQUEUE */
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_resume_process(struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct net_device *pnetdev;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct pwrctrl_priv *pwrpriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
int ret = -1;
|
|
|
|
u32 start_time = rtw_get_current_time();
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
u8 pm_cnt;
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* ifdef CONFIG_BT_COEXIST */
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(padapter) {
|
|
|
|
pnetdev= padapter->pnetdev;
|
|
|
|
pwrpriv = adapter_to_pwrctl(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
_enter_pwrlock(&pwrpriv->lock);
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
|
|
|
|
DBG_871X("%s...pm_usage_cnt(%d) pwrpriv->bAutoResume=%x. ....\n",__func__,atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt)),pwrpriv->bAutoResume);
|
|
|
|
pm_cnt=atomic_read(&(adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt));
|
|
|
|
#else
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt);
|
|
|
|
pm_cnt = adapter_to_dvobj(padapter)->pusbintf->pm_usage_cnt;
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume );
|
2014-12-29 02:13:24 +00:00
|
|
|
if( true == pwrpriv->bAutoResume ){
|
|
|
|
pwrpriv->bInternalAutoSuspend = false;
|
|
|
|
pwrpriv->bAutoResume=false;
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend );
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* ifdef CONFIG_AUTOSUSPEND */
|
|
|
|
#endif /* ifdef CONFIG_BT_COEXIST */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
if(rtw_resume_common(padapter)!= 0) {
|
|
|
|
DBG_871X("%s rtw_resume_common failed\n",__FUNCTION__);
|
|
|
|
_exit_pwrlock(&pwrpriv->lock);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
|
|
|
if(pwrpriv->bInternalAutoSuspend )
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
2015-02-20 04:11:26 +00:00
|
|
|
/* The FW command register update must after MAC and FW init ready. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect) && (padapter->registrypriv.usbss_enable ))
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
u8 bOpen = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume );
|
2014-12-29 02:13:24 +00:00
|
|
|
if( true == pwrpriv->bAutoResume ){
|
|
|
|
pwrpriv->bInternalAutoSuspend = false;
|
|
|
|
pwrpriv->bAutoResume=false;
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend );
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
#else /* ifdef CONFIG_BT_COEXIST */
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bInternalAutoSuspend = false;
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* ifdef CONFIG_BT_COEXIST */
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->brfoffbyhw = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
_exit_pwrlock(&pwrpriv->lock);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if( padapter->pid[1]!=0) {
|
|
|
|
DBG_871X("pid[1]:%d\n",padapter->pid[1]);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_signal_process(padapter->pid[1], SIGUSR2);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
exit:
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_RESUME_IN_WORKQUEUE
|
|
|
|
rtw_unlock_suspend();
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_RESUME_IN_WORKQUEUE */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bInSuspend = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__
|
|
|
|
, ret, rtw_get_passing_time_ms(start_time));
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
2014-12-19 06:59:46 +00:00
|
|
|
void autosuspend_enter(struct adapter* padapter)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
|
|
|
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("==>autosuspend_enter...........\n");
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bInternalAutoSuspend = true;
|
|
|
|
pwrpriv->bips_processing = true;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(rf_off == pwrpriv->change_rfpwrstate )
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifndef CONFIG_BT_COEXIST
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
|
|
|
|
usb_enable_autosuspend(dvobj->pusbdev);
|
|
|
|
#else
|
2015-02-20 04:11:26 +00:00
|
|
|
dvobj->pusbdev->autosuspend_disabled = 0;/* autosuspend disabled by the user */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
|
2014-12-19 06:59:46 +00:00
|
|
|
usb_autopm_put_interface(dvobj->pusbintf);
|
|
|
|
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
|
2014-12-17 01:03:30 +00:00
|
|
|
usb_autopm_enable(dvobj->pusbintf);
|
|
|
|
#else
|
|
|
|
usb_autosuspend_device(dvobj->pusbdev, 1);
|
|
|
|
#endif
|
2015-02-20 04:11:26 +00:00
|
|
|
#else /* ifndef CONFIG_BT_COEXIST */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(1==pwrpriv->autopm_cnt){
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
|
|
|
|
usb_enable_autosuspend(dvobj->pusbdev);
|
|
|
|
#else
|
2015-02-20 04:11:26 +00:00
|
|
|
dvobj->pusbdev->autosuspend_disabled = 0;/* autosuspend disabled by the user */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
|
2014-12-19 06:59:46 +00:00
|
|
|
usb_autopm_put_interface(dvobj->pusbintf);
|
|
|
|
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
|
2014-12-17 01:03:30 +00:00
|
|
|
usb_autopm_enable(dvobj->pusbintf);
|
|
|
|
#else
|
|
|
|
usb_autosuspend_device(dvobj->pusbdev, 1);
|
|
|
|
#endif
|
|
|
|
pwrpriv->autopm_cnt --;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DBG_871X("0!=pwrpriv->autopm_cnt[%d] didn't usb_autopm_put_interface\n", pwrpriv->autopm_cnt);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* ifndef CONFIG_BT_COEXIST */
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
|
|
|
#else
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2014-12-17 23:13:53 +00:00
|
|
|
int autoresume_enter(struct adapter* padapter)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
int result = _SUCCESS;
|
|
|
|
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
|
|
|
struct security_priv* psecuritypriv=&(padapter->securitypriv);
|
|
|
|
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
|
|
|
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
|
|
|
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("====> autoresume_enter \n");
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(rf_off == pwrpriv->rf_pwrstate )
|
|
|
|
{
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->ps_flag = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifndef CONFIG_BT_COEXIST
|
2014-12-19 06:59:46 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
|
|
|
|
if (usb_autopm_get_interface(dvobj->pusbintf) < 0)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
DBG_871X( "can't get autopm: %d\n", result);
|
|
|
|
result = _FAIL;
|
|
|
|
goto error_exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
|
2014-12-17 01:03:30 +00:00
|
|
|
usb_autopm_disable(dvobj->pusbintf);
|
|
|
|
#else
|
|
|
|
usb_autoresume_device(dvobj->pusbdev, 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
|
|
|
#else
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2015-02-20 04:11:26 +00:00
|
|
|
#else /* ifndef CONFIG_BT_COEXIST */
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrpriv->bAutoResume=true;
|
2014-12-17 01:03:30 +00:00
|
|
|
if(0==pwrpriv->autopm_cnt){
|
2014-12-19 06:59:46 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
|
|
|
|
if (usb_autopm_get_interface(dvobj->pusbintf) < 0)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
DBG_871X( "can't get autopm: %d\n", result);
|
|
|
|
result = _FAIL;
|
|
|
|
goto error_exit;
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
|
2014-12-17 01:03:30 +00:00
|
|
|
usb_autopm_disable(dvobj->pusbintf);
|
|
|
|
#else
|
|
|
|
usb_autoresume_device(dvobj->pusbdev, 1);
|
|
|
|
#endif
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", atomic_read(&(dvobj->pusbintf->pm_usage_cnt)));
|
|
|
|
#else
|
|
|
|
DBG_871X("...pm_usage_cnt(%d).....\n", dvobj->pusbintf->pm_usage_cnt);
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 01:03:30 +00:00
|
|
|
pwrpriv->autopm_cnt++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DBG_871X("0!=pwrpriv->autopm_cnt[%d] didn't usb_autopm_get_interface\n",pwrpriv->autopm_cnt);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* ifndef CONFIG_BT_COEXIST */
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("<==== autoresume_enter \n");
|
2014-12-19 06:59:46 +00:00
|
|
|
error_exit:
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_PLATFORM_RTD2880B
|
|
|
|
extern void rtd2885_wlan_netlink_sendMsg(char *action_string, char *name);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_PLATFORM_ARM_SUNxI
|
|
|
|
#include <mach/sys_config.h>
|
|
|
|
extern int sw_usb_disable_hcd(__u32 usbc_no);
|
|
|
|
extern int sw_usb_enable_hcd(__u32 usbc_no);
|
|
|
|
static int usb_wifi_host = 2;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_PLATFORM_ARM_SUN6I
|
|
|
|
#include <mach/sys_config.h>
|
|
|
|
extern int sw_usb_disable_hcd(__u32 usbc_no);
|
|
|
|
extern int sw_usb_enable_hcd(__u32 usbc_no);
|
|
|
|
extern void wifi_pm_power(int on);
|
|
|
|
static script_item_u item;
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
/*
|
|
|
|
* drv_init() - a device potentially for us
|
|
|
|
*
|
2014-12-17 01:03:30 +00:00
|
|
|
* notes: drv_init() is called when the bus driver has located a card for us to support.
|
2013-05-08 21:45:39 +00:00
|
|
|
* We accept the new device by returning 0.
|
2014-12-17 01:03:30 +00:00
|
|
|
*/
|
|
|
|
|
2014-12-19 04:28:04 +00:00
|
|
|
static struct adapter *rtw_sw_export = NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-19 04:28:04 +00:00
|
|
|
static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
|
2013-05-08 21:45:39 +00:00
|
|
|
struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
|
|
|
|
{
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct net_device *pnetdev = NULL;
|
|
|
|
int status = _FAIL;
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
if ((padapter = (struct adapter *)rtw_zvmalloc(sizeof(*padapter))) == NULL) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
padapter->dvobj = dvobj;
|
|
|
|
dvobj->if1 = padapter;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
padapter->bDriverStopped=true;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
dvobj->padapters[dvobj->iface_nums++] = padapter;
|
|
|
|
padapter->iface_id = IFACE_ID0;
|
|
|
|
|
|
|
|
#ifndef RTW_DVOBJ_CHIP_HW_TYPE
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step 1-1., decide the chip_type via vid/pid */
|
2013-05-08 21:45:39 +00:00
|
|
|
padapter->interface_type = RTW_USB;
|
2014-12-17 01:03:30 +00:00
|
|
|
decide_chip_type_by_usb_device_id(padapter, pdid);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
if (rtw_handle_dualmac(padapter, 1) != _SUCCESS)
|
|
|
|
goto free_adapter;
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if((pnetdev = rtw_init_netdev(padapter)) == NULL) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto handle_dualmac;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj));
|
|
|
|
padapter = rtw_netdev_priv(pnetdev);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(rtw_wdev_alloc(padapter, dvobj_to_dev(dvobj)) != 0) {
|
|
|
|
goto handle_dualmac;
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step 2. hook HalFunc, allocate HalData */
|
2013-05-08 21:45:39 +00:00
|
|
|
hal_set_hal_ops(padapter);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
padapter->intf_start=&usb_intf_start;
|
|
|
|
padapter->intf_stop=&usb_intf_stop;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step init_io_priv */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_init_io_priv(padapter, usb_set_intf_ops);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step read_chip_version */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_read_chip_version(padapter);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step usb endpoint mapping */
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_hal_chip_configure(padapter);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step read efuse/eeprom data and get mac_addr */
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_hal_read_chip_info(padapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step 5. */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(rtw_init_drv_sw(padapter) ==_FAIL) {
|
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("Initialize driver software resource Failed!\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto free_hal_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
|
|
|
|
if(adapter_to_pwrctl(padapter)->bSupportRemoteWakeup)
|
|
|
|
{
|
|
|
|
dvobj->pusbdev->do_remote_wakeup=1;
|
2014-12-19 06:59:46 +00:00
|
|
|
pusb_intf->needs_remote_wakeup = 1;
|
2013-05-08 21:45:39 +00:00
|
|
|
device_init_wakeup(&pusb_intf->dev, 1);
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("\n pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n");
|
|
|
|
DBG_871X("\n pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n",device_may_wakeup(&pusb_intf->dev));
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
#endif
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_AUTOSUSPEND
|
|
|
|
if( padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE )
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
if(padapter->registrypriv.usbss_enable ){ /* autosuspend (2s delay) */
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,38))
|
2015-02-20 04:11:26 +00:00
|
|
|
dvobj->pusbdev->dev.power.autosuspend_delay = 0 * HZ;/* 15 * HZ; idle-delay time */
|
2014-12-17 01:03:30 +00:00
|
|
|
#else
|
2015-02-20 04:11:26 +00:00
|
|
|
dvobj->pusbdev->autosuspend_delay = 0 * HZ;/* 15 * HZ; idle-delay time */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
|
|
|
|
usb_enable_autosuspend(dvobj->pusbdev);
|
|
|
|
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34))
|
|
|
|
padapter->bDisableAutosuspend = dvobj->pusbdev->autosuspend_disabled ;
|
2015-02-20 04:11:26 +00:00
|
|
|
dvobj->pusbdev->autosuspend_disabled = 0;/* autosuspend disabled by the user */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,32))
|
|
|
|
DBG_871X("%s...pm_usage_cnt(%d).....\n",__FUNCTION__,atomic_read(&(dvobj->pusbintf ->pm_usage_cnt)));
|
|
|
|
#else
|
|
|
|
DBG_871X("%s...pm_usage_cnt(%d).....\n",__FUNCTION__,dvobj->pusbintf ->pm_usage_cnt);
|
2014-12-19 06:59:46 +00:00
|
|
|
#endif
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2015-02-20 04:11:26 +00:00
|
|
|
/* 2012-07-11 Move here to prevent the 8723AS-VAU BT auto suspend influence */
|
2014-12-19 06:59:46 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
|
|
|
|
if (usb_autopm_get_interface(pusb_intf) < 0)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
DBG_871X( "can't get autopm: \n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
adapter_to_pwrctl(padapter)->autopm_cnt=1;
|
2013-10-19 17:45:47 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* set mac addr */
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_macaddr_cfg(padapter->eeprompriv.mac_addr);
|
|
|
|
rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n"
|
2013-05-08 21:45:39 +00:00
|
|
|
, padapter->bDriverStopped
|
|
|
|
, padapter->bSurpriseRemoved
|
|
|
|
, padapter->bup
|
|
|
|
, padapter->hw_init_completed
|
|
|
|
);
|
|
|
|
|
|
|
|
status = _SUCCESS;
|
|
|
|
|
|
|
|
free_hal_data:
|
2014-12-17 01:03:30 +00:00
|
|
|
if(status != _SUCCESS && padapter->HalData)
|
2014-12-19 04:28:04 +00:00
|
|
|
kfree(padapter->HalData);
|
2014-12-17 01:03:30 +00:00
|
|
|
free_wdev:
|
|
|
|
if(status != _SUCCESS) {
|
|
|
|
rtw_wdev_unregister(padapter->rtw_wdev);
|
|
|
|
rtw_wdev_free(padapter->rtw_wdev);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
handle_dualmac:
|
|
|
|
if (status != _SUCCESS)
|
|
|
|
rtw_handle_dualmac(padapter, 0);
|
|
|
|
free_adapter:
|
|
|
|
if (status != _SUCCESS) {
|
|
|
|
if (pnetdev)
|
|
|
|
rtw_free_netdev(pnetdev);
|
|
|
|
else if (padapter)
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_vmfree((u8*)padapter, sizeof(*padapter));
|
2013-05-08 21:45:39 +00:00
|
|
|
padapter = NULL;
|
|
|
|
}
|
|
|
|
exit:
|
|
|
|
return padapter;
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
static void rtw_usb_if1_deinit(struct adapter *if1)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct net_device *pnetdev = if1->pnetdev;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv= &if1->mlmepriv;
|
|
|
|
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(if1);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(check_fwstate(pmlmepriv, _FW_LINKED))
|
2014-12-29 02:13:24 +00:00
|
|
|
rtw_disassoc_cmd(if1, 0, false);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_AP_MODE
|
2013-05-08 21:45:39 +00:00
|
|
|
free_mlme_ap_info(if1);
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_HOSTAPD_MLME
|
|
|
|
hostapd_mode_unload(if1);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
#endif
|
|
|
|
rtw_cancel_all_timer(if1);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_WOWLAN
|
2014-12-29 02:13:24 +00:00
|
|
|
pwrctl->wowlan_mode=false;
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_WOWLAN */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_dev_unload(if1);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
DBG_871X("+r871xu_dev_remove, hw_init_completed=%d\n", if1->hw_init_completed);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_handle_dualmac(if1, 0);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-02-20 04:52:01 +00:00
|
|
|
if(if1->rtw_wdev) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* rtw_wdev_unregister(if1->rtw_wdev); */
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_wdev_free(if1->rtw_wdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_BT_COEXIST
|
|
|
|
if(1 == pwrctl->autopm_cnt){
|
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33))
|
2014-12-19 06:59:46 +00:00
|
|
|
usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf);
|
|
|
|
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20))
|
2014-12-17 01:03:30 +00:00
|
|
|
usb_autopm_enable(adapter_to_dvobj(if1)->pusbintf);
|
|
|
|
#else
|
|
|
|
usb_autosuspend_device(adapter_to_dvobj(if1)->pusbdev, 1);
|
|
|
|
#endif
|
|
|
|
pwrctl->autopm_cnt --;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_drv_sw(if1);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
if(pnetdev)
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_netdev(pnetdev);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_PLATFORM_RTD2880B
|
|
|
|
DBG_871X("wlan link down\n");
|
|
|
|
rtd2885_wlan_netlink_sendMsg("linkdown", "8712");
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
static void dump_usb_interface(struct usb_interface *usb_intf)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u8 val8;
|
|
|
|
|
|
|
|
struct usb_device *udev = interface_to_usbdev(usb_intf);
|
2014-12-19 06:59:46 +00:00
|
|
|
struct usb_device_descriptor *dev_desc = &udev->descriptor;
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
struct usb_host_config *act_conf = udev->actconfig;
|
|
|
|
struct usb_config_descriptor *act_conf_desc = &act_conf->desc;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
struct usb_host_interface *host_iface;
|
|
|
|
struct usb_interface_descriptor *iface_desc;
|
|
|
|
struct usb_host_endpoint *host_endp;
|
|
|
|
struct usb_endpoint_descriptor *endp_desc;
|
|
|
|
|
|
|
|
#if 1 /* The usb device this usb interface belongs to */
|
|
|
|
DBG_871X("usb_interface:%p, usb_device:%p(num:%d, path:%s), usb_device_descriptor:%p\n", usb_intf, udev, udev->devnum, udev->devpath, dev_desc);
|
|
|
|
DBG_871X("bLength:%u\n", dev_desc->bLength);
|
|
|
|
DBG_871X("bDescriptorType:0x%02x\n", dev_desc->bDescriptorType);
|
|
|
|
DBG_871X("bcdUSB:0x%04x\n", le16_to_cpu(dev_desc->bcdUSB));
|
|
|
|
DBG_871X("bDeviceClass:0x%02x\n", dev_desc->bDeviceClass);
|
|
|
|
DBG_871X("bDeviceSubClass:0x%02x\n", dev_desc->bDeviceSubClass);
|
|
|
|
DBG_871X("bDeviceProtocol:0x%02x\n", dev_desc->bDeviceProtocol);
|
|
|
|
DBG_871X("bMaxPacketSize0:%u\n", dev_desc->bMaxPacketSize0);
|
|
|
|
DBG_871X("idVendor:0x%04x\n", le16_to_cpu(dev_desc->idVendor));
|
|
|
|
DBG_871X("idProduct:0x%04x\n", le16_to_cpu(dev_desc->idProduct));
|
|
|
|
DBG_871X("bcdDevice:0x%04x\n", le16_to_cpu(dev_desc->bcdDevice));
|
|
|
|
DBG_871X("iManufacturer:0x02%x\n", dev_desc->iManufacturer);
|
|
|
|
DBG_871X("iProduct:0x%02x\n", dev_desc->iProduct);
|
|
|
|
DBG_871X("iSerialNumber:0x%02x\n", dev_desc->iSerialNumber);
|
|
|
|
DBG_871X("bNumConfigurations:%u\n", dev_desc->bNumConfigurations);
|
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#if 1 /* The acting usb_config_descriptor */
|
|
|
|
DBG_871X("\nact_conf_desc:%p\n", act_conf_desc);
|
|
|
|
DBG_871X("bLength:%u\n", act_conf_desc->bLength);
|
|
|
|
DBG_871X("bDescriptorType:0x%02x\n", act_conf_desc->bDescriptorType);
|
|
|
|
DBG_871X("wTotalLength:%u\n", le16_to_cpu(act_conf_desc->wTotalLength));
|
|
|
|
DBG_871X("bNumInterfaces:%u\n", act_conf_desc->bNumInterfaces);
|
|
|
|
DBG_871X("bConfigurationValue:0x%02x\n", act_conf_desc->bConfigurationValue);
|
|
|
|
DBG_871X("iConfiguration:0x%02x\n", act_conf_desc->iConfiguration);
|
|
|
|
DBG_871X("bmAttributes:0x%02x\n", act_conf_desc->bmAttributes);
|
|
|
|
DBG_871X("bMaxPower=%u\n", act_conf_desc->bMaxPower);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
DBG_871X("****** num of altsetting = (%d) ******/\n", usb_intf->num_altsetting);
|
|
|
|
/* Get he host side alternate setting (the current alternate setting) for this interface*/
|
|
|
|
host_iface = usb_intf->cur_altsetting;
|
|
|
|
iface_desc = &host_iface->desc;
|
|
|
|
|
|
|
|
#if 1 /* The current alternate setting*/
|
|
|
|
DBG_871X("\nusb_interface_descriptor:%p:\n", iface_desc);
|
|
|
|
DBG_871X("bLength:%u\n", iface_desc->bLength);
|
|
|
|
DBG_871X("bDescriptorType:0x%02x\n", iface_desc->bDescriptorType);
|
|
|
|
DBG_871X("bInterfaceNumber:0x%02x\n", iface_desc->bInterfaceNumber);
|
|
|
|
DBG_871X("bAlternateSetting=%x\n", iface_desc->bAlternateSetting);
|
|
|
|
DBG_871X("bNumEndpoints=%x\n", iface_desc->bNumEndpoints);
|
|
|
|
DBG_871X("bInterfaceClass=%x\n", iface_desc->bInterfaceClass);
|
|
|
|
DBG_871X("bInterfaceSubClass=%x\n", iface_desc->bInterfaceSubClass);
|
|
|
|
DBG_871X("bInterfaceProtocol=%x\n", iface_desc->bInterfaceProtocol);
|
|
|
|
DBG_871X("iInterface=%x\n", iface_desc->iInterface);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if 1
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("\ndump usb_endpoint_descriptor:\n"); */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
for (i = 0; i < iface_desc->bNumEndpoints; i++)
|
|
|
|
{
|
|
|
|
host_endp = host_iface->endpoint + i;
|
|
|
|
if (host_endp)
|
|
|
|
{
|
|
|
|
endp_desc = &host_endp->desc;
|
|
|
|
|
|
|
|
DBG_871X("\nusb_endpoint_descriptor(%d):\n", i);
|
|
|
|
DBG_871X("bLength=%x\n",endp_desc->bLength);
|
|
|
|
DBG_871X("bDescriptorType=%x\n",endp_desc->bDescriptorType);
|
|
|
|
DBG_871X("bEndpointAddress=%x\n",endp_desc->bEndpointAddress);
|
|
|
|
DBG_871X("bmAttributes=%x\n",endp_desc->bmAttributes);
|
|
|
|
DBG_871X("wMaxPacketSize=%x\n",endp_desc->wMaxPacketSize);
|
|
|
|
DBG_871X("wMaxPacketSize=%x\n",le16_to_cpu(endp_desc->wMaxPacketSize));
|
|
|
|
DBG_871X("bInterval=%x\n",endp_desc->bInterval);
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("bRefresh=%x\n",pendp_desc->bRefresh); */
|
|
|
|
/* DBG_871X("bSynchAddress=%x\n",pendp_desc->bSynchAddress); */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
if (RT_usb_endpoint_is_bulk_in(endp_desc))
|
|
|
|
{
|
|
|
|
DBG_871X("RT_usb_endpoint_is_bulk_in = %x\n", RT_usb_endpoint_num(endp_desc));
|
2015-02-20 04:11:26 +00:00
|
|
|
/* pdvobjpriv->RtNumInPipes++; */
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
else if (RT_usb_endpoint_is_int_in(endp_desc))
|
|
|
|
{
|
|
|
|
DBG_871X("RT_usb_endpoint_is_int_in = %x, Interval = %x\n", RT_usb_endpoint_num(endp_desc),endp_desc->bInterval);
|
2015-02-20 04:11:26 +00:00
|
|
|
/* pdvobjpriv->RtNumInPipes++; */
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
else if (RT_usb_endpoint_is_bulk_out(endp_desc))
|
|
|
|
{
|
|
|
|
DBG_871X("RT_usb_endpoint_is_bulk_out = %x\n", RT_usb_endpoint_num(endp_desc));
|
2015-02-20 04:11:26 +00:00
|
|
|
/* pdvobjpriv->RtNumOutPipes++; */
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2015-02-20 04:11:26 +00:00
|
|
|
/* pdvobjpriv->ep_num[i] = RT_usb_endpoint_num(pendp_desc); */
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("nr_endpoint=%d, in_num=%d, out_num=%d\n\n", pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes, pdvobjpriv->RtNumOutPipes); */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (udev->speed == USB_SPEED_HIGH)
|
|
|
|
DBG_871X("USB_SPEED_HIGH\n");
|
|
|
|
else
|
|
|
|
DBG_871X("NON USB_SPEED_HIGH\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
int i;
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *if1 = NULL, *if2 = NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
int status;
|
|
|
|
struct dvobj_priv *dvobj;
|
|
|
|
|
|
|
|
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n"));
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("+rtw_drv_init\n"); */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* step 0. */
|
2013-05-08 21:45:39 +00:00
|
|
|
process_spec_devid(pdid);
|
|
|
|
|
|
|
|
/* Initialize dvobj_priv */
|
2014-12-17 01:03:30 +00:00
|
|
|
if ((dvobj = usb_dvobj_init(pusb_intf)) == NULL) {
|
|
|
|
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("initialize device object priv Failed!\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef RTW_DVOBJ_CHIP_HW_TYPE
|
|
|
|
decide_chip_type_by_usb_device_id(dvobj, pdid);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid)) == NULL) {
|
|
|
|
DBG_871X("rtw_init_primary_adapter Failed!\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
goto free_dvobj;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTEL_PROXIM
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_sw_export=if1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_GLOBAL_UI_PID
|
|
|
|
if(ui_pid[1]!=0) {
|
|
|
|
DBG_871X("ui_pid[1]:%d\n",ui_pid[1]);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_signal_process(ui_pid[1], SIGUSR2);
|
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* dev_alloc_name && register_netdev */
|
2014-12-17 01:03:30 +00:00
|
|
|
if((status = rtw_drv_register_netdev(if1)) != _SUCCESS) {
|
|
|
|
goto free_if2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_HOSTAPD_MLME
|
|
|
|
hostapd_mode_init(if1);
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_PLATFORM_RTD2880B
|
|
|
|
DBG_871X("wlan link up\n");
|
|
|
|
rtd2885_wlan_netlink_sendMsg("linkup", "8712");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef RTK_DMP_PLATFORM
|
|
|
|
rtw_proc_init_one(if1->pnetdev);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-871x_drv - drv_init, success!\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
status = _SUCCESS;
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
free_if2:
|
|
|
|
free_if1:
|
|
|
|
if (status != _SUCCESS && if1) {
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_usb_if1_deinit(if1);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
free_dvobj:
|
|
|
|
if (status != _SUCCESS)
|
|
|
|
usb_dvobj_deinit(pusb_intf);
|
|
|
|
exit:
|
2014-12-17 01:03:30 +00:00
|
|
|
return status == _SUCCESS?0:-ENODEV;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* dev_remove() - our device is being removed
|
|
|
|
*/
|
2015-02-20 04:11:26 +00:00
|
|
|
/* rmmod module & unplug(SurpriseRemoved) will call r871xu_dev_remove() => how to recognize both */
|
2013-05-08 21:45:39 +00:00
|
|
|
static void rtw_dev_remove(struct usb_interface *pusb_intf)
|
|
|
|
{
|
|
|
|
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = dvobj->if1;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct net_device *pnetdev = padapter->pnetdev;
|
|
|
|
struct mlme_priv *pmlmepriv= &padapter->mlmepriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
DBG_871X("+rtw_dev_remove\n");
|
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+dev_remove()\n"));
|
2014-12-29 02:13:24 +00:00
|
|
|
dvobj->processing_dev_remove = true;
|
2014-12-19 06:59:46 +00:00
|
|
|
rtw_unregister_netdevs(dvobj);
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(usb_drv->drv_registered == true)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("r871xu_dev_remove():padapter->bSurpriseRemoved == true\n"); */
|
2014-12-29 02:13:24 +00:00
|
|
|
padapter->bSurpriseRemoved = true;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
|
|
|
|
rtw_unregister_early_suspend(dvobj_to_pwrctl(dvobj));
|
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_pm_set_ips(padapter, IPS_NONE);
|
|
|
|
rtw_pm_set_lps(padapter, PS_MODE_ACTIVE);
|
|
|
|
|
|
|
|
LeaveAllPowerSaveMode(padapter);
|
|
|
|
|
|
|
|
rtw_usb_if1_deinit(padapter);
|
|
|
|
|
|
|
|
usb_dvobj_deinit(pusb_intf);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-dev_remove()\n"));
|
|
|
|
DBG_871X("-r871xu_dev_remove, done\n");
|
|
|
|
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTEL_PROXIM
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_sw_export=NULL;
|
|
|
|
#endif
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
return;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
2014-12-17 01:03:30 +00:00
|
|
|
extern int console_suspend_enabled;
|
|
|
|
#endif
|
2013-07-21 04:27:16 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
static int __init rtw_drv_entry(void)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_PLATFORM_RTK_DMP
|
|
|
|
u32 tmp;
|
|
|
|
tmp=readl((volatile unsigned int*)0xb801a608);
|
|
|
|
tmp &= 0xffffff00;
|
|
|
|
tmp |= 0x55;
|
2015-02-20 04:11:26 +00:00
|
|
|
writel(tmp,(volatile unsigned int*)0xb801a608);/* write dummy register for 1055 */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PLATFORM_ARM_SUNxI
|
|
|
|
int ret = 0;
|
2014-12-19 06:59:46 +00:00
|
|
|
/* ----------get usb_wifi_usbc_num------------- */
|
|
|
|
ret = script_parser_fetch("usb_wifi_para", "usb_wifi_usbc_num", (int *)&usb_wifi_host, 64);
|
|
|
|
if(ret != 0){
|
|
|
|
DBG_8192C("ERR: script_parser_fetch usb_wifi_usbc_num failed\n");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
DBG_8192C("sw_usb_enable_hcd: usbc_num = %d\n", usb_wifi_host);
|
2014-12-17 01:03:30 +00:00
|
|
|
sw_usb_enable_hcd(usb_wifi_host);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_PLATFORM_ARM_SUNxI */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#if defined CONFIG_PLATFORM_ARM_SUN6I
|
2014-12-17 01:03:30 +00:00
|
|
|
script_item_value_type_e type;
|
|
|
|
|
|
|
|
type = script_get_item("wifi_para", "wifi_usbc_id", &item);
|
|
|
|
if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
|
|
|
|
printk("ERR: script_get_item wifi_usbc_id failed\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
printk("sw_usb_enable_hcd: usbc_num = %d\n", item.val);
|
|
|
|
wifi_pm_power(1);
|
|
|
|
mdelay(10);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
sw_usb_enable_hcd(item.val);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* defined CONFIG_PLATFORM_ARM_SUN6I */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+rtw_drv_entry\n"));
|
|
|
|
|
|
|
|
DBG_871X(DRV_NAME " driver version=%s\n", DRIVERVERSION);
|
|
|
|
DBG_871X("build time: %s %s\n", __DATE__, __TIME__);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
|
2015-02-20 04:11:26 +00:00
|
|
|
/* console_suspend_enabled=0; */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_suspend_lock_init();
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
usb_drv->drv_registered = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
return usb_register(&usb_drv->usbdrv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit rtw_drv_halt(void)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+rtw_drv_halt\n"));
|
2014-12-19 06:59:46 +00:00
|
|
|
DBG_871X("+rtw_drv_halt\n");
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
usb_drv->drv_registered = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_deregister(&usb_drv->usbdrv);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_PLATFORM_ARM_SUNxI
|
|
|
|
DBG_8192C("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host);
|
|
|
|
sw_usb_disable_hcd(usb_wifi_host);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_PLATFORM_ARM_SUNxI */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#if defined CONFIG_PLATFORM_ARM_SUN6I
|
|
|
|
sw_usb_disable_hcd(item.val);
|
|
|
|
wifi_pm_power(0);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* defined CONFIG_PLATFORM_ARM_SUN6I */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
rtw_suspend_lock_uninit();
|
|
|
|
DBG_871X("-rtw_drv_halt\n");
|
|
|
|
|
|
|
|
rtw_mstat_dump();
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
module_init(rtw_drv_entry);
|
|
|
|
module_exit(rtw_drv_halt);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
#ifdef CONFIG_INTEL_PROXIM
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *rtw_usb_get_sw_pointer(void)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
return rtw_sw_export;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(rtw_usb_get_sw_pointer);
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_INTEL_PROXIM */
|