Skip to contentSkip to conversation

dt-bindings: net: wireless: mt76: add power-limits node

PATCH In review Felix Fietkau 2 participants 3 messages Jul 15, 2020 – Jul 21, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 dt-bindings: net: wireless: mt76: add power-limits node

This subnode can be used to set per-rate tx power limits either per country code / regdomain or globally.
These limits are typically provided by the device manufacturers and are used to limit sideband emissions and stay within regulatory limits

---
v3:
- fix S-o-b order
v2:
- merge 802.11ax rate changes from Shayne's patch
- document txs-delta property

 .../bindings/net/wireless/mediatek,mt76.txt   | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +59 -0
index ab7e7a00e534..e4859c974ef4 100644
@@ -36,6 +36,7 @@ Optional nodes:
 - led: Properties for a connected LED
   Optional properties:
     - led-sources: See Documentation/devicetree/bindings/leds/common.txt
+- power-limits: contains per-regdomain/channel rate power limit subnodes
 
 &pcie {
 	pcie0 {
@@ -76,3 +77,61 @@ wmac: wmac@18000000 {
 
 	power-domains = <&scpsys MT7622_POWER_DOMAIN_WB>;
 };
+
+
+Subnodes of power-limits:
+
+Properties:
+- country: One or more country codes, as used by the cfg80211 regdomain code
+- regdomain: "FCC", "ETSI" or "JP"
+
+If neither country, nor regdomain is specified, the power limits node is used
+as a fallback when no other subnode matches.
+
+Subnodes txpower-2g, txpower-5g:
+
+Properties:
+- channels: pairs of first and last channel number
+- cck: 4 half-dBm per-rate power limit values
+- ofdm: 8 half-dBm per-rate power limit values
+- mcs:
+	sets of per-rate power limit values for 802.11n/802.11ac rates for
+	multiple channel bandwidth settings.
+	Each set starts with the number of channel bandwidth settings for
+	which the rate set applies, followed by either 8 (MT7603/MT7628) or
+	10 (all other chips) power limit values.
+	The order of the channel bandwidth settings is: 20, 40, 80, 160 MHz.
+- ru:
+	sets of per-rate power limit values for 802.11ax rates for multiple
+	channel bandwidth or resource unit settings.
+	Each set starts with the number of channel bandwidth or resource unit
+	settings for which the rate set applies, followed by 12 power limit
+	values. The order of the channel resource unit settings is:
+	RU26, RU52, RU106, RU242/SU20, RU484/SU40, RU996/SU80, RU2x996/SU160.
+- txs-delta: half-dBm power delta for different numbers of antennas (1, 2, ...)
+
+
+power-limit example:
+
+power-limits {
+	r0 {
+		regdomain = "FCC";
+		txpower-5g {
+			r1 {
+				channels = <36 48>;
+				ofdm = <23 23 23 23 23 23 23 23>;
+				mcs = <1 23 23 23 23 23 23 23 23 23 23>,
+					  <3 22 22 22 22 22 22 22 22 22 22>;
+				ru = <3 22 22 22 22 22 22 22 22 22 22 22 22>,
+				     <4 20 20 20 20 20 20 20 20 20 20 20 20>;
+			};
+			r2 {
+				channels = <100 181>;
+				ofdm = <14 14 14 14 14 14 14 14>;
+				mcs = <4 14 14 14 14 14 14 14 14 14 14>;
+				txs-delta = <12 9 6>;
+				ru = <7 14 14 14 14 14 14 14 14 14 14 14 14>;
+			};
+		};
+	};
+};
Signature · 1 line
2.24.0
maintainer
#1 lore raw
Quoted 8 lines · Felix Fietkau

This subnode can be used to set per-rate tx power limits either per country code / regdomain or globally.
These limits are typically provided by the device manufacturers and are used to limit sideband emissions and stay within regulatory limits

Quoted 6 lines

---
v3:
- fix S-o-b order
v2:
- merge 802.11ax rate changes from Shayne's patch
- document txs-delta property

This is an extensive enough change that I think it needs to be in schema format.

Quoted 16 lines
 .../bindings/net/wireless/mediatek,mt76.txt   | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +1 -0
index ab7e7a00e534..e4859c974ef4 100644
@@ -36,6 +36,7 @@ Optional nodes:
 - led: Properties for a connected LED
   Optional properties:
     - led-sources: See Documentation/devicetree/bindings/leds/common.txt
+- power-limits: contains per-regdomain/channel rate power limit subnodes
 
 &pcie {
 	pcie0 {

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 85

Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +6 -0
@@ -76,3 +77,61 @@ wmac: wmac@18000000 {
 
 	power-domains = <&scpsys MT7622_POWER_DOMAIN_WB>;
 };
+
+
+Subnodes of power-limits:
+
+Properties:
+- country: One or more country codes, as used by the cfg80211 regdomain code

What are the values? cfg80211 is a Linux thing and doesn't belong in bindings.

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 86

Quoted 1 line
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +1 -0
+- regdomain: "FCC", "ETSI" or "JP"

These aren't implied by the country code?

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 94

Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +8 -0
+
+If neither country, nor regdomain is specified, the power limits node is used
+as a fallback when no other subnode matches.
+
+Subnodes txpower-2g, txpower-5g:
+
+Properties:
+- channels: pairs of first and last channel number

What's the range in terms of channel numbers and pairs?

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 103

Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +9 -0
+- cck: 4 half-dBm per-rate power limit values
+- ofdm: 8 half-dBm per-rate power limit values
+- mcs:
+	sets of per-rate power limit values for 802.11n/802.11ac rates for
+	multiple channel bandwidth settings.
+	Each set starts with the number of channel bandwidth settings for
+	which the rate set applies, followed by either 8 (MT7603/MT7628) or
+	10 (all other chips) power limit values.
+	The order of the channel bandwidth settings is: 20, 40, 80, 160 MHz.

The example only has 2 sets, so which channels are they?

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 110

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +7 -0
+- ru:
+	sets of per-rate power limit values for 802.11ax rates for multiple
+	channel bandwidth or resource unit settings.
+	Each set starts with the number of channel bandwidth or resource unit
+	settings for which the rate set applies, followed by 12 power limit
+	values. The order of the channel resource unit settings is:
+	RU26, RU52, RU106, RU242/SU20, RU484/SU40, RU996/SU80, RU2x996/SU160.

Could be 8-bit? Doesn't really matter much for the example, but what's the worst/typical case?

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 117

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +7 -0
+- txs-delta: half-dBm power delta for different numbers of antennas (1, 2, ...)
+
+
+power-limit example:
+
+power-limits {
+	r0 {

What's 'r0'? Not documented.

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 120

Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +3 -0
+		regdomain = "FCC";
+		txpower-5g {
+			r1 {

What's 'r1' and 'r2'? Not documented.

Quoted 20 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +17 -0
+				channels = <36 48>;
+				ofdm = <23 23 23 23 23 23 23 23>;
+				mcs = <1 23 23 23 23 23 23 23 23 23 23>,
+					  <3 22 22 22 22 22 22 22 22 22 22>;
+				ru = <3 22 22 22 22 22 22 22 22 22 22 22 22>,
+				     <4 20 20 20 20 20 20 20 20 20 20 20 20>;
+			};
+			r2 {
+				channels = <100 181>;
+				ofdm = <14 14 14 14 14 14 14 14>;
+				mcs = <4 14 14 14 14 14 14 14 14 14 14>;
+				txs-delta = <12 9 6>;
+				ru = <7 14 14 14 14 14 14 14 14 14 14 14 14>;
+			};
+		};
+	};
+};
Signature · 1 line
2.24.0
#2 lore raw
Quoted 16 lines · Rob Herring
Quoted 8 lines · Felix Fietkau

This subnode can be used to set per-rate tx power limits either per country code / regdomain or globally.
These limits are typically provided by the device manufacturers and are used to limit sideband emissions and stay within regulatory limits

Quoted 6 lines

---
v3:
- fix S-o-b order
v2:
- merge 802.11ax rate changes from Shayne's patch
- document txs-delta property

Quoted 2 lines

This is an extensive enough change that I think it needs to be in schema format.

Okay, I will convert the existing file soon and then add these changes afterwards.

Quoted 17 lines
Quoted 17 lines
 .../bindings/net/wireless/mediatek,mt76.txt   | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +1 -0
index ab7e7a00e534..e4859c974ef4 100644
@@ -36,6 +36,7 @@ Optional nodes:
 - led: Properties for a connected LED
   Optional properties:
     - led-sources: See Documentation/devicetree/bindings/leds/common.txt
+- power-limits: contains per-regdomain/channel rate power limit subnodes
 
 &pcie {
 	pcie0 {
@@ -76,3 +77,61 @@ wmac: wmac@18000000 {
 
Quoted 11 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 85

Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +6 -0
 	power-domains = <&scpsys MT7622_POWER_DOMAIN_WB>;
 };
+
+
+Subnodes of power-limits:
+
+Properties:
+- country: One or more country codes, as used by the cfg80211 regdomain code

What are the values? cfg80211 is a Linux thing and doesn't belong in bindings.

I'll change the description to leave out cfg80211. It's a simple alpha2 country code.

Quoted 3 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 86

Quoted 1 line
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +1 -0
+- regdomain: "FCC", "ETSI" or "JP"

These aren't implied by the country code?

You use either country code or regdomain.

Quoted 9 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 94

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +7 -0
+If neither country, nor regdomain is specified, the power limits node is used
+as a fallback when no other subnode matches.
+
+Subnodes txpower-2g, txpower-5g:
+
+Properties:
+- channels: pairs of first and last channel number

What's the range in terms of channel numbers and pairs?

802.11 channel numbers (0-255)

Quoted 11 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 103

Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +9 -0
+- cck: 4 half-dBm per-rate power limit values
+- ofdm: 8 half-dBm per-rate power limit values
+- mcs:
+	sets of per-rate power limit values for 802.11n/802.11ac rates for
+	multiple channel bandwidth settings.
+	Each set starts with the number of channel bandwidth settings for
+	which the rate set applies, followed by either 8 (MT7603/MT7628) or
+	10 (all other chips) power limit values.
+	The order of the channel bandwidth settings is: 20, 40, 80, 160 MHz.

The example only has 2 sets, so which channels are they?

The format is <number_of_sets set_data>, so a set starting with <3 ...> would contain the values for 20, 40 and 80 MHz and you'd add another one with <1 ...> to describe 160 MHz.
Sets often contain the same data for multiple channel bandwidths, so this reduces duplication.

Quoted 10 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 110

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +7 -0
+- ru:
+	sets of per-rate power limit values for 802.11ax rates for multiple
+	channel bandwidth or resource unit settings.
+	Each set starts with the number of channel bandwidth or resource unit
+	settings for which the rate set applies, followed by 12 power limit
+	values. The order of the channel resource unit settings is:
+	RU26, RU52, RU106, RU242/SU20, RU484/SU40, RU996/SU80, RU2x996/SU160.

Could be 8-bit? Doesn't really matter much for the example, but what's the worst/typical case?

Yes, 8 bit would also work.

Quoted 10 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 117

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +7 -0
+- txs-delta: half-dBm power delta for different numbers of antennas (1, 2, ...)
+
+
+power-limit example:
+
+power-limits {
+	r0 {

What's 'r0'? Not documented.

Quoted 5 lines

Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt wmac: wmac@18000000 { · line 120

Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +3 -0
+		regdomain = "FCC";
+		txpower-5g {
+			r1 {

What's 'r1' and 'r2'? Not documented.

You add an arbitrary number of subnodes (I just used r0, r1, ...) containing rules with the documented properties.

- Felix