xref: /linux/drivers/net/wireless/realtek/rtw89/acpi.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2021-2023  Realtek Corporation
3  */
4 
5 #ifndef __RTW89_ACPI_H__
6 #define __RTW89_ACPI_H__
7 
8 #include "core.h"
9 
10 enum rtw89_acpi_dsm_func {
11 	RTW89_ACPI_DSM_FUNC_IDN_BAND_SUP = 2,
12 	RTW89_ACPI_DSM_FUNC_6G_DIS = 3,
13 	RTW89_ACPI_DSM_FUNC_6G_BP = 4,
14 	RTW89_ACPI_DSM_FUNC_TAS_EN = 5,
15 	RTW89_ACPI_DSM_FUNC_UNII4_SUP = 6,
16 	RTW89_ACPI_DSM_FUNC_6GHZ_SP_SUP = 7,
17 };
18 
19 enum rtw89_acpi_conf_unii4 {
20 	RTW89_ACPI_CONF_UNII4_FCC = BIT(0),
21 	RTW89_ACPI_CONF_UNII4_IC = BIT(1),
22 };
23 
24 enum rtw89_acpi_policy_mode {
25 	RTW89_ACPI_POLICY_BLOCK = 0,
26 	RTW89_ACPI_POLICY_ALLOW = 1,
27 };
28 
29 struct rtw89_acpi_country_code {
30 	/* below are allowed:
31 	 * * ISO alpha2 country code
32 	 * * EU for countries in Europe
33 	 */
34 	char alpha2[2];
35 } __packed;
36 
37 struct rtw89_acpi_policy_6ghz {
38 	u8 signature[3];
39 	u8 rsvd;
40 	u8 policy_mode;
41 	u8 country_count;
42 	struct rtw89_acpi_country_code country_list[] __counted_by(country_count);
43 } __packed;
44 
45 enum rtw89_acpi_conf_6ghz_sp {
46 	RTW89_ACPI_CONF_6GHZ_SP_US = BIT(0),
47 };
48 
49 struct rtw89_acpi_policy_6ghz_sp {
50 	u8 signature[4];
51 	u8 revision;
52 	u8 override;
53 	u8 conf;
54 	u8 rsvd;
55 } __packed;
56 
57 struct rtw89_acpi_dsm_result {
58 	union {
59 		u8 value;
60 		/* caller needs to free it after using */
61 		struct rtw89_acpi_policy_6ghz *policy_6ghz;
62 		struct rtw89_acpi_policy_6ghz_sp *policy_6ghz_sp;
63 	} u;
64 };
65 
66 int rtw89_acpi_evaluate_dsm(struct rtw89_dev *rtwdev,
67 			    enum rtw89_acpi_dsm_func func,
68 			    struct rtw89_acpi_dsm_result *res);
69 
70 #endif
71