summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath12k/acpi.h
blob: 39e003d86a48badf482f41e743e0a5dec43e46e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */
#ifndef ATH12K_ACPI_H
#define ATH12K_ACPI_H

#include <linux/acpi.h>

#define ATH12K_ACPI_DSM_FUNC_SUPPORT_FUNCS	0
#define ATH12K_ACPI_DSM_FUNC_BIOS_SAR		4
#define ATH12K_ACPI_DSM_FUNC_GEO_OFFSET		5
#define ATH12K_ACPI_DSM_FUNC_INDEX_CCA		6
#define ATH12K_ACPI_DSM_FUNC_TAS_CFG		8
#define ATH12K_ACPI_DSM_FUNC_TAS_DATA		9
#define ATH12K_ACPI_DSM_FUNC_INDEX_BAND_EDGE		10

#define ATH12K_ACPI_FUNC_BIT_BIOS_SAR			BIT(3)
#define ATH12K_ACPI_FUNC_BIT_GEO_OFFSET			BIT(4)
#define ATH12K_ACPI_FUNC_BIT_CCA			BIT(5)
#define ATH12K_ACPI_FUNC_BIT_TAS_CFG			BIT(7)
#define ATH12K_ACPI_FUNC_BIT_TAS_DATA			BIT(8)
#define ATH12K_ACPI_FUNC_BIT_BAND_EDGE_CHAN_POWER	BIT(9)

#define ATH12K_ACPI_NOTIFY_EVENT			0x86
#define ATH12K_ACPI_FUNC_BIT_VALID(_acdata, _func)	(((_acdata).func_bit) & (_func))

#define ATH12K_ACPI_TAS_DATA_VERSION		0x1
#define ATH12K_ACPI_TAS_DATA_ENABLE		0x1
#define ATH12K_ACPI_POWER_LIMIT_VERSION		0x1
#define ATH12K_ACPI_POWER_LIMIT_ENABLE_FLAG	0x1
#define ATH12K_ACPI_CCA_THR_VERSION		0x1
#define ATH12K_ACPI_CCA_THR_ENABLE_FLAG		0x1
#define ATH12K_ACPI_BAND_EDGE_VERSION		0x1
#define ATH12K_ACPI_BAND_EDGE_ENABLE_FLAG	0x1

#define ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET	1
#define ATH12K_ACPI_DBS_BACKOFF_DATA_OFFSET	2
#define ATH12K_ACPI_CCA_THR_OFFSET_DATA_OFFSET	5
#define ATH12K_ACPI_BIOS_SAR_DBS_BACKOFF_LEN	10
#define ATH12K_ACPI_POWER_LIMIT_DATA_OFFSET	12
#define ATH12K_ACPI_BIOS_SAR_GEO_OFFSET_LEN	18
#define ATH12K_ACPI_BIOS_SAR_TABLE_LEN		22
#define ATH12K_ACPI_CCA_THR_OFFSET_LEN		36

#define ATH12K_ACPI_DSM_TAS_DATA_SIZE			69
#define ATH12K_ACPI_DSM_BAND_EDGE_DATA_SIZE		100
#define ATH12K_ACPI_DSM_TAS_CFG_SIZE			108

#define ATH12K_ACPI_DSM_GEO_OFFSET_DATA_SIZE (ATH12K_ACPI_GEO_OFFSET_DATA_OFFSET + \
					      ATH12K_ACPI_BIOS_SAR_GEO_OFFSET_LEN)
#define ATH12K_ACPI_DSM_BIOS_SAR_DATA_SIZE (ATH12K_ACPI_POWER_LIMIT_DATA_OFFSET + \
					    ATH12K_ACPI_BIOS_SAR_TABLE_LEN)
#define ATH12K_ACPI_DSM_CCA_DATA_SIZE (ATH12K_ACPI_CCA_THR_OFFSET_DATA_OFFSET + \
				       ATH12K_ACPI_CCA_THR_OFFSET_LEN)

#ifdef CONFIG_ACPI

int ath12k_acpi_start(struct ath12k_base *ab);
void ath12k_acpi_stop(struct ath12k_base *ab);

#else

static inline int ath12k_acpi_start(struct ath12k_base *ab)
{
	return 0;
}

static inline void ath12k_acpi_stop(struct ath12k_base *ab)
{
}

#endif /* CONFIG_ACPI */

#endif /* ATH12K_ACPI_H */