Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1450659rdd; Wed, 10 Jan 2024 22:19:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJf9Kyjw4eKDkYMbwi82bT/jfStRyAgoeAA3G8TQrmkIMwXxpan9niDCUZgrHIujDclE5Q X-Received: by 2002:a17:90b:897:b0:28c:8db3:deee with SMTP id bj23-20020a17090b089700b0028c8db3deeemr408396pjb.7.1704953949709; Wed, 10 Jan 2024 22:19:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704953949; cv=none; d=google.com; s=arc-20160816; b=zm0wzVoLOcyOf6+xpjgv0QD7DqzEi93lTqlq/Os1ylZwmJDjgzYjQbcpX7mOQ5Yms/ Cq1GmJOiw6R0Urr6LQ9/Vnhkjn4p3nDnDKJj69U4ibiTl7at2whDNrJ/4sEli/CJgWIh ZXR/X2KGgPyjYs/HHED9PbrLDGmjIePr4uewLL7++6xbLuZnUoD/UGlG690uG6peZzf7 ngFsmEza0qf4iu5HfS+itth0XXhnKv48eIP93oHNYVy+geU/9K6KLPveHomykqP5uZvh uY4KFyrYSSfI+EtOcPqDRP4M5CNSh/6tAjFbZVZf38AfeSCBQIl6PbsjrVYm59AKFeKQ 6aJQ== ARC-Message-Signature: i=1; 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=IC3+GLMr4LDNrilPLuhGf61AY9/fwVusNXb18FDOfF8=; fh=jlecVeJ1zmiUcWLoYt7W352gNllWYkqAa/aIazCPBg4=; b=quck/v5At61p+C6iEiU944ugbgzrYSeZVYsKIVOk/7MSjdU7Z3INlk/xAEcTBrA0hn GDUyHIL+zaBlBFNB2TNiN/qR4PPHUr3soWzD1v+H9HC8hNu9YihXjqqFP84MBIa3OLJg 0Ge4tvqTrAh9NRznIQ15BQm1Eq+P5Ga3QRQ7T1mrgQzMgrOCWvf5eVpU0nJXJN4QidBT KwI71VMLbr3YVQzF8gJs/El5tbIZG3ug7Dtn/egXQsj9rrwLtC/ut4riGbo/56UqrcFq 7N9l4nr+kIBW03jNPlpJUVV8I9ykrB7gU+h1RwuI4n0FH4CZcy8dBSaKu59e06MslsZn GGlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=W167zq8O; spf=pass (google.com: domain of linux-wireless+bounces-1699-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1699-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v11-20020a17090a898b00b0028c708ae57csi2956247pjn.69.2024.01.10.22.19.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 22:19:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1699-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=W167zq8O; spf=pass (google.com: domain of linux-wireless+bounces-1699-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1699-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C355C286361 for ; Thu, 11 Jan 2024 06:19:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C0972116; Thu, 11 Jan 2024 06:19:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="W167zq8O" X-Original-To: linux-wireless@vger.kernel.org Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 309C42106 for ; Thu, 11 Jan 2024 06:19:03 +0000 (UTC) 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: 4e8dff08b04911ee9e680517dc993faa-20240111 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=IC3+GLMr4LDNrilPLuhGf61AY9/fwVusNXb18FDOfF8=; b=W167zq8O5+tUC1JgntuS8WGQCz3XSlRmgXEhZw6pRRu3Wki/kbrXwWbkB/phukp4kD/81p/QlNTJaYxsX1eQGHrS2HsIP3WSeCi4hnf/aKjM/jTOH+HDK3puHWBUAM2mktlL31N/I/qUXeFMoMPQsvIGHMoz/BJcarA4ksCM73o=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:3b55cd5c-1c75-4679-8d99-bced7115fc6c,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:7b60218e-e2c0-40b0-a8fe-7c7e47299109,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: 4e8dff08b04911ee9e680517dc993faa-20240111 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1709954906; Thu, 11 Jan 2024 14:18:59 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 11 Jan 2024 14:18:57 +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; Thu, 11 Jan 2024 14:18:57 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Ming Yen Hsieh , Leon Yen Subject: [PATCH] wifi: mt76: mt792x: add the illegal value check for mtcl table of acpi Date: Thu, 11 Jan 2024 14:18:56 +0800 Message-ID: <20240111061856.16370-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 From: Ming Yen Hsieh The mtcl table provided regulatory information for 5.9/6Ghz channels and configured by platform venders. So, sometimes vendors may write illegal values, and therefore it is necessary to check and add corresponding handling for such cases. Signed-off-by: Leon Yen Signed-off-by: Ming Yen Hsieh --- drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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..c64562216caa 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c @@ -353,11 +353,15 @@ static u8 mt792x_acpi_get_mtcl_map(int row, int column, struct mt792x_asar_cl *cl) { u8 config = 0; + u8 mode_6g, mode_5g9; - if (cl->cl6g[row] & BIT(column)) - config |= (cl->mode_6g & 0x3) << 2; + mode_6g = (cl->mode_6g > 0x02) ? 0 : cl->mode_6g; + mode_5g9 = (cl->mode_5g9 > 0x01) ? 0 : cl->mode_5g9; + + if ((cl->cl6g[row] & BIT(column)) || cl->mode_6g == 0x02) + config |= (mode_6g & 0x3) << 2; if (cl->version > 1 && cl->cl5g9[row] & BIT(column)) - config |= (cl->mode_5g9 & 0x3); + config |= (mode_5g9 & 0x3); return config; } -- 2.18.0