Commit 44bc17f7 authored by Chin-Yen Lee's avatar Chin-Yen Lee Committed by Kalle Valo

rtw88: support wowlan feature for 8822c

Wake on WLAN(wowlan) is a feature which allows devices
to be woken up from suspend state through wlan events.

When user enables wowlan feature and then let the device
enter suspend state, wowlan firmware will be loaded by
the driver and periodically monitors wifi packets.
Power consumption of wifi chip will be reduced in this
state.

If wowlan firmware detects that specific wlan event
happens, it will issue wakeup signal to trigger resume
process. Driver will load normal firmware and let wifi
chip return to the original state.

Currently supported wlan events include receiving magic packet,
rekey packet and deauth packet, and disconnecting from AP.
Signed-off-by: default avatarChin-Yen Lee <timlee@realtek.com>
Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent c8e5695e
...@@ -15,6 +15,7 @@ rtw88-y += main.o \ ...@@ -15,6 +15,7 @@ rtw88-y += main.o \
ps.o \ ps.o \
sec.o \ sec.o \
bf.o \ bf.o \
wow.o \
regd.o regd.o
rtw88-$(CONFIG_RTW88_8822BE) += rtw8822b.o rtw8822b_table.o rtw88-$(CONFIG_RTW88_8822BE) += rtw8822b.o rtw8822b_table.o
......
...@@ -18,6 +18,7 @@ enum rtw_debug_mask { ...@@ -18,6 +18,7 @@ enum rtw_debug_mask {
RTW_DBG_DEBUGFS = 0x00000200, RTW_DBG_DEBUGFS = 0x00000200,
RTW_DBG_PS = 0x00000400, RTW_DBG_PS = 0x00000400,
RTW_DBG_BF = 0x00000800, RTW_DBG_BF = 0x00000800,
RTW_DBG_WOW = 0x00001000,
RTW_DBG_ALL = 0xffffffff RTW_DBG_ALL = 0xffffffff
}; };
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "sec.h" #include "sec.h"
#include "debug.h" #include "debug.h"
#include "util.h" #include "util.h"
#include "wow.h"
static void rtw_fw_c2h_cmd_handle_ext(struct rtw_dev *rtwdev, static void rtw_fw_c2h_cmd_handle_ext(struct rtw_dev *rtwdev,
struct sk_buff *skb) struct sk_buff *skb)
...@@ -482,6 +483,91 @@ void rtw_fw_set_pwr_mode(struct rtw_dev *rtwdev) ...@@ -482,6 +483,91 @@ void rtw_fw_set_pwr_mode(struct rtw_dev *rtwdev)
rtw_fw_send_h2c_command(rtwdev, h2c_pkt); rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
} }
void rtw_fw_set_keep_alive_cmd(struct rtw_dev *rtwdev, bool enable)
{
u8 h2c_pkt[H2C_PKT_SIZE] = {0};
struct rtw_fw_wow_keep_alive_para mode = {
.adopt = true,
.pkt_type = KEEP_ALIVE_NULL_PKT,
.period = 5,
};
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_KEEP_ALIVE);
SET_KEEP_ALIVE_ENABLE(h2c_pkt, enable);
SET_KEEP_ALIVE_ADOPT(h2c_pkt, mode.adopt);
SET_KEEP_ALIVE_PKT_TYPE(h2c_pkt, mode.pkt_type);
SET_KEEP_ALIVE_CHECK_PERIOD(h2c_pkt, mode.period);
rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
}
void rtw_fw_set_disconnect_decision_cmd(struct rtw_dev *rtwdev, bool enable)
{
struct rtw_wow_param *rtw_wow = &rtwdev->wow;
u8 h2c_pkt[H2C_PKT_SIZE] = {0};
struct rtw_fw_wow_disconnect_para mode = {
.adopt = true,
.period = 30,
.retry_count = 5,
};
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_DISCONNECT_DECISION);
if (test_bit(RTW_WOW_FLAG_EN_DISCONNECT, rtw_wow->flags)) {
SET_DISCONNECT_DECISION_ENABLE(h2c_pkt, enable);
SET_DISCONNECT_DECISION_ADOPT(h2c_pkt, mode.adopt);
SET_DISCONNECT_DECISION_CHECK_PERIOD(h2c_pkt, mode.period);
SET_DISCONNECT_DECISION_TRY_PKT_NUM(h2c_pkt, mode.retry_count);
}
rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
}
void rtw_fw_set_wowlan_ctrl_cmd(struct rtw_dev *rtwdev, bool enable)
{
struct rtw_wow_param *rtw_wow = &rtwdev->wow;
u8 h2c_pkt[H2C_PKT_SIZE] = {0};
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_WOWLAN);
SET_WOWLAN_FUNC_ENABLE(h2c_pkt, enable);
if (rtw_wow_mgd_linked(rtwdev)) {
if (test_bit(RTW_WOW_FLAG_EN_MAGIC_PKT, rtw_wow->flags))
SET_WOWLAN_MAGIC_PKT_ENABLE(h2c_pkt, enable);
if (test_bit(RTW_WOW_FLAG_EN_DISCONNECT, rtw_wow->flags))
SET_WOWLAN_DEAUTH_WAKEUP_ENABLE(h2c_pkt, enable);
if (test_bit(RTW_WOW_FLAG_EN_REKEY_PKT, rtw_wow->flags))
SET_WOWLAN_REKEY_WAKEUP_ENABLE(h2c_pkt, enable);
}
rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
}
void rtw_fw_set_aoac_global_info_cmd(struct rtw_dev *rtwdev,
u8 pairwise_key_enc,
u8 group_key_enc)
{
u8 h2c_pkt[H2C_PKT_SIZE] = {0};
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_AOAC_GLOBAL_INFO);
SET_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(h2c_pkt, pairwise_key_enc);
SET_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(h2c_pkt, group_key_enc);
rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
}
void rtw_fw_set_remote_wake_ctrl_cmd(struct rtw_dev *rtwdev, bool enable)
{
u8 h2c_pkt[H2C_PKT_SIZE] = {0};
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_REMOTE_WAKE_CTRL);
SET_REMOTE_WAKECTRL_ENABLE(h2c_pkt, enable);
rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
}
static u8 rtw_get_rsvd_page_location(struct rtw_dev *rtwdev, static u8 rtw_get_rsvd_page_location(struct rtw_dev *rtwdev,
enum rtw_rsvd_packet_type type) enum rtw_rsvd_packet_type type)
{ {
......
...@@ -100,6 +100,23 @@ struct rtw_rsvd_page { ...@@ -100,6 +100,23 @@ struct rtw_rsvd_page {
bool add_txdesc; bool add_txdesc;
}; };
enum rtw_keep_alive_pkt_type {
KEEP_ALIVE_NULL_PKT = 0,
KEEP_ALIVE_ARP_RSP = 1,
};
struct rtw_fw_wow_keep_alive_para {
bool adopt;
u8 pkt_type;
u8 period; /* unit: sec */
};
struct rtw_fw_wow_disconnect_para {
bool adopt;
u8 period; /* unit: sec */
u8 retry_count;
};
struct rtw_fw_hdr { struct rtw_fw_hdr {
__le16 signature; __le16 signature;
u8 category; u8 category;
...@@ -198,6 +215,11 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id) ...@@ -198,6 +215,11 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id)
#define H2C_CMD_QUERY_BT_MP_INFO 0x67 #define H2C_CMD_QUERY_BT_MP_INFO 0x67
#define H2C_CMD_BT_WIFI_CONTROL 0x69 #define H2C_CMD_BT_WIFI_CONTROL 0x69
#define H2C_CMD_KEEP_ALIVE 0x03
#define H2C_CMD_DISCONNECT_DECISION 0x04
#define H2C_CMD_WOWLAN 0x80
#define H2C_CMD_REMOTE_WAKE_CTRL 0x81
#define H2C_CMD_AOAC_GLOBAL_INFO 0x82
#define SET_H2C_CMD_ID_CLASS(h2c_pkt, value) \ #define SET_H2C_CMD_ID_CLASS(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(7, 0)) le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(7, 0))
...@@ -301,6 +323,45 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id) ...@@ -301,6 +323,45 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id)
#define SET_BT_WIFI_CONTROL_DATA5(h2c_pkt, value) \ #define SET_BT_WIFI_CONTROL_DATA5(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x01, value, GENMASK(23, 16)) le32p_replace_bits((__le32 *)(h2c_pkt) + 0x01, value, GENMASK(23, 16))
#define SET_KEEP_ALIVE_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(8))
#define SET_KEEP_ALIVE_ADOPT(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(9))
#define SET_KEEP_ALIVE_PKT_TYPE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(10))
#define SET_KEEP_ALIVE_CHECK_PERIOD(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(23, 16))
#define SET_DISCONNECT_DECISION_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(8))
#define SET_DISCONNECT_DECISION_ADOPT(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(9))
#define SET_DISCONNECT_DECISION_CHECK_PERIOD(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(23, 16))
#define SET_DISCONNECT_DECISION_TRY_PKT_NUM(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(31, 24))
#define SET_WOWLAN_FUNC_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(8))
#define SET_WOWLAN_MAGIC_PKT_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(10))
#define SET_WOWLAN_UNICAST_PKT_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(11))
#define SET_WOWLAN_REKEY_WAKEUP_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(14))
#define SET_WOWLAN_DEAUTH_WAKEUP_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(15))
#define SET_REMOTE_WAKECTRL_ENABLE(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(8))
#define SET_REMOTE_WAKE_CTRL_NLO_OFFLOAD_EN(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, BIT(12))
#define SET_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(15, 8))
#define SET_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(h2c_pkt, value) \
le32p_replace_bits((__le32 *)(h2c_pkt) + 0x00, value, GENMASK(23, 16))
static inline struct rtw_c2h_cmd *get_c2h_from_skb(struct sk_buff *skb) static inline struct rtw_c2h_cmd *get_c2h_from_skb(struct sk_buff *skb)
{ {
u32 pkt_offset; u32 pkt_offset;
...@@ -340,4 +401,12 @@ int rtw_fw_download_rsvd_page(struct rtw_dev *rtwdev, ...@@ -340,4 +401,12 @@ int rtw_fw_download_rsvd_page(struct rtw_dev *rtwdev,
void rtw_send_rsvd_page_h2c(struct rtw_dev *rtwdev); void rtw_send_rsvd_page_h2c(struct rtw_dev *rtwdev);
int rtw_dump_drv_rsvd_page(struct rtw_dev *rtwdev, int rtw_dump_drv_rsvd_page(struct rtw_dev *rtwdev,
u32 offset, u32 size, u32 *buf); u32 offset, u32 size, u32 *buf);
void rtw_fw_set_remote_wake_ctrl_cmd(struct rtw_dev *rtwdev, bool enable);
void rtw_fw_set_wowlan_ctrl_cmd(struct rtw_dev *rtwdev, bool enable);
void rtw_fw_set_keep_alive_cmd(struct rtw_dev *rtwdev, bool enable);
void rtw_fw_set_disconnect_decision_cmd(struct rtw_dev *rtwdev, bool enable);
void rtw_fw_set_aoac_global_info_cmd(struct rtw_dev *rtwdev,
u8 pairwise_key_enc,
u8 group_key_enc);
#endif #endif
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "reg.h" #include "reg.h"
#include "bf.h" #include "bf.h"
#include "debug.h" #include "debug.h"
#include "wow.h"
static void rtw_ops_tx(struct ieee80211_hw *hw, static void rtw_ops_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control, struct ieee80211_tx_control *control,
...@@ -735,6 +736,44 @@ static int rtw_ops_set_bitrate_mask(struct ieee80211_hw *hw, ...@@ -735,6 +736,44 @@ static int rtw_ops_set_bitrate_mask(struct ieee80211_hw *hw,
return 0; return 0;
} }
#ifdef CONFIG_PM
static int rtw_ops_suspend(struct ieee80211_hw *hw,
struct cfg80211_wowlan *wowlan)
{
struct rtw_dev *rtwdev = hw->priv;
int ret;
mutex_lock(&rtwdev->mutex);
ret = rtw_wow_suspend(rtwdev, wowlan);
if (ret)
rtw_err(rtwdev, "failed to suspend for wow %d\n", ret);
mutex_unlock(&rtwdev->mutex);
return ret ? 1 : 0;
}
static int rtw_ops_resume(struct ieee80211_hw *hw)
{
struct rtw_dev *rtwdev = hw->priv;
int ret;
mutex_lock(&rtwdev->mutex);
ret = rtw_wow_resume(rtwdev);
if (ret)
rtw_err(rtwdev, "failed to resume for wow %d\n", ret);
mutex_unlock(&rtwdev->mutex);
return ret ? 1 : 0;
}
static void rtw_ops_set_wakeup(struct ieee80211_hw *hw, bool enabled)
{
struct rtw_dev *rtwdev = hw->priv;
device_set_wakeup_enable(rtwdev->dev, enabled);
}
#endif
const struct ieee80211_ops rtw_ops = { const struct ieee80211_ops rtw_ops = {
.tx = rtw_ops_tx, .tx = rtw_ops_tx,
.wake_tx_queue = rtw_ops_wake_tx_queue, .wake_tx_queue = rtw_ops_wake_tx_queue,
...@@ -757,5 +796,10 @@ const struct ieee80211_ops rtw_ops = { ...@@ -757,5 +796,10 @@ const struct ieee80211_ops rtw_ops = {
.sta_statistics = rtw_ops_sta_statistics, .sta_statistics = rtw_ops_sta_statistics,
.flush = rtw_ops_flush, .flush = rtw_ops_flush,
.set_bitrate_mask = rtw_ops_set_bitrate_mask, .set_bitrate_mask = rtw_ops_set_bitrate_mask,
#ifdef CONFIG_PM
.suspend = rtw_ops_suspend,
.resume = rtw_ops_resume,
.set_wakeup = rtw_ops_set_wakeup,
#endif
}; };
EXPORT_SYMBOL(rtw_ops); EXPORT_SYMBOL(rtw_ops);
...@@ -1493,6 +1493,9 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw) ...@@ -1493,6 +1493,9 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
#ifdef CONFIG_PM
hw->wiphy->wowlan = rtwdev->chip->wowlan_stub;
#endif
rtw_set_supported_band(hw, rtwdev->chip); rtw_set_supported_band(hw, rtwdev->chip);
SET_IEEE80211_PERM_ADDR(hw, rtwdev->efuse.addr); SET_IEEE80211_PERM_ADDR(hw, rtwdev->efuse.addr);
......
...@@ -342,6 +342,7 @@ enum rtw_flags { ...@@ -342,6 +342,7 @@ enum rtw_flags {
RTW_FLAG_LEISURE_PS_DEEP, RTW_FLAG_LEISURE_PS_DEEP,
RTW_FLAG_DIG_DISABLE, RTW_FLAG_DIG_DISABLE,
RTW_FLAG_BUSY_TRAFFIC, RTW_FLAG_BUSY_TRAFFIC,
RTW_FLAG_WOWLAN,
NUM_OF_RTW_FLAGS, NUM_OF_RTW_FLAGS,
}; };
...@@ -372,6 +373,15 @@ enum rtw_snr { ...@@ -372,6 +373,15 @@ enum rtw_snr {
RTW_SNR_NUM RTW_SNR_NUM
}; };
enum rtw_wow_flags {
RTW_WOW_FLAG_EN_MAGIC_PKT,
RTW_WOW_FLAG_EN_REKEY_PKT,
RTW_WOW_FLAG_EN_DISCONNECT,
/* keep it last */
RTW_WOW_FLAG_MAX,
};
/* the power index is represented by differences, which cck-1s & ht40-1s are /* the power index is represented by differences, which cck-1s & ht40-1s are
* the base values, so for 1s's differences, there are only ht20 & ofdm * the base values, so for 1s's differences, there are only ht20 & ofdm
*/ */
...@@ -907,6 +917,12 @@ struct rtw_intf_phy_para { ...@@ -907,6 +917,12 @@ struct rtw_intf_phy_para {
u16 platform; u16 platform;
}; };
struct rtw_wow_param {
struct ieee80211_vif *wow_vif;
DECLARE_BITMAP(flags, RTW_WOW_FLAG_MAX);
u8 txpause;
};
struct rtw_intf_phy_para_table { struct rtw_intf_phy_para_table {
struct rtw_intf_phy_para *usb2_para; struct rtw_intf_phy_para *usb2_para;
struct rtw_intf_phy_para *usb3_para; struct rtw_intf_phy_para *usb3_para;
...@@ -1036,6 +1052,7 @@ struct rtw_chip_info { ...@@ -1036,6 +1052,7 @@ struct rtw_chip_info {
u8 bfer_mu_max_num; u8 bfer_mu_max_num;
const char *wow_fw_name; const char *wow_fw_name;
const struct wiphy_wowlan_support *wowlan_stub;
/* coex paras */ /* coex paras */
u32 coex_para_ver; u32 coex_para_ver;
...@@ -1589,6 +1606,7 @@ struct rtw_dev { ...@@ -1589,6 +1606,7 @@ struct rtw_dev {
u8 mp_mode; u8 mp_mode;
struct rtw_fw_state wow_fw; struct rtw_fw_state wow_fw;
struct rtw_wow_param wow;
/* hci related data, must be last */ /* hci related data, must be last */
u8 priv[0] __aligned(sizeof(void *)); u8 priv[0] __aligned(sizeof(void *));
......
...@@ -1282,6 +1282,23 @@ static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev) ...@@ -1282,6 +1282,23 @@ static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev)
rtw_pci_link_cfg(rtwdev); rtw_pci_link_cfg(rtwdev);
} }
#ifdef CONFIG_PM
static int rtw_pci_suspend(struct device *dev)
{
return 0;
}
static int rtw_pci_resume(struct device *dev)
{
return 0;
}
static SIMPLE_DEV_PM_OPS(rtw_pm_ops, rtw_pci_suspend, rtw_pci_resume);
#define RTW_PM_OPS (&rtw_pm_ops)
#else
#define RTW_PM_OPS NULL
#endif
static int rtw_pci_claim(struct rtw_dev *rtwdev, struct pci_dev *pdev) static int rtw_pci_claim(struct rtw_dev *rtwdev, struct pci_dev *pdev)
{ {
int ret; int ret;
...@@ -1508,6 +1525,7 @@ static struct pci_driver rtw_pci_driver = { ...@@ -1508,6 +1525,7 @@ static struct pci_driver rtw_pci_driver = {
.id_table = rtw_pci_id_table, .id_table = rtw_pci_id_table,
.probe = rtw_pci_probe, .probe = rtw_pci_probe,
.remove = rtw_pci_remove, .remove = rtw_pci_remove,
.driver.pm = RTW_PM_OPS,
}; };
module_pci_driver(rtw_pci_driver); module_pci_driver(rtw_pci_driver);
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#define BIT_FEN_CPUEN BIT(2) #define BIT_FEN_CPUEN BIT(2)
#define BIT_FEN_BB_GLB_RST BIT(1) #define BIT_FEN_BB_GLB_RST BIT(1)
#define BIT_FEN_BB_RSTB BIT(0) #define BIT_FEN_BB_RSTB BIT(0)
#define BIT_R_DIS_PRST BIT(6)
#define BIT_WLOCK_1C_B6 BIT(5)
#define REG_SYS_PW_CTRL 0x0004 #define REG_SYS_PW_CTRL 0x0004
#define REG_SYS_CLK_CTRL 0x0008 #define REG_SYS_CLK_CTRL 0x0008
#define BIT_CPU_CLK_EN BIT(14) #define BIT_CPU_CLK_EN BIT(14)
...@@ -160,8 +162,12 @@ ...@@ -160,8 +162,12 @@
#define REG_CR 0x0100 #define REG_CR 0x0100
#define REG_TRXFF_BNDY 0x0114 #define REG_TRXFF_BNDY 0x0114
#define REG_RXFF_BNDY 0x011C #define REG_RXFF_BNDY 0x011C
#define REG_FE1IMR 0x0120
#define BIT_FS_RXDONE BIT(16)
#define REG_PKTBUF_DBG_CTRL 0x0140 #define REG_PKTBUF_DBG_CTRL 0x0140
#define REG_C2HEVT 0x01A0 #define REG_C2HEVT 0x01A0
#define REG_MCUTST_II 0x01C4
#define REG_WOWLAN_WAKE_REASON 0x01C7
#define REG_HMETFR 0x01CC #define REG_HMETFR 0x01CC
#define REG_HMEBOX0 0x01D0 #define REG_HMEBOX0 0x01D0
#define REG_HMEBOX1 0x01D4 #define REG_HMEBOX1 0x01D4
...@@ -192,11 +198,18 @@ ...@@ -192,11 +198,18 @@
#define REG_H2C_TAIL 0x0248 #define REG_H2C_TAIL 0x0248
#define REG_H2C_READ_ADDR 0x024C #define REG_H2C_READ_ADDR 0x024C
#define REG_H2C_INFO 0x0254 #define REG_H2C_INFO 0x0254
#define REG_RXPKT_NUM 0x0284
#define BIT_RXDMA_REQ BIT(19)
#define BIT_RW_RELEASE BIT(18)
#define BIT_RXDMA_IDLE BIT(17)
#define REG_RXPKTNUM 0x02B0
#define REG_INT_MIG 0x0304 #define REG_INT_MIG 0x0304
#define REG_HCI_MIX_CFG 0x03FC #define REG_HCI_MIX_CFG 0x03FC
#define BIT_PCIE_EMAC_PDN_AUX_TO_FAST_CLK BIT(26) #define BIT_PCIE_EMAC_PDN_AUX_TO_FAST_CLK BIT(26)
#define REG_BCNQ_INFO 0x0418
#define BIT_MGQ_CPU_EMPTY BIT(24)
#define REG_FWHW_TXQ_CTRL 0x0420 #define REG_FWHW_TXQ_CTRL 0x0420
#define BIT_EN_BCNQ_DL BIT(22) #define BIT_EN_BCNQ_DL BIT(22)
#define BIT_EN_WR_FREE_TAIL BIT(20) #define BIT_EN_WR_FREE_TAIL BIT(20)
......
...@@ -4060,6 +4060,13 @@ static const struct rtw_pwr_track_tbl rtw8822c_rtw_pwr_track_tbl = { ...@@ -4060,6 +4060,13 @@ static const struct rtw_pwr_track_tbl rtw8822c_rtw_pwr_track_tbl = {
.pwrtrk_2g_ccka_p = rtw8822c_pwrtrk_2g_cck_a_p, .pwrtrk_2g_ccka_p = rtw8822c_pwrtrk_2g_cck_a_p,
}; };
#ifdef CONFIG_PM
static const struct wiphy_wowlan_support rtw_wowlan_stub_8822c = {
.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_GTK_REKEY_FAILURE |
WIPHY_WOWLAN_DISCONNECT | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
};
#endif
struct rtw_chip_info rtw8822c_hw_spec = { struct rtw_chip_info rtw8822c_hw_spec = {
.ops = &rtw8822c_ops, .ops = &rtw8822c_ops,
.id = RTW_CHIP_TYPE_8822C, .id = RTW_CHIP_TYPE_8822C,
...@@ -4106,6 +4113,10 @@ struct rtw_chip_info rtw8822c_hw_spec = { ...@@ -4106,6 +4113,10 @@ struct rtw_chip_info rtw8822c_hw_spec = {
.bfer_su_max_num = 2, .bfer_su_max_num = 2,
.bfer_mu_max_num = 1, .bfer_mu_max_num = 1,
#ifdef CONFIG_PM
.wow_fw_name = "rtw88/rtw8822c_wow_fw.bin",
.wowlan_stub = &rtw_wowlan_stub_8822c,
#endif
.coex_para_ver = 0x19062706, .coex_para_ver = 0x19062706,
.bt_desired_ver = 0x6, .bt_desired_ver = 0x6,
.scbd_support = true, .scbd_support = true,
...@@ -4135,3 +4146,4 @@ struct rtw_chip_info rtw8822c_hw_spec = { ...@@ -4135,3 +4146,4 @@ struct rtw_chip_info rtw8822c_hw_spec = {
EXPORT_SYMBOL(rtw8822c_hw_spec); EXPORT_SYMBOL(rtw8822c_hw_spec);
MODULE_FIRMWARE("rtw88/rtw8822c_fw.bin"); MODULE_FIRMWARE("rtw88/rtw8822c_fw.bin");
MODULE_FIRMWARE("rtw88/rtw8822c_wow_fw.bin");
...@@ -15,6 +15,8 @@ struct rtw_dev; ...@@ -15,6 +15,8 @@ struct rtw_dev;
IEEE80211_IFACE_ITER_NORMAL, iterator, data) IEEE80211_IFACE_ITER_NORMAL, iterator, data)
#define rtw_iterate_stas_atomic(rtwdev, iterator, data) \ #define rtw_iterate_stas_atomic(rtwdev, iterator, data) \
ieee80211_iterate_stations_atomic(rtwdev->hw, iterator, data) ieee80211_iterate_stations_atomic(rtwdev->hw, iterator, data)
#define rtw_iterate_keys(rtwdev, vif, iterator, data) \
ieee80211_iter_keys(rtwdev->hw, vif, iterator, data)
static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr) static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr)
{ {
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* Copyright(c) 2018-2019 Realtek Corporation
*/
#ifndef __RTW_WOW_H__
#define __RTW_WOW_H__
enum rtw_wake_reason {
RTW_WOW_RSN_RX_PTK_REKEY = 0x1,
RTW_WOW_RSN_RX_GTK_REKEY = 0x2,
RTW_WOW_RSN_RX_DEAUTH = 0x8,
RTW_WOW_RSN_DISCONNECT = 0x10,
RTW_WOW_RSN_RX_MAGIC_PKT = 0x21,
};
struct rtw_fw_media_status_iter_data {
struct rtw_dev *rtwdev;
u8 connect;
};
struct rtw_fw_key_type_iter_data {
struct rtw_dev *rtwdev;
u8 group_key_type;
u8 pairwise_key_type;
};
static inline bool rtw_wow_mgd_linked(struct rtw_dev *rtwdev)
{
struct ieee80211_vif *wow_vif = rtwdev->wow.wow_vif;
struct rtw_vif *rtwvif = (struct rtw_vif *)wow_vif->drv_priv;
return (rtwvif->net_type == RTW_NET_MGD_LINKED);
}
int rtw_wow_suspend(struct rtw_dev *rtwdev, struct cfg80211_wowlan *wowlan);
int rtw_wow_resume(struct rtw_dev *rtwdev);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment