From patchwork Fri Dec 22 08:53:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingyen Hsieh X-Patchwork-Id: 13503097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 493D5C46CD4 for ; Fri, 22 Dec 2023 08:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yERtKqeMRnRz8EWKdpgnTZ0HdSoa6D6t6hyWkYUHSl8=; b=5EM3uyWkxOLibNrflZR+gKOQ3d +V1ApUyLobJG2CHP1IjO/fDnJM2V+wLrjvevve6JCq5yRScc71v0+LmufjAAAia69Udl3nS5TNIPL bC85Lj+XY1KDAP+t04a8L+GYnx1fmeg1A/l54H9C91eDPmAWKVXVG1vWOqBsutT8NFqeUAlztaB0u xYfl2dUAnJaIDBW59GorCWwvnDulEbGQqTpRuqpAT+lYhbhx4EYh0Stbir3J5O7OTU3C2lLeeaAdJ We5OEL0OBAJgYpaLZ/edi+GiYx5fuC0LoYxkBT1+TQNNu93NSxemNgN+k/Mqvtkk2qmqesawvHrDS QYRtPhBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGbI5-005Mnz-0T; Fri, 22 Dec 2023 08:53:57 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGbI2-005Mn4-1t for linux-mediatek@lists.infradead.org; Fri, 22 Dec 2023 08:53:56 +0000 X-UUID: 9f8734eea0a711ee958cff29c719f35b-20231222 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=yERtKqeMRnRz8EWKdpgnTZ0HdSoa6D6t6hyWkYUHSl8=; b=RcPHZyZXdpZoG0+FKCFXRMiTNoJiP2LGMAnf0KCQ5o5AYzUuGLseJ1FJyhNd1iSVzqPr/zibKDDoR2ThAvW7wWnOBm/wYtVz3EKDmtzL3KNyBaZkgCakiM04cTA3qXRrihiUy7vYLA9K03CXnCBvKFlj/PfGfVuyGYtax0D1axo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:5741f090-8790-4f55-a34a-c4ffb9c4cce5,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:5d391d7,CLOUDID:376d0f82-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:1,File: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,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_ULS,TF_CID_SPAM_SNR X-UUID: 9f8734eea0a711ee958cff29c719f35b-20231222 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 72642589; Fri, 22 Dec 2023 01:53:49 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 16:53:46 +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; Fri, 22 Dec 2023 16:53:46 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Ming Yen Hsieh Subject: [PATCH v1 1/4] wifi: mt76: mt7921: fix incorrect type conversion for CLC command Date: Fri, 22 Dec 2023 16:53:35 +0800 Message-ID: <20231222085338.4530-2-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> References: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--4.267000-8.000000 X-TMASE-MatchedRID: zfURmU8ZpfG0A65es43yNsFWmsryu9ZfN/BTU5ZfZRIFi3R9x/2qQp7O 325kkkmthleoxClEaad3ASMeJ378tBdg+HtW3bymnVTWWiNp+v9MkOX0UoduuQNBdqC0PZz4o8W MkQWv6iXBcIE78YqRWvcUt5lc1lLgjMejjvPkBr7gBxE/u1mqEiwnOlZD/aCzUx3FFlKt//Pssr Rv1LUSc8ORKiRcdxPZV6BJkTJ5zLM6JULy9tmMFNQv8m9xy61E6bVO/2eNXpp5lSmbrC6fdtr/T o2FgNrjDLMIOOVTHz2nbLeYgH6K31Zca9RSYo/b X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.267000-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 526BBC830612C1FDA913175EE9C294AFD8814AA39D53E68BE6423B740288DE312000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_005354_632499_BF3EF130 X-CRM114-Status: GOOD ( 10.03 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ming Yen Hsieh clc->len is defined as 32 bits in length, so it must also be operated on with 32 bits, not 16 bits. Fixes: fa6ad88e023d ("wifi: mt76: mt7921: fix country count limitation for CLC") Signed-off-by: Ming Yen Hsieh Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202312112104.Zkc3QUHr-lkp@intel.com/ --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index 5fcee178b698..f1145002c900 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -1271,7 +1271,7 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2, .mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2), }; int ret, valid_cnt = 0; - u16 buf_len = 0; + u32 buf_len = 0; u8 *pos; if (!clc) @@ -1282,7 +1282,7 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2, if (mt76_find_power_limits_node(&dev->mt76)) req.cap |= CLC_CAP_DTS_EN; - buf_len = le16_to_cpu(clc->len) - sizeof(*clc); + buf_len = le32_to_cpu(clc->len) - sizeof(*clc); pos = clc->data; while (buf_len > 16) { struct mt7921_clc_rule *rule = (struct mt7921_clc_rule *)pos; From patchwork Fri Dec 22 08:53:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingyen Hsieh X-Patchwork-Id: 13503098 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 627A8C41535 for ; Fri, 22 Dec 2023 08:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uSWtu7QGZlDy2U9rpLeluhtBrJ5IhbOXU4hBNtyp7lE=; b=C3WXI3MSbR2lz/we0ip90zTPRV KZ7xy8THlr9pqstUBmoH3PiCHdMAGkYNRW3ifGWvhjD07IwcjQ629sbCU/ymKuLvZIe5sX+RA91eU DIkjpriSCC3JFrq1icdA7tOI5hTXWjZq95UZs9+KTlcaUv3GjYuPsu3ZcHXitdvYumz8jXPBtLMQ6 klKQlve4iOg3PLGIotEL0n3z2+Hslpp2NhTFdoa/T/V8aRzAbaVYW8jHIogzS0iEnGNV2EMpXnSZq IDJP9SVRodsLj2O8gUSucLT71ATiStxXXDT8PZ23+jFUz2A+0x/lYSxYDyPl4r/Dj44jjNGjT3REp b8q+Xu3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGbIc-005Ms0-16; Fri, 22 Dec 2023 08:54:30 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGbIZ-005Mqi-1Q for linux-mediatek@lists.infradead.org; Fri, 22 Dec 2023 08:54:28 +0000 X-UUID: b34ae58ea0a711ee9b09ad09c76753c8-20231222 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=uSWtu7QGZlDy2U9rpLeluhtBrJ5IhbOXU4hBNtyp7lE=; b=Z9gW3/nlKBZJKVadETDNhZ1y6lUxEbpzMRnreGwFov/0SMPuL2UDB39IST4kYh7QVNFUJgm2aCZb0QZWwfrHJ8RuElahHkoUvCxqTI9n1IHMxvxZ2JrA7gTLH71XbdERoHUOMI5gv4YIF8qtI9AY9INzWSLdcL+3DADN4nkB4zk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:b0276c89-97c5-432d-82f0-b45cbb58fc23,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:5d391d7,CLOUDID:ffb8602e-1ab8-4133-9780-81938111c800,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File: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_ULN,TF_CID_SPAM_SNR X-UUID: b34ae58ea0a711ee9b09ad09c76753c8-20231222 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2071714746; Fri, 22 Dec 2023 01:54:22 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 16:53:46 +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; Fri, 22 Dec 2023 16:53:46 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Ming Yen Hsieh , Leon Yen Subject: [PATCH v1 2/4] wifi: mt76: mt792x: fix a potential loading failure of the 6Ghz channel config from ACPI Date: Fri, 22 Dec 2023 16:53:36 +0800 Message-ID: <20231222085338.4530-3-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> References: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--6.013300-8.000000 X-TMASE-MatchedRID: PwZ81m9fkLbZK1rQqyNiGR3EEAbn+GRbI9yVcHNDU7a5ZjHyzYrpGt6M yUV+2+DZ+tt/G7x8wM7kQHSm+HqcuqPzznyWrbXqQpxiLlDD9FV9LQinZ4QefPcjNeVeWlqY+gt Hj7OwNO0gCYMnfcK3PF5UWE0xOO8BLkvWsDkhjDg8nmtjrcR7Xbvmmn0nKMw9bk8+unopmQA= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--6.013300-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 778A392B4FBF824153A3D16F8A705AE2BB6A9F931D6633525BF85C5497578E862000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_005427_482918_AEC21CBE X-CRM114-Status: GOOD ( 11.52 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ming Yen Hsieh In some case, the MTCL table will exist, but MTDS table will not. So the SAR will init fail. This patch make MTCL and MTDS can exist with no dependence. Fixes: f965333e491e ("mt76: mt7921: introduce ACPI SAR support") Signed-off-by: Ming Yen Hsieh Signed-off-by: Leon Yen --- .../wireless/mediatek/mt76/mt792x_acpi_sar.c | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c index e7afea87e82e..8fee3d481df0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c @@ -66,13 +66,15 @@ mt792x_acpi_read(struct mt792x_dev *dev, u8 *method, u8 **tbl, u32 *len) } /* MTCL : Country List Table for 6G band */ -static void +static int mt792x_asar_acpi_read_mtcl(struct mt792x_dev *dev, u8 **table, u8 *version) { - if (mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL) < 0) - *version = 1; - else - *version = 2; + int ret; + + *version = ((ret = mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL)) < 0) + ? 1 : 2; + + return ret; } /* MTDS : Dynamic SAR Power Table */ @@ -166,16 +168,16 @@ int mt792x_init_acpi_sar(struct mt792x_dev *dev) if (!asar) return -ENOMEM; - mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver); + ret = mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver); + if (ret) { + devm_kfree(dev->mt76.dev, asar->countrylist); + asar->countrylist = NULL; + } - /* MTDS is mandatory. Return error if table is invalid */ ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver); if (ret) { devm_kfree(dev->mt76.dev, asar->dyn); - devm_kfree(dev->mt76.dev, asar->countrylist); - devm_kfree(dev->mt76.dev, asar); - - return ret; + asar->dyn = NULL; } /* MTGS is optional */ @@ -290,7 +292,7 @@ int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default) const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa; int i; - if (!phy->acpisar) + if (!phy->acpisar || !((struct mt792x_acpi_sar *)phy->acpisar)->dyn) return 0; /* When ACPI SAR enabled in HW, we should apply rules for .frp From patchwork Fri Dec 22 08:53:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingyen Hsieh X-Patchwork-Id: 13503099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE2F7C46CD4 for ; Fri, 22 Dec 2023 08:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Kh4ADFx8DyKsyheb1kxCqsOD8YqzwyrfLZNAEnzeVrQ=; b=kOZEgCwezFtHEH63ZLNxa/tA9C DM6RzRcEg+4twfp83PvjZHMsxIENDM+m0WApMB+GKp13nLiNNgGMog3TNSDv+IRNwCbll/9A4Oj73 kI8kkJji0Zrf1piKa+yqrsTTGWnH+7pm6QfERuSwG9s9xnqFmL1PF546Wf1ChfxrqSV0XUE89xR4A o3dgVWO/gfRyJbpLBy4+s9d3vkpwMq/uyFBYFkvEhJGTtKk3Z5yfwYcL5lmNYVWXP0dAx6eUdx97L 4sfe0+u0FFNBI7I3l1LGiWDBtlrOwokcORFOsJ2qEh2iD/8gy31uWRjwbJPg+lvSkb/JWIJF0A0bn KMBh5vOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGbIe-005MsY-2O; Fri, 22 Dec 2023 08:54:32 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGbIa-005Mr4-1P for linux-mediatek@lists.infradead.org; Fri, 22 Dec 2023 08:54:29 +0000 X-UUID: b410d1f4a0a711ee9b09ad09c76753c8-20231222 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Kh4ADFx8DyKsyheb1kxCqsOD8YqzwyrfLZNAEnzeVrQ=; b=cTRK7JC/TP6OE7KU4eFbkC5NoeZMhDAlJfw0e+5K68kp8GQslLlrj2d56lkZ5R3BE1+/gARSJ8cvMvMZHZR0c/QAcOLIrJiJFB4Nf12l8S2oPYN1RPDJ+cSvf7ubI+972A4pmXrfGjL46A52BnAXPf74TYbTnYNfbFOXJ+mZYVA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:07a1523b-264f-4b76-90d0-0d47c5f2ca48,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:5d391d7,CLOUDID:b24c8f7e-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File: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 X-UUID: b410d1f4a0a711ee9b09ad09c76753c8-20231222 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1111788868; Fri, 22 Dec 2023 01:54:23 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 16:53:46 +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; Fri, 22 Dec 2023 16:53:46 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Ming Yen Hsieh , Leon Yen Subject: [PATCH v1 3/4] wifi: mt76: mt792x: update the country list of EU for ACPI SAR Date: Fri, 22 Dec 2023 16:53:37 +0800 Message-ID: <20231222085338.4530-4-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> References: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--0.860300-8.000000 X-TMASE-MatchedRID: VZuxIYcieyyaOlY3WxOn56+dYEguu4aVQl/FdRYkUZKcbyawsiRjd6PF jJEFr+olwXCBO/GKkVr3FLeZXNZS4IzHo47z5Aa+cwtUq/gdOcbwxZn5SZV9DgKZS1JL1tAkTk1 GBFvYVW1Yrf8u8Zq9GO0beEAOU2XCcmRZviJrho/obQWp6Rpd/QcKyX9nDkfBeZUpm6wun3ba/0 6NhYDa4wyzCDjlUx89p2y3mIB+it9WXGvUUmKP2w== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.860300-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 937F82216C4683102AF37373C5463ED00BFE8F9F487D4C97ACC41EE3825D52712000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_005428_473564_88CC5653 X-CRM114-Status: UNSURE ( 8.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ming Yen Hsieh This patch updates the EU country list to ensure the MTCL table works correctly. Signed-off-by: Ming Yen Hsieh Signed-off-by: Leon Yen --- drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c index 8fee3d481df0..571ef03cd4cd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c @@ -376,7 +376,7 @@ u8 mt792x_acpi_get_mtcl_conf(struct mt792x_phy *phy, char *alpha2) "AT", "BE", "BG", "CY", "CZ", "HR", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LI", "LT", "LU", "MT", "NL", "NO", "PL", - "PT", "RO", "MT", "SK", "SI", "ES", "CH", + "PT", "RO", "SK", "SI", "ES", "SE", "CH", }; struct mt792x_acpi_sar *sar = phy->acpisar; struct mt792x_asar_cl *cl; From patchwork Fri Dec 22 08:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingyen Hsieh X-Patchwork-Id: 13503101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74F1EC4706E for ; Fri, 22 Dec 2023 08:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=G903a+rUPsDraNi3izuk1MYUFsGK+bZ2eCu8WQaAmhc=; b=e8aG+7HoBMBvKbDJWFSWXYj4XN irV8G/AAG+Mz2mZDiMvbgaJGH3nNd1KVkVyUXHk+2Ecb0kFahO+uhhUngI9UPQAPpGHGjvv5I8Toy LQ74Vct96cyYJ+vLcJu/dVaXPhPKyO45MhkmBR2/58tdXbZtZKPOtJeTpb26FGy44NaxhxMeg2jIN 95gKshDVz0PqLF434Cb4ciRwfduqIppBhJ74cNistRXm+O5laM+JsFcWVSVtLkwx0PQD381zzSw70 9BA7Wr8JTi5RyOfGnRUJ5tR5kGeRF54Q9/sq9jSk8/wx/u+BIuQya9gMxbpJ+GvEMIQceukvypUof ZGuaGp4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rGbIf-005Msw-1C; Fri, 22 Dec 2023 08:54:33 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rGbIb-005MrZ-1P for linux-mediatek@lists.infradead.org; Fri, 22 Dec 2023 08:54:30 +0000 X-UUID: b412ff92a0a711ee9b09ad09c76753c8-20231222 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=G903a+rUPsDraNi3izuk1MYUFsGK+bZ2eCu8WQaAmhc=; b=DUs5d+unO7N9INw9ANe+qVV2oiBRqI60eN4BEA3KqrdQfnmOFXMLvVW9o8PqcqsoUg5rJTHjzxTWow6gv+ahJBZCWQuiN9Da2ZEFDMLfejONmOaDXQBlYSJ+yZLaVe/IX4iaTu60rgYTbnvvs5tuviQwZMoV8qeP1rXLxJP40h0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:4fb4fa48-3548-4da4-a4ac-d6e415612bdb,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:0b6f0f82-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File: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,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: b412ff92a0a711ee9b09ad09c76753c8-20231222 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2114635672; Fri, 22 Dec 2023 01:54:23 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 22 Dec 2023 16:53:46 +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; Fri, 22 Dec 2023 16:53:46 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Ming Yen Hsieh , Leon Yen Subject: [PATCH v1 4/4] wifi: mt76: mt7921: fix the unfinished command of regd_notifier before suspend Date: Fri, 22 Dec 2023 16:53:38 +0800 Message-ID: <20231222085338.4530-5-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> References: <20231222085338.4530-1-mingyen.hsieh@mediatek.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231222_005429_478962_FBCFDCBC X-CRM114-Status: GOOD ( 10.50 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ming Yen Hsieh Before entering suspend, we need to ensure that all MCU command are completed. In some cases, such as with regd_notifier, there is a chance that CLC commands, will be executed before suspend. Signed-off-by: Ming Yen Hsieh Signed-off-by: Leon Yen --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 6 ++++++ drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt792x.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 48433c6d5e7d..bb2abf341c68 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -138,9 +138,14 @@ mt7921_regd_notifier(struct wiphy *wiphy, if (pm->suspended) return; + dev->regd_in_progress = true; + mt792x_mutex_acquire(dev); mt7921_regd_update(dev); mt792x_mutex_release(dev); + + dev->regd_in_progress = true; + wake_up(&dev->wait); } int mt7921_mac_init(struct mt792x_dev *dev) @@ -261,6 +266,7 @@ int mt7921_register_device(struct mt792x_dev *dev) spin_lock_init(&dev->pm.wake.lock); mutex_init(&dev->pm.mutex); init_waitqueue_head(&dev->pm.wait); + init_waitqueue_head(&dev->wait); if (mt76_is_sdio(&dev->mt76)) init_waitqueue_head(&dev->mt76.sdio.wait); spin_lock_init(&dev->pm.txq_lock); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index 57903c6e4f11..8b226b731ec9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -409,6 +409,9 @@ static int mt7921_pci_suspend(struct device *device) if (err < 0) goto restore_suspend; + wait_event_timeout(dev->wait, + !dev->regd_in_progress, 5 * HZ); + err = mt76_connac_mcu_set_hif_suspend(mdev, true); if (err) goto restore_suspend; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 3c897b34aaa7..a8556de3d480 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -186,6 +186,8 @@ struct mt792x_dev { bool hw_init_done:1; bool fw_assert:1; bool has_eht:1; + bool regd_in_progress:1; + wait_queue_head_t wait; struct work_struct init_work;