162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/* Copyright(c) 2009-2012  Realtek Corporation.*/
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#include "../wifi.h"
562306a36Sopenharmony_ci#include "../core.h"
662306a36Sopenharmony_ci#include "../usb.h"
762306a36Sopenharmony_ci#include "../efuse.h"
862306a36Sopenharmony_ci#include "../base.h"
962306a36Sopenharmony_ci#include "reg.h"
1062306a36Sopenharmony_ci#include "def.h"
1162306a36Sopenharmony_ci#include "phy.h"
1262306a36Sopenharmony_ci#include "mac.h"
1362306a36Sopenharmony_ci#include "dm.h"
1462306a36Sopenharmony_ci#include "rf.h"
1562306a36Sopenharmony_ci#include "trx.h"
1662306a36Sopenharmony_ci#include "led.h"
1762306a36Sopenharmony_ci#include "hw.h"
1862306a36Sopenharmony_ci#include "../rtl8192c/fw_common.h"
1962306a36Sopenharmony_ci#include <linux/module.h>
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciMODULE_AUTHOR("Georgia		<georgia@realtek.com>");
2262306a36Sopenharmony_ciMODULE_AUTHOR("Ziv Huang	<ziv_huang@realtek.com>");
2362306a36Sopenharmony_ciMODULE_AUTHOR("Larry Finger	<Larry.Finger@lwfinger.net>");
2462306a36Sopenharmony_ciMODULE_LICENSE("GPL");
2562306a36Sopenharmony_ciMODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless");
2662306a36Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin");
2762306a36Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin");
2862306a36Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin");
2962306a36Sopenharmony_ciMODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin");
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cistatic int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
3262306a36Sopenharmony_ci{
3362306a36Sopenharmony_ci	struct rtl_priv *rtlpriv = rtl_priv(hw);
3462306a36Sopenharmony_ci	int err;
3562306a36Sopenharmony_ci	char *fw_name;
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	rtlpriv->dm.dm_initialgain_enable = true;
3862306a36Sopenharmony_ci	rtlpriv->dm.dm_flag = 0;
3962306a36Sopenharmony_ci	rtlpriv->dm.disable_framebursting = false;
4062306a36Sopenharmony_ci	rtlpriv->dm.thermalvalue = 0;
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	/* for firmware buf */
4362306a36Sopenharmony_ci	rtlpriv->rtlhal.pfirmware = vzalloc(0x4000);
4462306a36Sopenharmony_ci	if (!rtlpriv->rtlhal.pfirmware) {
4562306a36Sopenharmony_ci		pr_err("Can't alloc buffer for fw\n");
4662306a36Sopenharmony_ci		return 1;
4762306a36Sopenharmony_ci	}
4862306a36Sopenharmony_ci	if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) &&
4962306a36Sopenharmony_ci	    !IS_92C_SERIAL(rtlpriv->rtlhal.version)) {
5062306a36Sopenharmony_ci		fw_name = "rtlwifi/rtl8192cufw_A.bin";
5162306a36Sopenharmony_ci	} else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) {
5262306a36Sopenharmony_ci		fw_name = "rtlwifi/rtl8192cufw_B.bin";
5362306a36Sopenharmony_ci	} else {
5462306a36Sopenharmony_ci		fw_name = "rtlwifi/rtl8192cufw_TMSC.bin";
5562306a36Sopenharmony_ci	}
5662306a36Sopenharmony_ci	/* provide name of alternative file */
5762306a36Sopenharmony_ci	rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin";
5862306a36Sopenharmony_ci	pr_info("Loading firmware %s\n", fw_name);
5962306a36Sopenharmony_ci	rtlpriv->max_fw_size = 0x4000;
6062306a36Sopenharmony_ci	err = request_firmware_nowait(THIS_MODULE, 1,
6162306a36Sopenharmony_ci				      fw_name, rtlpriv->io.dev,
6262306a36Sopenharmony_ci				      GFP_KERNEL, hw, rtl_fw_cb);
6362306a36Sopenharmony_ci	if (err) {
6462306a36Sopenharmony_ci		vfree(rtlpriv->rtlhal.pfirmware);
6562306a36Sopenharmony_ci		rtlpriv->rtlhal.pfirmware = NULL;
6662306a36Sopenharmony_ci	}
6762306a36Sopenharmony_ci	return err;
6862306a36Sopenharmony_ci}
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cistatic void rtl92cu_deinit_sw_vars(struct ieee80211_hw *hw)
7162306a36Sopenharmony_ci{
7262306a36Sopenharmony_ci	struct rtl_priv *rtlpriv = rtl_priv(hw);
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci	if (rtlpriv->rtlhal.pfirmware) {
7562306a36Sopenharmony_ci		vfree(rtlpriv->rtlhal.pfirmware);
7662306a36Sopenharmony_ci		rtlpriv->rtlhal.pfirmware = NULL;
7762306a36Sopenharmony_ci	}
7862306a36Sopenharmony_ci}
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/* get bt coexist status */
8162306a36Sopenharmony_cistatic bool rtl92cu_get_btc_status(void)
8262306a36Sopenharmony_ci{
8362306a36Sopenharmony_ci	return false;
8462306a36Sopenharmony_ci}
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_cistatic struct rtl_hal_ops rtl8192cu_hal_ops = {
8762306a36Sopenharmony_ci	.init_sw_vars = rtl92cu_init_sw_vars,
8862306a36Sopenharmony_ci	.deinit_sw_vars = rtl92cu_deinit_sw_vars,
8962306a36Sopenharmony_ci	.read_chip_version = rtl92c_read_chip_version,
9062306a36Sopenharmony_ci	.read_eeprom_info = rtl92cu_read_eeprom_info,
9162306a36Sopenharmony_ci	.enable_interrupt = rtl92c_enable_interrupt,
9262306a36Sopenharmony_ci	.disable_interrupt = rtl92c_disable_interrupt,
9362306a36Sopenharmony_ci	.hw_init = rtl92cu_hw_init,
9462306a36Sopenharmony_ci	.hw_disable = rtl92cu_card_disable,
9562306a36Sopenharmony_ci	.set_network_type = rtl92cu_set_network_type,
9662306a36Sopenharmony_ci	.set_chk_bssid = rtl92cu_set_check_bssid,
9762306a36Sopenharmony_ci	.set_qos = rtl92c_set_qos,
9862306a36Sopenharmony_ci	.set_bcn_reg = rtl92cu_set_beacon_related_registers,
9962306a36Sopenharmony_ci	.set_bcn_intv = rtl92cu_set_beacon_interval,
10062306a36Sopenharmony_ci	.update_interrupt_mask = rtl92cu_update_interrupt_mask,
10162306a36Sopenharmony_ci	.get_hw_reg = rtl92cu_get_hw_reg,
10262306a36Sopenharmony_ci	.set_hw_reg = rtl92cu_set_hw_reg,
10362306a36Sopenharmony_ci	.update_rate_tbl = rtl92cu_update_hal_rate_tbl,
10462306a36Sopenharmony_ci	.fill_tx_desc = rtl92cu_tx_fill_desc,
10562306a36Sopenharmony_ci	.fill_fake_txdesc = rtl92cu_fill_fake_txdesc,
10662306a36Sopenharmony_ci	.fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc,
10762306a36Sopenharmony_ci	.query_rx_desc = rtl92cu_rx_query_desc,
10862306a36Sopenharmony_ci	.set_channel_access = rtl92cu_update_channel_access_setting,
10962306a36Sopenharmony_ci	.radio_onoff_checking = rtl92cu_gpio_radio_on_off_checking,
11062306a36Sopenharmony_ci	.set_bw_mode = rtl92c_phy_set_bw_mode,
11162306a36Sopenharmony_ci	.switch_channel = rtl92c_phy_sw_chnl,
11262306a36Sopenharmony_ci	.dm_watchdog = rtl92c_dm_watchdog,
11362306a36Sopenharmony_ci	.scan_operation_backup = rtl_phy_scan_operation_backup,
11462306a36Sopenharmony_ci	.set_rf_power_state = rtl92cu_phy_set_rf_power_state,
11562306a36Sopenharmony_ci	.led_control = rtl92cu_led_control,
11662306a36Sopenharmony_ci	.enable_hw_sec = rtl92cu_enable_hw_security_config,
11762306a36Sopenharmony_ci	.set_key = rtl92c_set_key,
11862306a36Sopenharmony_ci	.get_bbreg = rtl92c_phy_query_bb_reg,
11962306a36Sopenharmony_ci	.set_bbreg = rtl92c_phy_set_bb_reg,
12062306a36Sopenharmony_ci	.get_rfreg = rtl92cu_phy_query_rf_reg,
12162306a36Sopenharmony_ci	.set_rfreg = rtl92cu_phy_set_rf_reg,
12262306a36Sopenharmony_ci	.phy_rf6052_config = rtl92cu_phy_rf6052_config,
12362306a36Sopenharmony_ci	.phy_rf6052_set_cck_txpower = rtl92cu_phy_rf6052_set_cck_txpower,
12462306a36Sopenharmony_ci	.phy_rf6052_set_ofdm_txpower = rtl92cu_phy_rf6052_set_ofdm_txpower,
12562306a36Sopenharmony_ci	.config_bb_with_headerfile = _rtl92cu_phy_config_bb_with_headerfile,
12662306a36Sopenharmony_ci	.config_bb_with_pgheaderfile = _rtl92cu_phy_config_bb_with_pgheaderfile,
12762306a36Sopenharmony_ci	.phy_lc_calibrate = _rtl92cu_phy_lc_calibrate,
12862306a36Sopenharmony_ci	.phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback,
12962306a36Sopenharmony_ci	.dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
13062306a36Sopenharmony_ci	.fill_h2c_cmd = rtl92c_fill_h2c_cmd,
13162306a36Sopenharmony_ci	.get_btc_status = rtl92cu_get_btc_status,
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_cistatic struct rtl_mod_params rtl92cu_mod_params = {
13562306a36Sopenharmony_ci	.sw_crypto = 0,
13662306a36Sopenharmony_ci	.debug_level = 0,
13762306a36Sopenharmony_ci	.debug_mask = 0,
13862306a36Sopenharmony_ci};
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_cimodule_param_named(swenc, rtl92cu_mod_params.sw_crypto, bool, 0444);
14162306a36Sopenharmony_cimodule_param_named(debug_level, rtl92cu_mod_params.debug_level, int, 0644);
14262306a36Sopenharmony_cimodule_param_named(debug_mask, rtl92cu_mod_params.debug_mask, ullong, 0644);
14362306a36Sopenharmony_ciMODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
14462306a36Sopenharmony_ciMODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)");
14562306a36Sopenharmony_ciMODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)");
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_cistatic struct rtl_hal_usbint_cfg rtl92cu_interface_cfg = {
14862306a36Sopenharmony_ci	/* rx */
14962306a36Sopenharmony_ci	.in_ep_num = RTL92C_USB_BULK_IN_NUM,
15062306a36Sopenharmony_ci	.rx_urb_num = RTL92C_NUM_RX_URBS,
15162306a36Sopenharmony_ci	.rx_max_size = RTL92C_SIZE_MAX_RX_BUFFER,
15262306a36Sopenharmony_ci	.usb_rx_hdl = rtl8192cu_rx_hdl,
15362306a36Sopenharmony_ci	.usb_rx_segregate_hdl = NULL,
15462306a36Sopenharmony_ci	/* tx */
15562306a36Sopenharmony_ci	.usb_tx_cleanup = rtl8192c_tx_cleanup,
15662306a36Sopenharmony_ci	.usb_tx_post_hdl = rtl8192c_tx_post_hdl,
15762306a36Sopenharmony_ci	.usb_tx_aggregate_hdl = rtl8192c_tx_aggregate_hdl,
15862306a36Sopenharmony_ci	/* endpoint mapping */
15962306a36Sopenharmony_ci	.usb_endpoint_mapping = rtl8192cu_endpoint_mapping,
16062306a36Sopenharmony_ci	.usb_mq_to_hwq = rtl8192cu_mq_to_hwq,
16162306a36Sopenharmony_ci};
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_cistatic struct rtl_hal_cfg rtl92cu_hal_cfg = {
16462306a36Sopenharmony_ci	.name = "rtl92c_usb",
16562306a36Sopenharmony_ci	.ops = &rtl8192cu_hal_ops,
16662306a36Sopenharmony_ci	.mod_params = &rtl92cu_mod_params,
16762306a36Sopenharmony_ci	.usb_interface_cfg = &rtl92cu_interface_cfg,
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci	.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
17062306a36Sopenharmony_ci	.maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN,
17162306a36Sopenharmony_ci	.maps[SYS_CLK] = REG_SYS_CLKR,
17262306a36Sopenharmony_ci	.maps[MAC_RCR_AM] = AM,
17362306a36Sopenharmony_ci	.maps[MAC_RCR_AB] = AB,
17462306a36Sopenharmony_ci	.maps[MAC_RCR_ACRC32] = ACRC32,
17562306a36Sopenharmony_ci	.maps[MAC_RCR_ACF] = ACF,
17662306a36Sopenharmony_ci	.maps[MAC_RCR_AAP] = AAP,
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci	.maps[EFUSE_TEST] = REG_EFUSE_TEST,
17962306a36Sopenharmony_ci	.maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
18062306a36Sopenharmony_ci	.maps[EFUSE_CLK] = 0,
18162306a36Sopenharmony_ci	.maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL,
18262306a36Sopenharmony_ci	.maps[EFUSE_PWC_EV12V] = PWC_EV12V,
18362306a36Sopenharmony_ci	.maps[EFUSE_FEN_ELDR] = FEN_ELDR,
18462306a36Sopenharmony_ci	.maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN,
18562306a36Sopenharmony_ci	.maps[EFUSE_ANA8M] = EFUSE_ANA8M,
18662306a36Sopenharmony_ci	.maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE,
18762306a36Sopenharmony_ci	.maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION,
18862306a36Sopenharmony_ci	.maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN,
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci	.maps[RWCAM] = REG_CAMCMD,
19162306a36Sopenharmony_ci	.maps[WCAMI] = REG_CAMWRITE,
19262306a36Sopenharmony_ci	.maps[RCAMO] = REG_CAMREAD,
19362306a36Sopenharmony_ci	.maps[CAMDBG] = REG_CAMDBG,
19462306a36Sopenharmony_ci	.maps[SECR] = REG_SECCFG,
19562306a36Sopenharmony_ci	.maps[SEC_CAM_NONE] = CAM_NONE,
19662306a36Sopenharmony_ci	.maps[SEC_CAM_WEP40] = CAM_WEP40,
19762306a36Sopenharmony_ci	.maps[SEC_CAM_TKIP] = CAM_TKIP,
19862306a36Sopenharmony_ci	.maps[SEC_CAM_AES] = CAM_AES,
19962306a36Sopenharmony_ci	.maps[SEC_CAM_WEP104] = CAM_WEP104,
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6,
20262306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5,
20362306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4,
20462306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3,
20562306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2,
20662306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1,
20762306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8,
20862306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7,
20962306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6,
21062306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5,
21162306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4,
21262306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3,
21362306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2,
21462306a36Sopenharmony_ci	.maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1,
21562306a36Sopenharmony_ci	.maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,
21662306a36Sopenharmony_ci	.maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci	.maps[RTL_IMR_TXFOVW] = IMR_TXFOVW,
21962306a36Sopenharmony_ci	.maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT,
22062306a36Sopenharmony_ci	.maps[RTL_IMR_BCNINT] = IMR_BCNINT,
22162306a36Sopenharmony_ci	.maps[RTL_IMR_RXFOVW] = IMR_RXFOVW,
22262306a36Sopenharmony_ci	.maps[RTL_IMR_RDU] = IMR_RDU,
22362306a36Sopenharmony_ci	.maps[RTL_IMR_ATIMEND] = IMR_ATIMEND,
22462306a36Sopenharmony_ci	.maps[RTL_IMR_BDOK] = IMR_BDOK,
22562306a36Sopenharmony_ci	.maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK,
22662306a36Sopenharmony_ci	.maps[RTL_IMR_TBDER] = IMR_TBDER,
22762306a36Sopenharmony_ci	.maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK,
22862306a36Sopenharmony_ci	.maps[RTL_IMR_TBDOK] = IMR_TBDOK,
22962306a36Sopenharmony_ci	.maps[RTL_IMR_BKDOK] = IMR_BKDOK,
23062306a36Sopenharmony_ci	.maps[RTL_IMR_BEDOK] = IMR_BEDOK,
23162306a36Sopenharmony_ci	.maps[RTL_IMR_VIDOK] = IMR_VIDOK,
23262306a36Sopenharmony_ci	.maps[RTL_IMR_VODOK] = IMR_VODOK,
23362306a36Sopenharmony_ci	.maps[RTL_IMR_ROK] = IMR_ROK,
23462306a36Sopenharmony_ci	.maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER),
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci	.maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M,
23762306a36Sopenharmony_ci	.maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M,
23862306a36Sopenharmony_ci	.maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M,
23962306a36Sopenharmony_ci	.maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M,
24062306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M,
24162306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M,
24262306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M,
24362306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M,
24462306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M,
24562306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M,
24662306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M,
24762306a36Sopenharmony_ci	.maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M,
24862306a36Sopenharmony_ci	.maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7,
24962306a36Sopenharmony_ci	.maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15,
25062306a36Sopenharmony_ci};
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci#define USB_VENDOR_ID_REALTEK		0x0bda
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci/* 2010-10-19 DID_USB_V3.4 */
25562306a36Sopenharmony_cistatic const struct usb_device_id rtl8192c_usb_ids[] = {
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	/*=== Realtek demoboard ===*/
25862306a36Sopenharmony_ci	/* Default ID */
25962306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8191, rtl92cu_hal_cfg)},
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	/****** 8188CU ********/
26262306a36Sopenharmony_ci	/* RTL8188CTV */
26362306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x018a, rtl92cu_hal_cfg)},
26462306a36Sopenharmony_ci	/* 8188CE-VAU USB minCard */
26562306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8170, rtl92cu_hal_cfg)},
26662306a36Sopenharmony_ci	/* 8188cu 1*1 dongle */
26762306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8176, rtl92cu_hal_cfg)},
26862306a36Sopenharmony_ci	/* 8188cu 1*1 dongle, (b/g mode only) */
26962306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)},
27062306a36Sopenharmony_ci	/* 8188cu Slim Solo */
27162306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817a, rtl92cu_hal_cfg)},
27262306a36Sopenharmony_ci	/* 8188cu Slim Combo */
27362306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)},
27462306a36Sopenharmony_ci	/* 8188RU High-power USB Dongle */
27562306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817d, rtl92cu_hal_cfg)},
27662306a36Sopenharmony_ci	/* 8188CE-VAU USB minCard (b/g mode only) */
27762306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817e, rtl92cu_hal_cfg)},
27862306a36Sopenharmony_ci	/* 8188RU in Alfa AWUS036NHR */
27962306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)},
28062306a36Sopenharmony_ci	/* RTL8188CUS-VL */
28162306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x818a, rtl92cu_hal_cfg)},
28262306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x819a, rtl92cu_hal_cfg)},
28362306a36Sopenharmony_ci	/* 8188 Combo for BC4 */
28462306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)},
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci	/****** 8192CU ********/
28762306a36Sopenharmony_ci	/* 8192cu 2*2 */
28862306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8178, rtl92cu_hal_cfg)},
28962306a36Sopenharmony_ci	/* 8192CE-VAU USB minCard */
29062306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x817c, rtl92cu_hal_cfg)},
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci	/*=== Customer ID ===*/
29362306a36Sopenharmony_ci	/****** 8188CU ********/
29462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/
29562306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x11f2, rtl92cu_hal_cfg)}, /*Belkin - ISY*/
29662306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/
29762306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
29862306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
29962306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
30062306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/
30162306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
30262306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
30362306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
30462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
30562306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */
30662306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/
30762306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/
30862306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/
30962306a36Sopenharmony_ci	/* HP - Lite-On ,8188CUS Slim Combo */
31062306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)},
31162306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */
31262306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x3308, rtl92cu_hal_cfg)}, /*D-Link - Alpha*/
31362306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0x4902, rtl92cu_hal_cfg)}, /*Planex - Etop*/
31462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xab2a, rtl92cu_hal_cfg)}, /*Planex - Abocom*/
31562306a36Sopenharmony_ci	/*SW-WF02-AD15 -Abocom*/
31662306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xab2e, rtl92cu_hal_cfg)},
31762306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xed17, rtl92cu_hal_cfg)}, /*PCI - Edimax*/
31862306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x20f4, 0x648b, rtl92cu_hal_cfg)}, /*TRENDnet - Cameo*/
31962306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x7392, 0x7811, rtl92cu_hal_cfg)}, /*Edimax - Edimax*/
32062306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x13d3, 0x3358, rtl92cu_hal_cfg)}, /*Azwave 8188CE-VAU*/
32162306a36Sopenharmony_ci	/* Russian customer -Azwave (8188CE-VAU  b/g mode only) */
32262306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x13d3, 0x3359, rtl92cu_hal_cfg)},
32362306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x4855, 0x0090, rtl92cu_hal_cfg)}, /* Feixun */
32462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x4855, 0x0091, rtl92cu_hal_cfg)}, /* NetweeN-Feixun */
32562306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x9846, 0x9041, rtl92cu_hal_cfg)}, /* Netgear Cameo */
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci	/****** 8188 RU ********/
32862306a36Sopenharmony_ci	/* Netcore */
32962306a36Sopenharmony_ci	{RTL_USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x317f, rtl92cu_hal_cfg)},
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci	/****** 8188CUS Slim Solo********/
33262306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaff7, rtl92cu_hal_cfg)}, /*Xavi*/
33362306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaff9, rtl92cu_hal_cfg)}, /*Xavi*/
33462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaffa, rtl92cu_hal_cfg)}, /*Xavi*/
33562306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9042, rtl92cu_hal_cfg)}, /*On Netwrks N150MA*/
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_ci	/****** 8188CUS Slim Combo ********/
33862306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaff8, rtl92cu_hal_cfg)}, /*Xavi*/
33962306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaffb, rtl92cu_hal_cfg)}, /*Xavi*/
34062306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x04f2, 0xaffc, rtl92cu_hal_cfg)}, /*Xavi*/
34162306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0x1201, rtl92cu_hal_cfg)}, /*Planex-Vencer*/
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci	/****** 8192CU ********/
34462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x1004, rtl92cu_hal_cfg)}, /*Belcom-SurfN300*/
34562306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x2102, rtl92cu_hal_cfg)}, /*Belcom-Sercomm*/
34662306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x050d, 0x2103, rtl92cu_hal_cfg)}, /*Belcom-Edimax*/
34762306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0586, 0x341f, rtl92cu_hal_cfg)}, /*Zyxel -Abocom*/
34862306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/
34962306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
35062306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
35162306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/
35262306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
35362306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
35462306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/
35562306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/
35662306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
35762306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
35862306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
35962306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2001, 0x330d, rtl92cu_hal_cfg)}, /*D-Link DWA-131 */
36062306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
36162306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
36262306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
36362306a36Sopenharmony_ci	{RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/
36462306a36Sopenharmony_ci	{}
36562306a36Sopenharmony_ci};
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ciMODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids);
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_cistatic int rtl8192cu_probe(struct usb_interface *intf,
37062306a36Sopenharmony_ci			   const struct usb_device_id *id)
37162306a36Sopenharmony_ci{
37262306a36Sopenharmony_ci	return rtl_usb_probe(intf, id, &rtl92cu_hal_cfg);
37362306a36Sopenharmony_ci}
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_cistatic struct usb_driver rtl8192cu_driver = {
37662306a36Sopenharmony_ci	.name = "rtl8192cu",
37762306a36Sopenharmony_ci	.probe = rtl8192cu_probe,
37862306a36Sopenharmony_ci	.disconnect = rtl_usb_disconnect,
37962306a36Sopenharmony_ci	.id_table = rtl8192c_usb_ids,
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci#ifdef CONFIG_PM
38262306a36Sopenharmony_ci	/* .suspend = rtl_usb_suspend, */
38362306a36Sopenharmony_ci	/* .resume = rtl_usb_resume, */
38462306a36Sopenharmony_ci	/* .reset_resume = rtl8192c_resume, */
38562306a36Sopenharmony_ci#endif /* CONFIG_PM */
38662306a36Sopenharmony_ci	.disable_hub_initiated_lpm = 1,
38762306a36Sopenharmony_ci};
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_cimodule_usb_driver(rtl8192cu_driver);
390