Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TX power not able to modify. #111

Open
soragaoanakash opened this issue Jan 13, 2023 · 10 comments
Open

TX power not able to modify. #111

soragaoanakash opened this issue Jan 13, 2023 · 10 comments

Comments

@soragaoanakash
Copy link

Hi,

We trying to adjust the TX power using /etc/config/wireless configuration, but we can't able to change TX power of RTL8822BE.

In the RTL driver code we observed the TXSCAL table, we not getting what exact the TXSCAL meant for, is possible to modify for the TXSCALE table to achieve low TX power.

RTL8822b.c

#define RTW_TXSCALE_SIZE 37
static const u32 rtw8822b_txscale_tbl[RTW_TXSCALE_SIZE] = {
	0x081, 0x088, 0x090, 0x099, 0x0a2, 0x0ac, 0x0b6, 0x0c0, 0x0cc, 0x0d8,
	0x0e5, 0x0f2, 0x101, 0x110, 0x120, 0x131, 0x143, 0x156, 0x16a, 0x180,
	0x197, 0x1af, 0x1c8, 0x1e3, 0x200, 0x21e, 0x23e, 0x261, 0x285, 0x2ab,
	0x2d3, 0x2fe, 0x32b, 0x35c, 0x38e, 0x3c4, 0x3fe
};

Thank you
Akash

@lwfinger
Copy link
Owner

I did not write the driver. I merely take the kernel code, adapt it to build on older kernels, and put it here. I have no idea what that table does.

What are you trying to do?

@soragaoanakash
Copy link
Author

@lwfinger , Thanks for the reply.

We are trying to reduce TX power.

@lwfinger
Copy link
Owner

I will need to send an inquiry to the driver's authors. It will be at least Monday before I get an answer.

I looked through the code and found ".max_power_index = 0x3f," at line 2536 od rtw8822b.c. You might try what happens if yiu change that 0x3f to 0x1f. I do not have the chip so I cannot test the effect.

@soragaoanakash
Copy link
Author

Yes sure, I will update you on Monday.

@lwfinger
Copy link
Owner

My contact replied with the following:

In rtw_phy_get_tx_power_index(), we can have:

offset = min3(pwr_param.pwr_offset,
	      pwr_param.pwr_limit,
	      pwr_param.pwr_sar);

So, a way to restrict the TX power is to set SAR via iw command without changing
driver. Note, you should update the newer iw to have this support.

You would also need kernel 5.11 or newer. That line would be a place to impose your limit if you are not using iw. Pwr_sar is restricted to be between +/-127. I would expect offset above to be in that range.

@soragaoanakash
Copy link
Author

@lwfinger , Thanks for the Input.

@soragaoanakash
Copy link
Author

soragaoanakash commented Jan 17, 2023

When I tried to update the Kernel to 5.15, started facing other issues.

 9.367853] ------------[ cut here ]------------
