2020-04-02 23:48:27 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-12-23 20:43:07 +01:00
|
|
|
#ifndef _SAR_H_
|
|
|
|
#define _SAR_H_
|
|
|
|
|
2022-12-19 02:14:39 +01:00
|
|
|
#include <fw_config.h>
|
2016-12-23 20:43:07 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2021-08-31 03:41:35 +02:00
|
|
|
#define MAX_ANT_GAINS_REVISION 2
|
2021-08-31 03:49:30 +02:00
|
|
|
#define MAX_DENYLIST_ENTRY 16
|
2021-07-30 16:42:22 +02:00
|
|
|
#define MAX_DSAR_SET_COUNT 3
|
|
|
|
#define MAX_GEO_OFFSET_REVISION 3
|
2021-08-25 14:06:44 +02:00
|
|
|
#define MAX_PROFILE_COUNT 5
|
2021-07-30 16:42:22 +02:00
|
|
|
#define MAX_SAR_REVISION 2
|
|
|
|
#define REVISION_SIZE 1
|
|
|
|
#define SAR_REV0_CHAINS_COUNT 2
|
|
|
|
#define SAR_REV0_SUBBANDS_COUNT 5
|
|
|
|
#define SAR_FILE_REVISION 1
|
|
|
|
#define SAR_STR_PREFIX "$SAR"
|
|
|
|
#define SAR_STR_PREFIX_SIZE 4
|
|
|
|
|
|
|
|
struct geo_profile {
|
|
|
|
uint8_t revision;
|
|
|
|
uint8_t chains_count;
|
|
|
|
uint8_t bands_count;
|
|
|
|
uint8_t wgds_table[0];
|
|
|
|
} __packed;
|
|
|
|
|
|
|
|
struct sar_profile {
|
|
|
|
uint8_t revision;
|
|
|
|
uint8_t dsar_set_count;
|
|
|
|
uint8_t chains_count;
|
|
|
|
uint8_t subbands_count;
|
|
|
|
uint8_t sar_table[0];
|
|
|
|
} __packed;
|
2017-08-11 23:06:57 +02:00
|
|
|
|
2021-08-31 03:41:35 +02:00
|
|
|
struct gain_profile {
|
|
|
|
uint8_t revision;
|
|
|
|
uint8_t mode;
|
|
|
|
uint8_t chains_count;
|
|
|
|
uint8_t bands_count;
|
|
|
|
uint8_t ppag_table[0];
|
|
|
|
} __packed;
|
|
|
|
|
2021-08-31 03:49:30 +02:00
|
|
|
struct avg_profile {
|
|
|
|
uint8_t revision;
|
|
|
|
uint8_t tas_selection;
|
|
|
|
uint8_t tas_list_size;
|
2021-09-06 11:35:56 +02:00
|
|
|
uint16_t deny_list_entry[MAX_DENYLIST_ENTRY];
|
2021-08-31 03:49:30 +02:00
|
|
|
} __packed;
|
|
|
|
|
2021-08-25 14:06:44 +02:00
|
|
|
struct dsm_profile {
|
|
|
|
uint32_t supported_functions;
|
|
|
|
uint32_t disable_active_sdr_channels;
|
|
|
|
uint32_t support_indonesia_5g_band;
|
|
|
|
uint32_t support_ultra_high_band;
|
|
|
|
uint32_t regulatory_configurations;
|
|
|
|
uint32_t uart_configurations;
|
|
|
|
uint32_t enablement_11ax;
|
|
|
|
uint32_t unii_4;
|
|
|
|
};
|
|
|
|
|
2021-07-30 16:42:22 +02:00
|
|
|
struct sar_header {
|
|
|
|
char marker[SAR_STR_PREFIX_SIZE];
|
2017-08-11 23:06:57 +02:00
|
|
|
uint8_t version;
|
2021-07-30 16:42:22 +02:00
|
|
|
uint16_t offsets[0];
|
2017-08-11 23:06:57 +02:00
|
|
|
} __packed;
|
2016-12-23 20:43:07 +01:00
|
|
|
|
|
|
|
/* Wifi SAR limit table structure */
|
2021-07-30 16:42:22 +02:00
|
|
|
union wifi_sar_limits {
|
|
|
|
struct {
|
|
|
|
struct sar_profile *sar;
|
|
|
|
struct geo_profile *wgds;
|
2021-08-31 03:41:35 +02:00
|
|
|
struct gain_profile *ppag;
|
2021-08-31 03:49:30 +02:00
|
|
|
struct avg_profile *wtas;
|
2021-08-25 14:06:44 +02:00
|
|
|
struct dsm_profile *dsm;
|
2021-07-30 16:42:22 +02:00
|
|
|
};
|
|
|
|
void *profile[MAX_PROFILE_COUNT];
|
|
|
|
};
|
2016-12-23 20:43:07 +01:00
|
|
|
|
|
|
|
/*
|
2021-07-30 16:42:22 +02:00
|
|
|
* Retrieve the wifi ACPI configuration data from CBFS and decode it
|
2016-12-23 20:43:07 +01:00
|
|
|
* sar_limits: Pointer to wifi_sar_limits where the resulted data is stored
|
|
|
|
*
|
2021-07-30 16:42:22 +02:00
|
|
|
* Returns: 0 on success, -1 on errors (The .hex file doesn't exist, or the decode failed)
|
2016-12-23 20:43:07 +01:00
|
|
|
*/
|
2021-07-30 16:42:22 +02:00
|
|
|
int get_wifi_sar_limits(union wifi_sar_limits *sar_limits);
|
2016-12-23 20:43:07 +01:00
|
|
|
|
2021-03-14 07:54:16 +01:00
|
|
|
#define WIFI_SAR_CBFS_DEFAULT_FILENAME "wifi_sar_defaults.hex"
|
|
|
|
|
2018-12-14 19:05:03 +01:00
|
|
|
const char *get_wifi_sar_cbfs_filename(void);
|
|
|
|
|
2022-12-19 02:14:39 +01:00
|
|
|
char *get_wifi_sar_fw_config_filename(const struct fw_config_field *field);
|
|
|
|
|
2016-12-23 20:43:07 +01:00
|
|
|
#endif /* _SAR_H_ */
|