Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp404778ybv; Fri, 7 Feb 2020 01:29:19 -0800 (PST) X-Google-Smtp-Source: APXvYqwxuIDuDVAhaHcazUdjimusnB1W+fgKma7QJKy9Vw+KW+tEMuzuGw0TlMdl6oat0KAttlM/ X-Received: by 2002:aca:6542:: with SMTP id j2mr1465430oiw.69.1581067759266; Fri, 07 Feb 2020 01:29:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581067759; cv=none; d=google.com; s=arc-20160816; b=ZjHPxR/0iHVnRgY89tYqOY1LofpGfmI6DYop08/EoAbAqpjlJaQuYfgJngcNDRceiW e0eWlRmOFSZpvxsYrz7xjv7+zUkAP/rQ5XwjYJRfFF56znDbV34WmBe8sRTBE8GEJ81R aGRhfZbdGX8Pa38U5adnBTyS5dDNUgd5Aa/cbpjMwNSncm8TeZVt8VtozaH05c+cJTZR Z5RKElnIsSn4fjkeXIEO2LjSudFRu5y9fzEHVR2J6cjNgbf2bIENmOH8yuy3pGGO8ed0 m0JAv1uvuzU5pLFFyztXhuieHk66TQvdpayjpmdG3kOgFKUxHWq17z+8f936XH3F7KpC MSFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=vp5NGILsW9aLartsUifKy+t1pEk8ublElUnPfU9WIyY=; b=ptBwU1Zbua7yDH5rRQlydbxJLjuHX0qjoJ+zELRtaRBwDiCD5uleyofsJYVokzdOi+ 9dxRQLpxiiaRv1k+8cQ7c17O0xvEXqb6vx/Xgd7e+qppWDRVPZtm9C3PcNFl1LvZbHcE VV3fzPML7ugI9h6TvsC+B/qeT510tRy05K70qEF0b6eWj8P138WpgsOlhqO8+FvjN/Ix vDrUsxvyDczS6jCaMqVrHfXOTkeRqhH3yPS6vVnOL44WBd9onIruJl5cGviXvMnOLBBD A+kssxDcf/g0UP/YlxnEf4kBEzyG21xIBybkcPI874nfFqF1KwP87qFgNiz2n+AeDLas T+AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si1335603ote.90.2020.02.07.01.29.00; Fri, 07 Feb 2020 01:29:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgBGJ2z (ORCPT + 99 others); Fri, 7 Feb 2020 04:28:55 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:44680 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgBGJ2y (ORCPT ); Fri, 7 Feb 2020 04:28:54 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID 0179Smsj018556, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTEXMB06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id 0179Smsj018556 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Feb 2020 17:28:48 +0800 Received: from RTEXMB03.realtek.com.tw (172.21.6.96) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 7 Feb 2020 17:28:48 +0800 Received: from RTEXMB06.realtek.com.tw (172.21.6.99) by RTEXMB03.realtek.com.tw (172.21.6.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 7 Feb 2020 17:28:48 +0800 Received: from RTITCASV01.realtek.com.tw (172.21.6.18) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.1.1779.2 via Frontend Transport; Fri, 7 Feb 2020 17:28:48 +0800 Received: from localhost.localdomain (172.21.68.128) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Fri, 7 Feb 2020 17:28:47 +0800 From: To: CC: , , Subject: [PATCH 2/8] nl80211: vendor-cmd: realtek: Add vendor command to set SAR power limit Date: Fri, 7 Feb 2020 17:28:38 +0800 Message-ID: <20200207092844.29175-3-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200207092844.29175-1-yhchuang@realtek.com> References: <20200207092844.29175-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.128] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ping-Ke Shih This is added to set SAR power limit, but doesn't replace existing functionality. Use 'iw' to set SAR power limit with ${p1,p2,p3,p4,p5} for five sub-bands: sudo iw dev wlan0 vendor send 0x00E04C 0x88 0x68 0x00 0x01 0x80 0x14 0x00 0x01 0x80 0x08 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x05 0x00 0x03 0x00 $p1 0x00 0x00 0x00 0x14 0x00 0x02 0x80 0x08 0x00 0x02 0x00 0x01 0x00 0x00 0x00 0x05 0x00 0x03 0x00 $p2 0x00 0x00 0x00 0x14 0x00 0x03 0x80 0x08 0x00 0x02 0x00 0x02 0x00 0x00 0x00 0x05 0x00 0x03 0x00 $p3 0x00 0x00 0x00 0x14 0x00 0x04 0x80 0x08 0x00 0x02 0x00 0x03 0x00 0x00 0x00 0x05 0x00 0x03 0x00 $p4 0x00 0x00 0x00 0x14 0x00 0x05 0x80 0x08 0x00 0x02 0x00 0x04 0x00 0x00 0x00 0x05 0x00 0x03 0x00 $p5 0x00 0x00 0x00 Signed-off-by: Ping-Ke Shih Signed-off-by: Yan-Hsuan Chuang --- include/uapi/nl80211-vnd-realtek.h | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 include/uapi/nl80211-vnd-realtek.h diff --git a/include/uapi/nl80211-vnd-realtek.h b/include/uapi/nl80211-vnd-realtek.h new file mode 100644 index 000000000000..6b71de8d7cdf --- /dev/null +++ b/include/uapi/nl80211-vnd-realtek.h @@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ +/* Copyright(c) 2018-2019 Realtek Corporation + */ +#ifndef _UAPI_NL80211_VND_REALTEK_H +#define _UAPI_NL80211_VND_REALTEK_H + +/** + * This vendor ID is the value of atrribute %NL80211_ATTR_VENDOR_ID used by + * %NL80211_CMD_VENDOR to send vendor command. + */ +#define REALTEK_NL80211_VENDOR_ID 0x00E04C + +/** + * enum realtek_nl80211_vndcmd - supported vendor subcmds + * + * @REALTEK_NL80211_VNDCMD_SET_SAR: set SAR power limit + * %realtek_vndcmd_sar_band within attribute %REALTEK_VNDCMD_ATTR_SAR_BAND + * and corresponding power limit attribute %REALTEK_VNDCMD_ATTR_SAR_POWER. + * The two attributes are in nested attribute %REALTEK_VNDCMD_ATTR_SAR_RULES. + */ +enum realtek_nl80211_vndcmd { + REALTEK_NL80211_VNDCMD_SET_SAR = 0x88, +}; + +/** + * enum realtek_vndcmd_sar_band - bands of SAR power limit + * + * @REALTEK_VNDCMD_SAR_BAND_2G: all channels of 2G band + * @REALTEK_VNDCMD_SAR_BAND_5G_BAND1: channels of 5G band1 (5.15~5.35G) + * @REALTEK_VNDCMD_SAR_BAND_5G_BAND2: channels of 5G band2 (5.35~5.47G) + * 5G band2 isn't used by rtw88 by now, so don't need to set SAR power + * limit for this band. But we still enumerate this band as a placeholder + * for the furture. + * @REALTEK_VNDCMD_SAR_BAND_5G_BAND3: channels of 5G band3 (5.47~5.725G) + * @REALTEK_VNDCMD_SAR_BAND_5G_BAND4: channels of 5G band4 (5.725~5.95G) + */ +enum realtek_vndcmd_sar_band { + REALTEK_VNDCMD_SAR_BAND_2G, + REALTEK_VNDCMD_SAR_BAND_5G_BAND1, + REALTEK_VNDCMD_SAR_BAND_5G_BAND2, + REALTEK_VNDCMD_SAR_BAND_5G_BAND3, + REALTEK_VNDCMD_SAR_BAND_5G_BAND4, + + REALTEK_VNDCMD_SAR_BAND_NR, +}; + +/** + * enum realtek_vndcmd_sar_rule_attr - attributes of vendor command + * %REALTEK_NL80211_VNDCMD_SET_SAR + * + * @REALTEK_VNDCMD_ATTR_SAR_RULES: nested attribute to hold SAR rules containing + * band and corresponding power limit. + * + * @REALTEK_VNDCMD_ATTR_SAR_BAND: an attribute within %REALTEK_VNDCMD_ATTR_SAR_RULES, + * and its value is %realtek_vndcmd_sar_band (u32 data type). + * @REALTEK_VNDCMD_ATTR_SAR_POWER: an attribute within %REALTEK_VNDCMD_ATTR_SAR_RULES. + * SAR power limit is 'u8' type and in unit of 0.125 dBm, so its range is + * 0 to 31.875 dBm. + */ +enum realtek_vndcmd_sar_rule_attr { + __REALTEK_VNDCMD_SAR_RULE_ATTR_INVALID, + + REALTEK_VNDCMD_ATTR_SAR_RULES, + REALTEK_VNDCMD_ATTR_SAR_BAND, + REALTEK_VNDCMD_ATTR_SAR_POWER, + + /* keep last */ + __REALTEK_VNDCMD_SAR_RULE_ATTR_AFTER_LAST, + REALTEK_VNDCMD_SAR_RULE_ATTR_MAX = __REALTEK_VNDCMD_SAR_RULE_ATTR_AFTER_LAST - 1, +}; + +#endif /* _UAPI_NL80211_VND_REALTEK_H */ -- 2.17.1