Skip to contentSkip to conversation

wifi: nxpwifi: add TX power limit configuration support

PATCH In review [email protected] 2 participants 6 messages Oct 5

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

v3 cover wifi: nxpwifi: add TX power limit configuration support

From: Jeff Chen <[email protected]>

This series adds support for accessing firmware Transmit Rate-based Power Control (TRPC) configuration through an NL80211 vendor command.

Patch 1 adds common NXP vendor command definitions in a UAPI header.

Patch 2 adds support for the firmware TRPC command used to retrieve and update TX power limit data.

Patch 3 exposes the TRPC configuration interface to userspace through NL80211_CMD_VENDOR.

Changes in v3:
- Fix kernel-doc warnings.
- Rename txpwr symbols to txpwrlimit for consistency.

Changes in v2:
- Add a common UAPI header for NXP vendor command definitions.
- Move vendor command definitions from the driver to the UAPI header.
- Address review comments.

Jeff Chen (3):
wifi: nl80211: vendor-cmd: add NXP vendor command definitions
wifi: nxpwifi: add firmware TRPC command support
wifi: nxpwifi: add netlink vendor command for TX power limits

 drivers/net/wireless/nxp/nxpwifi/Makefile   |   1 +
 drivers/net/wireless/nxp/nxpwifi/cfg.h      |  11 ++
 drivers/net/wireless/nxp/nxpwifi/cfg80211.c |   5 +-
 drivers/net/wireless/nxp/nxpwifi/fw.h       |   8 ++
 drivers/net/wireless/nxp/nxpwifi/main.h     |   3 +
 drivers/net/wireless/nxp/nxpwifi/sta_cfg.c  |   8 ++
 drivers/net/wireless/nxp/nxpwifi/sta_cmd.c  |  67 +++++++++
 drivers/net/wireless/nxp/nxpwifi/vendor.c   | 152 ++++++++++++++++++++
 drivers/net/wireless/nxp/nxpwifi/vendor.h   |  14 ++
 include/uapi/linux/nl80211-vnd-nxp.h        |  81 +++++++++++
 10 files changed, 349 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.c
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.h
 create mode 100644 include/uapi/linux/nl80211-vnd-nxp.h

base-commit: f49defea7668d8c68ec19fa085ef3da6075561c7

Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/3 wifi: nl80211: vendor-cmd: add NXP vendor command definitions

From: Jeff Chen <[email protected]>

Add NXP vendor command and attribute definitions for use with NL80211_CMD_VENDOR.

The initial user of this interface is the Transmit Rate-based Power Control (TRPC) configuration command.

The TRPC table is a firmware-defined ABI that contains TX power limit data. Existing nl80211 TX power interfaces allow TX power levels to be configured, but do not provide an interface for exchanging TRPC table data between userspace and firmware.

Therefore, the TRPC configuration interface is exposed through a vendor command. The kernel does not interpret the TRPC table contents and only passes the table data between userspace and firmware.

Example use cases include:
- Reading firmware TX power limit configuration for verification.
- Updating platform-specific TX power limit tables.
- Supporting manufacturing, validation, regulatory, and platform bring-up workflows that require access to firmware-defined TX power limit data.

Assisted-by LLM
---
 include/uapi/linux/nl80211-vnd-nxp.h | 81 ++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 include/uapi/linux/nl80211-vnd-nxp.h
include/uapi/linux/nl80211-vnd-nxp.h new file +81 -0
new file mode 100644
index 000000000000..4e18d0f5af03
@@ -0,0 +1,81 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * NXP vendor command definitions for nl80211
+ *
+ * Copyright 2026 NXP
+ */
+
+#ifndef __VENDOR_CMD_NXP_H__
+#define __VENDOR_CMD_NXP_H__
+
+#define NXP_OUI		0x006037
+
+/**
+ * enum nxp_vendor_cmd - supported NXP vendor commands
+ *
+ * @NXP_VENDOR_CMD_TXPOWER_LIMIT: Access firmware Transmit Rate-based
+ *      Power Control (TRPC) configuration. The command uses the
+ *      attributes defined by &enum nxp_txpwrlimit_attrs.
+ *
+ *      SET operations provide TRPC table data through
+ *      %NXP_ATTR_TXPWRLIMIT_DATA. GET operations return the requested TRPC
+ *      table in %NXP_ATTR_TXPWRLIMIT_DATA.
+ *
+ *      The kernel does not interpret the TRPC table contents and only
+ *      passes the table data between userspace and firmware.
+ */
+enum nxp_vendor_cmd {
+	NXP_VENDOR_CMD_TXPOWER_LIMIT,
+};
+
+/**
+ * enum nxp_txpwrlimit_action - operation for %NXP_ATTR_TXPWRLIMIT_ACTION
+ *
+ * @NXP_TXPWRLIMIT_ACTION_GET: Retrieve the TRPC table for the selected
+ *	subband.
+ * @NXP_TXPWRLIMIT_ACTION_SET: Update the TRPC table for the selected
+ *	subband using data from %NXP_ATTR_TXPWRLIMIT_DATA.
+ */
+enum nxp_txpwrlimit_action {
+	NXP_TXPWRLIMIT_ACTION_GET,
+	NXP_TXPWRLIMIT_ACTION_SET,
+};
+
+/**
+ * enum nxp_txpwrlimit_subband - firmware TRPC subband selectors
+ *
+ * The selector values are defined by the firmware Transmit Rate-based
+ * Power Control (TRPC) interface.
+ *
+ * @NXP_TXPWRLIMIT_SUBBAND_2G: 2.4 GHz band.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_0: 5 GHz subband 0.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_1: 5 GHz subband 1.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_2: 5 GHz subband 2.
+ * @NXP_TXPWRLIMIT_SUBBAND_5G_3: 5 GHz subband 3.
+ */
+enum nxp_txpwrlimit_subband {
+	NXP_TXPWRLIMIT_SUBBAND_2G	= 0x00,
+	NXP_TXPWRLIMIT_SUBBAND_5G_0	= 0x10,
+	NXP_TXPWRLIMIT_SUBBAND_5G_1	= 0x11,
+	NXP_TXPWRLIMIT_SUBBAND_5G_2	= 0x12,
+	NXP_TXPWRLIMIT_SUBBAND_5G_3	= 0x13,
+};
+
+/**
+ * enum nxp_txpwrlimit_attrs - TX power limit vendor attributes
+ * @NXP_ATTR_TXPWRLIMIT_UNSPEC: Unspecified attribute.
+ * @NXP_ATTR_TXPWRLIMIT_ACTION: Operation from &enum nxp_txpwrlimit_action.
+ * @NXP_ATTR_TXPWRLIMIT_SUBBAND: Target subband.
+ * @NXP_ATTR_TXPWRLIMIT_DATA: Firmware-defined TRPC table data.
+ */
+enum nxp_txpwrlimit_attrs {
+	NXP_ATTR_TXPWRLIMIT_UNSPEC,
+	NXP_ATTR_TXPWRLIMIT_ACTION,
+	NXP_ATTR_TXPWRLIMIT_SUBBAND,
+	NXP_ATTR_TXPWRLIMIT_DATA,
+
+	__NXP_ATTR_TXPWRLIMIT_AFTER_LAST,
+	NXP_ATTR_TXPWRLIMIT_MAX = __NXP_ATTR_TXPWRLIMIT_AFTER_LAST - 1
+};
+
+#endif /* __VENDOR_CMD_NXP_H__ */
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH nxpwifi-next v3 1/3] wifi: nl80211: vendor-cmd: add NXP vendor command definitions

Quoted 17 lines · On Mon, 2026-10-05 at 13:44 +0800, [email protected] wrote:

From: Jeff Chen <[email protected]>

Add NXP vendor command and attribute definitions for use with NL80211_CMD_VENDOR.

The initial user of this interface is the Transmit Rate-based Power Control (TRPC) configuration command.

The TRPC table is a firmware-defined ABI that contains TX power limit data. Existing nl80211 TX power interfaces allow TX power levels to be configured, but do not provide an interface for exchanging TRPC table data between userspace and firmware.

Therefore, the TRPC configuration interface is exposed through a vendor command. The kernel does not interpret the TRPC table contents and only passes the table data between userspace and firmware.

Quoted 6 lines

Example use cases include:
- Reading firmware TX power limit configuration for verification.
- Updating platform-specific TX power limit tables.
- Supporting manufacturing, validation, regulatory, and platform bring-up workflows that require access to firmware-defined TX power limit data.

But ... none of this really needs full support on every production device, so it could just be debugfs?

johannes

#3 lore raw

Re:[PATCH nxpwifi-next v3 1/3] wifi: nl80211: vendor-cmd: add NXP vendor command definitions

In reply to [email protected]
Quoted 11 lines · Johannes Berg
Quoted 6 lines

Example use cases include:
- Reading firmware TX power limit configuration for verification.
- Updating platform-specific TX power limit tables.
- Supporting manufacturing, validation, regulatory, and platform bring-up workflows that require access to firmware-defined TX power limit data.

But ... none of this really needs full support on every production device, so it could just be debugfs?

johannes

Hi Johannes

Sorry, the examples were not very precise.

The TRPC table is product-specific and is typically provided by the module vendor or OEM. It depends on the RF characteristics of the final product and may also vary by regulatory region.

This is not intended only for manufacturing or validation. It is used to read and update firmware TX power limit configuration on deployed systems.

I can clarify this in the next revision if needed.

rgards,
Jeff

#4 lore raw

PATCH v3 2/3 wifi: nxpwifi: add firmware TRPC command support

In reply to [email protected]

From: Jeff Chen <[email protected]>

Add support for the firmware TRPC configuration command used to retrieve and update TX power limit data.

Assisted-by LLM
---
 drivers/net/wireless/nxp/nxpwifi/cfg.h     | 11 ++++
 drivers/net/wireless/nxp/nxpwifi/fw.h      |  8 +++
 drivers/net/wireless/nxp/nxpwifi/main.h    |  2 +
 drivers/net/wireless/nxp/nxpwifi/sta_cfg.c |  8 +++
 drivers/net/wireless/nxp/nxpwifi/sta_cmd.c | 67 ++++++++++++++++++++++
 5 files changed, 96 insertions(+)
drivers/net/wireless/nxp/nxpwifi/cfg.h +11 -0
index 8627a3372978..4c0558ed483e 100644
@@ -755,6 +755,17 @@ struct nxpwifi_ds_coalesce_cfg {
 	struct nxpwifi_coalesce_rule rule[NXPWIFI_COALESCE_MAX_RULES];
 };
 
+/* Host-side helper for the channel TRPC command. */
+struct nxpwifi_ds_chan_trpc_cfg {
+	u32 len;
+	u16 action;
+	u16 subband;
+	u8 tlvbuffer[];
+};
+
+/* Upper bound on the TRPC TLV table exchanged with the firmware. */
+#define NXPWIFI_MAX_TRPC_BUF (4 * 1024)
+
 struct nxpwifi_11ax_he_cap_cfg {
 	u16 id;
 	u16 len;
drivers/net/wireless/nxp/nxpwifi/fw.h +8 -0
index 188110b020cf..0de5d2fc9242 100644
@@ -386,6 +386,7 @@ enum NXPWIFI_802_11_PRIVACY_FILTER {
 #define HOST_CMD_CAU_REG_ACCESS                    0x00ed
 #define HOST_CMD_SET_BSS_MODE                      0x00f7
 #define HOST_CMD_PCIE_DESC_DETAILS                 0x00fa
+#define HOST_CMD_CHAN_TRPC_CONFIG                  0x00fb
 #define HOST_CMD_802_11_NET_MONITOR                0x0102
 #define HOST_CMD_802_11_SCAN_EXT                   0x0107
 #define HOST_CMD_COALESCE_CFG                      0x010a
@@ -2373,6 +2374,12 @@ struct host_cmd_twt_cfg {
 	u8 val[];
 } __packed;
 
+struct host_cmd_chan_trpc_cfg {
+	__le16 action;
+	__le16 subband;
+	u8 tlvbuffer[];
+} __packed;
+
 struct host_cmd_ds_command {
 	__le16 command;
 	__le16 size;
@@ -2447,6 +2454,7 @@ struct host_cmd_ds_command {
 		struct host_cmd_11ax_cmd ax_cmd;
 		struct host_cmd_ds_802_11_net_monitor net_mon;
 		struct host_cmd_twt_cfg twt_cfg;
+		struct host_cmd_chan_trpc_cfg ch_trpc_cfg;
 	} params;
 } __packed;
 
drivers/net/wireless/nxp/nxpwifi/main.h +2 -0
index b25a6a4f2936..9ae017bdc6ca 100644
@@ -1415,6 +1415,8 @@ int nxpwifi_get_wakeup_reason(struct nxpwifi_private *priv, u16 action,
 			      struct nxpwifi_ds_wakeup_reason *wakeup_reason);
 int nxpwifi_get_chan_info(struct nxpwifi_private *priv,
 			  struct nxpwifi_channel_band *channel_band);
+int nxpwifi_chan_trpc_cfg(struct nxpwifi_private *priv, int cmd_type,
+			  struct nxpwifi_ds_chan_trpc_cfg *ch_trpc);
 void nxpwifi_coex_ampdu_rxwinsize(struct nxpwifi_adapter *adapter);
 void nxpwifi_11n_delba(struct nxpwifi_private *priv, int tid);
 int nxpwifi_send_domain_info_cmd_fw(struct wiphy *wiphy, enum nl80211_band band);
drivers/net/wireless/nxp/nxpwifi/sta_cfg.c +8 -0
index 56cf63fbf7fe..650de6156912 100644
@@ -1175,3 +1175,11 @@ int nxpwifi_get_chan_info(struct nxpwifi_private *priv,
 				HOST_ACT_GEN_GET, 0, channel_band,
 				NXPWIFI_SYNC_CMD);
 }
+
+int nxpwifi_chan_trpc_cfg(struct nxpwifi_private *priv, int cmd_type,
+			  struct nxpwifi_ds_chan_trpc_cfg *ch_trpc)
+{
+	return nxpwifi_send_cmd(priv, HOST_CMD_CHAN_TRPC_CONFIG,
+				ch_trpc->action, 0, ch_trpc,
+				cmd_type == NXPWIFI_SYNC_CMD);
+}
drivers/net/wireless/nxp/nxpwifi/sta_cmd.c +67 -0

79 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

PATCH v3 3/3 wifi: nxpwifi: add netlink vendor command for TX power limits

In reply to [email protected]

From: Jeff Chen <[email protected]>

Add support for the NXP TX power limit vendor command.

The command provides userspace access to firmware Transmit Rate-based Power Control (TRPC) configuration through NL80211_CMD_VENDOR.

---
 drivers/net/wireless/nxp/nxpwifi/Makefile   |   1 +
 drivers/net/wireless/nxp/nxpwifi/cfg80211.c |   5 +-
 drivers/net/wireless/nxp/nxpwifi/main.h     |   1 +
 drivers/net/wireless/nxp/nxpwifi/vendor.c   | 152 ++++++++++++++++++++
 drivers/net/wireless/nxp/nxpwifi/vendor.h   |  14 ++
 5 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.c
 create mode 100644 drivers/net/wireless/nxp/nxpwifi/vendor.h
drivers/net/wireless/nxp/nxpwifi/Makefile +1 -0
index 8f581429f28d..f82435253a72 100644
@@ -28,6 +28,7 @@ nxpwifi-y += sta_tx.o
 nxpwifi-y += sta_rx.o
 nxpwifi-y += uap_txrx.o
 nxpwifi-y += cfg80211.o
+nxpwifi-y += vendor.o
 nxpwifi-y += ethtool.o
 nxpwifi-y += 11h.o
 nxpwifi-$(CONFIG_DEBUG_FS) += debugfs.o
drivers/net/wireless/nxp/nxpwifi/cfg80211.c +4 -1
index 8805439c0b4b..16b970227e9c 100644
@@ -10,6 +10,7 @@
 #include "cmdevt.h"
 #include "11n.h"
 #include "wmm.h"
+#include "vendor.h"
 
 static const struct ieee80211_iface_limit nxpwifi_ap_sta_limits[] = {
 	{
@@ -91,7 +92,7 @@ u8 nxpwifi_get_chan_type(struct nxpwifi_private *priv)
 }
 
 /* Retrieve the driver private data from the wiphy */
-static void *nxpwifi_cfg80211_get_adapter(struct wiphy *wiphy)
+void *nxpwifi_cfg80211_get_adapter(struct wiphy *wiphy)
 {
 	return (void *)(*(unsigned long *)wiphy_priv(wiphy));
 }
@@ -3834,6 +3835,8 @@ int nxpwifi_register_cfg80211(struct nxpwifi_adapter *adapter)
 	wiphy->cipher_suites = nxpwifi_cipher_suites;
 	wiphy->n_cipher_suites = ARRAY_SIZE(nxpwifi_cipher_suites);
 
+	nxpwifi_set_vendor_commands(wiphy);
+
 	if (adapter->regd) {
 		wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
 					   REGULATORY_DISABLE_BEACON_HINTS |
drivers/net/wireless/nxp/nxpwifi/main.h +1 -0
index 9ae017bdc6ca..bbfc4266c48d 100644
@@ -1435,4 +1435,5 @@ void nxpwifi_dev_debugfs_remove(struct nxpwifi_private *priv);
 int nxpwifi_reinit_sw(struct nxpwifi_adapter *adapter);
 void nxpwifi_shutdown_sw(struct nxpwifi_adapter *adapter);
 bool nxpwifi_is_valid_region_code(enum nxpwifi_region_code code);
+void *nxpwifi_cfg80211_get_adapter(struct wiphy *wiphy);
 #endif /* !_NXPWIFI_MAIN_H_ */
drivers/net/wireless/nxp/nxpwifi/vendor.c new file +152 -0

152 lines not on this page · raw message

drivers/net/wireless/nxp/nxpwifi/vendor.h new file +14 -0
new file mode 100644
index 000000000000..fdde8e1a7a40
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * NXP Wireless LAN device driver: vendor command interface
+ *
+ * Copyright 2026 NXP
+ */
+
+#ifndef __NXPWIFI_VENDOR_H__
+#define __NXPWIFI_VENDOR_H__
+
+#include <uapi/linux/nl80211-vnd-nxp.h>
+
+void nxpwifi_set_vendor_commands(struct wiphy *wiphy);
+#endif /* __NXPWIFI_VENDOR_H__ */
Signature · 1 line
2.34.1