diff mbox

[04/10] rtlwifi: Extend tx_power_by_rate_offset size for newer IC

Message ID 20180126074645.27201-5-pkshih@realtek.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Ping-Ke Shih Jan. 26, 2018, 7:46 a.m. UTC
From: Ping-Ke Shih <pkshih@realtek.com>

In older design, the TX power is grouped into rate section (smaller array
size), but new design groups them into rate (larger array size). Thus,
we extend the size for both cases, and add compile time assertion.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 2 ++
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Larry Finger Jan. 27, 2018, 7:44 p.m. UTC | #1
On 01/26/2018 01:46 AM, pkshih@realtek.com wrote:
> From: Ping-Ke Shih <pkshih@realtek.com>
> 
> In older design, the TX power is grouped into rate section (smaller array
> size), but new design groups them into rate (larger array size). Thus,
> we extend the size for both cases, and add compile time assertion.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> ---

I hate to see any arrays getting larger, but I can see that changes in rates 
make this inevitable. The BUILD_BUG_ON() is a good addition.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Ping-Ke Shih Jan. 29, 2018, 3:13 a.m. UTC | #2
On Sat, 2018-01-27 at 13:44 -0600, Larry Finger wrote:
> On 01/26/2018 01:46 AM, pkshih@realtek.com wrote:

> > From: Ping-Ke Shih <pkshih@realtek.com>

> > 

> > In older design, the TX power is grouped into rate section (smaller array

> > size), but new design groups them into rate (larger array size). Thus,

> > we extend the size for both cases, and add compile time assertion.

> > 

> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

> > ---


> I hate to see any arrays getting larger, but I can see that changes in rates 

> make this inevitable. The BUILD_BUG_ON() is a good addition.


> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

>


My steps to revise tx_power procedure are
1. extends the array size (this commit)
2. add 8822be (the new tx_power procedure is included)
3. make all chips use the new tx_power procedure

PK
diff mbox

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index 92f99a303920..c000c85a3ded 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -2646,6 +2646,8 @@  EXPORT_SYMBOL_GPL(rtl_global_var);
 
 static int __init rtl_core_module_init(void)
 {
+	BUILD_BUG_ON(TX_PWR_BY_RATE_NUM_RATE < TX_PWR_BY_RATE_NUM_SECTION);
+
 	if (rtl_rate_control_register())
 		pr_err("rtl: Unable to register rtl_rc, use default RC !!\n");
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index be45420f34d3..5b29502a2864 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -173,6 +173,7 @@  enum rtl8192c_h2c_cmd {
 #define TX_PWR_BY_RATE_NUM_BAND		2
 #define TX_PWR_BY_RATE_NUM_RF		4
 #define TX_PWR_BY_RATE_NUM_SECTION	12
+#define TX_PWR_BY_RATE_NUM_RATE		84 /* >= TX_PWR_BY_RATE_NUM_SECTION */
 #define MAX_BASE_NUM_IN_PHY_REG_PG_24G  6
 #define MAX_BASE_NUM_IN_PHY_REG_PG_5G	5
 
@@ -1285,7 +1286,7 @@  struct rtl_phy {
 	u32 tx_power_by_rate_offset[TX_PWR_BY_RATE_NUM_BAND]
 				   [TX_PWR_BY_RATE_NUM_RF]
 				   [TX_PWR_BY_RATE_NUM_RF]
-				   [TX_PWR_BY_RATE_NUM_SECTION];
+				   [TX_PWR_BY_RATE_NUM_RATE];
 	u8 txpwr_by_rate_base_24g[TX_PWR_BY_RATE_NUM_RF]
 				 [TX_PWR_BY_RATE_NUM_RF]
 				 [MAX_BASE_NUM_IN_PHY_REG_PG_24G];