Blame SOURCES/0012-rtw89-update-rtw89-regulation-definition-to-R58-R31.patch

56e3f4
From 7613345d117cb43c93176775f2fd7cc06cdc8006 Mon Sep 17 00:00:00 2001
56e3f4
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
56e3f4
Date: Fri, 21 Jan 2022 08:49:02 +0100
56e3f4
Subject: [PATCH 12/36] rtw89: update rtw89 regulation definition to R58-R31
56e3f4
MIME-Version: 1.0
56e3f4
Content-Type: text/plain; charset=UTF-8
56e3f4
Content-Transfer-Encoding: 8bit
56e3f4
56e3f4
Bugzilla: http://bugzilla.redhat.com/2033291
56e3f4
56e3f4
commit 542577149794b9c8638f6f2cb90b35b137b44156
56e3f4
Author: Zong-Zhe Yang <kevin_yang@realtek.com>
56e3f4
Date:   Mon Nov 1 17:31:04 2021 +0800
56e3f4
56e3f4
    rtw89: update rtw89 regulation definition to R58-R31
56e3f4
56e3f4
    Support QATAR in rtw89_regulation_type and reorder the enum to align
56e3f4
    realtek R58-R31 regulation definition. Besides, if an unassigned entry
56e3f4
    of limit/limit_ru tables is read, return the corresponding WW value for
56e3f4
    the unconfigured case.
56e3f4
56e3f4
    Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
56e3f4
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
56e3f4
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
56e3f4
    Link: https://lore.kernel.org/r/20211101093106.28848-3-pkshih@realtek.com
56e3f4
56e3f4
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
56e3f4
---
56e3f4
 drivers/net/wireless/realtek/rtw89/core.h |  9 +++++----
56e3f4
 drivers/net/wireless/realtek/rtw89/phy.c  | 12 ++++++++++++
56e3f4
 2 files changed, 17 insertions(+), 4 deletions(-)
56e3f4
56e3f4
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
56e3f4
index c2885e4dd882..3729abda04f9 100644
56e3f4
--- a/drivers/net/wireless/realtek/rtw89/core.h
56e3f4
+++ b/drivers/net/wireless/realtek/rtw89/core.h
56e3f4
@@ -411,12 +411,13 @@ enum rtw89_regulation_type {
56e3f4
 	RTW89_NA	= 4,
56e3f4
 	RTW89_IC	= 5,
56e3f4
 	RTW89_KCC	= 6,
56e3f4
-	RTW89_NCC	= 7,
56e3f4
-	RTW89_CHILE	= 8,
56e3f4
-	RTW89_ACMA	= 9,
56e3f4
-	RTW89_MEXICO	= 10,
56e3f4
+	RTW89_ACMA	= 7,
56e3f4
+	RTW89_NCC	= 8,
56e3f4
+	RTW89_MEXICO	= 9,
56e3f4
+	RTW89_CHILE	= 10,
56e3f4
 	RTW89_UKRAINE	= 11,
56e3f4
 	RTW89_CN	= 12,
56e3f4
+	RTW89_QATAR	= 13,
56e3f4
 	RTW89_REGD_NUM,
56e3f4
 };
56e3f4
 
56e3f4
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
56e3f4
index ab134856baac..0620ef02e275 100644
56e3f4
--- a/drivers/net/wireless/realtek/rtw89/phy.c
56e3f4
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
56e3f4
@@ -1099,9 +1099,15 @@ s8 rtw89_phy_read_txpwr_limit(struct rtw89_dev *rtwdev,
56e3f4
 	switch (band) {
56e3f4
 	case RTW89_BAND_2G:
56e3f4
 		lmt = (*chip->txpwr_lmt_2g)[bw][ntx][rs][bf][regd][ch_idx];
56e3f4
+		if (!lmt)
56e3f4
+			lmt = (*chip->txpwr_lmt_2g)[bw][ntx][rs][bf]
56e3f4
+						   [RTW89_WW][ch_idx];
56e3f4
 		break;
56e3f4
 	case RTW89_BAND_5G:
56e3f4
 		lmt = (*chip->txpwr_lmt_5g)[bw][ntx][rs][bf][regd][ch_idx];
56e3f4
+		if (!lmt)
56e3f4
+			lmt = (*chip->txpwr_lmt_5g)[bw][ntx][rs][bf]
56e3f4
+						   [RTW89_WW][ch_idx];
56e3f4
 		break;
56e3f4
 	default:
56e3f4
 		rtw89_warn(rtwdev, "unknown band type: %d\n", band);
56e3f4
@@ -1224,9 +1230,15 @@ static s8 rtw89_phy_read_txpwr_limit_ru(struct rtw89_dev *rtwdev,
56e3f4
 	switch (band) {
56e3f4
 	case RTW89_BAND_2G:
56e3f4
 		lmt_ru = (*chip->txpwr_lmt_ru_2g)[ru][ntx][regd][ch_idx];
56e3f4
+		if (!lmt_ru)
56e3f4
+			lmt_ru = (*chip->txpwr_lmt_ru_2g)[ru][ntx]
56e3f4
+							 [RTW89_WW][ch_idx];
56e3f4
 		break;
56e3f4
 	case RTW89_BAND_5G:
56e3f4
 		lmt_ru = (*chip->txpwr_lmt_ru_5g)[ru][ntx][regd][ch_idx];
56e3f4
+		if (!lmt_ru)
56e3f4
+			lmt_ru = (*chip->txpwr_lmt_ru_5g)[ru][ntx]
56e3f4
+							 [RTW89_WW][ch_idx];
56e3f4
 		break;
56e3f4
 	default:
56e3f4
 		rtw89_warn(rtwdev, "unknown band type: %d\n", band);
56e3f4
-- 
56e3f4
2.13.6
56e3f4