[    9.372484] write RF mode table fail
[    9.376081] WARNING: CPU: 2 PID: 3542 at backports-6.1-rc8/drivers/net/wireless/realtek/rtw88/rtw8822b.c:805 0xffff800000eac23c
[    9.387569] Modules linked in: rtw88_8822ce rtw88_8822c rtw88_8822be rtw88_8822b rtw88_8723de rtw88_8723d pppoe ppp_async nft_fib_inet nf_flow_table_ipv6 nf_flow_table_ipv4 nf_flow_table_inet rtw88_pci rtw88n
[    9.452539] CPU: 2 PID: 3542 Comm: iw Not tainted 5.15.88 #0
[    9.458200] Hardware name: LS1046A FRWY Board (DT)
[    9.462987] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    9.469950] pc : 0xffff800000eac23c
[    9.473433] lr : 0xffff800000eac23c
[    9.476916] sp : ffff80000ae837b0
[    9.480225] x29: ffff80000ae837b0 x28: ffff000800cf4180 x27: ffff80000ae83dd0
[    9.487365] x26: 0000000000000001 x25: ffff800000eae2a8 x24: 0000000000000005
[    9.494504] x23: ffff800000eae010 x22: 0000000000000000 x21: 00000000000aeaea
[    9.501644] x20: ffff0008050269f0 x19: ffff000805022060 x18: ffff800008e7fa10
[    9.508782] x17: 0000000000000000 x16: 0000000000000000 x15: 000000000000063c
[    9.515920] x14: 0000000000000214 x13: ffff80000ae834d8 x12: ffff800008ed7a10
[    9.523060] x11: fffffffffffe99b0 x10: ffff800008ed7a10 x9 : 0000000000000000
[    9.530198] x8 : ffff800008e7f9c0 x7 : ffff800008e7fa10 x6 : 00000000ffffefff
[    9.537337] x5 : ffff00087bfd5770 x4 : 0000000000000000 x3 : 0000000000000027
[    9.544475] x2 : 0000000000000027 x1 : ffff000800cf4180 x0 : 0000000000000018
[    9.551613] Call trace:
[    9.554053]  0xffff800000eac23c
[    9.557188]  0xffff800000eac63c
[    9.560323]  rtw_set_txrx_1ss+0x24c/0x17b0 [rtw88_core]
[    9.565556]  ieeee80211_obss_color_collision_notify+0x19a8/0x2e3c [mac80211]
[    9.572622]  nl80211_parse_chandef+0x1638/0x2e54 [cfg80211]
[    9.578201]  genl_family_rcv_msg_doit+0xb8/0x11c
[    9.582823]  genl_rcv_msg+0xd4/0x1cc
[    9.586395]  netlink_rcv_skb+0x5c/0x130
[    9.590228]  genl_rcv+0x38/0x50
[    9.593366]  netlink_unicast+0x184/0x280
[    9.597286]  netlink_sendmsg+0x1a0/0x3dc
[    9.601205]  ____sys_sendmsg+0x1b8/0x220
[    9.605125]  ___sys_sendmsg+0x84/0xf0
[    9.608783]  __sys_sendmsg+0x48/0xb0
[    9.612354]  __arm64_sys_sendmsg+0x24/0x30
[    9.616447]  invoke_syscall.constprop.0+0x50/0xf0
[    9.621149]  do_el0_svc+0x50/0x140
[    9.624547]  el0_svc+0x18/0x54
[    9.627597]  el0t_64_sync_handler+0xe8/0x114
[    9.631863]  el0t_64_sync+0x184/0x188
[    9.635520] ---[ end trace 5fc4dc9a29135c5f ]---


@soragaoanakash
Copy link
Author

I don't what exactly happening over there.

@lwfinger
Copy link
Owner

First of all, switch from the in-kernel driver to the one from this repo. That will update the driver from kernel 5.15 to 6.2. It is possible, even likely, that the problem is fixed.

The warning happens because the driver is unable to write to the RF control registers. I have never seen that before.

Why are the 8821c and 8723d modules loaded if you have an 8822b module?

@soragaoanakash
Copy link
Author

soragaoanakash commented Jan 23, 2023

Hi @lwfinger ,

Sorry for the late reply.

In openwrt build default when we select rtw88 package all the driver will be part of the build and loaded during the kernel bootup.

error remains same even after removing unused driver.

[    8.947089] ------------[ cut here ]------------
[    8.951729] write RF mode table fail
[    8.955324] WARNING: CPU: 3 PID: 3536 at backports-6.1-rc8/drivers/net/wireless/realtek/rtw88/rtw8822b.c:805 0xffff800000e9423c
[    8.966814] Modules linked in: rtw88_8822be rtw88_8822b pppoe ppp_async nft_fib_inet nf_flow_table_ipv6 nf_flow_table_ipv4 nf_flow_table_inet rtw88_pci rtw88_core pppox ppp_generic nft_reject_ipv6 nft_rejectn
[    9.027430] CPU: 3 PID: 3536 Comm: iw Not tainted 5.15.88 #0
[    9.033090] Hardware name: LS1046A FRWY Board (DT)
[    9.037877] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants