xref: /linux/drivers/net/wireless/ath/ath12k/acpi.h (revision 90d32e92011eaae8e70a9169b4e7acf4ca8f9d3a)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 #ifndef ATH12K_ACPI_H
7 #define ATH12K_ACPI_H
8 
9 #include <linux/acpi.h>
10 
11 #define ATH12K_ACPI_DSM_FUNC_SUPPORT_FUNCS	0
12 #define ATH12K_ACPI_DSM_FUNC_BIOS_SAR		4
13 #define ATH12K_ACPI_DSM_FUNC_GEO_OFFSET		5
14 #define ATH12K_ACPI_DSM_FUNC_INDEX_CCA		6
15 #define ATH12K_ACPI_DSM_FUNC_TAS_CFG		8
16 #define ATH12K_ACPI_DSM_FUNC_TAS_DATA		9
17 #define ATH12K_ACPI_DSM_FUNC_INDEX_BAND_EDGE		10
18 
19 #define ATH12K_ACPI_FUNC_BIT_BIOS_SAR			BIT(3)
20 #define ATH12K_ACPI_FUNC_BIT_GEO_OFFSET			BIT(4)
21 #define ATH12K_ACPI_FUNC_BIT_CCA			BIT(5)
22 #define ATH12K_ACPI_FUNC_BIT_TAS_CFG			BIT(7)
23 #define ATH12K_ACPI_FUNC_BIT_TAS_DATA			BIT(8)
24 #define ATH12K_ACPI_FUNC_BIT_BAND_EDGE_CHAN_POWER	BIT(9)
25 
26 #define ATH12K_ACPI_NOTIFY_EVENT			0x86
27 #define ATH12K_ACPI_FUNC_BIT_VALID(_acdata, _func)	(((_acdata).func_bit) & (_func))
28 
29 #define ATH12K_ACPI_TAS_DATA_VERSION		0x1
30 #define ATH12K_ACPI_TAS_DATA_ENABLE		0x1
31 #define ATH12K_ACPI_POWER_LIMIT_VERSION		0x1
32 #define ATH12K_ACPI_POWER_LIMIT_ENABLE_FLAG	0x1
33 #define ATH12K_ACPI_CCA_THR_VERSION		0x1
34 #define ATH12K_ACPI_CCA_THR_ENABLE_FLAG		0x1
35 #define ATH12K_ACPI_BAND_EDGE_VERSION		0x1
36 #define ATH12K_ACPI_BAND_EDGE_ENABLE_FLAG	0x1
37 
38 #define ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET	1
39 #define ATH12K_ACPI_DBS_BACKOFF_DATA_OFFSET	2
40 #define ATH12K_ACPI_CCA_THR_OFFSET_DATA_OFFSET	5
41 #define ATH12K_ACPI_BIOS_SAR_DBS_BACKOFF_LEN	10
42 #define ATH12K_ACPI_POWER_LIMIT_DATA_OFFSET	12
43 #define ATH12K_ACPI_BIOS_SAR_GEO_OFFSET_LEN	18
44 #define ATH12K_ACPI_BIOS_SAR_TABLE_LEN		22
45 #define ATH12K_ACPI_CCA_THR_OFFSET_LEN		36
46 
47 #define ATH12K_ACPI_DSM_TAS_DATA_SIZE			69
48 #define ATH12K_ACPI_DSM_BAND_EDGE_DATA_SIZE		100
49 #define ATH12K_ACPI_DSM_TAS_CFG_SIZE			108
50 
51 #define ATH12K_ACPI_DSM_GEO_OFFSET_DATA_SIZE (ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET + \
52 					      ATH12K_ACPI_BIOS_SAR_GEO_OFFSET_LEN)
53 #define ATH12K_ACPI_DSM_BIOS_SAR_DATA_SIZE (ATH12K_ACPI_POWER_LIMIT_DATA_OFFSET + \
54 					    ATH12K_ACPI_BIOS_SAR_TABLE_LEN)
55 #define ATH12K_ACPI_DSM_CCA_DATA_SIZE (ATH12K_ACPI_CCA_THR_OFFSET_DATA_OFFSET + \
56 				       ATH12K_ACPI_CCA_THR_OFFSET_LEN)
57 
58 #ifdef CONFIG_ACPI
59 
60 int ath12k_acpi_start(struct ath12k_base *ab);
61 void ath12k_acpi_stop(struct ath12k_base *ab);
62 
63 #else
64 
65 static inline int ath12k_acpi_start(struct ath12k_base *ab)
66 {
67 	return 0;
68 }
69 
70 static inline void ath12k_acpi_stop(struct ath12k_base *ab)
71 {
72 }
73 
74 #endif /* CONFIG_ACPI */
75 
76 #endif /* ATH12K_ACPI_H */
77