Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp24475rdh; Tue, 6 Feb 2024 17:43:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXzf/J3o1o2pi5IJhbyymbiQFGK7jxz/E3qjGcWNsfFYTM/1JglroxNI/KMZSFvH7OEMZPSjZ8l/ZTlTLYkizjk3o8DYePBV9Gyo7805g== X-Google-Smtp-Source: AGHT+IGwIWxTk+Kjua759Y17V4enZSTyQ4pknZ96PhIHGcLdKeR5WsUcueYvmayKaYv887DHW8Ga X-Received: by 2002:a05:622a:180e:b0:42b:f088:5c6 with SMTP id t14-20020a05622a180e00b0042bf08805c6mr5407012qtc.48.1707270204202; Tue, 06 Feb 2024 17:43:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707270204; cv=pass; d=google.com; s=arc-20160816; b=oMNZWU8gLicbLlubzSDb3KtI+cIvEAcGetZU6MxJFHHjR0V6enVW8RiwDsAIrqDn4t jBB0LuH8f8OePZoPgqq6h1hIDsyEBiGmlmrloxQxdIxiTz+pQ1wKnNlBNke42cEO2dHO zNWVMChBmduXO9VPHS0TgVaH2J6StlOG5NRr2mZHHwQmTwP523ii/ZsY6ySZ1Bg97u53 iYBSS2wMSF6WWzNLlziIlG9uFh9DmcLXwHcQxbuJGb7BYqFBa5lWpD2fLa5kKuILW9TB 8H/4+HnzC3lZJKAGLR0uPAOA21wMXeUDRFKrbTiAazl5OLS2bV+5v0iEjZvcrsDzks5O rj5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=uDouN0pdbhwQRjTzuJpHQCJy8aUyeV2qZj7bI+J4528=; fh=znU+UqIPnH14qGD7UReFazaXUNvlN9cMnfdPIaBaePk=; b=X8BGRq0vfxbpMYWnBu5PjdCIhEDLrHcZlsVyDpMApIrUdE+cw6Gka9DKsKB1k8nhjA oaCpVKAuax6YweJhseXpXdMUwk2a9u0/UZHgoc+x8WC39HsKBv5HqFB+meDiWS/PMNhW FOhtaR+kH4Yy4JHsVjTGgOlFFVdU/v33Ib42r8kNi8Zh9Tkh825Y2NAhtQfhAjnKcJ1v bdQbfhcrbxGQO80y5zI/xKyGEMbYtk85k4Plx1NiuaTsoDZAnfuRHi5+qN0DszxtJEyr ZOCQnPi+Fxe+Wxf5ssGPCRtPxCeFwqNREzlrjncJboFQIWjSGGW4RZbl3FWYeKQNsEIN WZqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=fgfwDmrp; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-3260-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com X-Forwarded-Encrypted: i=2; AJvYcCVcS1/W7PqkP9nLFbsu/aVHPtrRwcd02L2mQQ77gIl69kQQlHPEzRO0Qe2H+cgjO7JQhV/WWVUcW6fNAFzwcPeuN1dP2LWt2aRdlucxvg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 12-20020ac8590c000000b0042c394c262asi213974qty.198.2024.02.06.17.43.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 17:43:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3260-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=fgfwDmrp; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-3260-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B43EC1C24B8E for ; Wed, 7 Feb 2024 01:43:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0967200AD; Wed, 7 Feb 2024 01:40:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="fgfwDmrp" X-Original-To: linux-wireless@vger.kernel.org Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43254F9F7 for ; Wed, 7 Feb 2024 01:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707270004; cv=none; b=PY+sODDPXB7r71hT5IMZc9nVE9xw+ZHIsWEVwEOIY97vEvhQUwxI6gczk9/v8EGLu6LbGVZ2354bgaU4fkz5gr93VFgjn2OL2X3vjvtGVh1gtn31RHoOU/8sFVNJ+TA9qpvHuevvYFhjXNBUmBZXUGGkO1CQ/dmxjhFVzGKtN4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707270004; c=relaxed/simple; bh=mkXsOTVtzPGnVdeMan/cvnNzUB86ikW3Nr1J9YAL0LI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=OVLyaVYYTv4cUv+ubXcUaY5OzSsCULK1Qq+VXAdHa78XAU/MM/oRah7ZZtAVZqEmYDomAaZF53bOe56qoK8cL3XeO92iFwbgdqZhKu2qTcxiuombKZ69RbBFJnL+5PZ16FqTLpa/5xDk5jvKIeOg11m78EAeChk2Iv33PD/tT1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=fgfwDmrp; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: cc8e78fec55911eea2298b7352fd921d-20240207 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=uDouN0pdbhwQRjTzuJpHQCJy8aUyeV2qZj7bI+J4528=; b=fgfwDmrpaqMez5Z9BkpGXFNZYLQDof9jjel6dunDkNgfvWyf1h10PN7uhIh5bGy55a8/A/0gPIy6qIkQXx88xdEUkqTX1xozjtd/YiEdgI1DBCesiylbyVe0Rq7UXGQ8fU3R9L0/ocEOBLR47SDFtJEgMMcLyNnpukVS5hMWwzs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:65120662-306b-41aa-b21b-7c6cb1c6066d,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6f543d0,CLOUDID:d447b383-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES :1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: cc8e78fec55911eea2298b7352fd921d-20240207 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 268962624; Wed, 07 Feb 2024 09:39:56 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 7 Feb 2024 09:39:54 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 7 Feb 2024 09:39:54 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Michael Lo , Ming Yen Hsieh Subject: [PATCH] wifi: mt76: mt7921: fix suspend issue on MediaTek COB platform Date: Wed, 7 Feb 2024 09:39:45 +0800 Message-ID: <20240207013945.23558-1-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--4.150300-8.000000 X-TMASE-MatchedRID: yZoAMijhO4c9S3IiQd+eNRNEPNwNrw/rieyBFTE1+ceIoW+1yT7Gw6UJ mwqvEWihdAyEKWUq4v4C3sKcss0odmK6SHtwuj6rQpxiLlDD9FWusS9CiBzL8X5h6y4KCSJcZ10 wKXUWXnJirZ/FbBb+bqCF2qOQ8zIWVJTV35UngiMZXJLztZviXKxwr8rYOW+O0zabL4+/4csJSK yYs8AD/ax4GQqkd00FumMCMwce1mUfE8yM4pjsDwtuKBGekqUpOlxBO2IcOBajycPov0YYz9FAH qz04bFbXGumjTnZ3ElZZFJWUoXZhel/jnRe4WMsiMi52pBTvfk12WiR9TdDZ5UDrgLdu1TA4gKV wGe6cHjBkGBTIlURuXoXDz8+lMxFpW+aIDJ4DaRzkxJ+SIkUjmncuUSUEdOX X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.150300-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: B575A5AC19A7385059901DA6BF1BFA2F5ED3C6E1A2C7CF06A57263B916AC3F032000:8 From: Michael Lo 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 Signed-off-by: Ming Yen Hsieh --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index fabd24726f3e..e673a153d3cb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "mt7921.h" #include "../mt76_connac2_mac.h" @@ -369,6 +370,9 @@ static int mt7921_pci_probe(struct pci_dev *pdev, if (ret) goto err_free_irq; + if (of_property_read_bool(dev->mt76.dev->of_node, "wakeup-source")) + device_init_wakeup(dev->mt76.dev, true); + return 0; err_free_irq: @@ -386,6 +390,9 @@ static void mt7921_pci_remove(struct pci_dev *pdev) struct mt76_dev *mdev = pci_get_drvdata(pdev); struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); + if (of_property_read_bool(dev->mt76.dev->of_node, "wakeup-source")) + device_init_wakeup(dev->mt76.dev, false); + mt7921e_unregister_device(dev); set_bit(MT76_REMOVED, &mdev->phy.state); devm_free_irq(&pdev->dev, pdev->irq, dev); -- 2.18.0