History log of /linux-master/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
Revision Date Author Comments
# 61785540 07-Dec-2023 Peter Chiu <chui-hao.chiu@mediatek.com>

wifi: mt76: check txs format before getting skb by pid

The PPDU TxS does not include the error bit so it cannot use to report
status to mac80211.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 775cf70c4 06-Sep-2023 Peter Chiu <chui-hao.chiu@mediatek.com>

wifi: mt76: disable HW AMSDU when using fixed rate

When using fixed rate, HW uses txd DW9 to store tx arrivial time if VTA
is set. It would overwrite the msdu_id in txd and lead to token pending
if amsdu is enable.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2e420b88 19-Oct-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: introduce wed pointer in mt76_queue

Introduce mtk_wed_device pointer in mt76_queue structure in order to
configure WED chip.
Get rid of dev parameter in Q_READ and Q_WRITE macros.
Introduce wed parameter to the following routine signatures:
- mt76_init_queue
- mt76_init_tx_queue

This is a preliminary patch to introduce WED support for mt7996 since
mt7996 runs two separate WED chips.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 32b1000d 18-Sep-2023 Sean Wang <sean.wang@mediatek.com>

wifi: mt76: mt7921: fix the wrong rate pickup for the chanctx driver

The variable band should be determined by the ieee80211_chanctx_conf when
the driver is a kind of chanctx one e.g mt7921 and mt7922 driver so we
added the extension to mt76_connac2_mac_tx_rate_val by distinguishing if
it can support chanctx to fix the incorrect rate pickup.

Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Reviewed-by: David Ruth <druth@chromium.org>
Tested-by: David Ruth <druth@chromium.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 52520926 01-Aug-2023 Deren Wu <deren.wu@mediatek.com>

wifi: mt76: connac: introduce helper for mt7925 chipset

Introduce is_mt7925() helper for new chipset. mt7925 runs the same
firmware download and mmio map flow as mt7921.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 832f4269 11-Sep-2023 Felix Fietkau <nbd@nbd.name>

wifi: mt76: remove unused error path in mt76_connac_tx_complete_skb

The error handling code was added in order to allow tx enqueue to fail after
calling .tx_prepare_skb. Since this can no longer happen, the error handling
code is unused.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c8e370fe 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move more mt7921/mt7915 mac shared code in connac lib

Move the following routines in mt76-connac lib since they are shared
between mt7915 and mt7921:
- mt76_connac2_tx_check_aggr
- mt76_connac2_txwi_free
- mt76_connac2_tx_token_put

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b642f4c5 17-May-2023 Deren Wu <deren.wu@mediatek.com>

wifi: mt76: mt7921: fix skb leak by txs missing in AMSDU

txs may be dropped if the frame is aggregated in AMSDU. When the problem
shows up, some SKBs would be hold in driver to cause network stopped
temporarily. Even if the problem can be recovered by txs timeout handling,
mt7921 still need to disable txs in AMSDU to avoid this issue.

Cc: stable@vger.kernel.org
Fixes: 163f4d22c118 ("mt76: mt7921: add MAC support")
Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f39d4993 09-May-2023 Peter Chiu <chui-hao.chiu@mediatek.com>

wifi: mt76: mt7915: rework tx bytes counting when WED is active

Concurrent binding/non-binding skbs could be handled anywhere which leads
to mixed byte counting, so switch to use PPDU TxS reporting regardless Tx
paths when WED is active.

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 161a7528 09-May-2023 Peter Chiu <chui-hao.chiu@mediatek.com>

wifi: mt76: mt7915: rework tx packets counting when WED is active

PPDU TxS can only report MPDU count whereas mac80211 requires MSDU scale
(NL80211_STA_INFO_TX_PACKETS), so switch to get MSDU counts from WA
statistic.

Note that mt7915 WA firmware only counts tx_packet for WED path, so driver
needs to take care of host path additionally.

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 943e4fb9 09-May-2023 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: mt7915: report tx retries/failed counts for non-WED path

Get missing tx retries/failed counts from txfree done events and report
them via mt7915_sta_statistics().

Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c7ab7a29 23-Apr-2023 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: connac: fix stats->tx_bytes calculation

The stats->tx_bytes shall subtract retry byte from tx byte.

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/b3cd45596943cf5a06b2e08e2fe732ab0b51311b.1682285873.git.ryder.lee@mediatek.com


# 9c54548b 13-Apr-2023 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: connac: add nss calculation into mt76_connac2_mac_tx_rate_val()

Take nss calculation into account since this function always wrongly
returns 0.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3d2892e0 13-Apr-2023 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: connac: fix txd multicast rate setting

The vif->bss_conf.mcast_rate should be applied to multicast data frame
only.

Fixes: 182071cdd594 ("mt76: connac: move connac2_mac_write_txwi in mt76_connac module")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6a8b899d 02-Apr-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: add mt76_connac_gen_ppe_thresh utility routine

gen_ppe_thresh routine is shared between mt7615, mt7915, mt7921 and
mt7996 so move it in mt76_connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1a1ff6c3 17-Feb-2023 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: connac: refresh tx session timer for WED device

There's no keep-alive packet being received by mac80211 stack when WED
is enabled, which leads to tx BA session timeout. This patch calls
ieee80211_refresh_tx_agg_session_timer() to refresh timer according
to tx status reporting.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0b8e2d69 16-Jan-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7996: rely on mt76_connac2_mac_tx_rate_val

In order to fix a possible NULL pointer dereference in
mt7996_mac_write_txwi() of vif pointer, export
mt76_connac2_mac_tx_rate_val utility routine and reuse it
in mt7996 driver.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0ffcb2a6 07-Dec-2022 Deren Wu <deren.wu@mediatek.com>

wifi: mt76: fix coverity uninit_use_in_call in mt76_connac2_reverse_frag0_hdr_trans()

The default case for frame_contorl is invalid. We should always
assign addr3 of this frame properly.

Coverity error message:
if (ieee80211_has_a4(hdr.frame_control))
(19) Event uninit_use_in_call: Using uninitialized value "hdr".
Field "hdr.addr3" is uninitialized when calling "memcpy".
memcpy(skb_push(skb, sizeof(hdr)), &hdr, sizeof(hdr));
else
memcpy(skb_push(skb, sizeof(hdr) - 6), &hdr, sizeof(hdr) - 6);

