• Ping-Ke Shih's avatar
    rtw88: 8723d: Add mac power-on/-off function · 4e223a5f
    Ping-Ke Shih authored
    The mac power-on flow consists of three steps:
    1. pre_sys_cfg  (Before switching power state)
    2. power_switch (Switching power state)
    3. init_sys_cfg (Settings after swtiching power state)
    
    When switching power state, driver will load and parse the power sequence
    tables. For 8723D devices, the logics for parsing are most same except for
    the polling function. 8723D devices need to toggle BIT_PFM_WOWL twice.
    
    The settings after power state is switched for 8723D devices are quite
    different with other devices, extract a legacy function for them.
    
    For power-off flow, 8723D devices have the same logic with existing chips.
    But warning printed if we run power-off sequence in power-off state:
    
       rtw_pci 0000:03:00.0: failed to poll offset=0x5f8 mask=0xff value=0x0
    
    The scenario is user do 'ifconfig up' that will run power-on sequence to
    bring up and then run power-off sequence to enter idle
    (IEEE80211_CONF_IDLE). Then, user do 'ifconfig down' that will run
    power-off sequence again, and the warning is shown. Original code check
    power-on state to avoid to run power-on sequence twice, and this commit
    extends to check both power-on and power-off states.
    Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
    Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/20200422034607.28747-4-yhchuang@realtek.com
    4e223a5f
mac.c 29.8 KB