Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: mt76: mt7921: fix suspend issue on MediaTek COB platform

MediaTek's controller driver on COB platform (e.g. MT8188) is
capable of controlling power supplies and reset pin of a component
(e.g. a WIFI chip) in power-on and power-off process.

Due to this optional feature, mt76 need to inform controller
that mt76 need to keep power during suspend. Otherwise WIFI will be
powered off when system enters suspend process.

The "wakeup-source" property was used for the device that need
this to go into suspend mode so that mt76 suspend handler doesn't
fail and the system is able to enter into a suspend state.

An example:
wifi: mt7921@0 {
wifi0{
reg = <0x0000 0 0 0 0>;
wakeup-source;
};
};

Signed-off-by: Michael Lo <michael.lo@mediatek.com>
Signed-off-by: Ming Yen Hsieh <MingYen.Hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>

authored by

Michael Lo and committed by
Felix Fietkau
8cd72574 352d9661

+7
+7
drivers/net/wireless/mediatek/mt76/mt7921/pci.c
··· 6 6 #include <linux/kernel.h> 7 7 #include <linux/module.h> 8 8 #include <linux/pci.h> 9 + #include <linux/of.h> 9 10 10 11 #include "mt7921.h" 11 12 #include "../mt76_connac2_mac.h" ··· 370 369 if (ret) 371 370 goto err_free_irq; 372 371 372 + if (of_property_read_bool(dev->mt76.dev->of_node, "wakeup-source")) 373 + device_init_wakeup(dev->mt76.dev, true); 374 + 373 375 return 0; 374 376 375 377 err_free_irq: ··· 389 385 { 390 386 struct mt76_dev *mdev = pci_get_drvdata(pdev); 391 387 struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); 388 + 389 + if (of_property_read_bool(dev->mt76.dev->of_node, "wakeup-source")) 390 + device_init_wakeup(dev->mt76.dev, false); 392 391 393 392 mt7921e_unregister_device(dev); 394 393 set_bit(MT76_REMOVED, &mdev->phy.state);