MediaTek MT76 Ignoring Wi-Fi TX Power Configuration

I was on my way to open a new bug report about the subject of this topic, but there are at least two bugs about this issue already reported and still open (one of them from 2017):

So instead of open a new bug report I decided to share my findings here (just in case someone has an workaround) and later I will update both bugs above with the details below.

I am reporting this issue observed on a TP-Link Archer C6 3.2 (MT7621 + MT7603EN 2.4Ghz + MT7613BEN 5Ghz) running a snapshot build (r17525-a46fa5c3a7).

The issue seems to be with the M76 driver which is completely ignoring the "TX Power" set via LuCI and UCI. I am saying the issue seems to be the Wi-Fi driver because UCI and iwinfo everything seems to be OK.

See the example below. I've set the TX Power to 0dbm for testing purposes, and UCI and iwinfo correctly show the value I've configured:

root@ap2:~# uci show wireless.radio1

root@ap2:~# iwinfo wlan1 info
wlan1     ESSID: "dshome5ghz-tst"
          Access Point: xx:xx:xx:xx:C8:40
          Mode: Master  Channel: 100 (5.500 GHz)
          Center Channel 1: 106 2: unknown
          Tx-Power: 0 dBm  Link Quality: 24/70
          Signal: -86 dBm  Noise: -92 dBm
          Bit Rate: 234.0 MBit/s
          Encryption: WPA2 PSK (CCMP)
          Type: nl80211  HW Mode(s): 802.11nac
          Hardware: 14C3:7663 14C3:7663 [MediaTek MT7613BE]
          TX power offset: none
          Frequency offset: none
          Supports VAPs: yes  PHY name: phy1

However the 0dBm configuration above has no effect on TX Power at all.

With TX Power configured at 0 dBm for the 5Ghz radio in the example above, Wi-Fi signal should be very weak and should work only on the same room and close to the access point.

However as seen below the signal strength measured with a laptop located about 10 meters away from the access point with a brick wall between the laptop and the access point and the wi-if signal strength is still strong. This is the same level as if TX Power is at 22dBm (driver default level), so in fact the TX Power configuration is not working:

ubuntu@ubuntu:~$ iwconfig wlp2s0
wlp2s0    IEEE 802.11  ESSID:"dshome5ghz-tst"  
          Mode:Managed  Frequency:5.5 GHz  Access Point: xx:xx:xx:xx:C8:40   
          Bit Rate=26 Mb/s   Tx-Power=22 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=42/70  Signal level=-68 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:30   Missed beacon:0

I've experimented other TX Power levels, and none configuration has any effect on OpenWRT TX Power. I am not sure if this is an OpenWRT bug or if it is in fact a MT76 driver issue to be reported upstream by OpenWRT devs.

Anyway I will update issues #181 and #3983 with the above details.