Fixes: 0880d40871d1 ("mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fa67120b 11-Nov-2022 Evelyn Tsai <evelyn.tsai@mediatek.com>

wifi: mt76: connac: update nss calculation in txs

The hardware reports the number of transmitting antennas not the actual
number of spatial streams

Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# faf2e7b5 30-Sep-2022 Shayne Chen <shayne.chen@mediatek.com>

wifi: mt76: connac: introduce mt76_connac_spe_idx()

Add mt76_connac_spe_idx() for antenna mask to spatial extension
index conversion. This is used to support flexible control of
tx antenna.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 43eaa368 10-Aug-2022 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: add PPDU based TxS support for WED device

Given that there's no data coming from network stack for binding flows,
hence driver counts and reports station's statistics directly through
NL80211_STA_INFO_* based on active PPDU based TxS for offloading data.

Apart from that, WA firmware and its offloading engine (SDO) have hardcoded
"2" as PID, so we introduce MT_PACKET_ID_WED to differentiate WED reporting.

Note that PPDU format TxS is mutually exclusive with MT_TXD5_TX_STATUS_HOST.

Co-developed-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dc877523 10-Aug-2022 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: move move mt76_sta_stats to mt76_wcid

This is a preliminary patch for WED's TxS support.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a062f001 04-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: convert MT_TX_HW_QUEUE_EXT_PHY to MT_TX_HW_QUEUE_PHY

Report phy_indx in tx_info->hw_queue. This is a preliminary patch to add
newer chipset support

Co-developed-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a1a99d7b 04-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: add phy_idx to mt76_wcid

Introduce phy_idx to mt76_wcid structure instead of ext_phy.
This is a preliminary patch to add newer chipset support.

Co-developed-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dc44c45c 04-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: introduce phys array in mt76_dev structure

Introduce phys array in mt76_dev structure to reference mt76_phy
supported by the chipset. This is a preliminary patch to introduce
newer chipset support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9dfb28e9 23-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move tx initialization/cleanup in mt76_connac module

Move mt76_connac_init_tx_queues and mt76_connac_tx_cleanup routines
in mt76_connac module. This is a preliminary patch to add mt7990
chipset support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1d5af0ac 02-Jul-2022 Felix Fietkau <nbd@nbd.name>

mt76: do not use skb_set_queue_mapping for internal purposes

Previously the code used skb_set_queue_mapping for management or non-bufferable
powersave frames that need to be sent to a different hardware queue.
This can confuse AQL, which expects the value to remain the same until the tx
status report.
The only place that currently uses the altered skb queue mapping is the txwi
write function. Change the code to pass the hardware queue id as a function
parameter instead.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2b25b855 19-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt7615_txp_skb_unmap in common code

Move mt7615_txp_skb_unmap in shared code and reuse it in mt7915e and
mt7921e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5e610f8e 19-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac_write_hw_txp in shared code

Now we can move mt76_connac_write_hw_txp routine in mt76-connac module
and reuse it in mt7921e and mt7615e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0a178a60 19-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac_tx_complete_skb in shared code

Since now txp structures are in common code we can reuse
mt76_connac_tx_complete_skb routine in mt7921e, mt7915e and mt7615e
drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d832f5e7 08-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac2_mac_fill_rx_rate in connac module

Rely on mt76_connac2_mac_fill_rx_rate routine in mt7921 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0880d408 08-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module

mt76_connac2_reverse_frag0_hdr_trans routine is shared between mt7921
and mt7915e drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f71662de 08-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move HE radiotap parsing in connac module

HE radiotap parsing code is shared between connac2 devices.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b932425b 07-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac2_mac_add_txs_skb in connac module

Move mt76_connac2_mac_add_txs_skb in mt76-connac module since it is
shared between connac2 devices (mt7921 and mt7915)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 182071cd 07-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move connac2_mac_write_txwi in mt76_connac module

mac_write_txwi code is shared between connac2 devices (mt7915 and
mt7921). Move it in connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d430dffb 21-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: fix a possible race enabling/disabling runtime-pm

Fix a possible race enabling/disabling runtime-pm between
mt7921_pm_set() and mt7921_poll_rx() since mt7921_pm_wake_work()
always schedules rx-napi callback and it will trigger
mt7921_pm_power_save_work routine putting chip to in low-power state
during mt7921_pm_set processing.

Suggested-by: Deren Wu <deren.wu@mediatek.com>
Tested-by: Deren Wu <deren.wu@mediatek.com>
Fixes: 1d8efc741df8 ("mt76: mt7921: introduce Runtime PM support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/0f3e075a2033dc05f09dab4059e5be8cbdccc239.1640094847.git.lorenzo@kernel.org


# 8aff2d91 18-Jun-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7663s: enable runtime-pm

Allow the user to enable runtime-pm for mt7663s driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f86625ae 19-May-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix invalid register access in wake_work

Make sure mt7921_pm_wake_work wouldn't be scheduled after the driver is
in suspend mode to fix the following the kernel crash.

[ 3515.390012] mt7921e 0000:01:00.0: calling pci_pm_suspend+0x0/0x22c @ 2869, parent: 0000:00:00.0
[ 3515.390015] mt7921e 0000:01:00.0: mt7921_pci_suspend +
[ 3515.396395] anx7625 3-0058: anx7625_suspend+0x0/0x6c returned 0 after 0 usecs
[ 3515.405965] mt7921e 0000:01:00.0: mt7921_pci_suspend -
[ 3515.411336] usb 1-1.4: usb_dev_suspend+0x0/0x2c returned 0 after 1 usecs
[ 3515.411513] SError Interrupt on CPU7, code 0xbe000011 -- SError
[ 3515.411515] CPU: 7 PID: 2849 Comm: kworker/u16:27 Not tainted 5.4.114 #44
[ 3515.411516] Hardware name: MediaTek Asurada rev1 board (DT)
[ 3515.411517] Workqueue: mt76 mt7921_pm_wake_work [mt7921e]
[ 3515.411518] pstate: 80c00009 (Nzcv daif +PAN +UAO)
[ 3515.411519] pc : mt76_mmio_rr+0x30/0xf0 [mt76]
[ 3515.411520] lr : mt7921_rr+0x38/0x44 [mt7921e]
[ 3515.411520] sp : ffffffc015813c50
[ 3515.411521] x29: ffffffc015813c50 x28: 0000000000000402
[ 3515.411522] x27: ffffffe5a2012138 x26: ffffffe5a1eea018
[ 3515.411524] x25: 00000000328be505 x24: 00000000000a0002
[ 3515.411525] x23: 0000000000000006 x22: ffffffbd29b7a300
[ 3515.411527] x21: ffffffbd29b7a300 x20: 00000000000e0010
[ 3515.411528] x19: 00000000eac08f43 x18: 0000000000000000
[ 3515.411529] x17: 0000000000000000 x16: ffffffe5a16b2914
[ 3515.411531] x15: 0000000000000010 x14: 0000000000000010
[ 3515.411532] x13: 00000000003dd3a2 x12: 0000000000010000
[ 3515.411533] x11: ffffffe597abec14 x10: 0000000000000010
[ 3515.411535] x9 : ffffffe597abeba8 x8 : ffffffc013ce0010
[ 3515.411536] x7 : 000000b2b5593519 x6 : 0000000000300000
[ 3515.411537] x5 : 0000000000000000 x4 : 0000000000000032
[ 3515.411539] x3 : 0000000000000000 x2 : 0000000000000004
[ 3515.411540] x1 : 00000000000e0010 x0 : ffffffbd29b7a300
[ 3515.411542] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 3515.411543] CPU: 7 PID: 2849 Comm: kworker/u16:27 Not tainted 5.4.114 #44
[ 3515.411544] Hardware name: MediaTek Asurada rev1 board (DT)
[ 3515.411544] Workqueue: mt76 mt7921_pm_wake_work [mt7921e]
[ 3515.411545] Call trace:
[ 3515.411546] dump_backtrace+0x0/0x14c
[ 3515.411546] show_stack+0x20/0x2c
[ 3515.411547] dump_stack+0xa0/0xfc
[ 3515.411548] panic+0x154/0x350
[ 3515.411548] panic+0x0/0x350
[ 3515.411549] arm64_serror_panic+0x78/0x84
[ 3515.411550] do_serror+0x0/0x118
[ 3515.411550] do_serror+0xa4/0x118
[ 3515.411551] el1_error+0x84/0xf8
[ 3515.411552] mt76_mmio_rr+0x30/0xf0 [mt76]
[ 3515.411552] mt7921_rr+0x38/0x44 [mt7921e]
[ 3515.411553] __mt76_poll_msec+0x5c/0x9c [mt76]
[ 3515.411554] __mt7921_mcu_drv_pmctrl+0x50/0x94 [mt7921e]
[ 3515.411555] mt7921_mcu_drv_pmctrl+0x38/0xb0 [mt7921e]
[ 3515.411555] mt7921_pm_wake_work+0x34/0xd4 [mt7921e]
[ 3515.411556] process_one_work+0x208/0x3c8
[ 3515.411557] worker_thread+0x23c/0x3e8
[ 3515.411557] kthread+0x144/0x178
[ 3515.411558] ret_from_fork+0x10/0x18
[ 3515.418831] SMP: stopping secondary CPUs
[ 3515.418832] Kernel Offset: 0x2590c00000 from 0xffffffc010000000
[ 3515.418832] PHYS_OFFSET: 0xffffffc400000000
[ 3515.418833] CPU features: 0x080026,2a80aa18
[ 3515.418834] Memory Limit: none
[DL] 00000000 00000000 010701

Fixes: 1d8efc741df80 ("mt76: mt7921: introduce Runtime PM support")
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 081b37ae 20-Apr-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: mt7921_stop should put device in fw_own state

mt7921_stop should put device in fw_own state to reduce
power consumption.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b1bd7bb8 20-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: unschedule mac_work before going to sleep

In order to wake the device less frequently and so reduce power
consumpation, unschedule mac_work before going to sleep

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e5f35576 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: use waitqueue for runtime-pm

Simplify the code using a wait_queue_head_t instead of a completion to
wait the chip is fully awake in mt76_connac_pm_wake routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a6182620 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: alaways wake the device before scanning

move scanning check from mt76_connac_power_save_sched routine
to mt7921_pm_power_save_work/mt7615_pm_power_save_work ones

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4f9b3aeb 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: unschedule ps_work in mt76_connac_pm_wake

In order to avoid synchronization issues between wake and ps works,
cancel ps_work in mt76_connac_pm_wake routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1755f6ad 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76_connac: move pm utility routines in mt76_connac_lib module

Move power_save common code shared between mt7663 and mt7921 in
mt76_connac module

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>